ES6: Removed and renamed some admin views

This commit is contained in:
Robin Ward 2015-02-24 13:47:46 -05:00
parent 5a7ae8c63f
commit 3f729438ad
11 changed files with 55 additions and 77 deletions

View File

@ -0,0 +1,3 @@
export default Ember.Component.extend({
tagName: 'tbody'
});

View File

@ -92,9 +92,9 @@ Discourse.Report = Discourse.Model.extend({
icon: function() {
switch( this.get('type') ) {
case 'flags':
return 'fa-flag';
return 'flag';
case 'likes':
return 'fa-heart';
return 'heart';
default:
return null;
}

View File

@ -0,0 +1,13 @@
<tr>
<td class="title">
{{#if report.icon}}
{{fa-icon report.icon}}
{{/if}}
<a {{bind-attr href="report.reportUrl"}}>{{report.title}}</a>
</td>
<td class="value">{{report.todayCount}}</td>
<td {{bind-attr class=":value report.yesterdayTrend"}} {{bind-attr title="report.yesterdayCountTitle"}}>{{report.yesterdayCount}} {{fa-icon "caret-up" class="up"}} {{fa-icon "caret-down" class="down"}}</td>
<td {{bind-attr class=":value report.sevenDayTrend"}} {{bind-attr title="report.sevenDayCountTitle"}}>{{report.lastSevenDaysCount}} {{fa-icon "caret-up" class="up"}} {{fa-icon "caret-down" class="down"}}</td>
<td {{bind-attr class=":value report.thirtyDayTrend"}} {{bind-attr title="report.thirtyDayCountTitle"}}>{{report.lastThirtyDaysCount}} {{fa-icon "caret-up" class="up"}} {{fa-icon "caret-down" class="down"}}</td>
<td class="value">{{report.total}}</td>
</tr>

View File

@ -16,7 +16,7 @@
</tr>
</thead>
{{#unless loading}}
{{ render 'admin/templates/reports/trust_levels_report' users_by_trust_level tagName="tbody" }}
{{ render 'admin/templates/reports/trust_levels_report' users_by_trust_level tagName="tbody"}}
{{/unless}}
</table>
</div>
@ -52,13 +52,13 @@
</thead>
{{#unless loading}}
{{ render 'admin/templates/reports/per_day_counts_report' visits tagName="tbody"}}
{{ render 'admin_report_counts' signups }}
{{ render 'admin_report_counts' topics }}
{{ render 'admin_report_counts' posts }}
{{ render 'admin_report_counts' likes }}
{{ render 'admin_report_counts' flags }}
{{ render 'admin_report_counts' bookmarks }}
{{ render 'admin_report_counts' emails }}
{{admin-report-counts report=signups}}
{{admin-report-counts report=topics}}
{{admin-report-counts report=posts}}
{{admin-report-counts report=likes}}
{{admin-report-counts report=flags}}
{{admin-report-counts report=bookmarks}}
{{admin-report-counts report=emails}}
{{/unless}}
</table>
</div>
@ -76,10 +76,10 @@
</tr>
</thead>
{{#unless loading}}
{{ render 'admin_report_counts' page_view_anon_reqs }}
{{ render 'admin_report_counts' page_view_logged_in_reqs }}
{{ render 'admin_report_counts' page_view_crawler_reqs }}
{{ render 'admin_report_counts' page_view_total_reqs }}
{{admin-report-counts report=page_view_anon_reqs}}
{{admin-report-counts report=page_view_logged_in_reqs}}
{{admin-report-counts report=page_view_crawler_reqs}}
{{admin-report-counts report=page_view_total_reqs}}
{{/unless}}
</table>
</div>
@ -98,11 +98,11 @@
</tr>
</thead>
{{#unless loading}}
{{ render 'admin_report_counts' user_to_user_private_messages }}
{{ render 'admin_report_counts' system_private_messages }}
{{ render 'admin_report_counts' notify_moderators_private_messages }}
{{ render 'admin_report_counts' notify_user_private_messages }}
{{ render 'admin_report_counts' moderator_warning_private_messages }}
{{admin-report-counts report=user_to_user_private_messages}}
{{admin-report-counts report=system_private_messages}}
{{admin-report-counts report=notify_moderators_private_messages}}
{{admin-report-counts report=notify_user_private_messages}}
{{admin-report-counts report=moderator_warning_private_messages}}
{{/unless}}
</table>
</div>
@ -145,12 +145,12 @@
</tr>
</thead>
{{#unless loading}}
{{ render 'admin_report_counts' http_2xx_reqs }}
{{ render 'admin_report_counts' http_3xx_reqs}}
{{ render 'admin_report_counts' http_4xx_reqs}}
{{ render 'admin_report_counts' http_5xx_reqs}}
{{ render 'admin_report_counts' http_background_reqs }}
{{ render 'admin_report_counts' http_total_reqs }}
{{admin-report-counts report=http_2xx_reqs}}
{{admin-report-counts report=http_3xx_reqs}}
{{admin-report-counts report=http_4xx_reqs}}
{{admin-report-counts report=http_5xx_reqs}}
{{admin-report-counts report=http_background_reqs}}
{{admin-report-counts report=http_total_reqs}}
{{/unless}}
</table>
</div>

View File

@ -1,13 +0,0 @@
<tr>
<td class="title">
{{#if icon}}
<i {{bind-attr class=":fa icon"}}></i>
{{/if}}
<a {{bind-attr href="reportUrl"}}>{{title}}</a>
</td>
<td class="value">{{todayCount}}</td>
<td {{bind-attr class=":value yesterdayTrend"}} {{bind-attr title="yesterdayCountTitle"}}>{{yesterdayCount}} <i class="fa up fa-caret-up"></i><i class="fa down fa-caret-down"></i></td>
<td {{bind-attr class=":value sevenDayTrend"}} {{bind-attr title="sevenDayCountTitle"}}>{{lastSevenDaysCount}} <i class="fa up fa-caret-up"></i><i class="fa down fa-caret-down"></i></td>
<td {{bind-attr class=":value thirtyDayTrend"}} {{bind-attr title="thirtyDayCountTitle"}}>{{lastThirtyDaysCount}} <i class="fa up fa-caret-up"></i><i class="fa down fa-caret-down"></i></td>
<td class="value">{{total}}</td>
</tr>

View File

@ -1,4 +1,4 @@
Discourse.AdminBackupsView = Discourse.View.extend({
export default Discourse.View.extend({
classNames: ["admin-backups"],
_hijackDownloads: function() {

View File

@ -1,3 +0,0 @@
Discourse.AdminApiView = Discourse.View.extend({
templateName: 'admin/templates/api'
});

View File

@ -1,13 +0,0 @@
/**
The default view in the admin section
@class AdminDashboardView
@extends Discourse.View
@namespace Discourse
@module Discourse
**/
Discourse.AdminDashboardView = Discourse.View.extend({
templateName: 'admin/templates/dashboard'
});

View File

@ -1,4 +0,0 @@
Discourse.AdminReportCountsView = Discourse.View.extend({
templateName: 'admin/templates/reports/summed_counts_report',
tagName: 'tbody'
});

View File

@ -1,12 +1,4 @@
/**
A view to display a site setting with edit controls
@class SiteSettingView
@extends Discourse.View
@namespace Discourse
@module Discourse
**/
Discourse.SiteSettingView = Discourse.View.extend(Discourse.ScrollTop, {
export default Discourse.View.extend(Discourse.ScrollTop, {
classNameBindings: [':row', ':setting', 'content.overridden'],
preview: function() {

View File

@ -1,24 +1,27 @@
import registerUnbound from 'discourse/helpers/register-unbound';
function iconClasses(icon, modifier) {
function iconClasses(icon, params) {
var classes = "fa fa-" + icon;
if (modifier) { classes += " fa-" + modifier; }
if (params.modifier) { classes += " fa-" + params.modifier; }
if (params['class']) { classes += ' ' + params['class']; }
return classes;
}
function iconHTML(icon, label, modifier) {
var html = "<i class='" + iconClasses(icon, modifier) + "'";
if (label) { html += " aria-hidden='true'"; }
function iconHTML(icon, params) {
params = params || {};
var html = "<i class='" + iconClasses(icon, params) + "'";
if (params.label) { html += " aria-hidden='true'"; }
html += "></i>";
if (label) {
html += "<span class='sr-only'>" + I18n.t(label) + "</span>";
if (params.label) {
html += "<span class='sr-only'>" + I18n.t(params.label) + "</span>";
}
return html;
}
registerUnbound('fa-icon', function(icon, params) {
return new Handlebars.SafeString(iconHTML(icon, params.label, params.modifier));
return new Handlebars.SafeString(iconHTML(icon, params));
});
export { iconClasses, iconHTML };
export { iconHTML };