From dba006ad5768b9eb59fbbd703ab9fcfe96017743 Mon Sep 17 00:00:00 2001 From: Simon Brooke Date: Mon, 14 Feb 2022 10:33:06 +0000 Subject: [PATCH] Cope with the fact that `servlet-context` is no longer working... At least as I think it did. Also moved some assets to fixed URLs so that they can be served by Apache, reducing load on Tomcat. --- resources/templates/app.html | 14 +++++----- resources/templates/base.html | 26 +++++++++---------- resources/templates/login.html | 2 +- .../youyesyet/canvasser_app/handlers.cljs | 6 +++-- workspace.code-workspace | 14 ++++++++++ 5 files changed, 39 insertions(+), 23 deletions(-) create mode 100644 workspace.code-workspace diff --git a/resources/templates/app.html b/resources/templates/app.html index f5e7c9a..9c2220f 100644 --- a/resources/templates/app.html +++ b/resources/templates/app.html @@ -2,9 +2,9 @@ {% block head %} - - - + + + {{site-title}}: {{title}} {% endblock %} @@ -43,12 +43,12 @@ {% block extra-tail %} - - + + - + - + {% endblock %} diff --git a/resources/templates/base.html b/resources/templates/base.html index aac9050..a60bd83 100644 --- a/resources/templates/base.html +++ b/resources/templates/base.html @@ -27,20 +27,20 @@ {% block top %}
@@ -91,16 +91,16 @@ diff --git a/resources/templates/login.html b/resources/templates/login.html index dca783e..1c337db 100644 --- a/resources/templates/login.html +++ b/resources/templates/login.html @@ -11,7 +11,7 @@ {% endblock %} {% block content %} -
+ {% csrf-field %}

diff --git a/src/cljs/youyesyet/canvasser_app/handlers.cljs b/src/cljs/youyesyet/canvasser_app/handlers.cljs index 921410e..4217925 100644 --- a/src/cljs/youyesyet/canvasser_app/handlers.cljs +++ b/src/cljs/youyesyet/canvasser_app/handlers.cljs @@ -64,8 +64,8 @@ (apply 'do forms))) (defn compose-packet - [item] "Convert this `item` into a URI which can be sent as a GET call" + [item] (assoc (url js/window.location) :path (str "/rest/" (name (:action item))) @@ -74,6 +74,7 @@ (def feedback-messages + "Messages used as feedback to the user" {:fetch-locality "Fetching local data." :send-request "Request has been queued." :send-intention-and-visit "Voting intention has been sent" @@ -119,9 +120,10 @@ (remove-from-key db :outqueue x)) -(defn coerce-to-number [v] +(defn coerce-to-number "If it is possible to do so, coerce `v` to a number. NOTE: I tried to do this in *cljc*, but it did not work. Leave it alone." + [v] (if (number? v) v (try (read-string (str v)) diff --git a/workspace.code-workspace b/workspace.code-workspace new file mode 100644 index 0000000..3565d75 --- /dev/null +++ b/workspace.code-workspace @@ -0,0 +1,14 @@ +{ + "folders": [ + { + "path": "." + }, + { + "path": "../adl-support" + }, + { + "path": "../Selmer" + } + ], + "settings": {} +} \ No newline at end of file