diff options
| author | ckonstanski <kostcarl@isu.edu> | 2026-07-21 15:26:40 -0600 |
|---|---|---|
| committer | ckonstanski <kostcarl@isu.edu> | 2026-07-21 15:26:40 -0600 |
| commit | 51354fd19f76c2cbfd31542e9c072b86a90134f0 (patch) | |
| tree | 01e60982cd467d266c70dab68bc3c3e5714b4d53 /lisp/webapps/resume | |
| parent | 05154d8591bc1d7f31b7d875e6086e81055288c4 (diff) | |
added education
Diffstat (limited to 'lisp/webapps/resume')
| -rw-r--r-- | lisp/webapps/resume/clojurescript/resume/src/core.cljs | 213 | ||||
| -rw-r--r-- | lisp/webapps/resume/site.lisp | 28 |
2 files changed, 240 insertions, 1 deletions
diff --git a/lisp/webapps/resume/clojurescript/resume/src/core.cljs b/lisp/webapps/resume/clojurescript/resume/src/core.cljs index cde1a89..d894e7f 100644 --- a/lisp/webapps/resume/clojurescript/resume/src/core.cljs +++ b/lisp/webapps/resume/clojurescript/resume/src/core.cljs @@ -172,6 +172,29 @@ (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 on-menu-clicked) (declare handler-location) (declare goto-location) @@ -1396,6 +1419,193 @@ {: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 "/resumes/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 "educations")] + [: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 "/resumes/education/view" {:handler handler-education-view})) + +;; education-add + +(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 "/resumes/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 "/resumes/education"))) + +(defn render-education-add-submit [] + (POST "/resumes/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 "/resumes/education/modify" + {:format :raw + :params {:id id} + :handler handler-education-modify})) + +;; education-modify-submit + +(defn on-education-modify-submit-clicked [] + (when (-> (jquery "#education-modify-form") + (.get "0") + (.checkValidity)) + (.modal (jquery "#modify") "hide") + (render-education-modify-submit))) + +(defn handler-education-modify-submit [response] + (let [jsonobj (js->clj (js/JSON.parse response))] + (auth-notifications jsonobj) + (on-menu-clicked "/resumes/education"))) + +(defn render-education-modify-submit [] + (POST "/resumes/education/modify/submit" + {:format :raw + :params {:id (dommy/value (dommy/sel1 :#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 "/resumes/education"))) + +(defn render-education-delete [id] + (DELETE (str "/resumes/education/delete/" id) + {:format :raw + :handler handler-education-delete})) + ;; location (defn on-menu-clicked [handler] @@ -1410,7 +1620,8 @@ (= handler "/messages") (render-messages) (= handler "/users") (render-users) (= handler "/resumes") (render-resumes) - (= handler "/resumes/contactinfo") (render-contactinfo))) + (= handler "/resumes/contactinfo") (render-contactinfo) + (= handler "/resumes/education") (render-education))) (defn handler-location [response] (let [jsonobj (js->clj (js/JSON.parse response))] diff --git a/lisp/webapps/resume/site.lisp b/lisp/webapps/resume/site.lisp index 2142c9c..d8c1fb5 100644 --- a/lisp/webapps/resume/site.lisp +++ b/lisp/webapps/resume/site.lisp @@ -173,6 +173,27 @@ (defmacro .contactinfo-delete () `(contactinfo-delete-json id)) +(defmacro .education () + `(education-json)) + +(defmacro .education-view () + `(education-view-json)) + +(defmacro .education-add () + `(education-add-json)) + +(defmacro .education-add-submit () + `(education-add-submit-json school major minor degree progress start_date end_date)) + +(defmacro .education-modify () + `(education-modify-json id)) + +(defmacro .education-modify-submit () + `(education-modify-submit-json id school major minor degree progress start_date end_date)) + +(defmacro .education-delete () + `(education-delete-json id)) + (define-endpoint ("/" :method :get) () .base) (define-endpoint ("/location" :method :post) (&post (location :parameter-type 'string)) .location) (define-endpoint ("/home" :method :get) () .home-get) @@ -224,3 +245,10 @@ (define-endpoint ("/resumes/contactinfo/modify" :method :post) (&post (id :parameter-type 'integer)) .contactinfo-modify) (define-endpoint ("/resumes/contactinfo/modify/submit" :method :post) (&post (id :parameter-type 'integer) (address :parameter-type 'string) (city :parameter-type 'string) (state_id :parameter-type 'integer) (phone :parameter-type 'string) (email :parameter-type 'string) (visastatus_id :parameter-type 'integer)) .contactinfo-modify-submit) (define-endpoint ("/resumes/contactinfo/delete/:id" :method :delete) (&path (id 'integer)) .contactinfo-delete) +(define-endpoint ("/resumes/education" :method :get) () .education) +(define-endpoint ("/resumes/education/view" :method :get) () .education-view) +(define-endpoint ("/resumes/education/add" :method :post) () .education-add) +(define-endpoint ("/resumes/education/add/submit" :method :post) (&post (school :parameter-type 'string) (major :parameter-type 'string) (minor :parameter-type 'string) (degree :parameter-type 'string) (progress :parameter-type 'string) (start_date :parameter-type 'string) (end_date :parameter-type 'string)) .education-add-submit) +(define-endpoint ("/resumes/education/modify" :method :post) (&post (id :parameter-type 'integer)) .education-modify) +(define-endpoint ("/resumes/education/modify/submit" :method :post) (&post (id :parameter-type 'integer) (school :parameter-type 'string) (major :parameter-type 'string) (minor :parameter-type 'string) (degree :parameter-type 'string) (progress :parameter-type 'string) (start_date :parameter-type 'string) (end_date :parameter-type 'string)) .education-modify-submit) +(define-endpoint ("/resumes/education/delete/:id" :method :delete) (&path (id 'integer)) .education-delete) |
