Skip to content

Commit

Permalink
feat: add jexl textarea for isRequired (#232)
Browse files Browse the repository at this point in the history
  • Loading branch information
fkm authored and czosel committed May 13, 2019
1 parent 020f9c8 commit 7b3e16a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
6 changes: 6 additions & 0 deletions addon/components/cfb-jexl-boolean-toggle-switch.js
Expand Up @@ -3,6 +3,7 @@ import layout from "../templates/components/cfb-jexl-boolean-toggle-switch";
import jexl from "jexl";
import { reads } from "@ember/object/computed";
import { task } from "ember-concurrency";
import { computed } from "@ember/object";

export default RenderComponent.extend({
layout,
Expand All @@ -19,6 +20,11 @@ export default RenderComponent.extend({
return yield jexl.eval(this.get("value"));
}),

disabled: computed("value", function() {
const value = this.get("value");
return !(value === "true" || value === "false");
}),

actions: {
toggle(boolValue) {
this.get("update")(String(boolValue));
Expand Down
7 changes: 7 additions & 0 deletions addon/templates/components/cfb-form-editor/question.hbs
Expand Up @@ -271,6 +271,13 @@
name="isHidden"
class="jexl-textarea"
}}

{{f.input
type="textarea"
label=(t "caluma.form-builder.question.isRequired")
name="isRequired"
class="jexl-textarea"
}}
{{/if}}

<div class="uk-text-right">
Expand Down
Expand Up @@ -5,5 +5,6 @@
value=boolValue
size=size
name=name
disabled=disabled
update=(action "toggle")
}}
1 change: 1 addition & 0 deletions addon/templates/components/cfb-toggle-switch.hbs
Expand Up @@ -5,6 +5,7 @@
value=value
size=size
name=name
disabled=disabled
on-toggle=(action "toggle")
}}
</div>
Expand Down

0 comments on commit 7b3e16a

Please sign in to comment.