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

View File

@ -7,7 +7,11 @@
</div>
</div>
<table class='admin-flags'>
{{#if model.loading}}
<div class='admin-loading'>{{i18n loading}}</div>
{{else}}
{{#if model.length}}
<table class='admin-flags'>
<thead>
<tr>
<th class='user'></th>
@ -46,4 +50,8 @@
{{/each}}
{{/each}}
</tbody>
</table>
</table>
{{else}}
<p>{{i18n admin.flags.no_results}}</p>
{{/if}}
{{/if}}

View File

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