0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-24 02:10:29 +01:00
discourse-custom-wizard/assets/javascripts/discourse/components/wizard-export.js.es6

46 Zeilen
1,1 KiB
Text

2020-04-05 03:37:09 +02:00
import Component from "@ember/component";
import { A } from "@ember/array";
2020-05-28 05:06:06 +02:00
import I18n from "I18n";
2020-04-05 03:37:09 +02:00
export default Component.extend({
2019-08-07 12:38:50 +02:00
classNames: ['container', 'export'],
2020-04-05 03:37:09 +02:00
selected: A(),
2019-08-07 12:38:50 +02:00
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;
}
}
}
});