Admin flags UI shows when it's loading and when there are no results

This commit is contained in:
Neil Lalonde 2013-06-05 10:24:50 -04:00
parent 870e59883b
commit f0d4a38433
3 changed files with 49 additions and 38 deletions

View file

@ -66,6 +66,7 @@ Discourse.FlaggedPost = Discourse.Post.extend({
Discourse.FlaggedPost.reopenClass({ Discourse.FlaggedPost.reopenClass({
findAll: function(filter) { findAll: function(filter) {
var result = Em.A(); var result = Em.A();
result.set('loading', true);
Discourse.ajax("/admin/flags/" + filter + ".json").then(function(data) { Discourse.ajax("/admin/flags/" + filter + ".json").then(function(data) {
var userLookup = {}; var userLookup = {};
data.users.each(function(u) { data.users.each(function(u) {
@ -76,6 +77,7 @@ Discourse.FlaggedPost.reopenClass({
f.userLookup = userLookup; f.userLookup = userLookup;
result.pushObject(f); result.pushObject(f);
}); });
result.set('loading', false);
}); });
return result; return result;
} }

View file

@ -7,6 +7,10 @@
</div> </div>
</div> </div>
{{#if model.loading}}
<div class='admin-loading'>{{i18n loading}}</div>
{{else}}
{{#if model.length}}
<table class='admin-flags'> <table class='admin-flags'>
<thead> <thead>
<tr> <tr>
@ -47,3 +51,7 @@
{{/each}} {{/each}}
</tbody> </tbody>
</table> </table>
{{else}}
<p>{{i18n admin.flags.no_results}}</p>
{{/if}}
{{/if}}

View file

@ -1015,6 +1015,7 @@ en:
flagged_by: "Flagged by" flagged_by: "Flagged by"
error: "Something went wrong" error: "Something went wrong"
view_message: "view message" view_message: "view message"
no_results: "There are no flags."
groups: groups:
title: "Groups" title: "Groups"