Skip to content
Permalink
Browse files

fix: remove jexl logic and hide toggle (#233)

  • Loading branch information...
fkm authored and czosel committed May 14, 2019
1 parent 2f5a197 commit 9627dec00a07b96718f9ea52274a1c707a2e1610
@@ -189,6 +189,16 @@ export default Component.extend(ComponentQueryManager, {
return namespace ? `${namespace}-` : "";
}),

requiredIsVisible: computed("changeset.{__typename,isRequired}", function() {
const isRequired = this.changeset.get("isRequired");
const typename = this.changeset.get("__typename");

return (
(isRequired === "true" || isRequired === "false") &&
typename !== "StaticQuestion"
);
}),

_getIntegerQuestionInput(changeset) {
return {
isRequired: changeset.get("isRequired"),
@@ -1,28 +1,16 @@
import RenderComponent from "ember-validated-form/components/validated-input/-themes/uikit/render";
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,

didReceiveAttrs() {
this._super(...arguments);

this.get("_boolValue").perform();
},

boolValue: reads("_boolValue.lastSuccessful.value"),

_boolValue: task(function*() {
return yield jexl.eval(this.get("value"));
}),

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

actions: {
@@ -76,7 +76,7 @@
{{/if}}
</div>

{{#if (not-eq f.model.__typename "StaticQuestion")}}
{{#if requiredIsVisible}}
<div class="uk-width-auto uk-flex">
{{f.input
name="isRequired"

0 comments on commit 9627dec

Please sign in to comment.
You can’t perform that action at this time.