Add back adding grubs from recipes

This commit is contained in:
Nicholas Kariniemi 2014-07-30 17:51:36 +03:00
parent 7998b205d6
commit 8cd03220d3
2 changed files with 9 additions and 32 deletions

View file

@ -113,7 +113,7 @@ tr:hover .grub-close {
.recipe-panel { .recipe-panel {
padding: 0px; padding: 0px;
margin-bottom: -1px; margin-bottom: 0px;
} }
.recipe-panel > .recipe-header { .recipe-panel > .recipe-header {
@ -131,8 +131,8 @@ tr:hover .grub-close {
box-shadow: none; box-shadow: none;
transition: none; transition: none;
border-bottom: none; border-bottom: none;
width: inherit;
display: inline; display: inline;
width: inherit;
} }
.recipe-header-input:focus { .recipe-header-input:focus {
@ -146,9 +146,6 @@ tr:hover .grub-close {
margin-top: 10px; margin-top: 10px;
} }
.recipe-grubs {
}
.recipe-grubs-input { .recipe-grubs-input {
border: none; border: none;
box-shadow: none; box-shadow: none;

View file

@ -31,31 +31,6 @@
event (grub-view/add-list-event grubs)] event (grub-view/add-list-event grubs)]
(put! add-grubs-ch event))) (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] (defn update-recipe [ch id name grubs owner]
(when (and (not (empty? name)) (when (and (not (empty? name))
(not (empty? grubs))) (not (empty? grubs)))
@ -80,7 +55,8 @@
om/IRenderState om/IRenderState
(render-state [this {:keys [editing >local-events name grubs]}] (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 (html
[:div.panel.panel-default.recipe-panel [:div.panel.panel-default.recipe-panel
{:on-click #(put! >local-events :click)} {:on-click #(put! >local-events :click)}
@ -88,7 +64,11 @@
[:input.form-control.recipe-header-input [:input.form-control.recipe-header-input
{:type "text" {:type "text"
:value name :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 [:div.panel-body.recipe-grubs
{:class (when (not editing) "hidden")} {:class (when (not editing) "hidden")}
[:textarea.form-control.recipe-grubs-input [:textarea.form-control.recipe-grubs-input