Skip to content

Commit

Permalink
fix!: rename meta attribute to metainfo (django-rf change) (#404)
Browse files Browse the repository at this point in the history
  • Loading branch information
derrabauke authored Feb 4, 2022
1 parent 69d3c17 commit 253d160
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions addon/components/meta-fields.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<PowerSelect
@disabled={{eval-meta field.readOnly @model}}
@options={{field.options}}
@selected={{find-by "value" (get @model.meta field.slug) field.options}}
@selected={{find-by "value" (get @model.metainfo field.slug) field.options}}
@onChange={{fn this.updateMetaField field @model}}
@placeholder={{t field.label}}
@allowClear={{true}}
Expand All @@ -20,7 +20,7 @@
data-test-meta-field-text={{field.slug}}
class="uk-input"
type="text"
value={{get @model.meta field.slug}}
value={{get @model.metainfo field.slug}}
disabled={{eval-meta field.readOnly @model}}
{{on "input" (fn this.updateMetaField field @model)}}
>
Expand Down
4 changes: 2 additions & 2 deletions addon/components/meta-fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default class EditFormComponent extends Component {
@action
updateMetaField(field, model, optionOrEvent) {
const value = optionOrEvent?.target?.value ?? optionOrEvent?.value;
model.meta = { ...model.meta, [field.slug]: value };
model.notifyPropertyChange("meta");
model.metainfo = { ...model.metainfo, [field.slug]: value };
model.notifyPropertyChange("metainfo");
}
}
2 changes: 1 addition & 1 deletion addon/models/scope.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default class ScopeModel extends LocalizedModel {
@localizedAttr fullName;
@localizedAttr description;
@attr level;
@attr meta;
@attr metainfo;

@belongsTo("scope", { inverse: "children", async: false }) parent;
@hasMany("scope", { inverse: "parent", async: false }) children;
Expand Down
2 changes: 1 addition & 1 deletion addon/models/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default class UserModel extends LocalizedModel {
@attr address;
@localizedAttr city;
@attr zip;
@attr meta;
@attr metainfo;
@attr isActive;

get fullName() {
Expand Down
2 changes: 1 addition & 1 deletion tests/dummy/mirage/factories/scope.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ export default Factory.extend({
),
description: () => localize(faker.lorem.paragraph()),
level: () => 0,
meta: () => {},
metainfo: () => {},
});
2 changes: 1 addition & 1 deletion tests/dummy/mirage/factories/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ export default Factory.extend({
address: () => faker.address.streetAddress(),
city: () => localize(faker.address.city()),
zip: () => faker.datatype.number(),
meta: () => {},
metainfo: () => {},
isActive: () => faker.datatype.boolean(),
});
6 changes: 3 additions & 3 deletions tests/integration/components/meta-fields-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ module("Integration | Component | meta-fields", function (hooks) {
this.emeisOptions = this.owner.lookup("service:emeisOptions");

this.model = {
meta: {},
metainfo: {},
notifyPropertyChange: () => {},
};
});
Expand Down Expand Up @@ -106,12 +106,12 @@ module("Integration | Component | meta-fields", function (hooks) {
assert.dom(this.element).containsText(translations.scope.metaExample2);

await selectChoose(".ember-power-select-trigger", "Ham");
assert.deepEqual(this.model.meta, {
assert.deepEqual(this.model.metainfo, {
"meta-example": "option-1",
});

await fillIn("[data-test-meta-field-text]", "My value");
assert.deepEqual(this.model.meta, {
assert.deepEqual(this.model.metainfo, {
"meta-example": "option-1",
"meta-example-2": "My value",
});
Expand Down

0 comments on commit 253d160

Please sign in to comment.