Merge remote-tracking branch 'origin/develop' into develop
This commit is contained in:
commit
68bb22bd31
49
project.clj
49
project.clj
|
@ -5,35 +5,36 @@
|
|||
|
||||
:dependencies [[org.clojure/clojure "1.8.0"]
|
||||
[org.clojure/clojurescript "1.9.229" :scope "provided"]
|
||||
[ring/ring-servlet "1.5.0"]
|
||||
[ring/ring-servlet "1.5.1"]
|
||||
[clj-oauth "1.5.5"]
|
||||
[ch.qos.logback/logback-classic "1.1.8"]
|
||||
[re-frame "0.9.1"]
|
||||
[ch.qos.logback/logback-classic "1.2.2"]
|
||||
[re-frame "0.9.2"]
|
||||
[cljs-ajax "0.5.8"]
|
||||
[secretary "1.2.3"]
|
||||
[reagent-utils "0.2.0"]
|
||||
[reagent "0.6.0"]
|
||||
[reagent-utils "0.2.1"]
|
||||
[reagent "0.6.1"]
|
||||
[korma "0.4.3"]
|
||||
[selmer "1.10.3"]
|
||||
[markdown-clj "0.9.91"]
|
||||
[ring-middleware-format "0.7.0"]
|
||||
[metosin/ring-http-response "0.8.0"]
|
||||
[bouncer "1.0.0"]
|
||||
[org.webjars/bootstrap "4.0.0-alpha.5"]
|
||||
[selmer "1.10.6"]
|
||||
[markdown-clj "0.9.98"]
|
||||
[ring-middleware-format "0.7.2"]
|
||||
[metosin/ring-http-response "0.8.2"]
|
||||
[bouncer "1.0.1"]
|
||||
[org.webjars/bootstrap "4.0.0-alpha.6-1"]
|
||||
[org.webjars/font-awesome "4.7.0"]
|
||||
[org.webjars.bower/tether "1.3.7"]
|
||||
[org.webjars.bower/tether "1.4.0"]
|
||||
[org.clojure/tools.logging "0.3.1"]
|
||||
[compojure "1.5.1"]
|
||||
[compojure "1.5.2"]
|
||||
[metosin/compojure-api "1.1.10"]
|
||||
[ring-webjars "0.1.1"]
|
||||
[ring/ring-defaults "0.2.1"]
|
||||
[ring/ring-defaults "0.2.3"]
|
||||
[luminus/ring-ttl-session "0.3.1"]
|
||||
[mount "0.1.11"]
|
||||
[cprop "0.1.9"]
|
||||
[cprop "0.1.10"]
|
||||
[org.clojure/tools.cli "0.3.5"]
|
||||
[migratus "0.8.32"]
|
||||
[migratus "0.8.33"]
|
||||
[luminus-nrepl "0.1.4"]
|
||||
[luminus-migrations "0.2.9"]
|
||||
[conman "0.6.2"]
|
||||
[luminus-migrations "0.3.0"]
|
||||
[conman "0.6.3"]
|
||||
[org.postgresql/postgresql "9.4.1212"]
|
||||
]
|
||||
|
||||
|
@ -111,21 +112,21 @@
|
|||
|
||||
:project/dev {:dependencies [[prone "1.1.4"]
|
||||
[ring/ring-mock "0.3.0"]
|
||||
[ring/ring-devel "1.5.0"]
|
||||
[ring/ring-devel "1.5.1"]
|
||||
[luminus-jetty "0.1.4"]
|
||||
[pjstadig/humane-test-output "0.8.1"]
|
||||
[org.clojure/core.cache "0.6.5"]
|
||||
[org.apache.httpcomponents/httpcore "4.4.5"]
|
||||
[org.apache.httpcomponents/httpcore "4.4.6"]
|
||||
[clj-webdriver/clj-webdriver "0.7.2"]
|
||||
[org.seleniumhq.selenium/selenium-server "3.0.1"]
|
||||
[org.seleniumhq.selenium/selenium-server "3.3.1"]
|
||||
[doo "0.1.7"]
|
||||
[binaryage/devtools "0.8.3"]
|
||||
[figwheel-sidecar "0.5.8"]
|
||||
[binaryage/devtools "0.9.2"]
|
||||
[figwheel-sidecar "0.5.9"]
|
||||
[com.cemerick/piggieback "0.2.2-SNAPSHOT"]
|
||||
[directory-naming/naming-java "0.8"]]
|
||||
:plugins [[com.jakemccrary/lein-test-refresh "0.14.0"]
|
||||
[lein-doo "0.1.7"]
|
||||
[lein-figwheel "0.5.8"]
|
||||
[lein-figwheel "0.5.9"]
|
||||
[org.clojure/clojurescript "1.9.229"]]
|
||||
:cljsbuild
|
||||
{:builds
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<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-static.css" />
|
||||
<title>About YouYesYet</title>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<div id="nav">
|
||||
<img id="nav-icon" src="img/threelines.png" alt="Menu"/>
|
||||
<menu id="nav-menu" class="nav">
|
||||
<li class=""><a href="index.html">Home</a></li>
|
||||
<li class=""><a href="library.html">Library</a></li>
|
||||
<li class=""><a href="register.html">Register</a></li>
|
||||
<li class=""><a href="login.html">Login</a></li>
|
||||
<li class=""><a href="about.html">About</a></li>
|
||||
</menu>
|
||||
</div>
|
||||
|
||||
<h1>
|
||||
About YouYesYet
|
||||
</h1>
|
||||
</header>
|
||||
<div id="main-container" class="container">
|
||||
<div id="back-link-container">
|
||||
<a href="javascript:history.back()" id="back-link">Back</a>
|
||||
</div>
|
||||
<p>
|
||||
This isn't finished and doesn't work yet! This site is just a look-and-feel
|
||||
dummy.
|
||||
</p>
|
||||
<p>
|
||||
<b>YouYesYet</b> is a project to build a canvassing app for the new Scottish
|
||||
Independence Referendum. The source code is <a href="https://github.com/simon-brooke/youyesyet">here</a>. The specification
|
||||
is <a href="https://github.com/simon-brooke/youyesyet/blob/master/doc/specification/userspec.md">here</a>.
|
||||
</p>
|
||||
<p>
|
||||
If we're going to get this working in time I cannot do it alone: I need help. Contact
|
||||
me <a href="mailto:simon@journeyman.cc">by email</a> or on <a href="">on Twitter</a>.
|
||||
</p>
|
||||
</div>
|
||||
<footer>
|
||||
<div class="dummy">
|
||||
This is a dummy page illustrating the intended navigation flow through the app. It may be replaced by something more dynamic later.
|
||||
</div>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
|
141
resources/public/css/spinner.css
Normal file
141
resources/public/css/spinner.css
Normal file
|
@ -0,0 +1,141 @@
|
|||
/*
|
||||
* Cribbed from http://tobiasahlin.com/spinkit/
|
||||
* (source here https://github.com/tobiasahlin/SpinKit)
|
||||
* Thanks Tobias!
|
||||
*/
|
||||
|
||||
.sk-fading-circle {
|
||||
margin: 100px auto;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.sk-fading-circle .sk-circle {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.sk-fading-circle .sk-circle:before {
|
||||
content: '';
|
||||
display: block;
|
||||
margin: 0 auto;
|
||||
width: 15%;
|
||||
height: 15%;
|
||||
background-color: white;
|
||||
border-radius: 100%;
|
||||
-webkit-animation: sk-circleFadeDelay 1.2s infinite ease-in-out both;
|
||||
animation: sk-circleFadeDelay 1.2s infinite ease-in-out both;
|
||||
}
|
||||
.sk-fading-circle .sk-circle2 {
|
||||
-webkit-transform: rotate(30deg);
|
||||
-ms-transform: rotate(30deg);
|
||||
transform: rotate(30deg);
|
||||
}
|
||||
.sk-fading-circle .sk-circle3 {
|
||||
-webkit-transform: rotate(60deg);
|
||||
-ms-transform: rotate(60deg);
|
||||
transform: rotate(60deg);
|
||||
}
|
||||
.sk-fading-circle .sk-circle4 {
|
||||
-webkit-transform: rotate(90deg);
|
||||
-ms-transform: rotate(90deg);
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
.sk-fading-circle .sk-circle5 {
|
||||
-webkit-transform: rotate(120deg);
|
||||
-ms-transform: rotate(120deg);
|
||||
transform: rotate(120deg);
|
||||
}
|
||||
.sk-fading-circle .sk-circle6 {
|
||||
-webkit-transform: rotate(150deg);
|
||||
-ms-transform: rotate(150deg);
|
||||
transform: rotate(150deg);
|
||||
}
|
||||
.sk-fading-circle .sk-circle7 {
|
||||
-webkit-transform: rotate(180deg);
|
||||
-ms-transform: rotate(180deg);
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
.sk-fading-circle .sk-circle8 {
|
||||
-webkit-transform: rotate(210deg);
|
||||
-ms-transform: rotate(210deg);
|
||||
transform: rotate(210deg);
|
||||
}
|
||||
.sk-fading-circle .sk-circle9 {
|
||||
-webkit-transform: rotate(240deg);
|
||||
-ms-transform: rotate(240deg);
|
||||
transform: rotate(240deg);
|
||||
}
|
||||
.sk-fading-circle .sk-circle10 {
|
||||
-webkit-transform: rotate(270deg);
|
||||
-ms-transform: rotate(270deg);
|
||||
transform: rotate(270deg);
|
||||
}
|
||||
.sk-fading-circle .sk-circle11 {
|
||||
-webkit-transform: rotate(300deg);
|
||||
-ms-transform: rotate(300deg);
|
||||
transform: rotate(300deg);
|
||||
}
|
||||
.sk-fading-circle .sk-circle12 {
|
||||
-webkit-transform: rotate(330deg);
|
||||
-ms-transform: rotate(330deg);
|
||||
transform: rotate(330deg);
|
||||
}
|
||||
.sk-fading-circle .sk-circle2:before {
|
||||
-webkit-animation-delay: -1.1s;
|
||||
animation-delay: -1.1s;
|
||||
}
|
||||
.sk-fading-circle .sk-circle3:before {
|
||||
-webkit-animation-delay: -1s;
|
||||
animation-delay: -1s;
|
||||
}
|
||||
.sk-fading-circle .sk-circle4:before {
|
||||
-webkit-animation-delay: -0.9s;
|
||||
animation-delay: -0.9s;
|
||||
}
|
||||
.sk-fading-circle .sk-circle5:before {
|
||||
-webkit-animation-delay: -0.8s;
|
||||
animation-delay: -0.8s;
|
||||
}
|
||||
.sk-fading-circle .sk-circle6:before {
|
||||
-webkit-animation-delay: -0.7s;
|
||||
animation-delay: -0.7s;
|
||||
}
|
||||
.sk-fading-circle .sk-circle7:before {
|
||||
-webkit-animation-delay: -0.6s;
|
||||
animation-delay: -0.6s;
|
||||
}
|
||||
.sk-fading-circle .sk-circle8:before {
|
||||
-webkit-animation-delay: -0.5s;
|
||||
animation-delay: -0.5s;
|
||||
}
|
||||
.sk-fading-circle .sk-circle9:before {
|
||||
-webkit-animation-delay: -0.4s;
|
||||
animation-delay: -0.4s;
|
||||
}
|
||||
.sk-fading-circle .sk-circle10:before {
|
||||
-webkit-animation-delay: -0.3s;
|
||||
animation-delay: -0.3s;
|
||||
}
|
||||
.sk-fading-circle .sk-circle11:before {
|
||||
-webkit-animation-delay: -0.2s;
|
||||
animation-delay: -0.2s;
|
||||
}
|
||||
.sk-fading-circle .sk-circle12:before {
|
||||
-webkit-animation-delay: -0.1s;
|
||||
animation-delay: -0.1s;
|
||||
}
|
||||
|
||||
@-webkit-keyframes sk-circleFadeDelay {
|
||||
0%, 39%, 100% { opacity: 0; }
|
||||
40% { opacity: 1; }
|
||||
}
|
||||
|
||||
@keyframes sk-circleFadeDelay {
|
||||
0%, 39%, 100% { opacity: 0; }
|
||||
40% { opacity: 1; }
|
||||
}
|
|
@ -23,6 +23,14 @@
|
|||
* ## html elements generally in alphabetic order
|
||||
*/
|
||||
|
||||
a {
|
||||
color: silver;
|
||||
}
|
||||
|
||||
a:hover, a:active {
|
||||
color: white;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: "Archivo Narrow", "Helvetica", "Sans", sans-serif;
|
||||
background-color: rgb( 50, 109, 177);
|
||||
|
@ -160,7 +168,7 @@ th {
|
|||
#main-container{
|
||||
}
|
||||
|
||||
#back-link {
|
||||
#back-link, .back-link {
|
||||
min-width: 8em;
|
||||
padding: 0.25em 1em;
|
||||
background-color: gray;
|
||||
|
@ -170,7 +178,7 @@ th {
|
|||
border-bottom-right-radius: 0.5em;
|
||||
}
|
||||
|
||||
#back-link:hover, #back-link:active {
|
||||
#back-link:hover, #back-link:active, .back-link:hover, .back-link:active, {
|
||||
text-decoration: none;
|
||||
background-color: rgb(160, 160, 160);
|
||||
}
|
||||
|
@ -308,6 +316,9 @@ th {
|
|||
color: white;
|
||||
}
|
||||
|
||||
.splash-screen {
|
||||
}
|
||||
|
||||
.warn {
|
||||
color: maroon;
|
||||
}
|
||||
|
@ -430,7 +441,7 @@ th {
|
|||
}
|
||||
|
||||
#nav menu li {
|
||||
padding: 0.5em;
|
||||
padding: 0.5em 2em 0.5em 0.5em;
|
||||
margin: 0.5 em;
|
||||
font-size: 150%;
|
||||
}
|
||||
|
@ -463,6 +474,14 @@ th {
|
|||
text-align: right;
|
||||
}
|
||||
|
||||
.hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.shown {
|
||||
display: block;
|
||||
}
|
||||
|
||||
/* content of the current in the Wiki - editable, provided by users. Within main-container */
|
||||
#content {
|
||||
border: thin solid silver;
|
||||
|
@ -496,22 +515,16 @@ th {
|
|||
font-weight: bold;
|
||||
}
|
||||
|
||||
#nav:hover #nav-menu, #nav:hover #phone-side-bar {
|
||||
display: block;
|
||||
list-style-type: none;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#nav-icon {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#nav-menu, #phone-side-bar {
|
||||
display: none;
|
||||
#nav-menu {
|
||||
list-style-type: none;
|
||||
}
|
||||
|
||||
#nav menu li {
|
||||
padding: 0.5em;
|
||||
padding: 0.5em 2em 0.5em 0.5em;
|
||||
margin: 0.5 em;
|
||||
font-size: 150%;
|
||||
}
|
||||
|
|
BIN
resources/public/img/clojure-icon.gif
Normal file
BIN
resources/public/img/clojure-icon.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.1 KiB |
BIN
resources/public/img/github-logo-transparent.png
Normal file
BIN
resources/public/img/github-logo-transparent.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.7 KiB |
BIN
resources/public/img/gnu.small.png
Normal file
BIN
resources/public/img/gnu.small.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.3 KiB |
BIN
resources/public/img/ric-logo.png
Normal file
BIN
resources/public/img/ric-logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 47 KiB |
|
@ -1,38 +1,44 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Welcome to YouYesYet</title>
|
||||
<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-static.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>You Yes Yet?</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="app">
|
||||
<div class="container-fluid">
|
||||
<div class="card-deck">
|
||||
<div class="card-block">
|
||||
<h4>Welcome to YouYesYet</h4>
|
||||
<p>If you're seeing this message, that means you haven't yet compiled your ClojureScript!</p>
|
||||
<p>Please run <code>lein figwheel</code> to start the ClojureScript compiler and reload the page.</p>
|
||||
<h4>For better ClojureScript development experience in Chrome follow these steps:</h4>
|
||||
<ul>
|
||||
<li>Open DevTools
|
||||
<li>Go to Settings ("three dots" icon in the upper right corner of DevTools > Menu > Settings F1 > General > Console)
|
||||
<li>Check-in "Enable custom formatters"
|
||||
<li>Close DevTools
|
||||
<li>Open DevTools
|
||||
</ul>
|
||||
<p>See <a href="http://www.luminusweb.net/docs/clojurescript.md">ClojureScript</a> documentation for further details.</p>
|
||||
</div>
|
||||
<div class="splash-screen">
|
||||
<div class="sk-fading-circle">
|
||||
<div class="sk-circle1 sk-circle"></div>
|
||||
<div class="sk-circle2 sk-circle"></div>
|
||||
<div class="sk-circle3 sk-circle"></div>
|
||||
<div class="sk-circle4 sk-circle"></div>
|
||||
<div class="sk-circle5 sk-circle"></div>
|
||||
<div class="sk-circle6 sk-circle"></div>
|
||||
<div class="sk-circle7 sk-circle"></div>
|
||||
<div class="sk-circle8 sk-circle"></div>
|
||||
<div class="sk-circle9 sk-circle"></div>
|
||||
<div class="sk-circle10 sk-circle"></div>
|
||||
<div class="sk-circle11 sk-circle"></div>
|
||||
<div class="sk-circle12 sk-circle"></div>
|
||||
</div>
|
||||
</div>
|
||||
<p class="footer">
|
||||
You Yes Yet is loading.
|
||||
You must enable JavaScript to use the You Yes Yet app.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- scripts and styles -->
|
||||
{% script "/vendor/leaflet/dist/leaflet.js" %}
|
||||
{% style "/assets/bootstrap/css/bootstrap.min.css" %}
|
||||
{% style "/assets/font-awesome/css/font-awesome.min.css" %}
|
||||
{% style "/css/screen.css" %}
|
||||
<!-- ATTENTION \/ -->
|
||||
<!-- Leaflet -->
|
||||
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css" />
|
||||
<script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script>
|
||||
<!-- ATTENTION /\ -->
|
||||
|
||||
<script type="text/javascript">
|
||||
var context = "{{servlet-context}}";
|
||||
|
|
|
@ -34,6 +34,26 @@
|
|||
;;; redundant, and if they are the namespace probably needs to be renamed to 'entities'.
|
||||
;;; See also resources/migrations/20161014170335-basic-setup.up.sql
|
||||
|
||||
(defn create-districts-table!
|
||||
"Create a table to hold the electoral districts in which electors are registered.
|
||||
Note that, as this app is being developed for the independence referendum in which
|
||||
polling is across the whole of Scotland, this part of the design isn't fully thought
|
||||
through; if later adapted to general or local elections, some breakdown or hierarchy
|
||||
of polling districts into constituencies will be required."
|
||||
[]
|
||||
(sql/db-do-commands
|
||||
yyydb/*db*
|
||||
(sql/create-table-ddl
|
||||
:districts
|
||||
;; it may be necessary to have a serial abstract primary key but I suspect
|
||||
;; polling districts already have numbers assigned by the Electoral Commission and
|
||||
;; it would be sensible to use those. TODO: check.
|
||||
[:id "integer not null primary key"]
|
||||
[:name "varchar(64) not null"]
|
||||
;; TODO: it would make sense to hold polygon data for polling districts so we can reflect
|
||||
;; them on the map, but I haven't thought through how to do that yet.
|
||||
)))
|
||||
|
||||
|
||||
(kc/defentity district
|
||||
(kc/pk :id)
|
||||
|
|
|
@ -44,4 +44,4 @@
|
|||
:return Long
|
||||
:header-params [x :- Long, y :- Long]
|
||||
:summary "x^y with header-parameters"
|
||||
(ok (long (Math/pow x y))))))
|
||||
(ok (long (Math/pow x y)))))))
|
||||
|
|
|
@ -9,50 +9,23 @@
|
|||
[youyesyet.ajax :refer [load-interceptors!]]
|
||||
[youyesyet.handlers]
|
||||
[youyesyet.subscriptions]
|
||||
[youyesyet.ui-utils :as ui]
|
||||
[youyesyet.views.about :as about]
|
||||
[youyesyet.views.home :as home]
|
||||
[youyesyet.views.map :as maps])
|
||||
(:import goog.History))
|
||||
|
||||
(defn nav-link [uri title page collapsed?]
|
||||
(let [selected-page (rf/subscribe [:page])]
|
||||
[:li.nav-item
|
||||
{:class (when (= page @selected-page) "active")}
|
||||
[:a.nav-link
|
||||
{:href uri
|
||||
:on-click #(reset! collapsed? true)} title]]))
|
||||
|
||||
(defn navbar []
|
||||
(r/with-let [collapsed? (r/atom true)]
|
||||
[:nav.navbar.navbar-light.bg-faded
|
||||
[:button.navbar-toggler.hidden-sm-up
|
||||
{:on-click #(swap! collapsed? not)} "☰"]
|
||||
[:div.collapse.navbar-toggleable-xs
|
||||
(when-not @collapsed? {:class "in"})
|
||||
[:a.navbar-brand {:href "#/"} "youyesyet"]
|
||||
[:ul.nav.navbar-nav
|
||||
[nav-link "#/" "Home" :home collapsed?]
|
||||
[nav-link "#/map" "Map" :home collapsed?]
|
||||
[nav-link "#/about" "About" :about collapsed?]]]]))
|
||||
|
||||
(defn about-page []
|
||||
[:div.container
|
||||
[:div.row
|
||||
[:div.col-md-12
|
||||
"this is the story of youyesyet... work in progress"]]])
|
||||
(about/panel))
|
||||
|
||||
|
||||
(defn home-page []
|
||||
[:div.container
|
||||
[:div.jumbotron
|
||||
[:h1 "Welcome to youyesyet"]
|
||||
[:p "Time to start building your site!"]
|
||||
[:p [:a.btn.btn-primary.btn-lg {:href "http://luminusweb.net"} "Learn more »"]]]
|
||||
(when-let [docs @(rf/subscribe [:docs])]
|
||||
[:div.row
|
||||
[:div.col-md-12
|
||||
[:div {:dangerouslySetInnerHTML
|
||||
{:__html (md->html docs)}}]]])])
|
||||
(home/panel))
|
||||
|
||||
|
||||
(defn map-page []
|
||||
(maps/map-div))
|
||||
(maps/panel))
|
||||
|
||||
(def pages
|
||||
{:home #'home-page
|
||||
|
@ -61,7 +34,9 @@
|
|||
|
||||
(defn page []
|
||||
[:div
|
||||
[navbar]
|
||||
[:header
|
||||
[ui/navbar]
|
||||
[:h1 "You yes yet?"]]
|
||||
[(pages @(rf/subscribe [:page]))]])
|
||||
|
||||
;; -------------------------
|
||||
|
@ -74,6 +49,9 @@
|
|||
(secretary/defroute "/about" []
|
||||
(rf/dispatch [:set-active-page :about]))
|
||||
|
||||
(secretary/defroute "/map" []
|
||||
(rf/dispatch [:set-active-page :map]))
|
||||
|
||||
;; -------------------------
|
||||
;; History
|
||||
;; must be called after routes have been defined
|
||||
|
@ -88,7 +66,8 @@
|
|||
;; -------------------------
|
||||
;; Initialize app
|
||||
(defn fetch-docs! []
|
||||
(GET (str js/context "/docs") {:handler #(rf/dispatch [:set-docs %])}))
|
||||
(GET (str js/context "/docs")
|
||||
{:handler #(rf/dispatch [:set-docs %])}))
|
||||
|
||||
(defn mount-components []
|
||||
(r/render [#'page] (.getElementById js/document "app")))
|
||||
|
|
59
src/cljs/youyesyet/ui_utils.cljs
Normal file
59
src/cljs/youyesyet/ui_utils.cljs
Normal file
|
@ -0,0 +1,59 @@
|
|||
(ns youyesyet.ui-utils
|
||||
(:require [reagent.core :as r]
|
||||
[re-frame.core :as rf]))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;;
|
||||
;;;; youyesyet.ui-utils: User interface stuff common to many views.
|
||||
;;;;
|
||||
;;;; This program is free software; you can redistribute it and/or
|
||||
;;;; modify it under the terms of the GNU General Public License
|
||||
;;;; as published by the Free Software Foundation; either version 2
|
||||
;;;; of the License, or (at your option) any later version.
|
||||
;;;;
|
||||
;;;; This program is distributed in the hope that it will be useful,
|
||||
;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;;;; GNU General Public License for more details.
|
||||
;;;;
|
||||
;;;; You should have received a copy of the GNU General Public License
|
||||
;;;; along with this program; if not, write to the Free Software
|
||||
;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
;;;; USA.
|
||||
;;;;
|
||||
;;;; Copyright (C) 2016 Simon Brooke for Radical Independence Campaign
|
||||
;;;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
|
||||
(defn back-link []
|
||||
[:div.back-link-container {:id "back-link-container"}
|
||||
[:a {:href "javascript:history.back()" :id "back-link"} "Back"]])
|
||||
|
||||
|
||||
(defn big-link [text target]
|
||||
[:div.big-link-container
|
||||
[:a.big-link {:href target} text]])
|
||||
|
||||
|
||||
(defn nav-link [uri title page collapsed?]
|
||||
(let [selected-page (rf/subscribe [:page])]
|
||||
[:li.nav-item
|
||||
{:class (when (= page @selected-page) "active")}
|
||||
[:a.nav-link
|
||||
{:href uri
|
||||
:on-click #(reset! collapsed? true)} title]]))
|
||||
|
||||
|
||||
(defn navbar []
|
||||
(r/with-let [collapsed? (r/atom true)]
|
||||
[:div {:id "nav"}
|
||||
[:img {:id "nav-icon"
|
||||
:src "img/threelines.png"
|
||||
:on-click #(swap! collapsed? not)}]
|
||||
[:menu.nav {:id "nav-menu" :class (if @collapsed? "hidden" "shown")}
|
||||
(nav-link "#/" "Home" :home collapsed?)
|
||||
(nav-link "#/library" "Library" :library collapsed?)
|
||||
(nav-link "#/register" "Register" :register collapsed?)
|
||||
(nav-link "#/login" "Login" :login collapsed?)
|
||||
(nav-link "#/about" "About" :about collapsed?)]]))
|
54
src/cljs/youyesyet/views/about.cljs
Normal file
54
src/cljs/youyesyet/views/about.cljs
Normal file
|
@ -0,0 +1,54 @@
|
|||
(ns youyesyet.views.about
|
||||
(:require [re-frame.core :refer [reg-sub]]
|
||||
[youyesyet.ui-utils :as ui]))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;;
|
||||
;;;; youyesyet.views.electors: about/credits view for youyesyet.
|
||||
;;;;
|
||||
;;;; This program is free software; you can redistribute it and/or
|
||||
;;;; modify it under the terms of the GNU General Public License
|
||||
;;;; as published by the Free Software Foundation; either version 2
|
||||
;;;; of the License, or (at your option) any later version.
|
||||
;;;;
|
||||
;;;; This program is distributed in the hope that it will be useful,
|
||||
;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;;;; GNU General Public License for more details.
|
||||
;;;;
|
||||
;;;; You should have received a copy of the GNU General Public License
|
||||
;;;; along with this program; if not, write to the Free Software
|
||||
;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
;;;; USA.
|
||||
;;;;
|
||||
;;;; Copyright (C) 2016 Simon Brooke for Radical Independence Campaign
|
||||
;;;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
|
||||
;;; The pattern from the re-com demo (https://github.com/Day8/re-com) is to have
|
||||
;;; one source file/namespace per view. Each namespace contains a function 'panel'
|
||||
;;; whose output is an enlive-style specification of the view to be redered.
|
||||
|
||||
(defn panel
|
||||
"Generate the about panel."
|
||||
[]
|
||||
[:div.container {:id "main-container"}
|
||||
[:h2 "Pre-alpha/proof of concept"]
|
||||
[:p {:class "centre"}
|
||||
[:img {:src "img/ric-logo.png" :width "24" :height "24"}]
|
||||
" A project of the "
|
||||
[:a {:href "https://radical.scot/"} "Radical Independence Campaign"]]
|
||||
[:p {:class "centre"}
|
||||
[:img {:src "img/clojure-icon.gif" :alt "Clojure" :height "24" :width "24"}]
|
||||
" Powered by "
|
||||
[:a {:href "http://clojure.org"} "Clojure"]]
|
||||
[:p {:class "centre"}
|
||||
[:img {:src "img/github-logo-transparent.png" :alt "GitHub" :height "24" :width "24"}]
|
||||
" Find me/fork me on "
|
||||
[:a {:href "https://github.com/simon-brooke/youyesyet"} "GitHub"]]
|
||||
[:p {:class "centre"}
|
||||
[:img {:src "img/gnu.small.png" :alt "Free Software Foundation" :height "24" :width "24"}]
|
||||
" Licensed under the "
|
||||
[:a {:href "http://www.gnu.org/licenses/gpl-2.0.html"}
|
||||
"GNU General Public License v2.0"]]])
|
49
src/cljs/youyesyet/views/home.cljs
Normal file
49
src/cljs/youyesyet/views/home.cljs
Normal file
|
@ -0,0 +1,49 @@
|
|||
(ns youyesyet.views.home
|
||||
(:require [re-frame.core :as rf]
|
||||
[markdown.core :refer [md->html]]
|
||||
[youyesyet.ui-utils :as ui]))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;;
|
||||
;;;; youyesyet.views.electors: home view for youyesyet.
|
||||
;;;;
|
||||
;;;; This program is free software; you can redistribute it and/or
|
||||
;;;; modify it under the terms of the GNU General Public License
|
||||
;;;; as published by the Free Software Foundation; either version 2
|
||||
;;;; of the License, or (at your option) any later version.
|
||||
;;;;
|
||||
;;;; This program is distributed in the hope that it will be useful,
|
||||
;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;;;; GNU General Public License for more details.
|
||||
;;;;
|
||||
;;;; You should have received a copy of the GNU General Public License
|
||||
;;;; along with this program; if not, write to the Free Software
|
||||
;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
;;;; USA.
|
||||
;;;;
|
||||
;;;; Copyright (C) 2016 Simon Brooke for Radical Independence Campaign
|
||||
;;;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
|
||||
;;; The pattern from the re-com demo (https://github.com/Day8/re-com) is to have
|
||||
;;; one source file/namespace per view. Each namespace contains a function 'panel'
|
||||
;;; whose output is an enlive-style specification of the view to be redered.
|
||||
;;; I propose to follow this pattern. This file will provide the home view.
|
||||
|
||||
(defn panel
|
||||
"Generate the home panel."
|
||||
[]
|
||||
[:div.container {:id "main-container"}
|
||||
(ui/big-link "About" "#/about")
|
||||
(ui/big-link "Map" "#/map")
|
||||
[:div.jumbotron
|
||||
[:h1 "You Yes Yet?"]
|
||||
[:p "Time to start building your site!"]
|
||||
[:p [:a.btn.btn-primary.btn-lg {:href "http://luminusweb.net"} "Learn more »"]]]])
|
||||
(when-let [docs @(rf/subscribe [:docs])]
|
||||
[:div.row
|
||||
[:div.col-md-12
|
||||
[:div {:dangerouslySetInnerHTML
|
||||
{:__html (md->html docs)}}]]])
|
|
@ -44,7 +44,11 @@
|
|||
;; which provider to use
|
||||
(def *map-provider* :osm)
|
||||
|
||||
(def osm-url "http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png")
|
||||
(def osm-attrib "Map data © <a href='http://openstreetmap.org'>OpenStreetMap</a> contributors")
|
||||
|
||||
|
||||
;; My gods mapbox is user-hostile!
|
||||
(defn map-did-mount-mapbox
|
||||
"Did-mount function loading map tile data from MapBox (proprietary)."
|
||||
[]
|
||||
|
@ -60,8 +64,8 @@
|
|||
"Did-mount function loading map tile data from Open Street Map (open)."
|
||||
[]
|
||||
(let [map (.setView (.map js/L "map") #js [55.86 -4.25] 13)]
|
||||
(.addTo (.tileLayer js/L "http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
|
||||
(clj->js {:attribution "Map data © <a href=\"http://openstreetmap.org\">OpenStreetMap</a> contributors"
|
||||
(.addTo (.tileLayer js/L osm-url
|
||||
(clj->js {:attribution osm-attrib
|
||||
:maxZoom 18}))
|
||||
map)))
|
||||
|
||||
|
@ -79,10 +83,10 @@
|
|||
(defn map-render
|
||||
"Render the actual div containing the map."
|
||||
[]
|
||||
[:div#map {:style {:height "360px"}}])
|
||||
[:div#map {:style {:height "500px"}}])
|
||||
|
||||
|
||||
(defn map-div
|
||||
(defn panel
|
||||
"A reagent class for the map object."
|
||||
[]
|
||||
(reagent/create-class {:reagent-render map-render
|
||||
|
|
Loading…
Reference in a new issue