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 {
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;

View file

@ -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