Set recipe text area based on grubs
This commit is contained in:
parent
c4096a771a
commit
5a8bda4f0a
3 changed files with 8 additions and 8 deletions
|
@ -142,10 +142,6 @@ tr:hover .grub-close {
|
|||
outline: none;
|
||||
}
|
||||
|
||||
.recipe-btn {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.recipe-grubs-input {
|
||||
border: none;
|
||||
box-shadow: none;
|
||||
|
|
|
@ -49,6 +49,9 @@
|
|||
nil)
|
||||
(om/set-state! owner :edit-state next)))
|
||||
|
||||
(defn num-newlines [str]
|
||||
(count (re-seq #"\n" str)))
|
||||
|
||||
(defn view [{:keys [id] :as props} owner]
|
||||
(reify
|
||||
om/IInitState
|
||||
|
@ -87,10 +90,11 @@
|
|||
{:class (when (= edit-state :waiting) "hidden")}
|
||||
[:textarea.form-control.recipe-grubs-input
|
||||
{:id "recipe-grubs"
|
||||
:rows 3
|
||||
:ref :textarea
|
||||
:rows (inc (num-newlines grubs))
|
||||
:value grubs
|
||||
:on-change #(om/set-state! owner :grubs (dom/event-val %))}]
|
||||
[:button.btn.btn-primary.pull-right.recipe-btn.recipe-done-btn
|
||||
[:button.btn.btn-primary.pull-right.recipe-done-btn
|
||||
{:type "button"
|
||||
:ref :save-btn
|
||||
:on-click #(transition-state owner :save)}
|
||||
|
|
|
@ -58,11 +58,11 @@
|
|||
{:class (when (= edit-state :waiting) "hidden")}
|
||||
[:textarea.form-control.recipe-grubs-input
|
||||
{:id "new-recipe-grubs"
|
||||
:rows 3
|
||||
:rows (inc (recipe/num-newlines new-recipe-grubs))
|
||||
:placeholder "Recipe ingredients"
|
||||
:value new-recipe-grubs
|
||||
:on-change #(om/set-state! owner :new-recipe-grubs (dom/event-val %))}]
|
||||
[:button.btn.btn-primary.pull-right.recipe-btn.recipe-done-btn
|
||||
[:button.btn.btn-primary.pull-right.recipe-done-btn
|
||||
{:type "button"
|
||||
:ref :save-btn
|
||||
:on-click #(transition-state owner :save)}
|
||||
|
|
Loading…
Reference in a new issue