Skip to content

Commit 831342a

Browse files
committed
Added secretary based URL routing
Simplified re-initialization with :figwheel :on-jsload Fixed quirk with goog.History by providing hidden input and iframe elements (so the DOM is not mutated during load time) Removed eraf namespace as it is currently not used. Updated dependencies
1 parent 5c4dd93 commit 831342a

File tree

12 files changed

+325
-223
lines changed

12 files changed

+325
-223
lines changed

README.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,14 @@ Source for the clojurebridgemn.org website
44

55
Are you (or do you know) a developer that might want to learn
66
Clojure in the Minneapolis / St. Paul area? We still have
7-
openings for Track 2 at the next [ClojureBridgeMN](http://ClojureBridgeMN.org) workshop!
7+
openings at the next [ClojureBridgeMN](http://ClojureBridgeMN.org) workshop!
88

99
## documentation
1010

11+
_NOTE as of 0.3.0_: This is not a great example of Clojure/ClojureScript
12+
programming for the web, but more like a work in progress. Future direction
13+
will remove excess state mutation and will be based on om.next.
14+
1115
Now [ClojureBridgeMN](http://ClojureBridgeMN.org) is based on ClojureScript and Om!
1216

1317
The organization of the project is based on

project.clj

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
(defproject clojurebridgemn "0.2.3"
1+
(defproject clojurebridgemn "0.3.0"
22
:description "ClojureScriptMN.org website"
33
:url "https://github.com/clojurebridge-minneapolis/clojurebridgemn.org"
44
:license {:name "MIT"
55
:url "http://opensource.org/licenses/MIT"}
66

77
:dependencies [[org.clojure/clojure "1.7.0"]
8-
[org.clojure/clojurescript "1.7.107"]
9-
;; [org.clojure/clojurescript "1.7.48"] ;; to match figwheel
8+
[org.clojure/clojurescript "1.7.122"]
109
[org.codehaus.plexus/plexus-utils "3.0.22"] ;; for figwheel
1110
[org.clojure/core.async "0.1.346.0-17112a-alpha"]
1211
[potemkin "0.4.1"]
@@ -26,15 +25,15 @@
2625
[cljs-http "0.1.37"]]
2726

2827
:plugins [[lein-cljsbuild "1.0.6"]
29-
[lein-figwheel "0.3.8-SNAPSHOT"
28+
[lein-figwheel "0.3.8"
3029
:exclusions [org.clojure/clojure
3130
org.codehaus.plexus/plexus-utils]]
3231
[lein-environ "1.0.0"]]
3332

3433
:hooks [leiningen.cljsbuild]
3534

3635
:figwheel {:css-dirs ["resources/public/css"]
37-
:open-file-command "myfile-opener"
36+
;; :open-file-command "myfile-opener"
3837
:ring-handler clojurebridgemn.server/info-handler}
3938

4039
:source-paths ["src/main/clj"]
@@ -63,8 +62,8 @@
6362
{:builds
6463
{:app
6564
{:source-paths ["src/main/cljs"]
66-
:figwheel {:websocket-host
67-
:js-client-host}
65+
:figwheel {:websocket-host :js-client-host
66+
:on-jsload "clojurebridgemn.client/figwheel-reload"}
6867
:compiler {:main clojurebridgemn.client
6968
:closure-defines {"clojurebridgemn.utils.program_mode" "dev"}
7069
:output-dir "resources/public/js/compiled"

resources/public/css/clojurebridgemn.css

+4
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ button, input, select, textarea {
5757
font-size: 100%;
5858
}
5959

60+
#history-input, #history-iframe, #out {
61+
display: none;
62+
}
63+
6064
button {
6165
-webkit-box-sizing: border-box; /* For legacy WebKit based browsers */
6266
-moz-box-sizing: border-box; /* For legacy (Firefox <29) Gecko based browsers */

resources/public/index.html

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
<link href="css/clojurebridgemn.css" rel="stylesheet" type="text/css">
99
</head>
1010
<body>
11+
<input id="history-input" name="history-input" type="text"></input>
12+
<iframe id="history-iframe"></iframe>
1113
<div id="app">
1214
<h2>Figwheel template</h2>
1315
<p>Checkout your developer console.</p>

src/main/clj/clojurebridgemn/web.clj

+10
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@
8585
(append-head nodes
8686
(html [:script {:type "text/javascript" :src script-uri}])))
8787

88+
(defn add-element [nodes & {:keys [element] :as opts}]
89+
(append-body nodes
90+
(html [element (dissoc opts :element)])))
91+
8892
(defn add-h1 [nodes heading]
8993
(append-body nodes
9094
(html [:h1 heading])))
@@ -113,6 +117,8 @@
113117
(add-favicon)
114118
(add-css app-css-uri)
115119
(add-js app)
120+
(add-element :element :input :id "history-input" :name "history-input" :type "text")
121+
(add-element :element :iframe :id "history-iframe")
116122
(add-div "app")
117123
render-snippet))
118124

@@ -122,6 +128,8 @@
122128
(add-favicon)
123129
(add-css app-css-uri)
124130
(add-js app)
131+
(add-element :element :input :id "history-input" :name "history-input" :type "text")
132+
(add-element :element :iframe :id "history-iframe")
125133
(add-div "app")
126134
render-snippet))
127135

@@ -131,6 +139,8 @@
131139
(add-css app-css)
132140
(add-js phantomjs-shims)
133141
(add-js app)
142+
(add-element :element :input :id "history-input" :name "history-input" :type "text")
143+
(add-element :element :iframe :id "history-iframe")
134144
(add-div "app")
135145
(add-textarea "out")
136146
render-snippet))

0 commit comments

Comments
 (0)