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

View File

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

View File

@ -13,7 +13,13 @@ Discourse.AdminUsersListRoute = Discourse.Route.extend({
actions: {
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"));
}
});
}
}
});