1
0
Fork 0
discourse-custom-wizard-unl.../assets/javascripts/discourse/components/wizard-export.js.es6

42 Zeilen
992 B
Text

2019-08-07 12:38:50 +02:00
export default Ember.Component.extend({
classNames: ['container', 'export'],
selected: Ember.A(),
actions: {
checkChanged(event) {
this.set('exportMessage', '');
let selected = this.get('selected');
if (event.target.checked) {
selected.addObject(event.target.id);
} else if (!event.target.checked) {
selected.removeObject(event.target.id);
}
this.set('selected', selected);
},
export() {
const wizards = this.get('selected');
if (!wizards.length) {
this.set('exportMessage', I18n.t("admin.wizard.transfer.export.none_selected"));
} else {
this.set('exportMessage', '');
let url = Discourse.BaseUrl;
let route = '/admin/wizards/transfer/export';
url += route + '?';
wizards.forEach((wizard) => {
let step = 'wizards[]=' + wizard;
step += '&';
url += step;
});
location.href = url;
}
}
}
});