diff options
4 files changed, 359 insertions, 314 deletions
diff --git a/lisp/webapps/resume/clojurescript/resume/src/resume/core.clj b/lisp/webapps/resume/clojurescript/resume/src/resume/core.clj new file mode 100644 index 0000000..0e4333d --- /dev/null +++ b/lisp/webapps/resume/clojurescript/resume/src/resume/core.clj @@ -0,0 +1,129 @@ +(ns resume.core) + +(defmacro define-resume-component [component] + `(do + (declare ~(symbol (namespace ::x) (str "handler-" component))) + (declare ~(symbol (namespace ::x) (str "render-" component))) + (declare ~(symbol (namespace ::x) (str "template-" component "-view"))) + (declare ~(symbol (namespace ::x) (str "handler-" component "-view"))) + (declare ~(symbol (namespace ::x) (str "render-" component "-view"))) + (declare ~(symbol (namespace ::x) (str "on-" component "-add-clicked"))) + (declare ~(symbol (namespace ::x) (str "handler-" component "-add"))) + (declare ~(symbol (namespace ::x) (str "render-" component "-add"))) + (declare ~(symbol (namespace ::x) (str "on-" component "-add-submit-clicked"))) + (declare ~(symbol (namespace ::x) (str "handler-" component "-add-submit"))) + (declare ~(symbol (namespace ::x) (str "render-" component "-add-submit"))) + (declare ~(symbol (namespace ::x) (str "on-" component "-modify-clicked"))) + (declare ~(symbol (namespace ::x) (str "handler-" component "-modify"))) + (declare ~(symbol (namespace ::x) (str "render-" component "-modify"))) + (declare ~(symbol (namespace ::x) (str "on-" component "-modify-submit-clicked"))) + (declare ~(symbol (namespace ::x) (str "handler-" component "-modify-submit"))) + (declare ~(symbol (namespace ::x) (str "render-" component "-modify-submit"))) + (declare ~(symbol (namespace ::x) (str "on-" component" -delete-clicked"))) + (declare ~(symbol (namespace ::x) (str "handler-" component "-delete"))) + (declare ~(symbol (namespace ::x) (str "render-" component "-delete"))) + + (defn ~(symbol (namespace ::x) (str "handler-" component)) [response] + (let [jsonobj (cljs.core/js->clj (js/JSON.parse response))] + (notifications jsonobj) + (dommy/set-html! (dommy/sel1 :#body) (template-resume jsonobj)) + (~(symbol (namespace ::x) (str "template-" component "-view"))))) + + (defn ~(symbol (namespace ::x) (str "render-" component)) [] + (ajax.core/GET ~(str "/resume/" component) {:handler handler-resume})) + + )) + ;; (hiccups/defhtml ~(symbol (namespace ::x) (str "template-" component "-view")) [jsonobj] + ;; [:div {:style "text-align: right"} + ;; [:img {:src "/static/images/add.png" + ;; :style "cursor:pointer; cursor:hand" + ;; :onclick (str (namespace ::x) ".on_contactinfo_add_clicked()")}]] + ;; (generic-table ~component jsonobj)) + + ;; (defn ~(symbol (namespace ::x) (str "handler-" component "-view")) [response] + ;; (let [jsonobj (js->clj (js/JSON.parse response))] + ;; (dommy/set-html! (dommy/sel1 :#content) (~(symbol (namespace ::x) (str "template-" component "-view")) jsonobj)))) + + ;; (defn ~(symbol (namespace ::x) (str "render-" component "-view")) [] + ;; (ajax.core/GET ~(str "/resume/" component "/view") + ;; {:handler ~(symbol (namespace ::x) (str "handler-" component "-view"))})) + + ;; (defn ~(symbol (namespace ::x) (str "on-" component "-add-clicked")) [] + ;; (~(symbol (namespace ::x) (str "render-" component "-add")))) + + ;; (defn ~(symbol (namespace ::x) (str "handler-" component "-add")) [response] + ;; (let [jsonobj (js->clj (js/JSON.parse response))] + ;; (auth-notifications jsonobj) + ;; (dommy/set-html! (dommy/sel1 :#modify-title) (get jsonobj "title")) + ;; (dommy/set-html! (dommy/sel1 :#modify-body) (generic-component-add-modify jsonobj)) + ;; (.modal (jquery "#modify")))) + + ;; (defn ~(symbol (namespace ::x) (str "render-" component "-add")) [] + ;; (ajax.core/POST ~(str "/resume/" component "/add") + ;; {:handler ~(symbol (namespace ::x) (str "handler-" component "-add"))})) + + ;; (defn ~(symbol (namespace ::x) (str "on-" component "-add-submit-clicked")) [] + ;; (when (-> (jquery ~(str "#" component "-add-form")) + ;; (.get "0") + ;; (.checkValidity)) + ;; (.modal (jquery "#modify") "hide") + ;; (~(symbol (namespace ::x) (str "render-" component "-add-submit"))))) + + ;; (defn ~(symbol (namespace ::x) (str "handler-" component "-add-submit")) [response] + ;; (let [jsonobj (js->clj (js/JSON.parse response))] + ;; (auth-notifications jsonobj) + ;; (on-menu-clicked ~(str "/resume/" component)))) + + ;; (defn ~(symbol (namespace ::x) (str "render-" component "-add-submit")) [] + ;; (ajax.core/POST ~(str "/resume/" component "/add/submit") + ;; {:format :raw + ;; :params (form-fields-to-map ~(str "#" component "-add-form :input")) + ;; :handler ~(symbol (namespace ::x) (str "handler-" component "-add-submit"))})) + + ;; (defn ~(symbol (namespace ::x) (str "on-" component "-modify-clicked")) [id] + ;; (~(symbol (namespace ::x) (str "render-" component "-modify")) id)) + + ;; (defn ~(symbol (namespace ::x) (str "handler-" component "-modify")) [response] + ;; (let [jsonobj (js->clj (js/JSON.parse response))] + ;; (auth-notifications jsonobj) + ;; (dommy/set-html! (dommy/sel1 :#modify-title) (get jsonobj "title")) + ;; (dommy/set-html! (dommy/sel1 :#modify-body) (generic-component-add-modify jsonobj)) + ;; (.modal (jquery "#modify")))) + + ;; (defn ~(symbol (namespace ::x) (str "render-" component "-modify")) [id] + ;; (ajax.core/POST ~(str "/resume/" component "/modify") + ;; {:format :raw + ;; :params {:id id} + ;; :handler ~(symbol (namespace ::x) (str "handler-" component "-modify"))})) + + ;; (defn ~(symbol (namespace ::x) (str "on-" component "-modify-submit-clicked")) [id] + ;; (when (-> (jquery ~(str "#" component "-modify-form")) + ;; (.get "0") + ;; (.checkValidity)) + ;; (.modal (jquery "#modify") "hide") + ;; (~(symbol (namespace ::x) (str "render-" component "-modify-submit")) id))) + + ;; (defn ~(symbol (namespace ::x) (str "handler-" component "-modify-submit")) [response] + ;; (let [jsonobj (js->clj (js/JSON.parse response))] + ;; (auth-notifications jsonobj) + ;; (on-menu-clicked ~(str "/resume/" component)))) + + ;; (defn ~(symbol (namespace ::x) (str "render-" component "-modify-submit")) [id] + ;; (ajax.core/POST ~(str "/resume/" component "/modify/submit") + ;; {:format :raw + ;; :params (form-fields-to-map ~(str "#" component "-modify-form :input")) + ;; :handler ~(symbol (namespace ::x) (str "handler-" component "-modify-submit"))})) + + ;; (defn ~(symbol (namespace ::x) (str "on-" component" -delete-clicked")) [id] + ;; (when (js/confirm (str "Are you sure you want to delete " id "? This action cannot be undone.")) + ;; (~(symbol (namespace ::x) (str "render-" component "-delete")) id))) + + ;; (defn ~(symbol (namespace ::x) (str "handler-" component "-delete")) [response] + ;; (let [jsonobj (js->clj (js/JSON.parse response))] + ;; (auth-notifications jsonobj) + ;; (on-menu-clicked ~(str "/resume/" component)))) + + ;; (defn ~(symbol (namespace ::x) (str "render-" component "-delete")) [id] + ;; (ajax.core/DELETE (str "/resume/" ~component "/delete/" id) + ;; {:format :raw + ;; :handler ~(symbol (namespace ::x) (str "handler-" component "-delete"))})))) diff --git a/lisp/webapps/resume/clojurescript/resume/src/resume/core.cljs b/lisp/webapps/resume/clojurescript/resume/src/resume/core.cljs index 7b5747d..833039f 100644 --- a/lisp/webapps/resume/clojurescript/resume/src/resume/core.cljs +++ b/lisp/webapps/resume/clojurescript/resume/src/resume/core.cljs @@ -1,5 +1,6 @@ (ns resume.core - (:require-macros [hiccups.core :as hiccups :refer [html]]) + (:require-macros [hiccups.core :as hiccups :refer [html]] + [resume.core :refer [define-resume-component]]) (:require [ajax.core :refer [GET POST PUT DELETE raw-response-format]] [dommy.core :as dommy] [hiccups.runtime :as hiccupsrt] @@ -10,14 +11,16 @@ [reagent.dom :as rd] [reagent.dom.client :as rdc] [org-ckons-cljs.notifications.react :as ck-notifications] - [org-ckons-cljs.form.core :as ck-form] - [resume.util :as util])) + [org-ckons-cljs.form.core :as ck-form])) ;; declarations (declare date-sql-to-pretty) (declare markdown-to-html) (declare reduce-checkboxes) +(declare form-fields-to-map) +(declare generic-component-add-modify) +(declare generic-table) (declare comp-app) (declare start-render) (declare start-location) @@ -151,29 +154,29 @@ (declare handler-resume-delete) (declare render-resume-delete) -(declare template-contactinfo) -(declare handler-contactinfo) -(declare render-contactinfo) -(declare template-contactinfo-view) -(declare handler-contactinfo-view) -(declare render-contactinfo-view) -(declare on-contactinfo-add-clicked) -(declare template-contactinfo-add) -(declare handler-contactinfo-add) -(declare render-contactinfo-add) -(declare on-contactinfo-add-submit-clicked) -(declare handler-contactinfo-add-submit) -(declare render-contactinfo-add-submit) -(declare on-contactinfo-modify-clicked) -(declare template-contactinfo-modify) -(declare handler-contactinfo-modify) -(declare render-contactinfo-modify) -(declare on-contactinfo-modify-submit-clicked) -(declare handler-contactinfo-modify-submit) -(declare render-contactinfo-modify-submit) -(declare on-contactinfo-delete-clicked) -(declare handler-contactinfo-delete) -(declare render-contactinfo-delete) +;; (declare template-contactinfo) +;; (declare handler-contactinfo) +;; (declare render-contactinfo) +;; (declare template-contactinfo-view) +;; (declare handler-contactinfo-view) +;; (declare render-contactinfo-view) +;; (declare on-contactinfo-add-clicked) +;; (declare template-contactinfo-add) +;; (declare handler-contactinfo-add) +;; (declare render-contactinfo-add) +;; (declare on-contactinfo-add-submit-clicked) +;; (declare handler-contactinfo-add-submit) +;; (declare render-contactinfo-add-submit) +;; (declare on-contactinfo-modify-clicked) +;; (declare template-contactinfo-modify) +;; (declare handler-contactinfo-modify) +;; (declare render-contactinfo-modify) +;; (declare on-contactinfo-modify-submit-clicked) +;; (declare handler-contactinfo-modify-submit) +;; (declare render-contactinfo-modify-submit) +;; (declare on-contactinfo-delete-clicked) +;; (declare handler-contactinfo-delete) +;; (declare render-contactinfo-delete) (declare template-education) (declare handler-education) @@ -288,6 +291,43 @@ (second (str/split (-> this (.prop "id")) "_"))))) (.toArray (jquery selector))))) +(defn form-fields-to-map [selector] + (apply merge (for [x (jquery selector) + :when (not (empty? (.-name x)))] + {(.-name x) (.-value x)}))) + +(hiccups/defhtml generic-component-add-modify [jsonobj] + (ck-form/template-generic-form (get jsonobj "form") (namespace ::x))) + +(defn generic-table [component jsonobj & [reverse-p]] + (let [results (get jsonobj "components") + keys (remove (fn [x] + (not (get (first results) x))) + (sort #(if reverse-p (compare %2 %1) (compare %1 %2)) (keys (first results))))] + (cond (empty? results) + [:h5 {:style "text-align: center"} (str "No " component "s found.")] + :else + [:div + [:p (str (count results) " " component "s.")] + [:table {:class "table table-striped table-hover table-sm"} + [:thead + [:tr + (for [key keys] + [:th {:scope "col"} key]) + [:th {:scope "col"} "Mod"] + [:th {:scope "col"} "Del"]]] + [:tbody + (for [rec results] + [:tr + (for [key keys] + [:td (str (get rec key))]) + [:td {:width "30"} + [:img {:src "/static/images/modify.png" + :onclick (str (namespace ::x) ".on_" component "_modify_clicked(" (get rec "id") ")")}]] + [:td {:width "30"} + [:img {:src "/static/images/delete.png" + :onclick (str (namespace ::x) ".on_" component "_delete_clicked(" (get rec "id") "')")}]]])]]]))) + ;; body (defn comp-app [] @@ -799,9 +839,9 @@ [:th key]) [:th (str "Mark " (cond (= (dommy/value (dommy/sel1 :#read)) "read") - "unread" - :else - "read"))]]] + "unread" + :else + "read"))]]] [:tbody (for [rec results] (let [onclick "void()"] @@ -920,7 +960,7 @@ [:td {:onclick onclick} (get user "phone")] [:td [:img {:src "/static/images/delete.png" :onclick (str (namespace ::x) ".on_users_delete_clicked(" (get user "id") ", '" (get user "first_name") "', '" (get user "last_name") "')")}]]]))]]) - + (defn handler-users-view [response] (let [jsonobj (js->clj (js/JSON.parse response))] (dommy/set-html! (dommy/sel1 :#content) (template-users-view jsonobj)))) @@ -1124,38 +1164,6 @@ ;; resume -(defn generic-table [component jsonobj & [reverse-p]] - (let [results (get jsonobj "components") - keys (remove (fn [x] - (not (get (first results) x))) - (sort #(if reverse-p (compare %2 %1) (compare %1 %2)) (keys (first results))))] - (cond (empty? results) - [:h5 {:style "text-align: center"} (str "No " component "s found.")] - :else - [:div - [:p (str (count results) " " component "s.")] - [:table {:class "table table-striped table-hover table-sm"} - [:thead - [:tr - (for [key keys] - [:th {:scope "col"} key]) - [:th {:scope "col"} "Mod"] - [:th {:scope "col"} "Del"]]] - [:tbody - (for [rec results] - [:tr - (for [key keys] - [:td (str (get rec key))]) - [:td {:width "30"} - [:img {:src "/static/images/modify.png" - :onclick (str (namespace ::x) ".on_" component "_modify_clicked(" (get rec "id") ")")}]] - [:td {:width "30"} - [:img {:src "/static/images/delete.png" - :onclick (str (namespace ::x) ".on_" component "_delete_clicked(" (get rec "id") "')")}]]])]]]))) - -(hiccups/defhtml generic-component-add [jsonobj] - (ck-form/template-generic-form (get jsonobj "form") (namespace ::x))) - (hiccups/defhtml template-resume [jsonobj] [:h3 {:style "text-align: center"} (get jsonobj "title")] [:div {:id "content"}] @@ -1304,7 +1312,7 @@ ;; resume-delete (defn on-resume-delete-clicked [id name] - (when (js/confirm (str "Are you sure you want to delete " name "? This action cannot be undone.")) + (when (js/confirm (str "Are you sure you want to delete " name "? This action cannot be undone.")) (render-resume-delete id))) (defn handler-resume-delete [response] @@ -1319,190 +1327,192 @@ ;; contactinfo -(hiccups/defhtml template-contactinfo [jsonobj] - [:h3 {:style "text-align: center"} (get jsonobj "title")] - [:div {:id "content"}] - [:div {:id "modify" - :class "modal fade" - :role "dialog" - :tabindex "-1"} - [:div {:class "modal-dialog modal-lg"} - [:div {:class "modal-content"} - [:div {:class "modal-header"} - [:h5 [:span {:id "modify-title"}]] - [:button {:type "button" - :class "close" - :data-dismiss "modal"} - "×"]] - [:div {:id "modify-body" - :class "modal-body" - :style "height: 450px;"}] - [:div {:class "modal-footer"} - [:button {:type "submit" - :class "btn btn-danger btn-default" - :data-dismiss "modal"} - [:span {:class "glyphicon glyphicon-remove"}] - "Cancel"]]]]]) +(define-resume-component "contactinfo") -(defn handler-contactinfo [response] - (let [jsonobj (js->clj (js/JSON.parse response))] - (notifications jsonobj) - (dommy/set-html! (dommy/sel1 :#body) (template-contactinfo jsonobj)) - (render-contactinfo-view))) +;; (hiccups/defhtml template-contactinfo [jsonobj] +;; [:h3 {:style "text-align: center"} (get jsonobj "title")] +;; [:div {:id "content"}] +;; [:div {:id "modify" +;; :class "modal fade" +;; :role "dialog" +;; :tabindex "-1"} +;; [:div {:class "modal-dialog modal-lg"} +;; [:div {:class "modal-content"} +;; [:div {:class "modal-header"} +;; [:h5 [:span {:id "modify-title"}]] +;; [:button {:type "button" +;; :class "close" +;; :data-dismiss "modal"} +;; "×"]] +;; [:div {:id "modify-body" +;; :class "modal-body" +;; :style "height: 450px;"}] +;; [:div {:class "modal-footer"} +;; [:button {:type "submit" +;; :class "btn btn-danger btn-default" +;; :data-dismiss "modal"} +;; [:span {:class "glyphicon glyphicon-remove"}] +;; "Cancel"]]]]]) -(defn render-contactinfo [] - (GET "/resume/contactinfo" {:handler handler-contactinfo})) +;; (defn handler-contactinfo [response] +;; (let [jsonobj (js->clj (js/JSON.parse response))] +;; (notifications jsonobj) +;; (dommy/set-html! (dommy/sel1 :#body) (template-contactinfo jsonobj)) +;; (render-contactinfo-view))) -;; contactinfo-view +;; (defn render-contactinfo [] +;; (GET "/resume/contactinfo" {:handler handler-contactinfo})) -(hiccups/defhtml template-contactinfo-view [jsonobj] - [:div {:style "text-align: right"} - [:img {:src "/static/images/add.png" - :style "cursor:pointer; cursor:hand" - :onclick (str (namespace ::x) ".on_contactinfo_add_clicked()")}]] - [:table {:class "table table-striped table-hover table-sm"} - [:thead - [:tr - [:th {:scope "col"} "Address"] - [:th {:scope "col"} "City"] - [:th {:scope "col"} "State"] - [:th {:scope "col"} "Phone"] - [:th {:scope "col"} "Email"] - [:th {:scope "col"} "URL"] - [:th {:scope "col"} "VISA Status"] - [:th {:scope "col"} "Mod"] - [:th {:scope "col"} "Del"]]] - [:tbody - (for [contactinfo (get jsonobj "components")] - [:tr - [:td (get contactinfo "address")] - [:td (get contactinfo "city")] - [:td (get contactinfo "state_abbr")] - [:td (get contactinfo "phone")] - [:td (get contactinfo "email")] - [:td (get contactinfo "url")] - [:td (get contactinfo "visastatus")] - [:td {:width "30"} - [:img {:src "/static/images/modify.png" - :onclick (str (namespace ::x) ".on_contactinfo_modify_clicked(" (get contactinfo "id") ")")}]] - [:td {:width "30"} - [:img {:src "/static/images/delete.png" - :onclick (str (namespace ::x) ".on_contactinfo_delete_clicked(" (get contactinfo "id") ", '" (str (get contactinfo "address") ", " (get contactinfo "city") " " (get contactinfo "state_abbr")) "')")}]]])]]) +;; ;; contactinfo-view -(defn handler-contactinfo-view [response] - (let [jsonobj (js->clj (js/JSON.parse response))] - (dommy/set-html! (dommy/sel1 :#content) (template-contactinfo-view jsonobj)))) +;; (hiccups/defhtml template-contactinfo-view [jsonobj] +;; [:div {:style "text-align: right"} +;; [:img {:src "/static/images/add.png" +;; :style "cursor:pointer; cursor:hand" +;; :onclick (str (namespace ::x) ".on_contactinfo_add_clicked()")}]] +;; [:table {:class "table table-striped table-hover table-sm"} +;; [:thead +;; [:tr +;; [:th {:scope "col"} "Address"] +;; [:th {:scope "col"} "City"] +;; [:th {:scope "col"} "State"] +;; [:th {:scope "col"} "Phone"] +;; [:th {:scope "col"} "Email"] +;; [:th {:scope "col"} "URL"] +;; [:th {:scope "col"} "VISA Status"] +;; [:th {:scope "col"} "Mod"] +;; [:th {:scope "col"} "Del"]]] +;; [:tbody +;; (for [contactinfo (get jsonobj "components")] +;; [:tr +;; [:td (get contactinfo "address")] +;; [:td (get contactinfo "city")] +;; [:td (get contactinfo "state_abbr")] +;; [:td (get contactinfo "phone")] +;; [:td (get contactinfo "email")] +;; [:td (get contactinfo "url")] +;; [:td (get contactinfo "visastatus")] +;; [:td {:width "30"} +;; [:img {:src "/static/images/modify.png" +;; :onclick (str (namespace ::x) ".on_contactinfo_modify_clicked(" (get contactinfo "id") ")")}]] +;; [:td {:width "30"} +;; [:img {:src "/static/images/delete.png" +;; :onclick (str (namespace ::x) ".on_contactinfo_delete_clicked(" (get contactinfo "id") ", '" (str (get contactinfo "address") ", " (get contactinfo "city") " " (get contactinfo "state_abbr")) "')")}]]])]]) -(defn render-contactinfo-view [] - (GET "/resume/contactinfo/view" {:handler handler-contactinfo-view})) +;; (defn handler-contactinfo-view [response] +;; (let [jsonobj (js->clj (js/JSON.parse response))] +;; (dommy/set-html! (dommy/sel1 :#content) (template-contactinfo-view jsonobj)))) -;; contactinfo-add +;; (defn render-contactinfo-view [] +;; (GET "/resume/contactinfo/view" {:handler handler-contactinfo-view})) -(defn on-contactinfo-add-clicked [] - (render-contactinfo-add)) +;; ;; contactinfo-add -(hiccups/defhtml template-contactinfo-add [jsonobj] - (ck-form/template-generic-form (get jsonobj "form") (namespace ::x))) +;; (defn on-contactinfo-add-clicked [] +;; (render-contactinfo-add)) -(defn handler-contactinfo-add [response] - (let [jsonobj (js->clj (js/JSON.parse response))] - (auth-notifications jsonobj) - (dommy/set-html! (dommy/sel1 :#modify-title) (get jsonobj "title")) - (dommy/set-html! (dommy/sel1 :#modify-body) (template-contactinfo-add jsonobj)) - (.modal (jquery "#modify")))) +;; (hiccups/defhtml template-contactinfo-add [jsonobj] +;; (ck-form/template-generic-form (get jsonobj "form") (namespace ::x))) -(defn render-contactinfo-add [] - (POST "/resume/contactinfo/add" {:handler handler-contactinfo-add})) +;; (defn handler-contactinfo-add [response] +;; (let [jsonobj (js->clj (js/JSON.parse response))] +;; (auth-notifications jsonobj) +;; (dommy/set-html! (dommy/sel1 :#modify-title) (get jsonobj "title")) +;; (dommy/set-html! (dommy/sel1 :#modify-body) (template-contactinfo-add jsonobj)) +;; (.modal (jquery "#modify")))) -;; contactinfo-add-submit +;; (defn render-contactinfo-add [] +;; (POST "/resume/contactinfo/add" {:handler handler-contactinfo-add})) -(defn on-contactinfo-add-submit-clicked [] - (when (-> (jquery "#contactinfo-add-form") - (.get "0") - (.checkValidity)) - (.modal (jquery "#modify") "hide") - (render-contactinfo-add-submit))) +;; ;; contactinfo-add-submit -(defn handler-contactinfo-add-submit [response] - (let [jsonobj (js->clj (js/JSON.parse response))] - (auth-notifications jsonobj) - (on-menu-clicked "/resume/contactinfo"))) +;; (defn on-contactinfo-add-submit-clicked [] +;; (when (-> (jquery "#contactinfo-add-form") +;; (.get "0") +;; (.checkValidity)) +;; (.modal (jquery "#modify") "hide") +;; (render-contactinfo-add-submit))) -(defn render-contactinfo-add-submit [] - (POST "/resume/contactinfo/add/submit" - {:format :raw - :params {:address (dommy/value (dommy/sel1 :#address)) - :city (dommy/value (dommy/sel1 :#city)) - :state_id (dommy/value (dommy/sel1 :#state_id)) - :phone (dommy/value (dommy/sel1 :#phone)) - :email (dommy/value (dommy/sel1 :#email)) - :url (dommy/value (dommy/sel1 :#url)) - :visastatus_id (dommy/value (dommy/sel1 :#visastatus_id))} - :handler handler-contactinfo-add-submit})) +;; (defn handler-contactinfo-add-submit [response] +;; (let [jsonobj (js->clj (js/JSON.parse response))] +;; (auth-notifications jsonobj) +;; (on-menu-clicked "/resume/contactinfo"))) -;; contactinfo-modify +;; (defn render-contactinfo-add-submit [] +;; (POST "/resume/contactinfo/add/submit" +;; {:format :raw +;; :params {:address (dommy/value (dommy/sel1 :#address)) +;; :city (dommy/value (dommy/sel1 :#city)) +;; :state_id (dommy/value (dommy/sel1 :#state_id)) +;; :phone (dommy/value (dommy/sel1 :#phone)) +;; :email (dommy/value (dommy/sel1 :#email)) +;; :url (dommy/value (dommy/sel1 :#url)) +;; :visastatus_id (dommy/value (dommy/sel1 :#visastatus_id))} +;; :handler handler-contactinfo-add-submit})) -(defn on-contactinfo-modify-clicked [id] - (render-contactinfo-modify id)) +;; ;; contactinfo-modify -(hiccups/defhtml template-contactinfo-modify [jsonobj] - (ck-form/template-generic-form (get jsonobj "form") (namespace ::x))) +;; (defn on-contactinfo-modify-clicked [id] +;; (render-contactinfo-modify id)) -(defn handler-contactinfo-modify [response] - (let [jsonobj (js->clj (js/JSON.parse response))] - (auth-notifications jsonobj) - (dommy/set-html! (dommy/sel1 :#modify-title) (get jsonobj "title")) - (dommy/set-html! (dommy/sel1 :#modify-body) (template-contactinfo-modify jsonobj)) - (.modal (jquery "#modify")))) +;; (hiccups/defhtml template-contactinfo-modify [jsonobj] +;; (ck-form/template-generic-form (get jsonobj "form") (namespace ::x))) -(defn render-contactinfo-modify [id] - (POST "/resume/contactinfo/modify" - {:format :raw - :params {:id id} - :handler handler-contactinfo-modify})) +;; (defn handler-contactinfo-modify [response] +;; (let [jsonobj (js->clj (js/JSON.parse response))] +;; (auth-notifications jsonobj) +;; (dommy/set-html! (dommy/sel1 :#modify-title) (get jsonobj "title")) +;; (dommy/set-html! (dommy/sel1 :#modify-body) (template-contactinfo-modify jsonobj)) +;; (.modal (jquery "#modify")))) -;; contactinfo-modify-submit +;; (defn render-contactinfo-modify [id] +;; (POST "/resume/contactinfo/modify" +;; {:format :raw +;; :params {:id id} +;; :handler handler-contactinfo-modify})) -(defn on-contactinfo-modify-submit-clicked [id] - (when (-> (jquery "#contactinfo-modify-form") - (.get "0") - (.checkValidity)) - (.modal (jquery "#modify") "hide") - (render-contactinfo-modify-submit id))) +;; ;; contactinfo-modify-submit -(defn handler-contactinfo-modify-submit [response] - (let [jsonobj (js->clj (js/JSON.parse response))] - (auth-notifications jsonobj) - (on-menu-clicked "/resume/contactinfo"))) +;; (defn on-contactinfo-modify-submit-clicked [id] +;; (when (-> (jquery "#contactinfo-modify-form") +;; (.get "0") +;; (.checkValidity)) +;; (.modal (jquery "#modify") "hide") +;; (render-contactinfo-modify-submit id))) -(defn render-contactinfo-modify-submit [id] - (POST "/resume/contactinfo/modify/submit" - {:format :raw - :params {:id id - :address (dommy/value (dommy/sel1 :#address)) - :city (dommy/value (dommy/sel1 :#city)) - :state_id (dommy/value (dommy/sel1 :#state_id)) - :phone (dommy/value (dommy/sel1 :#phone)) - :email (dommy/value (dommy/sel1 :#email)) - :url (dommy/value (dommy/sel1 :#url)) - :visastatus_id (dommy/value (dommy/sel1 :#visastatus_id))} - :handler handler-contactinfo-modify-submit})) +;; (defn handler-contactinfo-modify-submit [response] +;; (let [jsonobj (js->clj (js/JSON.parse response))] +;; (auth-notifications jsonobj) +;; (on-menu-clicked "/resume/contactinfo"))) -;; contactinfo-delete +;; (defn render-contactinfo-modify-submit [id] +;; (POST "/resume/contactinfo/modify/submit" +;; {:format :raw +;; :params {:id id +;; :address (dommy/value (dommy/sel1 :#address)) +;; :city (dommy/value (dommy/sel1 :#city)) +;; :state_id (dommy/value (dommy/sel1 :#state_id)) +;; :phone (dommy/value (dommy/sel1 :#phone)) +;; :email (dommy/value (dommy/sel1 :#email)) +;; :url (dommy/value (dommy/sel1 :#url)) +;; :visastatus_id (dommy/value (dommy/sel1 :#visastatus_id))} +;; :handler handler-contactinfo-modify-submit})) -(defn on-contactinfo-delete-clicked [id name] - (when (js/confirm (str "Are you sure you want to delete " name "? This action cannot be undone.")) - (render-contactinfo-delete id))) +;; ;; contactinfo-delete -(defn handler-contactinfo-delete [response] - (let [jsonobj (js->clj (js/JSON.parse response))] - (auth-notifications jsonobj) - (on-menu-clicked "/resume/contactinfo"))) +;; (defn on-contactinfo-delete-clicked [id name] +;; (when (js/confirm (str "Are you sure you want to delete " name "? This action cannot be undone.")) +;; (render-contactinfo-delete id))) -(defn render-contactinfo-delete [id] - (DELETE (str "/resume/contactinfo/delete/" id) - {:format :raw - :handler handler-contactinfo-delete})) +;; (defn handler-contactinfo-delete [response] +;; (let [jsonobj (js->clj (js/JSON.parse response))] +;; (auth-notifications jsonobj) +;; (on-menu-clicked "/resume/contactinfo"))) + +;; (defn render-contactinfo-delete [id] +;; (DELETE (str "/resume/contactinfo/delete/" id) +;; {:format :raw +;; :handler handler-contactinfo-delete})) ;; education @@ -2051,7 +2061,7 @@ (= handler "/messages") (render-messages) (= handler "/users") (render-users) (= handler "/resume/resume") (render-resume) - (= handler "/resume/contactinfo") (render-contactinfo) + ;;(= handler "/resume/contactinfo") (render-contactinfo) (= handler "/resume/education") (render-education) (= handler "/resume/language") (render-language) (= handler "/resume/skill") (render-skill))) diff --git a/lisp/webapps/resume/clojurescript/resume/src/resume/util.clj b/lisp/webapps/resume/clojurescript/resume/src/resume/util.clj deleted file mode 100644 index 16276b3..0000000 --- a/lisp/webapps/resume/clojurescript/resume/src/resume/util.clj +++ /dev/null @@ -1,92 +0,0 @@ -(ns resume.util) - -(defmacro define-resume-component [component] - `(do - (declare ~(symbol (str "template-" component))) - (declare ~(symbol (str "handler-" component))) - (declare ~(symbol (str "render-" component))) - (declare ~(symbol (str "template-" component "-view"))) - (declare ~(symbol (str "handler-" component "-view"))) - (declare ~(symbol (str "render-" component "-view"))) - (declare ~(symbol (str "on-" component "-add-clicked"))) - (declare ~(symbol (str "template-" component "-add"))) - (declare ~(symbol (str "handler-" component "-add"))) - (declare ~(symbol (str "render-" component "-add"))) - (declare ~(symbol (str "on-" component "-add-submit-clicked"))) - (declare ~(symbol (str "handler-" component "-add-submit"))) - (declare ~(symbol (str "render-" component "-add-submit"))) - (declare ~(symbol (str "on-" component "-modify-clicked"))) - (declare ~(symbol (str "template-" component "-modify"))) - (declare ~(symbol (str "handler-" component "-modify"))) - (declare ~(symbol (str "render-" component "-modify"))) - (declare ~(symbol (str "on-" component "-modify-submit-clicked"))) - (declare ~(symbol (str "handler-" component "-modify-submit"))) - (declare ~(symbol (str "render-" component "-modify-submit"))) - (declare ~(symbol (str "on-" component" -delete-clicked"))) - (declare ~(symbol (str "handler-" component "-delete"))) - (declare ~(symbol (str "render-" component "-delete"))) - - (defn ~(symbol (str "handler-" component)) [response] - (let [jsonobj (js->clj (js/JSON.parse response))] - (notifications jsonobj) - (dommy/set-html! (dommy/sel1 :#body) (template-resume jsonobj)) - (~(symbol (str "template-" component "-view"))))) - - (defn ~(symbol (str "render-" component)) [] - (GET ~(str "/resume/" component) {:handler handler-resume})) - - (hiccups/defhtml ~(symbol (str "template-" component "-view")) [jsonobj] - [:div {:style "text-align: right"} - [:img {:src "/static/images/add.png" - :style "cursor:pointer; cursor:hand" - :onclick (str (namespace ::x) ".on_contactinfo_add_clicked()")}]] - (generic-table ~component jsonobj)) - - (defn ~(symbol (str "handler-" component "-view")) [response] - (let [jsonobj (js->clj (js/JSON.parse response))] - (dommy/set-html! (dommy/sel1 :#content) (template-contactinfo-view jsonobj)))) - - (defn ~(symbol (str "render-" component "-view")) [] - (GET ~(str "/resume/" component "/view") - {:handler ~(symbol (str "handler-" component "-view"))})) - - (defn ~(symbol (str "on-" component "-add-clicked")) [] - (~(symbol (str "render-" component "-add")))) - - (hiccups/defhtml template-component-add [jsonobj] - (ck-form/template-generic-form (get jsonobj "form") (namespace ::x))) - - (defn ~(symbol (str "handler-" component "-add")) [response] - (let [jsonobj (js->clj (js/JSON.parse response))] - (auth-notifications jsonobj) - (dommy/set-html! (dommy/sel1 :#modify-title) (get jsonobj "title")) - (dommy/set-html! (dommy/sel1 :#modify-body) (generic-component-add jsonobj)) - (.modal (jquery "#modify")))) - - (defn ~(symbol (str "render-" component "-add")) [] - (POST ~(str "/resume/" component "/add") - {:handler ~(symbol (str "handler-" component "-add"))})) - - (defn ~(symbol (str "on-" component "-add-submit-clicked")) [] - (when (-> (jquery "#contactinfo-add-form") - (.get "0") - (.checkValidity)) - (.modal (jquery "#modify") "hide") - (~(symbol (str "render-" component "-add-submit"))))) - - (defn ~(symbol (str "handler-" component "-add-submit")) [response] - (let [jsonobj (js->clj (js/JSON.parse response))] - (auth-notifications jsonobj) - (on-menu-clicked ~(str "/resume/" component)))) - - (defn ~(symbol (str "render-" component "-add-submit")) [] - (POST ~(str "/resume/" component "/add/submit") - {:format :raw - :params {:address (dommy/value (dommy/sel1 :#address)) - :city (dommy/value (dommy/sel1 :#city)) - :state_id (dommy/value (dommy/sel1 :#state_id)) - :phone (dommy/value (dommy/sel1 :#phone)) - :email (dommy/value (dommy/sel1 :#email)) - :url (dommy/value (dommy/sel1 :#url)) - :visastatus_id (dommy/value (dommy/sel1 :#visastatus_id))} - :handler ~(symbol (str "handler-" component "-add-submit"))})))) diff --git a/lisp/webapps/resume/clojurescript/resume/src/resume/util.cljs b/lisp/webapps/resume/clojurescript/resume/src/resume/util.cljs deleted file mode 100644 index b9d75a3..0000000 --- a/lisp/webapps/resume/clojurescript/resume/src/resume/util.cljs +++ /dev/null @@ -1,2 +0,0 @@ -(ns resume.util - (:require-macros [resume.util])) |
