1
0
Fork 0
discourse-custom-wizard-unl.../assets/javascripts/discourse/controllers/admin-wizards-custom-fields.js.es6
Angus McLeod d221d65d77 init
2020-10-17 12:31:07 +11:00

28 Zeilen
Kein EOL
663 B
JavaScript

import Controller from "@ember/controller";
import EmberObject from '@ember/object';
import { ajax } from 'discourse/lib/ajax';
import { popupAjaxError } from 'discourse/lib/ajax-error';
export default Controller.extend({
fieldKeys: ['klass', 'name', 'type'],
classes: ['topic', 'user', 'group'],
actions: {
addField() {
this.get('customFields').pushObject(
EmberObject.create({
new: true
})
);
},
saveFields() {
ajax(`/admin/wizards/custom-fields`, {
type: 'PUT',
data: {
custom_fields: this.customFields
}
}).catch(popupAjaxError)
}
}
});