From 8cd03220d3d646fa6ebf5bfa3a09931c01590050 Mon Sep 17 00:00:00 2001 From: Nicholas Kariniemi Date: Wed, 30 Jul 2014 17:51:36 +0300 Subject: [PATCH] Add back adding grubs from recipes --- public/css/styles.css | 7 ++----- src/cljs/grub/view/recipe.cljs | 34 +++++++--------------------------- 2 files changed, 9 insertions(+), 32 deletions(-) diff --git a/public/css/styles.css b/public/css/styles.css index ec949f2..eb5922b 100644 --- a/public/css/styles.css +++ b/public/css/styles.css @@ -113,7 +113,7 @@ tr:hover .grub-close { .recipe-panel { padding: 0px; - margin-bottom: -1px; + margin-bottom: 0px; } .recipe-panel > .recipe-header { @@ -131,8 +131,8 @@ tr:hover .grub-close { box-shadow: none; transition: none; border-bottom: none; - width: inherit; display: inline; + width: inherit; } .recipe-header-input:focus { @@ -146,9 +146,6 @@ tr:hover .grub-close { margin-top: 10px; } -.recipe-grubs { -} - .recipe-grubs-input { border: none; box-shadow: none; diff --git a/src/cljs/grub/view/recipe.cljs b/src/cljs/grub/view/recipe.cljs index fe68ee8..73e9dbb 100644 --- a/src/cljs/grub/view/recipe.cljs +++ b/src/cljs/grub/view/recipe.cljs @@ -31,31 +31,6 @@ event (grub-view/add-list-event grubs)] (put! add-grubs-ch event))) -(defn recipe-view [recipe owner] - (reify - om/IRender - (render [this] - (let [{:keys [id name grubs]} recipe - add-grubs-ch (om/get-shared owner :recipe-add-grubs)] - (html - [:div.panel.panel-default.recipe-panel - {:id id - :key id} - [:div.panel-heading.recipe-header - [:input.form-control.recipe-header-input - {:type "text" - :value name}] - [:button.btn.btn-primary.btn-sm.recipe-add-grubs-btn - {:type "button" - :on-click #(add-grubs add-grubs-ch grubs)} - "Add Grubs"]] - [:div.panel-body.recipe-grubs.hidden - [:textarea.form-control.recipe-grubs-input - {:rows 3 - :value grubs}] - [:button.btn.btn-primary.hidden.pull-right.recipe-btn.recipe-done-btn - {:type "button"} "Save"]]]))))) - (defn update-recipe [ch id name grubs owner] (when (and (not (empty? name)) (not (empty? grubs))) @@ -80,7 +55,8 @@ om/IRenderState (render-state [this {:keys [editing >local-events name grubs]}] - (let [update (om/get-shared owner :recipe-update)] + (let [update (om/get-shared owner :recipe-update) + add-grubs-ch (om/get-shared owner :recipe-add-grubs)] (html [:div.panel.panel-default.recipe-panel {:on-click #(put! >local-events :click)} @@ -88,7 +64,11 @@ [:input.form-control.recipe-header-input {:type "text" :value name - :on-change #(om/set-state! owner :name (dom/event-val %))}]] + :on-change #(om/set-state! owner :name (dom/event-val %))}] + [:button.btn.btn-primary.btn-sm.recipe-add-grubs-btn + {:type "button" + :on-click #(add-grubs add-grubs-ch grubs)} + "Add Grubs"]] [:div.panel-body.recipe-grubs {:class (when (not editing) "hidden")} [:textarea.form-control.recipe-grubs-input