diff options
| -rw-r--r-- | lisp/service/resume-service.lisp | 2 | ||||
| -rw-r--r-- | lisp/sql/job.lisp | 3 | ||||
| -rw-r--r-- | lisp/webapps/resume/clojurescript/resume/src/resume/core.clj | 157 | ||||
| -rw-r--r-- | lisp/webapps/resume/clojurescript/resume/src/resume/core.cljs | 832 |
4 files changed, 96 insertions, 898 deletions
diff --git a/lisp/service/resume-service.lisp b/lisp/service/resume-service.lisp index fca6c6e..53cb554 100644 --- a/lisp/service/resume-service.lisp +++ b/lisp/service/resume-service.lisp @@ -359,7 +359,7 @@ needs to JOIN with other data." "skill asc")) (define-resume-component (job - ((job :parameter-type 'string)) + ((company :parameter-type 'string) (location :parameter-type 'string) (start_date :parameter-type 'string) (end_date :parameter-type 'string) (overview :parameter-type 'string)) `((:name "company" :label "Company" :field-type "text" :required "required") (:name "location" :label "Location" :field-type "text" :required "required") (:name "start_date" :label "Start Date" :field-type "text" :required "required") diff --git a/lisp/sql/job.lisp b/lisp/sql/job.lisp index 96f9796..95b8639 100644 --- a/lisp/sql/job.lisp +++ b/lisp/sql/job.lisp @@ -7,6 +7,9 @@ ((id :initarg :id :initform nil :accessor id) + (user_id :initarg :user_id + :initform nil + :accessor user_id) (company :initarg :company :initform nil :accessor company) diff --git a/lisp/webapps/resume/clojurescript/resume/src/resume/core.clj b/lisp/webapps/resume/clojurescript/resume/src/resume/core.clj index b07ea64..54d3237 100644 --- a/lisp/webapps/resume/clojurescript/resume/src/resume/core.clj +++ b/lisp/webapps/resume/clojurescript/resume/src/resume/core.clj @@ -1,128 +1,129 @@ -(ns resume.core) +(ns resume.core + (:require [clojure.string :as str])) (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"))) + (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 "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 "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 (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 (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 (str "render-" component "-view"))))) - (defn ~(symbol (namespace ::x) (str "render-" component)) [] - (ajax.core/GET ~(str "/resume/" component) {:handler handler-resume})) + (defn ~(symbol (str "render-" component)) [] + (ajax.core/GET ~(str "/resume/" component) {:handler ~(symbol (str "handler-" component))})) - (hiccups/defhtml ~(symbol (namespace ::x) (str "template-" component "-view")) [jsonobj] + (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)) + :onclick ~(str (namespace ::x) ".on_" component "_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 (str "handler-" component "-view")) [response#] + (let [jsonobj# (cljs.core/js->clj (js/JSON.parse response#))] + (dommy/set-html! (dommy/sel1 :#content) (~(symbol (str "template-" component "-view")) jsonobj#)))) - (defn ~(symbol (namespace ::x) (str "render-" component "-view")) [] + (defn ~(symbol (str "render-" component "-view")) [] (ajax.core/GET ~(str "/resume/" component "/view") - {:handler ~(symbol (namespace ::x) (str "handler-" component "-view"))})) + {:handler ~(symbol (str "handler-" component "-view"))})) - (defn ~(symbol (namespace ::x) (str "on-" component "-add-clicked")) [] - (~(symbol (namespace ::x) (str "render-" component "-add")))) + (defn ~(symbol (str "on-" component "-add-clicked")) [] + (~(symbol (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)) + (defn ~(symbol (str "handler-" component "-add")) [response#] + (let [jsonobj# (cljs.core/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")) [] + (defn ~(symbol (str "render-" component "-add")) [] (ajax.core/POST ~(str "/resume/" component "/add") - {:handler ~(symbol (namespace ::x) (str "handler-" component "-add"))})) + {:handler ~(symbol (str "handler-" component "-add"))})) - (defn ~(symbol (namespace ::x) (str "on-" component "-add-submit-clicked")) [] + (defn ~(symbol (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"))))) + (~(symbol (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) + (defn ~(symbol (str "handler-" component "-add-submit")) [response#] + (let [jsonobj# (cljs.core/js->clj (js/JSON.parse response#))] + (auth-notifications jsonobj#) (on-menu-clicked ~(str "/resume/" component)))) - (defn ~(symbol (namespace ::x) (str "render-" component "-add-submit")) [] + (defn ~(symbol (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"))})) + :handler ~(symbol (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 (str "on-" component "-modify-clicked")) [id#] + (~(symbol (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)) + (defn ~(symbol (str "handler-" component "-modify")) [response#] + (let [jsonobj# (cljs.core/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] + (defn ~(symbol (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"))})) + :params {:id id#} + :handler ~(symbol (str "handler-" component "-modify"))})) - (defn ~(symbol (namespace ::x) (str "on-" component "-modify-submit-clicked")) [] + (defn ~(symbol (str "on-" component "-modify-submit-clicked")) [] (when (-> (jquery ~(str "#" component "-modify-form")) (.get "0") (.checkValidity)) (.modal (jquery "#modify") "hide") - (~(symbol (namespace ::x) (str "render-" component "-modify-submit"))))) + (~(symbol (str "render-" component "-modify-submit"))))) - (defn ~(symbol (namespace ::x) (str "handler-" component "-modify-submit")) [response] - (let [jsonobj (js->clj (js/JSON.parse response))] - (auth-notifications jsonobj) + (defn ~(symbol (str "handler-" component "-modify-submit")) [response#] + (let [jsonobj# (cljs.core/js->clj (js/JSON.parse response#))] + (auth-notifications jsonobj#) (on-menu-clicked ~(str "/resume/" component)))) - (defn ~(symbol (namespace ::x) (str "render-" component "-modify-submit")) [] + (defn ~(symbol (str "render-" component "-modify-submit")) [] (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"))})) + :handler ~(symbol (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 (str "on-" component "-delete-clicked")) [id#] + (when (js/confirm (str "Are you sure you want to delete " id# "? This action cannot be undone.")) + (~(symbol (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) + (defn ~(symbol (str "handler-" component "-delete")) [response#] + (let [jsonobj# (cljs.core/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) + (defn ~(symbol (str "render-" component "-delete")) [id#] + (ajax.core/DELETE (str "/resume/" ~component "/delete/" id#) {:format :raw - :handler ~(symbol (namespace ::x) (str "handler-" component "-delete"))})))) + :handler ~(symbol (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 b2274fd..0035ea0 100644 --- a/lisp/webapps/resume/clojurescript/resume/src/resume/core.cljs +++ b/lisp/webapps/resume/clojurescript/resume/src/resume/core.cljs @@ -153,100 +153,6 @@ (declare on-resume-delete-clicked) (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-education) -(declare handler-education) -(declare render-education) -(declare template-education-view) -(declare handler-education-view) -(declare render-education-view) -(declare on-education-add-clicked) -(declare template-education-add) -(declare handler-education-add) -(declare render-education-add) -(declare on-education-add-submit-clicked) -(declare handler-education-add-submit) -(declare render-education-add-submit) -(declare on-education-modify-clicked) -(declare template-education-modify) -(declare handler-education-modify) -(declare render-education-modify) -(declare on-education-modify-submit-clicked) -(declare handler-education-modify-submit) -(declare render-education-modify-submit) -(declare on-education-delete-clicked) -(declare handler-education-delete) -(declare render-education-delete) -(declare template-language) -(declare handler-language) -(declare render-language) -(declare template-language-view) -(declare handler-language-view) -(declare render-language-view) -(declare on-language-add-clicked) -(declare template-language-add) -(declare handler-language-add) -(declare render-language-add) -(declare on-language-add-submit-clicked) -(declare handler-language-add-submit) -(declare render-language-add-submit) -(declare on-language-modify-clicked) -(declare template-language-modify) -(declare handler-language-modify) -(declare render-language-modify) -(declare on-language-modify-submit-clicked) -(declare handler-language-modify-submit) -(declare render-language-modify-submit) -(declare on-language-delete-clicked) -(declare handler-language-delete) -(declare render-language-delete) -(declare template-skill) -(declare handler-skill) -(declare render-skill) -(declare template-skill-view) -(declare handler-skill-view) -(declare render-skill-view) -(declare on-skill-add-clicked) -(declare template-skill-add) -(declare handler-skill-add) -(declare render-skill-add) -(declare on-skill-add-submit-clicked) -(declare handler-skill-add-submit) -(declare render-skill-add-submit) -(declare on-skill-modify-clicked) -(declare template-skill-modify) -(declare handler-skill-modify) -(declare render-skill-modify) -(declare on-skill-modify-submit-clicked) -(declare handler-skill-modify-submit) -(declare render-skill-modify-submit) -(declare on-skill-delete-clicked) -(declare handler-skill-delete) -(declare render-skill-delete) (declare on-menu-clicked) (declare handler-location) (declare goto-location) @@ -312,21 +218,21 @@ [:table {:class "table table-striped table-hover table-sm"} [:thead [:tr - (for [key keys] + (for [key (filter #(not (str/includes? % "_id")) keys)] [:th {:scope "col"} key]) [:th {:scope "col"} "Mod"] [:th {:scope "col"} "Del"]]] [:tbody (for [rec results] [:tr - (for [key keys] + (for [key (filter #(not (str/includes? % "_id")) 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") "')")}]]])]]]))) + :onclick (str (namespace ::x) ".on_" component "_delete_clicked(" (get rec "id") ")")}]]])]]]))) ;; body @@ -1200,6 +1106,7 @@ ;; resume-view + (hiccups/defhtml template-resume-view [jsonobj] [:div {:style "text-align: right"} [:img {:src "/static/images/add.png" @@ -1325,727 +1232,13 @@ {:format :raw :handler handler-resume-delete})) -;; contactinfo - -;;(define-resume-component "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"]]]]]) - -;; (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))) - -;; (defn render-contactinfo [] -;; (GET "/resume/contactinfo" {:handler handler-contactinfo})) - -;; ;; contactinfo-view - -;; (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 handler-contactinfo-view [response] -;; (let [jsonobj (js->clj (js/JSON.parse response))] -;; (dommy/set-html! (dommy/sel1 :#content) (template-contactinfo-view jsonobj)))) - -;; (defn render-contactinfo-view [] -;; (GET "/resume/contactinfo/view" {:handler handler-contactinfo-view})) - -;; ;; contactinfo-add - -;; (defn on-contactinfo-add-clicked [] -;; (render-contactinfo-add)) - -;; (hiccups/defhtml template-contactinfo-add [jsonobj] -;; (ck-form/template-generic-form (get jsonobj "form") (namespace ::x))) - -;; (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")))) - -;; (defn render-contactinfo-add [] -;; (POST "/resume/contactinfo/add" {:handler handler-contactinfo-add})) - -;; ;; contactinfo-add-submit - -;; (defn on-contactinfo-add-submit-clicked [] -;; (when (-> (jquery "#contactinfo-add-form") -;; (.get "0") -;; (.checkValidity)) -;; (.modal (jquery "#modify") "hide") -;; (render-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 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})) - -;; ;; contactinfo-modify - -;; (defn on-contactinfo-modify-clicked [id] -;; (render-contactinfo-modify id)) - -;; (hiccups/defhtml template-contactinfo-modify [jsonobj] -;; (ck-form/template-generic-form (get jsonobj "form") (namespace ::x))) - -;; (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")))) - -;; (defn render-contactinfo-modify [id] -;; (POST "/resume/contactinfo/modify" -;; {:format :raw -;; :params {:id id} -;; :handler handler-contactinfo-modify})) - -;; ;; contactinfo-modify-submit - -;; (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 handler-contactinfo-modify-submit [response] -;; (let [jsonobj (js->clj (js/JSON.parse response))] -;; (auth-notifications jsonobj) -;; (on-menu-clicked "/resume/contactinfo"))) - -;; (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})) - -;; ;; contactinfo-delete - -;; (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 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 - -(hiccups/defhtml template-education [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 handler-education [response] - (let [jsonobj (js->clj (js/JSON.parse response))] - (notifications jsonobj) - (dommy/set-html! (dommy/sel1 :#body) (template-education jsonobj)) - (render-education-view))) - -(defn render-education [] - (GET "/resume/education" {:handler handler-education})) - -;; education-view - -(hiccups/defhtml template-education-view [jsonobj] - [:div {:style "text-align: right"} - [:img {:src "/static/images/add.png" - :style "cursor:pointer; cursor:hand" - :onclick (str (namespace ::x) ".on_education_add_clicked()")}]] - [:table {:class "table table-striped table-hover table-sm"} - [:thead - [:tr - [:th {:scope "col"} "School"] - [:th {:scope "col"} "Start Date"] - [:th {:scope "col"} "End Date"] - [:th {:scope "col"} "Major"] - [:th {:scope "col"} "Minor"] - [:th {:scope "col"} "Degree"] - [:th {:scope "col"} "Progress"] - [:th {:scope "col"} "Mod"] - [:th {:scope "col"} "Del"]]] - [:tbody - (for [education (get jsonobj "components")] - [:tr - [:td (get education "school")] - [:td (get education "start_date")] - [:td (get education "end_date")] - [:td (get education "major")] - [:td (get education "minor")] - [:td (get education "degree")] - [:td (get education "progress")] - [:td {:width "30"} - [:img {:src "/static/images/modify.png" - :onclick (str (namespace ::x) ".on_education_modify_clicked(" (get education "id") ")")}]] - [:td {:width "30"} - [:img {:src "/static/images/delete.png" - :onclick (str (namespace ::x) ".on_education_delete_clicked(" (get education "id") ", '" (str (get education "school") ", " (get education "major")) "')")}]]])]]) - -(defn handler-education-view [response] - (let [jsonobj (js->clj (js/JSON.parse response))] - (dommy/set-html! (dommy/sel1 :#content) (template-education-view jsonobj)))) - -(defn render-education-view [] - (GET "/resume/education/view" {:handler handler-education-view})) - -;; education-add +;; components -(defn on-education-add-clicked [] - (render-education-add)) - -(hiccups/defhtml template-education-add [jsonobj] - (ck-form/template-generic-form (get jsonobj "form") (namespace ::x))) - -(defn handler-education-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-education-add jsonobj)) - (.modal (jquery "#modify")))) - -(defn render-education-add [] - (POST "/resume/education/add" {:handler handler-education-add})) - -;; education-add-submit - -(defn on-education-add-submit-clicked [] - (when (-> (jquery "#education-add-form") - (.get "0") - (.checkValidity)) - (.modal (jquery "#modify") "hide") - (render-education-add-submit))) - -(defn handler-education-add-submit [response] - (let [jsonobj (js->clj (js/JSON.parse response))] - (auth-notifications jsonobj) - (on-menu-clicked "/resume/education"))) - -(defn render-education-add-submit [] - (POST "/resume/education/add/submit" - {:format :raw - :params {:school (dommy/value (dommy/sel1 :#school)) - :major (dommy/value (dommy/sel1 :#major)) - :minor (dommy/value (dommy/sel1 :#minor)) - :degree (dommy/value (dommy/sel1 :#degree)) - :progress (dommy/value (dommy/sel1 :#progress)) - :start_date (dommy/value (dommy/sel1 :#start_date)) - :end_date (dommy/value (dommy/sel1 :#end_date))} - :handler handler-education-add-submit})) - -;; education-modify - -(defn on-education-modify-clicked [id] - (render-education-modify id)) - -(hiccups/defhtml template-education-modify [jsonobj] - (ck-form/template-generic-form (get jsonobj "form") (namespace ::x))) - -(defn handler-education-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-education-modify jsonobj)) - (.modal (jquery "#modify")))) - -(defn render-education-modify [id] - (POST "/resume/education/modify" - {:format :raw - :params {:id id} - :handler handler-education-modify})) - -;; education-modify-submit - -(defn on-education-modify-submit-clicked [id] - (when (-> (jquery "#education-modify-form") - (.get "0") - (.checkValidity)) - (.modal (jquery "#modify") "hide") - (render-education-modify-submit id))) - -(defn handler-education-modify-submit [response] - (let [jsonobj (js->clj (js/JSON.parse response))] - (auth-notifications jsonobj) - (on-menu-clicked "/resume/education"))) - -(defn render-education-modify-submit [id] - (POST "/resume/education/modify/submit" - {:format :raw - :params {:id id - :school (dommy/value (dommy/sel1 :#school)) - :major (dommy/value (dommy/sel1 :#major)) - :minor (dommy/value (dommy/sel1 :#minor)) - :degree (dommy/value (dommy/sel1 :#degree)) - :progress (dommy/value (dommy/sel1 :#progress)) - :start_date (dommy/value (dommy/sel1 :#start_date)) - :end_date (dommy/value (dommy/sel1 :#end_date))} - :handler handler-education-modify-submit})) - -;; education-delete - -(defn on-education-delete-clicked [id name] - (when (js/confirm (str "Are you sure you want to delete " name "? This action cannot be undone.")) - (render-education-delete id))) - -(defn handler-education-delete [response] - (let [jsonobj (js->clj (js/JSON.parse response))] - (auth-notifications jsonobj) - (on-menu-clicked "/resume/education"))) - -(defn render-education-delete [id] - (DELETE (str "/resume/education/delete/" id) - {:format :raw - :handler handler-education-delete})) - -;; language - -(hiccups/defhtml template-language [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 handler-language [response] - (let [jsonobj (js->clj (js/JSON.parse response))] - (notifications jsonobj) - (dommy/set-html! (dommy/sel1 :#body) (template-language jsonobj)) - (render-language-view))) - -(defn render-language [] - (GET "/resume/language" {:handler handler-language})) - -;; language-view - -(hiccups/defhtml template-language-view [jsonobj] - [:div {:style "text-align: right"} - [:img {:src "/static/images/add.png" - :style "cursor:pointer; cursor:hand" - :onclick (str (namespace ::x) ".on_language_add_clicked()")}]] - [:table {:class "table table-striped table-hover table-sm"} - [:thead - [:tr - [:th {:scope "col"} "Name"] - [:th {:scope "col"} "Understanding Listening"] - [:th {:scope "col"} "Understanding Reading"] - [:th {:scope "col"} "Speaking Interaction"] - [:th {:scope "col"} "Speaking Production"] - [:th {:scope "col"} "Writing"] - [:th {:scope "col"} "Mod"] - [:th {:scope "col"} "Del"]]] - [:tbody - (for [language (get jsonobj "components")] - [:tr - [:td (get language "name")] - [:td (get language "understanding_listening")] - [:td (get language "understanding_reading")] - [:td (get language "speaking_interaction")] - [:td (get language "speaking_production")] - [:td (get language "writing")] - [:td {:width "30"} - [:img {:src "/static/images/modify.png" - :onclick (str (namespace ::x) ".on_language_modify_clicked(" (get language "id") ")")}]] - [:td {:width "30"} - [:img {:src "/static/images/delete.png" - :onclick (str (namespace ::x) ".on_language_delete_clicked(" (get language "id") ", '" (get language "name") "')")}]]])]]) - -(defn handler-language-view [response] - (let [jsonobj (js->clj (js/JSON.parse response))] - (dommy/set-html! (dommy/sel1 :#content) (template-language-view jsonobj)))) - -(defn render-language-view [] - (GET "/resume/language/view" {:handler handler-language-view})) - -;; language-add - -(defn on-language-add-clicked [] - (render-language-add)) - -(hiccups/defhtml template-language-add [jsonobj] - (ck-form/template-generic-form (get jsonobj "form") (namespace ::x))) - -(defn handler-language-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-language-add jsonobj)) - (.modal (jquery "#modify")))) - -(defn render-language-add [] - (POST "/resume/language/add" {:handler handler-language-add})) - -;; language-add-submit - -(defn on-language-add-submit-clicked [] - (when (-> (jquery "#language-add-form") - (.get "0") - (.checkValidity)) - (.modal (jquery "#modify") "hide") - (render-language-add-submit))) - -(defn handler-language-add-submit [response] - (let [jsonobj (js->clj (js/JSON.parse response))] - (auth-notifications jsonobj) - (on-menu-clicked "/resume/language"))) - -(defn render-language-add-submit [] - (POST "/resume/language/add/submit" - {:format :raw - :params {:name (dommy/value (dommy/sel1 :#name)) - :understanding_listening (dommy/value (dommy/sel1 :#understanding_listening)) - :understanding_reading (dommy/value (dommy/sel1 :#understanding_reading)) - :speaking_interaction (dommy/value (dommy/sel1 :#speaking_interaction)) - :speaking_production (dommy/value (dommy/sel1 :#speaking_production)) - :writing (dommy/value (dommy/sel1 :#writing))} - :handler handler-language-add-submit})) - -;; language-modify - -(defn on-language-modify-clicked [id] - (render-language-modify id)) - -(hiccups/defhtml template-language-modify [jsonobj] - (ck-form/template-generic-form (get jsonobj "form") (namespace ::x))) - -(defn handler-language-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-language-modify jsonobj)) - (.modal (jquery "#modify")))) - -(defn render-language-modify [id] - (POST "/resume/language/modify" - {:format :raw - :params {:id id} - :handler handler-language-modify})) - -;; language-modify-submit - -(defn on-language-modify-submit-clicked [id] - (when (-> (jquery "#language-modify-form") - (.get "0") - (.checkValidity)) - (.modal (jquery "#modify") "hide") - (render-language-modify-submit id))) - -(defn handler-language-modify-submit [response] - (let [jsonobj (js->clj (js/JSON.parse response))] - (auth-notifications jsonobj) - (on-menu-clicked "/resume/language"))) - -(defn render-language-modify-submit [id] - (POST "/resume/language/modify/submit" - {:format :raw - :params {:id id - :name (dommy/value (dommy/sel1 :#name)) - :understanding_listening (dommy/value (dommy/sel1 :#understanding_listening)) - :understanding_reading (dommy/value (dommy/sel1 :#understanding_reading)) - :speaking_interaction (dommy/value (dommy/sel1 :#speaking_interaction)) - :speaking_production (dommy/value (dommy/sel1 :#speaking_production)) - :writing (dommy/value (dommy/sel1 :#writing))} - :handler handler-language-modify-submit})) - -;; language-delete - -(defn on-language-delete-clicked [id name] - (when (js/confirm (str "Are you sure you want to delete " name "? This action cannot be undone.")) - (render-language-delete id))) - -(defn handler-language-delete [response] - (let [jsonobj (js->clj (js/JSON.parse response))] - (auth-notifications jsonobj) - (on-menu-clicked "/resume/language"))) - -(defn render-language-delete [id] - (DELETE (str "/resume/language/delete/" id) - {:format :raw - :handler handler-language-delete})) - -;; skill - -(hiccups/defhtml template-skill [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 handler-skill [response] - (let [jsonobj (js->clj (js/JSON.parse response))] - (notifications jsonobj) - (dommy/set-html! (dommy/sel1 :#body) (template-skill jsonobj)) - (render-skill-view))) - -(defn render-skill [] - (GET "/resume/skill" {:handler handler-skill})) - -;; skill-view - -(hiccups/defhtml template-skill-view [jsonobj] - [:div {:style "text-align: right"} - [:img {:src "/static/images/add.png" - :style "cursor:pointer; cursor:hand" - :onclick (str (namespace ::x) ".on_skill_add_clicked()")}]] - [:table {:class "table table-striped table-hover table-sm"} - [:thead - [:tr - [:th {:scope "col"} "Skill"] - [:th {:scope "col"} "Mod"] - [:th {:scope "col"} "Del"]]] - [:tbody - (for [skill (get jsonobj "components")] - [:tr - [:td (get skill "skill")] - [:td {:width "30"} - [:img {:src "/static/images/modify.png" - :onclick (str (namespace ::x) ".on_skill_modify_clicked(" (get skill "id") ")")}]] - [:td {:width "30"} - [:img {:src "/static/images/delete.png" - :onclick (str (namespace ::x) ".on_skill_delete_clicked(" (get skill "id") ", '" (get skill "skill") "')")}]]])]]) - -(defn handler-skill-view [response] - (let [jsonobj (js->clj (js/JSON.parse response))] - (dommy/set-html! (dommy/sel1 :#content) (template-skill-view jsonobj)))) - -(defn render-skill-view [] - (GET "/resume/skill/view" {:handler handler-skill-view})) - -;; skill-add - -(defn on-skill-add-clicked [] - (render-skill-add)) - -(hiccups/defhtml template-skill-add [jsonobj] - (ck-form/template-generic-form (get jsonobj "form") (namespace ::x))) - -(defn handler-skill-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-skill-add jsonobj)) - (.modal (jquery "#modify")))) - -(defn render-skill-add [] - (POST "/resume/skill/add" {:handler handler-skill-add})) - -;; skill-add-submit - -(defn on-skill-add-submit-clicked [] - (when (-> (jquery "#skill-add-form") - (.get "0") - (.checkValidity)) - (.modal (jquery "#modify") "hide") - (render-skill-add-submit))) - -(defn handler-skill-add-submit [response] - (let [jsonobj (js->clj (js/JSON.parse response))] - (auth-notifications jsonobj) - (on-menu-clicked "/resume/skill"))) - -(defn render-skill-add-submit [] - (POST "/resume/skill/add/submit" - {:format :raw - :params {:skill (dommy/value (dommy/sel1 :#skill))} - :handler handler-skill-add-submit})) - -;; skill-modify - -(defn on-skill-modify-clicked [id] - (render-skill-modify id)) - -(hiccups/defhtml template-skill-modify [jsonobj] - (ck-form/template-generic-form (get jsonobj "form") (namespace ::x))) - -(defn handler-skill-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-skill-modify jsonobj)) - (.modal (jquery "#modify")))) - -(defn render-skill-modify [id] - (POST "/resume/skill/modify" - {:format :raw - :params {:id id} - :handler handler-skill-modify})) - -;; skill-modify-submit - -(defn on-skill-modify-submit-clicked [id] - (when (-> (jquery "#skill-modify-form") - (.get "0") - (.checkValidity)) - (.modal (jquery "#modify") "hide") - (render-skill-modify-submit id))) - -(defn handler-skill-modify-submit [response] - (let [jsonobj (js->clj (js/JSON.parse response))] - (auth-notifications jsonobj) - (on-menu-clicked "/resume/skill"))) - -(defn render-skill-modify-submit [id] - (POST "/resume/skill/modify/submit" - {:format :raw - :params {:id id - :skill (dommy/value (dommy/sel1 :#skill))} - :handler handler-skill-modify-submit})) - -;; skill-delete - -(defn on-skill-delete-clicked [id name] - (when (js/confirm (str "Are you sure you want to delete " name "? This action cannot be undone.")) - (render-skill-delete id))) - -(defn handler-skill-delete [response] - (let [jsonobj (js->clj (js/JSON.parse response))] - (auth-notifications jsonobj) - (on-menu-clicked "/resume/skill"))) - -(defn render-skill-delete [id] - (DELETE (str "/resume/skill/delete/" id) - {:format :raw - :handler handler-skill-delete})) +(define-resume-component "contactinfo") +(define-resume-component "education") +(define-resume-component "language") +(define-resume-component "skill") +(define-resume-component "job") ;; location @@ -2061,10 +1254,11 @@ (= 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))) + (= handler "/resume/skill") (render-skill) + (= handler "/resume/job") (render-job))) (defn handler-location [response] (let [jsonobj (js->clj (js/JSON.parse response))] |
