From 3dbda68cd732f806a9d0956d89546e43cc2c8fdd Mon Sep 17 00:00:00 2001
From: simon <simon@journeyman.cc>
Date: Thu, 3 Mar 2016 23:53:57 +0000
Subject: [PATCH] Look and feel of the rule editor page is now almost perfect.
 I would like to know how to get the character entities onto the buttons...

---
 resources/public/css/standard.css | 33 ++++++++++++++++++++-----------
 src/cljs/mw3/core.cljs            | 25 +++++++----------------
 2 files changed, 29 insertions(+), 29 deletions(-)

diff --git a/resources/public/css/standard.css b/resources/public/css/standard.css
index 85d8e60..fdbd6f0 100644
--- a/resources/public/css/standard.css
+++ b/resources/public/css/standard.css
@@ -67,20 +67,15 @@ 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;
+  display: none;
+}
+
+.rule-delete {
+  color: white;
+  background-color: red;
 }
 
 .rule-down {
@@ -88,16 +83,32 @@ li.tab a:active { background: gray; color: white; }
   background-color: orange;
 }
 
+.rule-editor {
+  color: black;
+  background-color: silver;
+  padding: 0;
+}
+
+.rule-editor:hover .rule-controls, .rule-editor:hover .rule-feedback {
+  display: block;
+}
+
 .rule-feedback {
   font-family: monospace;
   padding: 0.25em 1em;
   width: 80%;
+  display: none;
 }
 
 .rule-input {
   font-family: monospace;
   width: 100%;
   padding: 0.25em 1em;
+  display: block;
+}
+
+.rule-input:focus ~ .rule-controls, .rule-input:focus ~ .rule-feedback {
+  display: block;
 }
 
 .rule-ok {
diff --git a/src/cljs/mw3/core.cljs b/src/cljs/mw3/core.cljs
index bb2761a..b13d955 100644
--- a/src/cljs/mw3/core.cljs
+++ b/src/cljs/mw3/core.cljs
@@ -87,10 +87,10 @@
    {:id (str "rule-editor-" index) :class "rule-editor"}
    [:input {:type "text" :id (str "rule-input-" index) :class "rule-input" :value rule}]
    [:div {:id (str "rule-controls-" index) :class "rule-controls"}
-    [:input {:type "button" :id (str "rule-ok-" index) :class "rule-ok" :value "&#x2714;"}]
-    [:input {:type "button" :id (str "rule-up-" index) :class "rule-up" :value "&uarr;"}]
-    [:input {:type "button" :id (str "rule-down-" index) :class "rule-down" :value "&darr;"}]
-    [:input {:type "button" :id (str "rule-cancel-" index) :class "rule-cancel" :value "&#x2718;"}]]
+    [:input {:type "button" :id (str "rule-ok-" index) :class "rule-ok" :value "ok"}]                ;; &#x2714;
+    [:input {:type "button" :id (str "rule-up-" index) :class "rule-up" :value "up"}]                ;; &uarr;
+    [:input {:type "button" :id (str "rule-down-" index) :class "rule-down" :value "down"}]          ;; &darr;
+    [:input {:type "button" :id (str "rule-delete-" index) :class "rule-delete" :value "delete"}]]   ;; &#x2718;
    [:pre {:id (str "rule-feedback-" index) :class "rule-feedback"}]
    ])
 
@@ -111,21 +111,9 @@
   (let [rules-container (sel1 :#rules-container)
         ruleset (rulesets/rulesets name)]
     (dommy/clear! rules-container)
-    (doseq [rule ruleset index (range (count ruleset))]
+    (doseq [[rule index] (map #(list %1 %2) ruleset (range (count ruleset)))]
       (dommy/append! rules-container (rule-editor rule index)))))
 
-;;(rule-editors "settlement")
-
-(load-ruleset "settlement")
-
-;; (rulesets/rulesets "ice-age")
-
-(def x (sel1 :#rules-container))
-
-(dommy/append! x (rule-editor "if state is new then state should be grass" 1))
-
-
-
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Set up the screen on loading
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -148,4 +136,5 @@
 ;; (rebuild-ruleset-menu)
 
 ;; put the default ruleset into the rulesets pages
-;; (dommy/set-text! (sel1 :#rules-src) (rulesets/ruleset-as-single-string "ice-age"))
+(load-ruleset "settlement")
+