Set recipe text area based on grubs

This commit is contained in:
Nicholas Kariniemi 2014-08-07 22:28:52 +03:00
parent c4096a771a
commit 5a8bda4f0a
3 changed files with 8 additions and 8 deletions

View file

@ -142,10 +142,6 @@ tr:hover .grub-close {
outline: none;
}
.recipe-btn {
margin-top: 10px;
}
.recipe-grubs-input {
border: none;
box-shadow: none;

View file

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

View file

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