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.
This commit is contained in:
Simon Brooke 2022-02-14 10:33:06 +00:00
parent 644dfcb517
commit 1d97622a48
No known key found for this signature in database
GPG key ID: A7A4F18D1D4DF987
5 changed files with 39 additions and 23 deletions
resources/templates
src/cljs/youyesyet/canvasser_app
workspace.code-workspace

View file

@ -2,9 +2,9 @@
{% block head %}
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<link rel="stylesheet" type="text/css" href="css/yyy-common.css" />
<link rel="stylesheet" type="text/css" href="css/yyy-app.css" />
<link rel="stylesheet" type="text/css" href="css/spinner.css" />
<link rel="stylesheet" type="text/css" href="/css/yyy-common.css" />
<link rel="stylesheet" type="text/css" href="/css/yyy-app.css" />
<link rel="stylesheet" type="text/css" href="/css/spinner.css" />
<link href="https://fonts.googleapis.com/css?family=Archivo+Black|Archivo+Narrow" rel="stylesheet"/>
<title>{{site-title}}: {{title}}</title>
{% endblock %}
@ -43,12 +43,12 @@
{% block extra-tail %}
<!-- scripts and styles -->
<!-- Leaflet -->
<link rel="stylesheet" href="{{servlet-context}}/js/lib/node_modules/leaflet/dist/leaflet.css" />
<script src="{{servlet-context}}/js/lib/node_modules/leaflet/dist/leaflet.js"></script>
<link rel="stylesheet" href="js/lib/node_modules/leaflet/dist/leaflet.css" />
<script src="js/lib/node_modules/leaflet/dist/leaflet.js"></script>
<!-- Signature pad -->
<script src="{{servlet-context}}/js/lib/node_modules/signature_pad/dist/signature_pad.min.js"></script>
<script src="js/lib/node_modules/signature_pad/dist/signature_pad.min.js"></script>
<!-- our actual app -->
<script src="{{servlet-context}}/js/app.js"></script>
<script src="js/app.js"></script>
{% endblock %}

View file

@ -27,20 +27,20 @@
{% block top %}
<header>
<div id="nav">
<img id="nav-icon" src="{{servlet-context}}/img/threelines.png" alt="Menu"/>
<img id="nav-icon" src="/img/threelines.png" alt="Menu"/>
<menu id="nav-menu" class="nav">
<li class=""><a href="{{servlet-context}}/">Home</a></li>
<li class=""><a href="/">Home</a></li>
<li class=""><a href="https://library.projecthope.scot/">Library</a></li>
{% if user %}
<li class=""><a href="{{servlet-context}}/roles">Roles</a></li>
<li class=""><a href="{{servlet-context}}/logout">Logout</a></li>
<li class=""><a href="roles">Roles</a></li>
<li class=""><a href="logout">Logout</a></li>
{% else %}
<li class=""><a href="{{servlet-context}}/register">Register</a></li>
<li class=""><a href="{{servlet-context}}/login">Login</a></li>
<li class=""><a href="register">Register</a></li>
<li class=""><a href="login">Login</a></li>
{% endif %}
<li class=""><a href="{{servlet-context}}/about">About</a></li>
<li class=""><a href="about">About</a></li>
{% if user %}
<li id="user"><a href="{{servlet-context}}/profile">Logged in as {{user.username}}</a></li>
<li id="user"><a href="profile">Logged in as {{user.username}}</a></li>
{% endif %}
</menu>
</div>
@ -91,16 +91,16 @@
<footer>
<div id="credits">
<div>
<img src="{{servlet-context}}/img/credits/ric-logo.png" width="24" height="24"/>
<img src="/img/credits/ric-logo.png" width="24" height="24"/>
A project of the
<a href="https://radical.scot/">Radical Independence Campaign</a> ||
Version {{version}}
</div>
<div>
<img height="16" width="16" alt="Clojure" src="{{servlet-context}}/img/credits/luminus-logo.png"/>Built with <a href="http://www.luminusweb.net/">LuminusWeb</a> ||
<img height="16" width="16" alt="Clojure" src="{{servlet-context}}/img/credits/clojure-icon.gif"/> Powered by <a href="http://clojure.org">Clojure</a> ||
<img height="16" width="16" alt="GitHub" src="{{servlet-context}}/img/credits/github-logo-transparent.png"/>Find me/fork me on <a href="https://github.com/simon-brooke/youyesyet">Github</a> ||
<img height="16" width="16" alt="Free Software Foundation" src="{{servlet-context}}/img/credits/gnu.small.png"/>Licensed under the <a href="http://www.gnu.org/licenses/gpl-2.0.html">GNU General Public License version 2.0</a>
<img height="16" width="16" alt="Clojure" src="/img/credits/luminus-logo.png"/>Built with <a href="http://www.luminusweb.net/">LuminusWeb</a> ||
<img height="16" width="16" alt="Clojure" src="/img/credits/clojure-icon.gif"/> Powered by <a href="http://clojure.org">Clojure</a> ||
<img height="16" width="16" alt="GitHub" src="/img/credits/github-logo-transparent.png"/>Find me/fork me on <a href="https://github.com/simon-brooke/youyesyet">Github</a> ||
<img height="16" width="16" alt="Free Software Foundation" src="/img/credits/gnu.small.png"/>Licensed under the <a href="http://www.gnu.org/licenses/gpl-2.0.html">GNU General Public License version 2.0</a>
</div>
</div>
</footer>

View file

@ -11,7 +11,7 @@
{% endblock %}
{% block content %}
<form action="{{servlet-context}}/login" method="post">
<form action="login" method="post">
{% csrf-field %}
<input type="hidden" name="redirect-to" value="{{servlet-context}}/roles"/>
<h2>

View file

@ -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))

14
workspace.code-workspace Normal file
View file

@ -0,0 +1,14 @@
{
"folders": [
{
"path": "."
},
{
"path": "../adl-support"
},
{
"path": "../Selmer"
}
],
"settings": {}
}