From 7439e5ae1563ad960a381678017c9dea75084b45 Mon Sep 17 00:00:00 2001 From: Simon Brooke Date: Sun, 19 Mar 2017 17:54:37 +0000 Subject: [PATCH] #30: Starting to work. We can serve both conventional pages, and the app. --- resources/templates/app.html | 53 ++++++++++++++++ resources/templates/base-authenticated.html | 42 +++++++++++++ resources/templates/base-unauthenticated.html | 40 ++++++++++++ resources/templates/home.html | 63 ++++--------------- src/clj/youyesyet/routes/home.clj | 7 ++- src/cljc/youyesyet/ui_utils.cljc | 1 + 6 files changed, 152 insertions(+), 54 deletions(-) create mode 100644 resources/templates/app.html create mode 100644 resources/templates/base-authenticated.html create mode 100644 resources/templates/base-unauthenticated.html create mode 100644 src/cljc/youyesyet/ui_utils.cljc diff --git a/resources/templates/app.html b/resources/templates/app.html new file mode 100644 index 0000000..5c334b5 --- /dev/null +++ b/resources/templates/app.html @@ -0,0 +1,53 @@ + + + + + + + + + You Yes Yet? + + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+ + + + + + + + + + {% script "/js/app.js" %} + + + + + + diff --git a/resources/templates/base-authenticated.html b/resources/templates/base-authenticated.html new file mode 100644 index 0000000..7b2d418 --- /dev/null +++ b/resources/templates/base-authenticated.html @@ -0,0 +1,42 @@ + + + + + + + + + {{title}} + + +
+ + +

+ {{title}} +

+
+ +
+ +
+ {{content}} +
+
+ + + + + + diff --git a/resources/templates/base-unauthenticated.html b/resources/templates/base-unauthenticated.html new file mode 100644 index 0000000..d1382fc --- /dev/null +++ b/resources/templates/base-unauthenticated.html @@ -0,0 +1,40 @@ + + + + + + + + + {{title}} + + +
+ + +

+ {{title}} +

+
+ +
+ +
+ {% block content %} + {% endblock %} +
+
+ + diff --git a/resources/templates/home.html b/resources/templates/home.html index 5c334b5..f89b6ae 100644 --- a/resources/templates/home.html +++ b/resources/templates/home.html @@ -1,53 +1,12 @@ - - - - - - - - - You Yes Yet? - - - -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+{% extends "base-unauthenticated.html" %} +{% block big-links %} + - -
- - - - - - - - - - {% script "/js/app.js" %} - - - - - - + +{% endblock %} +{% block content %} +froboz +{% endblock %} diff --git a/src/clj/youyesyet/routes/home.clj b/src/clj/youyesyet/routes/home.clj index 7fbf9f7..e2bffa7 100644 --- a/src/clj/youyesyet/routes/home.clj +++ b/src/clj/youyesyet/routes/home.clj @@ -5,11 +5,14 @@ [ring.util.http-response :as response] [clojure.java.io :as io])) +(defn app-page [] + (layout/render "app.html")) + (defn home-page [] - (layout/render "home.html")) + (layout/render "home.html" {:title "You Yes Yet?"})) (defroutes home-routes (GET "/" [] (home-page)) + (GET "/app" [] (app-page)) (GET "/docs" [] (-> (response/ok (-> "docs/docs.md" io/resource slurp)) (response/header "Content-Type" "text/plain; charset=utf-8")))) - diff --git a/src/cljc/youyesyet/ui_utils.cljc b/src/cljc/youyesyet/ui_utils.cljc new file mode 100644 index 0000000..3139020 --- /dev/null +++ b/src/cljc/youyesyet/ui_utils.cljc @@ -0,0 +1 @@ +;; Ultimately it's the goal to use the same UI utils for both main site and single page app.