diff options
| author | ckonstanski <ckonstanski@pippiandcarlos.com> | 2020-12-25 20:01:41 -0700 |
|---|---|---|
| committer | ckonstanski <ckonstanski@pippiandcarlos.com> | 2020-12-25 20:01:41 -0700 |
| commit | 1f85d67cfbe3f20d9548349f0ff02a9b6a9d71a3 (patch) | |
| tree | c819cc42fcedd4e809ced1154bc05d3353beb73a /webapps/ldapadmin | |
| parent | a3445ef9f7d1cb0f36c257d5b0d2caa42cfa230c (diff) | |
moved notifications to separate library
Diffstat (limited to 'webapps/ldapadmin')
| -rw-r--r-- | webapps/ldapadmin/clojurescript/ldapadmin/src/core.cljs | 38 |
1 files changed, 4 insertions, 34 deletions
diff --git a/webapps/ldapadmin/clojurescript/ldapadmin/src/core.cljs b/webapps/ldapadmin/clojurescript/ldapadmin/src/core.cljs index 02b5f6a..13fdcd4 100644 --- a/webapps/ldapadmin/clojurescript/ldapadmin/src/core.cljs +++ b/webapps/ldapadmin/clojurescript/ldapadmin/src/core.cljs @@ -3,16 +3,14 @@ (:require [ajax.core :refer [GET POST]] [dommy.core :as dommy] [hiccups.runtime :as hiccupsrt] - [clojure.string :as str])) + [clojure.string :as str] + [org-ckons-cljs.notifications.core :as ck-notifications])) ;; declarations (enable-console-print!) (def jquery (js* "$")) -(declare template-message) -(declare maybe-error) -(declare maybe-message) (declare notifications) (declare auth-notifications) (declare template-generic-form) @@ -66,37 +64,9 @@ ;; notifications -(hiccups/defhtml template-error [errormsg] - [:div {:class "alert alert-danger"} errormsg]) - -(hiccups/defhtml template-message [message] - [:div {:class "alert alert-success"} message]) - -(defn maybe-message [jsonobj] - (when (get jsonobj "locationP") - (let [message (get jsonobj "message")] - (cond (empty? message) - (dommy/set-style! (dommy/sel1 :#message) :display "none") - :else - (do - (dommy/set-style! (dommy/sel1 :#message) :display "block") - (dommy/set-html! (dommy/sel1 :#message) - (template-message message))))))) - -(defn maybe-error [jsonobj] - (when (get jsonobj "locationP") - (let [errormsg (get jsonobj "errormsg")] - (cond (empty? errormsg) - (dommy/set-style! (dommy/sel1 :#errormsg) :display "none") - :else - (do - (dommy/set-style! (dommy/sel1 :#errormsg) :display "block") - (dommy/set-html! (dommy/sel1 :#errormsg) - (template-error errormsg))))))) - (defn notifications [jsonobj] - (maybe-message jsonobj) - (maybe-error jsonobj)) + (ck-notifications/maybe-message jsonobj) + (ck-notifications/maybe-error jsonobj)) (defn auth-notifications [jsonobj] (cond (empty? (get jsonobj "errormsg")) |
