return a promise instead of triggering bootbox in model

This commit is contained in:
Arpit Jalan 2014-11-22 01:16:10 +05:30
parent 304b96aa81
commit 428b71687f
2 changed files with 8 additions and 8 deletions
app/assets/javascripts/admin

View file

@ -15,13 +15,7 @@ Discourse.ExportCsv.reopenClass({
@method export_user_list @method export_user_list
**/ **/
exportUserList: function() { exportUserList: function() {
return Discourse.ajax("/admin/export_csv/users.json").then(function(result) { return Discourse.ajax("/admin/export_csv/users.json");
if (result.success) {
bootbox.alert(I18n.t("admin.export_csv.success"));
} else {
bootbox.alert(I18n.t("admin.export_csv.failed"));
}
});
}, },
/** /**

View file

@ -13,7 +13,13 @@ Discourse.AdminUsersListRoute = Discourse.Route.extend({
actions: { actions: {
exportUsers: function() { exportUsers: function() {
Discourse.ExportCsv.exportUserList(); Discourse.ExportCsv.exportUserList().then(function(result) {
if (result.success) {
bootbox.alert(I18n.t("admin.export_csv.success"));
} else {
bootbox.alert(I18n.t("admin.export_csv.failed"));
}
});
} }
} }
}); });