Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-10 04:12:53 +01:00
28 Zeilen
Kein EOL
663 B
JavaScript
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)
|
|
}
|
|
}
|
|
}); |