meta data

This commit is contained in:
Rimian Perkins
2019-10-16 21:06:19 +11:00
parent 496f2b9706
commit d02ba3ef6a
7 changed files with 35 additions and 21 deletions
@@ -4,10 +4,10 @@ export default Ember.Controller.extend({
actions: {
createProduct() {
// TODO: set default group name beforehand
if (this.get("model.product.groupName") === undefined) {
if (this.get("model.product.metadata.group_name") === undefined) {
this.set(
"model.product.groupName",
this.get("model.group.firstObject")
"model.product.metadata",
{ group_name: this.get("model.groups.firstObject.name") }
);
}
@@ -10,7 +10,7 @@ const AdminProduct = Discourse.Model.extend({
save() {
const data = {
name: this.name,
groupName: this.groupName,
metadata: this.metadata,
active: this.active
};
@@ -20,7 +20,7 @@ const AdminProduct = Discourse.Model.extend({
update() {
const data = {
name: this.name,
groupName: this.groupName,
metadata: this.metadata,
active: this.active
};
@@ -2,6 +2,7 @@
<table class="table discourse-patrons-admin">
<thead>
<th>{{i18n 'discourse_patrons.admin.products.product.product_id'}}</th>
<th>{{i18n 'discourse_patrons.admin.products.product.name'}}</th>
<th>{{i18n 'discourse_patrons.admin.products.product.group'}}</th>
<th>{{i18n 'discourse_patrons.admin.products.product.active'}}</th>
<th></th>
@@ -9,6 +10,7 @@
{{#each model as |product|}}
<tr>
<td>{{product.id}}</td>
<td>{{product.name}}</td>
<td>{{product.metadata.group_name}}</td>
<td>{{product.active}}</td>
<td class="td-right">
@@ -8,7 +8,7 @@
</p>
<p>
<label for="interval">{{i18n 'discourse_patrons.admin.products.product.group'}}</label>
{{combo-box valueAttribute="value" content=model.groups value=model.product.groupName}}
{{combo-box valueAttribute="name" content=model.groups value=model.product.metadata.group_name}}
</p>
<p>
<label for="interval">{{i18n 'discourse_patrons.admin.products.product.active'}}</label>