mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 23:58:31 -05:00
Admin flags UI shows when it's loading and when there are no results
This commit is contained in:
parent
870e59883b
commit
f0d4a38433
3 changed files with 49 additions and 38 deletions
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,43 +7,51 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<table class='admin-flags'>
|
{{#if model.loading}}
|
||||||
<thead>
|
<div class='admin-loading'>{{i18n loading}}</div>
|
||||||
<tr>
|
{{else}}
|
||||||
<th class='user'></th>
|
{{#if model.length}}
|
||||||
<th class='excerpt'></th>
|
<table class='admin-flags'>
|
||||||
<th class='flaggers'>{{i18n admin.flags.flagged_by}}</th>
|
<thead>
|
||||||
<th class='last-flagged'></th>
|
|
||||||
<th class='action'></th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
{{#each flag in content}}
|
|
||||||
<tr {{bindAttr class="hiddenClass"}}>
|
|
||||||
<td class='user'>{{#linkTo 'adminUser' flag.user}}{{avatar flag.user imageSize="small"}}{{/linkTo}}</td>
|
|
||||||
<td class='excerpt'>{{#if flag.topicHidden}}<i title='{{i18n topic_statuses.invisible.help}}' class='icon icon-eye-close'></i> {{/if}}<h3><a href='{{unbound flag.url}}'>{{flag.title}}</a></h3><br>{{{flag.excerpt}}}
|
|
||||||
</td>
|
|
||||||
<td class='flaggers'>{{#each flag.flaggers}}{{#linkTo 'adminUser' this}}{{avatar this imageSize="small"}} {{/linkTo}}{{/each}}</td>
|
|
||||||
<td class='last-flagged'>{{date flag.lastFlagged}}</td>
|
|
||||||
<td class='action'>
|
|
||||||
{{#if adminActiveFlagsView}}
|
|
||||||
<button title='{{i18n admin.flags.clear_title}}' class='btn' {{action clearFlags flag}}>{{i18n admin.flags.clear}}</button>
|
|
||||||
<button title='{{i18n admin.flags.delete_title}}' class='btn' {{action deletePost flag}}>{{i18n admin.flags.delete}}</button>
|
|
||||||
{{/if}}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
{{#each flag.messages}}
|
|
||||||
<tr>
|
<tr>
|
||||||
<td></td>
|
<th class='user'></th>
|
||||||
<td class='message'>
|
<th class='excerpt'></th>
|
||||||
<div>{{#linkTo 'adminUser' user}}{{avatar user imageSize="small"}}{{/linkTo}} {{message}} <a href="{{unbound permalink}}">{{i18n admin.flags.view_message}}</a></div>
|
<th class='flaggers'>{{i18n admin.flags.flagged_by}}</th>
|
||||||
</td>
|
<th class='last-flagged'></th>
|
||||||
<td></td>
|
<th class='action'></th>
|
||||||
<td></td>
|
|
||||||
<td></td>
|
|
||||||
</tr>
|
</tr>
|
||||||
{{/each}}
|
</thead>
|
||||||
{{/each}}
|
<tbody>
|
||||||
</tbody>
|
{{#each flag in content}}
|
||||||
</table>
|
<tr {{bindAttr class="hiddenClass"}}>
|
||||||
|
<td class='user'>{{#linkTo 'adminUser' flag.user}}{{avatar flag.user imageSize="small"}}{{/linkTo}}</td>
|
||||||
|
<td class='excerpt'>{{#if flag.topicHidden}}<i title='{{i18n topic_statuses.invisible.help}}' class='icon icon-eye-close'></i> {{/if}}<h3><a href='{{unbound flag.url}}'>{{flag.title}}</a></h3><br>{{{flag.excerpt}}}
|
||||||
|
</td>
|
||||||
|
<td class='flaggers'>{{#each flag.flaggers}}{{#linkTo 'adminUser' this}}{{avatar this imageSize="small"}} {{/linkTo}}{{/each}}</td>
|
||||||
|
<td class='last-flagged'>{{date flag.lastFlagged}}</td>
|
||||||
|
<td class='action'>
|
||||||
|
{{#if adminActiveFlagsView}}
|
||||||
|
<button title='{{i18n admin.flags.clear_title}}' class='btn' {{action clearFlags flag}}>{{i18n admin.flags.clear}}</button>
|
||||||
|
<button title='{{i18n admin.flags.delete_title}}' class='btn' {{action deletePost flag}}>{{i18n admin.flags.delete}}</button>
|
||||||
|
{{/if}}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
{{#each flag.messages}}
|
||||||
|
<tr>
|
||||||
|
<td></td>
|
||||||
|
<td class='message'>
|
||||||
|
<div>{{#linkTo 'adminUser' user}}{{avatar user imageSize="small"}}{{/linkTo}} {{message}} <a href="{{unbound permalink}}">{{i18n admin.flags.view_message}}</a></div>
|
||||||
|
</td>
|
||||||
|
<td></td>
|
||||||
|
<td></td>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
{{/each}}
|
||||||
|
{{/each}}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
{{else}}
|
||||||
|
<p>{{i18n admin.flags.no_results}}</p>
|
||||||
|
{{/if}}
|
||||||
|
{{/if}}
|
|
@ -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"
|
||||||
|
|
Loading…
Reference in a new issue