From 5daa70f5ae33bc719c4de4b22b403bfd8e9deb6a Mon Sep 17 00:00:00 2001 From: Benjamin ter Kuile Date: Fri, 28 Sep 2018 10:52:33 -0500 Subject: [PATCH] Added utility options --- addon/styles/_convenience-helpers.sass | 7 +++++++ app/components/validated-input.coffee | 9 +++++++++ app/templates/components/validated-input.emblem | 6 +++--- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/addon/styles/_convenience-helpers.sass b/addon/styles/_convenience-helpers.sass index 158e3ee..186d3df 100644 --- a/addon/styles/_convenience-helpers.sass +++ b/addon/styles/_convenience-helpers.sass @@ -8,6 +8,13 @@ &:last-child &:after content: "" +.right-arrow-separated-items + > * + &:after + content: " -> " + &:last-child + &:after + content: "" .pull-right float: right diff --git a/app/components/validated-input.coffee b/app/components/validated-input.coffee index c193e8e..aa8d408 100644 --- a/app/components/validated-input.coffee +++ b/app/components/validated-input.coffee @@ -21,3 +21,12 @@ export default Ember.Component.extend inputEnter: (value)-> #https://github.com/DockYard/ember-one-way-controls/blob/master/addon/components/one-way-input.js invokeAction(@, enter, value) if enter = @get('enter') + setAttribute: (value) -> + #value = switch @get('type') + # when 'integer' + # # integer will be value or null + # res = Number.parseInt(value) + # if Number.isFinite(res) then res else null + # else value + @set "changeset.#{@get('attribute')}", value + false diff --git a/app/templates/components/validated-input.emblem b/app/templates/components/validated-input.emblem index 29d3cfb..ba11488 100644 --- a/app/templates/components/validated-input.emblem +++ b/app/templates/components/validated-input.emblem @@ -4,9 +4,9 @@ if label else if labelPath label= t labelPath - -one-way-input value=(get changeset attribute) update=(action (mut (get changeset attribute))) onblur=(action 'validateProperty' changeset attribute) disabled=disabled onenter='inputEnter' +one-way-input value=(get changeset attribute) update=(action 'setAttribute') onblur=(action 'validateProperty' changeset attribute) disabled=disabled onenter='inputEnter' if (get changeset.error attribute) each (get (get changeset.error attribute) 'validation') as |error| - .ui.pointing.red.basic.label= error + .ui.pointing.red.basic.label class=errorDirection + = error