0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-10 04:12:53 +01:00
discourse-custom-wizard/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)
}
}
});