From 59ac8c2690888081942fe0f191844714204c050f Mon Sep 17 00:00:00 2001 From: simon Date: Thu, 3 Mar 2016 08:29:06 +0000 Subject: [PATCH] Sketch of how the new rule-editor widget should look. --- resources/public/css/standard.css | 45 ++++++++++++++++++++++++++++++- resources/public/index.html | 16 ++++++++++- src/cljs/mw3/core.cljs | 25 ++++++++++++++++- 3 files changed, 83 insertions(+), 3 deletions(-) diff --git a/resources/public/css/standard.css b/resources/public/css/standard.css index 919b4ce..85d8e60 100644 --- a/resources/public/css/standard.css +++ b/resources/public/css/standard.css @@ -67,6 +67,49 @@ li.tab a:active { background: gray; color: white; } color: white; } +.rule-editor { + color: black; + background-color: silver; + padding: 0; +} + +.rule-cancel { + color: white; + background-color: red; +} + +.rule-controls { + float: right; + margin-left: 2em; +} + +.rule-down { + color: maroon; + background-color: orange; +} + +.rule-feedback { + font-family: monospace; + padding: 0.25em 1em; + width: 80%; +} + +.rule-input { + font-family: monospace; + width: 100%; + padding: 0.25em 1em; +} + +.rule-ok { + color: white; + background-color: green; +} + +.rule-up { + color: forest; + background-color: yellow; +} + .widget { background-color: silver; border: thin solid white; @@ -99,7 +142,7 @@ h1, h2, h3, h4, h5 { color: white; } -div.content, form, p, pre, ul, ol, dl, menu, h2, h3, h4, h5 { +div.content, div#params-container, div#rules-container, p, ul, ol, dl, menu, h2, h3, h4, h5 { padding: 0.25em 10%; } diff --git a/resources/public/index.html b/resources/public/index.html index 4f4325c..aedb6a3 100644 --- a/resources/public/index.html +++ b/resources/public/index.html @@ -96,10 +96,11 @@

Set your parameters

+

- {% for ruleset in rulesets %} @@ -126,12 +127,24 @@

+

Edit your rules

+
+
+ +
+ + + + +
+
This is feedback on your rule.
+

+
diff --git a/src/cljs/mw3/core.cljs b/src/cljs/mw3/core.cljs index 5b38621..2a26c8e 100644 --- a/src/cljs/mw3/core.cljs +++ b/src/cljs/mw3/core.cljs @@ -62,13 +62,33 @@ (dommy/set-text! (sel1 tab-id) (:text (tab-id available-tabs))) (dommy/listen! (sel1 tab-id) :click (fn [e] (tab-handler e tab-id)))) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Params page +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(defn rebuild-ruleset-menu + [] + (let [menu (sel1 :#params-ruleset)] + (dommy/set-html! + menu + (temp/->document-fragment (temp/node [:ul "Froboz"]))))) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Rules page ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defn load-ruleset [name] -) + (let [rules-container (sel1 :#rules-container) + ruleset (rulesets/rulesets name)] + (dommy/clear! rules-container) + (dommy/set-html! + rules-container + (temp/node + [:ul + (map #(vec (list :ul %)) ruleset)])))) + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Set up the screen on loading @@ -88,5 +108,8 @@ ;; hide all pages except home-tab (tab-handler nil :#home-tab) +;; set up the rulesets menu with the rulesets we actually have. +(rebuild-ruleset-menu) + ;; put the default ruleset into the rulesets pages (dommy/set-text! (sel1 :#rules-src) (rulesets/ruleset-as-single-string "ice-age"))