@projectcaluma/ember-form-builder 12.11.1 → 12.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/addon/components/cfb-form-editor/cfb-advanced-settings.hbs +1 -1
- package/addon/components/cfb-form-editor/cfb-advanced-settings.js +15 -1
- package/addon/components/cfb-form-editor/question-list/item.hbs +10 -2
- package/addon/components/cfb-form-editor/question-list/item.js +11 -0
- package/addon/components/cfb-form-editor/question.hbs +6 -4
- package/addon/components/cfb-form-editor/question.js +4 -0
- package/addon/templates/edit/questions/edit.hbs +0 -1
- package/package.json +4 -4
- package/addon/controllers/edit/questions/edit.js +0 -12
|
@@ -1,6 +1,20 @@
|
|
|
1
|
+
import { action } from "@ember/object";
|
|
1
2
|
import Component from "@glimmer/component";
|
|
2
3
|
import { tracked } from "@glimmer/tracking";
|
|
3
|
-
|
|
4
4
|
export default class CfbFormEditorCfbAdvancedSettings extends Component {
|
|
5
5
|
@tracked showAdvanced = false;
|
|
6
|
+
|
|
7
|
+
constructor(owner, args) {
|
|
8
|
+
super(owner, args);
|
|
9
|
+
|
|
10
|
+
this.showAdvanced =
|
|
11
|
+
JSON.parse(localStorage.getItem("showAdvanced")) ?? false;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
@action
|
|
15
|
+
toggleAdvanced() {
|
|
16
|
+
this.showAdvanced = !this.showAdvanced;
|
|
17
|
+
|
|
18
|
+
localStorage.setItem("showAdvanced", this.showAdvanced);
|
|
19
|
+
}
|
|
6
20
|
}
|
|
@@ -41,7 +41,11 @@
|
|
|
41
41
|
<a
|
|
42
42
|
data-test-edit-question
|
|
43
43
|
href="#"
|
|
44
|
-
class=
|
|
44
|
+
class={{if
|
|
45
|
+
this.isActive
|
|
46
|
+
"uk-width-auto uk-margin-small-right uk-text-bold"
|
|
47
|
+
"uk-width-auto uk-margin-small-right"
|
|
48
|
+
}}
|
|
45
49
|
{{on "click" (fn this.editQuestion @question)}}
|
|
46
50
|
>
|
|
47
51
|
{{@question.slug}}
|
|
@@ -51,7 +55,11 @@
|
|
|
51
55
|
</a>
|
|
52
56
|
{{else}}
|
|
53
57
|
<span
|
|
54
|
-
class=
|
|
58
|
+
class={{if
|
|
59
|
+
this.isActive
|
|
60
|
+
"uk-width-auto uk-margin-small-right uk-text-bold"
|
|
61
|
+
"uk-width-auto uk-margin-small-right"
|
|
62
|
+
}}
|
|
55
63
|
>{{@question.slug}}</span>
|
|
56
64
|
{{/if}}
|
|
57
65
|
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { action } from "@ember/object";
|
|
2
2
|
import { guidFor } from "@ember/object/internals";
|
|
3
|
+
import { service } from "@ember/service";
|
|
3
4
|
import Component from "@glimmer/component";
|
|
4
5
|
import jexl from "jexl";
|
|
5
6
|
|
|
6
7
|
import { hasQuestionType } from "@projectcaluma/ember-core/helpers/has-question-type";
|
|
7
8
|
|
|
8
9
|
export default class CfbFormEditorQuestionListItem extends Component {
|
|
10
|
+
@service router;
|
|
11
|
+
|
|
9
12
|
get elementId() {
|
|
10
13
|
return guidFor(this);
|
|
11
14
|
}
|
|
@@ -48,6 +51,14 @@ export default class CfbFormEditorQuestionListItem extends Component {
|
|
|
48
51
|
);
|
|
49
52
|
}
|
|
50
53
|
|
|
54
|
+
get isActive() {
|
|
55
|
+
// we can't access this.router.applicationRouter.currentRoute.queryParams
|
|
56
|
+
// because it is non-reactive
|
|
57
|
+
return this.router.currentURL?.endsWith(
|
|
58
|
+
`/questions/${this.args.question.slug}`,
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
51
62
|
@action
|
|
52
63
|
editQuestion(question, e) {
|
|
53
64
|
e.preventDefault();
|
|
@@ -428,10 +428,12 @@
|
|
|
428
428
|
</CfbFormEditor::CfbAdvancedSettings>
|
|
429
429
|
|
|
430
430
|
<div class="uk-flex uk-flex-between uk-flex-middle uk-flex-row-reverse">
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
431
|
+
{{#unless this.isNew}}
|
|
432
|
+
<CfbFormEditor::QuestionUsage
|
|
433
|
+
@slug={{changeset-get f.model "slug"}}
|
|
434
|
+
class="uk-flex-last"
|
|
435
|
+
/>
|
|
436
|
+
{{/unless}}
|
|
435
437
|
|
|
436
438
|
<f.submit
|
|
437
439
|
@disabled={{f.loading}}
|
|
@@ -195,6 +195,10 @@ export default class CfbFormEditorQuestion extends Component {
|
|
|
195
195
|
return this.data.lastSuccessful?.value?.[0]?.node;
|
|
196
196
|
}
|
|
197
197
|
|
|
198
|
+
get isNew() {
|
|
199
|
+
return !this.changeset.get("id");
|
|
200
|
+
}
|
|
201
|
+
|
|
198
202
|
get prefix() {
|
|
199
203
|
return this.calumaOptions.namespace
|
|
200
204
|
? `${this.calumaOptions.namespace}-`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@projectcaluma/ember-form-builder",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.13.0",
|
|
4
4
|
"description": "Ember engine for building Caluma forms.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon",
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"lodash.isequal": "^4.5.0",
|
|
45
45
|
"reactiveweb": "^1.2.2",
|
|
46
46
|
"uikit": "^3.19.2",
|
|
47
|
-
"@projectcaluma/ember-core": "^12.
|
|
48
|
-
"@projectcaluma/ember-form": "^12.
|
|
47
|
+
"@projectcaluma/ember-core": "^12.13.0",
|
|
48
|
+
"@projectcaluma/ember-form": "^12.13.0"
|
|
49
49
|
},
|
|
50
50
|
"//": [
|
|
51
51
|
"TODO: remove obsolete dependency to `ember-data` which is only necessary",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"qunit": "2.20.1",
|
|
82
82
|
"qunit-dom": "3.0.0",
|
|
83
83
|
"webpack": "5.91.0",
|
|
84
|
-
"@projectcaluma/ember-testing": "12.
|
|
84
|
+
"@projectcaluma/ember-testing": "12.13.0"
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {
|
|
87
87
|
"ember-engines": "^0.9.0",
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import Controller from "@ember/controller";
|
|
2
|
-
import { action } from "@ember/object";
|
|
3
|
-
import { inject as service } from "@ember/service";
|
|
4
|
-
|
|
5
|
-
export default class EditQuestionsEditController extends Controller {
|
|
6
|
-
@service router;
|
|
7
|
-
|
|
8
|
-
@action
|
|
9
|
-
afterSubmit() {
|
|
10
|
-
this.router.transitionTo("edit");
|
|
11
|
-
}
|
|
12
|
-
}
|