2017-06-29 04:56:44 +08:00
|
|
|
import computed from "ember-addons/ember-computed-decorators";
|
|
|
|
import UploadMixin from "discourse/mixins/upload";
|
|
|
|
|
|
|
|
export default Em.Component.extend(UploadMixin, {
|
|
|
|
type: 'csv',
|
|
|
|
classNames: 'watched-words-uploader',
|
2017-08-01 05:06:26 +08:00
|
|
|
uploadUrl: '/admin/logs/watched_words/upload',
|
2017-06-29 04:56:44 +08:00
|
|
|
addDisabled: Em.computed.alias("uploading"),
|
|
|
|
|
|
|
|
validateUploadedFilesOptions() {
|
|
|
|
return { csvOnly: true };
|
|
|
|
},
|
|
|
|
|
|
|
|
@computed('actionKey')
|
|
|
|
data(actionKey) {
|
|
|
|
return { action_key: actionKey };
|
|
|
|
},
|
|
|
|
|
|
|
|
uploadDone() {
|
|
|
|
if (this) {
|
|
|
|
bootbox.alert(I18n.t("admin.watched_words.form.upload_successful"));
|
|
|
|
this.sendAction("done");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|