Skip to content

Commit de17799

Browse files
author
Hieu Lam - TMA
authored
fix-8985: [Badge wizard] Fields section always expands when clicking saving. (#9001)
1 parent f1c4b5a commit de17799

File tree

4 files changed

+43
-41
lines changed

4 files changed

+43
-41
lines changed

app/components/forms/wizard/badge-field-form.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,10 @@ export default Component.extend(FormMixin, {
9191

9292
actions: {
9393
toggleSetting() {
94-
if (!this.isExpanded) {
95-
this.set('isExpanded', true);
94+
if (!this.data.is_field_expanded) {
95+
this.set('data.is_field_expanded', true);
9696
} else {
97-
this.set('isExpanded', false);
97+
this.set('data.is_field_expanded', false);
9898
}
9999
},
100100
removeForm() {

app/components/forms/wizard/badge-step.js

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -100,24 +100,25 @@ export default Component.extend(FormMixin, EventWizardMixin, {
100100
form.badgeFields.forEach(field => {
101101
if (!field.is_deleted) {
102102
badgeFields.pushObject(this.store.createRecord('badge-field-form', {
103-
badge_field_id : field.id,
104-
badge_id : field.badge_id,
105-
field_identifier : field.field_identifier,
106-
custom_field : field.custom_field,
107-
sample_text : field.sample_text,
108-
font_size : field.font_size,
109-
font_name : field.font_name,
110-
font_color : field.font_color,
111-
text_rotation : field.text_rotation,
112-
margin_top : field.margin_top,
113-
margin_bottom : field.margin_bottom,
114-
margin_left : field.margin_left,
115-
margin_right : field.margin_right,
116-
font_weight : field.font_weight,
117-
text_alignment : field.text_alignment,
118-
text_type : field.text_type,
119-
is_deleted : field.is_deleted,
120-
qr_custom_field : field.qr_custom_field
103+
badge_field_id : field.id,
104+
badge_id : field.badge_id,
105+
field_identifier : field.field_identifier,
106+
custom_field : field.custom_field,
107+
sample_text : field.sample_text,
108+
font_size : field.font_size,
109+
font_name : field.font_name,
110+
font_color : field.font_color,
111+
text_rotation : field.text_rotation,
112+
margin_top : field.margin_top,
113+
margin_bottom : field.margin_bottom,
114+
margin_left : field.margin_left,
115+
margin_right : field.margin_right,
116+
font_weight : field.font_weight,
117+
text_alignment : field.text_alignment,
118+
text_type : field.text_type,
119+
is_deleted : field.is_deleted,
120+
qr_custom_field : field.qr_custom_field,
121+
is_field_expanded : field.is_field_expanded
121122
}));
122123
field = null;
123124
}

app/models/badge-field-form.js

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,25 @@ export default ModelBase.extend({
1111
/**
1212
* Attributes
1313
*/
14-
badge_field_id : attr('number'),
15-
badge_id : attr('string'),
16-
field_identifier : attr('string'),
17-
custom_field : attr('string'),
18-
sample_text : attr('string'),
19-
font_size : attr('number'),
20-
font_name : attr('string'),
21-
font_color : attr('string'),
22-
text_rotation : attr('number'),
23-
margin_top : attr('number'),
24-
margin_bottom : attr('number'),
25-
margin_left : attr('number'),
26-
margin_right : attr('number'),
27-
font_weight : attr('number'),
28-
text_alignment : attr('string', { defaultValue: 'center' }),
29-
text_type : attr('string'),
30-
is_deleted : attr('boolean'),
31-
qr_custom_field : attr(),
14+
badge_field_id : attr('number'),
15+
badge_id : attr('string'),
16+
field_identifier : attr('string'),
17+
custom_field : attr('string'),
18+
sample_text : attr('string'),
19+
font_size : attr('number'),
20+
font_name : attr('string'),
21+
font_color : attr('string'),
22+
text_rotation : attr('number'),
23+
margin_top : attr('number'),
24+
margin_bottom : attr('number'),
25+
margin_left : attr('number'),
26+
margin_right : attr('number'),
27+
font_weight : attr('number'),
28+
text_alignment : attr('string', { defaultValue: 'center' }),
29+
text_type : attr('string'),
30+
is_deleted : attr('boolean'),
31+
qr_custom_field : attr(),
32+
is_field_expanded : attr('boolean', { defaultValue: true }),
3233
/**
3334
* Relationships
3435
*/

app/templates/components/forms/wizard/badge-field-form.hbs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
</h3>
1515
<div class="btn-row">
1616
<button type="button" class="ui compact icon button right floated" {{action 'toggleSetting' }}>
17-
{{#if this.isExpanded}}
17+
{{#if @data.is_field_expanded }}
1818
<i class="angle up icon" />
1919
{{else}}
2020
<i class="angle down icon" />
@@ -26,7 +26,7 @@
2626
</div>
2727
</div>
2828

29-
{{#if this.isExpanded}}
29+
{{#if @data.is_field_expanded }}
3030
<div class="badge-form-body-field">
3131
<h3 class="background-color-title padding-left-1rem margin-left-revert-1rem">
3232
{{t 'Setting'}}

0 commit comments

Comments
 (0)