/clientframework: Restructured a bit

This commit is contained in:
Simon Brooke 2017-03-18 08:56:15 +00:00
parent 94465273a0
commit 9ff8235d3e
9 changed files with 55 additions and 54 deletions

View file

@ -126,7 +126,7 @@
[directory-naming/naming-java "0.8"]] [directory-naming/naming-java "0.8"]]
:plugins [[com.jakemccrary/lein-test-refresh "0.14.0"] :plugins [[com.jakemccrary/lein-test-refresh "0.14.0"]
[lein-doo "0.1.7"] [lein-doo "0.1.7"]
[lein-figwheel "0.5.8"] [lein-figwheel "0.5.9"]
[org.clojure/clojurescript "1.9.229"]] [org.clojure/clojurescript "1.9.229"]]
:cljsbuild :cljsbuild
{:builds {:builds

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

View file

@ -10,57 +10,22 @@
[youyesyet.handlers] [youyesyet.handlers]
[youyesyet.subscriptions] [youyesyet.subscriptions]
[youyesyet.ui-utils :as ui] [youyesyet.ui-utils :as ui]
[youyesyet.views.about :as about]
[youyesyet.views.home :as home]
[youyesyet.views.map :as maps]) [youyesyet.views.map :as maps])
(:import goog.History)) (: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)]
[: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?)]]))
(defn about-page [] (defn about-page []
[:div.container {:id "main-container"} (about/panel))
(ui.back-link)
[:div.row
[:div.col-md-12
"this is the story of youyesyet... work in progress"]]])
(defn home-page [] (defn home-page []
[:div.container {:id "main-container"} (home/panel))
(big-link "About" "#/about")
(big-link "Map" "#/map")
[: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)}}]]])
(defn map-page [] (defn map-page []
(maps/map-div)) (maps/panel))
(def pages (def pages
{:home #'home-page {:home #'home-page
@ -70,7 +35,7 @@
(defn page [] (defn page []
[:div [:div
[:header [:header
[navbar] [ui/navbar]
[:h1 "You yes yet?"]] [:h1 "You yes yet?"]]
[(pages @(rf/subscribe [:page]))]]) [(pages @(rf/subscribe [:page]))]])
@ -84,7 +49,6 @@
(secretary/defroute "/about" [] (secretary/defroute "/about" []
(rf/dispatch [:set-active-page :about])) (rf/dispatch [:set-active-page :about]))
(secretary/defroute "/map" [] (secretary/defroute "/map" []
(rf/dispatch [:set-active-page :map])) (rf/dispatch [:set-active-page :map]))

View file

@ -1,8 +1,10 @@
(ns youyesyet.ui-utils) (ns youyesyet.ui-utils
(:require [reagent.core :as r]
[re-frame.core :as rf]))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; ;;;;
;;;; youyesyet.views.electors: electors view for youyesyet. ;;;; youyesyet.ui-utils: User interface stuff common to many views.
;;;; ;;;;
;;;; This program is free software; you can redistribute it and/or ;;;; This program is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU General Public License ;;;; modify it under the terms of the GNU General Public License
@ -23,8 +25,6 @@
;;;; ;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; User interface stuff common to many views
(defn back-link [] (defn back-link []
[:div.back-link-container {:id "back-link-container"} [:div.back-link-container {:id "back-link-container"}
@ -34,3 +34,26 @@
(defn big-link [text target] (defn big-link [text target]
[:div.big-link-container [:div.big-link-container
[:a.big-link {:href target} text]]) [: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?)]]))

View file

@ -4,7 +4,7 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; ;;;;
;;;; youyesyet.views.electors: electors view for youyesyet. ;;;; youyesyet.views.electors: about/credits view for youyesyet.
;;;; ;;;;
;;;; This program is free software; you can redistribute it and/or ;;;; This program is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU General Public License ;;;; modify it under the terms of the GNU General Public License
@ -34,7 +34,21 @@
"Generate the about panel." "Generate the about panel."
[] []
[:div.container {:id "main-container"} [:div.container {:id "main-container"}
(ui/back-link) [:h2 "Pre-alpha/proof of concept"]
[:div.row [:p {:class "centre"}
[:div.col-md-12 [:img {:src "img/ric-logo.png" :width "24" :height "24"}]
"this is the story of youyesyet... work in progress"]]]) " 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"]]])

View file

@ -4,7 +4,7 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; ;;;;
;;;; youyesyet.views.electors: electors view for youyesyet. ;;;; youyesyet.views.electors: home view for youyesyet.
;;;; ;;;;
;;;; This program is free software; you can redistribute it and/or ;;;; This program is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU General Public License ;;;; modify it under the terms of the GNU General Public License