Upgrade to Ember 1.7.1 + group patch
This commit is contained in:
parent
c32df362d4
commit
a6b1be81b1
|
@ -1,14 +1,5 @@
|
|||
/**
|
||||
This controller supports the interface for listing screened email addresses in the admin section.
|
||||
|
||||
@class AdminLogsScreenedEmailsController
|
||||
@extends Ember.ArrayController
|
||||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
export default Ember.ArrayController.extend(Discourse.Presence, {
|
||||
loading: false,
|
||||
content: [],
|
||||
|
||||
actions: {
|
||||
clearBlock: function(row){
|
||||
|
@ -23,7 +14,7 @@ export default Ember.ArrayController.extend(Discourse.Presence, {
|
|||
var self = this;
|
||||
this.set('loading', true);
|
||||
Discourse.ScreenedEmail.findAll().then(function(result) {
|
||||
self.set('content', result);
|
||||
self.set('model', result);
|
||||
self.set('loading', false);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,28 +1,19 @@
|
|||
/**
|
||||
This controller supports the interface for listing screened IP addresses in the admin section.
|
||||
|
||||
@class AdminLogsScreenedIpAddressesController
|
||||
@extends Ember.ArrayController
|
||||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
export default Ember.ArrayController.extend(Discourse.Presence, {
|
||||
loading: false,
|
||||
content: [],
|
||||
itemController: 'admin-log-screened-ip-address',
|
||||
|
||||
show: function() {
|
||||
var self = this;
|
||||
this.set('loading', true);
|
||||
Discourse.ScreenedIpAddress.findAll().then(function(result) {
|
||||
self.set('content', result);
|
||||
self.set('model', result);
|
||||
self.set('loading', false);
|
||||
});
|
||||
},
|
||||
|
||||
actions: {
|
||||
recordAdded: function(arg) {
|
||||
this.get("content").unshiftObject(arg);
|
||||
this.get("model").unshiftObject(arg);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,20 +1,11 @@
|
|||
/**
|
||||
This controller supports the interface for listing screened URLs in the admin section.
|
||||
|
||||
@class AdminLogsScreenedUrlsController
|
||||
@extends Ember.ArrayController
|
||||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
export default Ember.ArrayController.extend(Discourse.Presence, {
|
||||
loading: false,
|
||||
content: [],
|
||||
|
||||
show: function() {
|
||||
var self = this;
|
||||
this.set('loading', true);
|
||||
Discourse.ScreenedUrl.findAll().then(function(result) {
|
||||
self.set('content', result);
|
||||
self.set('model', result);
|
||||
self.set('loading', false);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ export default Ember.ArrayController.extend(Discourse.Presence, {
|
|||
this.set('loading', true);
|
||||
Discourse.URL.set('queryParams', this.get('filters')); // TODO: doesn't work
|
||||
Discourse.StaffActionLog.findAll(this.get('filters')).then(function(result) {
|
||||
self.set('content', result);
|
||||
self.set('model', result);
|
||||
self.set('loading', false);
|
||||
});
|
||||
}.observes('filters.action_name', 'filters.acting_user', 'filters.target_user', 'filters.subject'),
|
||||
|
|
|
@ -10,7 +10,6 @@ export default Ember.ArrayController.extend(Discourse.Presence, {
|
|||
username: null,
|
||||
query: null,
|
||||
selectAll: false,
|
||||
content: null,
|
||||
loading: false,
|
||||
|
||||
mustApproveUsers: Discourse.computed.setting('must_approve_users'),
|
||||
|
@ -27,7 +26,7 @@ export default Ember.ArrayController.extend(Discourse.Presence, {
|
|||
**/
|
||||
selectAllChanged: function() {
|
||||
var _this = this;
|
||||
_.each(this.get('content'),function(user) {
|
||||
_.each(this.get('model'),function(user) {
|
||||
user.set('selected', _this.get('selectAll'));
|
||||
});
|
||||
}.observes('selectAll'),
|
||||
|
@ -74,9 +73,9 @@ export default Ember.ArrayController.extend(Discourse.Presence, {
|
|||
@property selectedCount
|
||||
**/
|
||||
selectedCount: function() {
|
||||
if (this.blank('content')) return 0;
|
||||
return this.get('content').filterProperty('selected').length;
|
||||
}.property('content.@each.selected'),
|
||||
if (this.blank('model')) return 0;
|
||||
return this.get('model').filterProperty('selected').length;
|
||||
}.property('model.@each.selected'),
|
||||
|
||||
/**
|
||||
Do we have any selected users?
|
||||
|
@ -95,7 +94,7 @@ export default Ember.ArrayController.extend(Discourse.Presence, {
|
|||
adminUsersListController.set('loading', true);
|
||||
|
||||
Discourse.AdminUser.findAll(this.get('query'), { filter: this.get('username'), show_emails: showEmails }).then(function (result) {
|
||||
adminUsersListController.set('content', result);
|
||||
adminUsersListController.set('model', result);
|
||||
adminUsersListController.set('loading', false);
|
||||
});
|
||||
},
|
||||
|
@ -114,36 +113,28 @@ export default Ember.ArrayController.extend(Discourse.Presence, {
|
|||
this.set('query', term);
|
||||
},
|
||||
|
||||
/**
|
||||
Approve all the currently selected users.
|
||||
actions: {
|
||||
approveUsers: function() {
|
||||
Discourse.AdminUser.bulkApprove(this.get('model').filterProperty('selected'));
|
||||
this.refreshUsers();
|
||||
},
|
||||
|
||||
@method approveUsers
|
||||
**/
|
||||
approveUsers: function() {
|
||||
Discourse.AdminUser.bulkApprove(this.get('content').filterProperty('selected'));
|
||||
this.refreshUsers();
|
||||
},
|
||||
rejectUsers: function() {
|
||||
var controller = this;
|
||||
Discourse.AdminUser.bulkReject(this.get('model').filterProperty('selected')).then(function(result){
|
||||
var message = I18n.t("admin.users.reject_successful", {count: result.success});
|
||||
if (result.failed > 0) {
|
||||
message += ' ' + I18n.t("admin.users.reject_failures", {count: result.failed});
|
||||
message += ' ' + I18n.t("admin.user.delete_forbidden", {count: Discourse.SiteSettings.delete_user_max_post_age});
|
||||
}
|
||||
bootbox.alert(message);
|
||||
controller.refreshUsers();
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
Reject all the currently selected users.
|
||||
|
||||
@method rejectUsers
|
||||
**/
|
||||
rejectUsers: function() {
|
||||
var controller = this;
|
||||
Discourse.AdminUser.bulkReject(this.get('content').filterProperty('selected')).then(function(result){
|
||||
var message = I18n.t("admin.users.reject_successful", {count: result.success});
|
||||
if (result.failed > 0) {
|
||||
message += ' ' + I18n.t("admin.users.reject_failures", {count: result.failed});
|
||||
message += ' ' + I18n.t("admin.user.delete_forbidden", {count: Discourse.SiteSettings.delete_user_max_post_age});
|
||||
}
|
||||
bootbox.alert(message);
|
||||
controller.refreshUsers();
|
||||
});
|
||||
},
|
||||
|
||||
showEmails: function() {
|
||||
this.refreshUsers(true);
|
||||
showEmails: function() {
|
||||
this.refreshUsers(true);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
|
|
@ -48,7 +48,7 @@ export default ObjectController.extend(Discourse.SelectedPostsCount, {
|
|||
if (arguments.length > 1) {
|
||||
postStream.set('show_deleted', value);
|
||||
}
|
||||
return postStream.get('show_deleted') ? true : null;
|
||||
return postStream.get('show_deleted') ? true : undefined;
|
||||
}.property('postStream.summary'),
|
||||
|
||||
filter: function(key, value) {
|
||||
|
@ -58,10 +58,18 @@ export default ObjectController.extend(Discourse.SelectedPostsCount, {
|
|||
if (arguments.length > 1) {
|
||||
postStream.set('summary', value === "summary");
|
||||
}
|
||||
return postStream.get('summary') ? "summary" : null;
|
||||
return postStream.get('summary') ? "summary" : undefined;
|
||||
}.property('postStream.summary'),
|
||||
|
||||
username_filters: Discourse.computed.queryAlias('postStream.streamFilters.username_filters'),
|
||||
username_filters: function(key, value) {
|
||||
var postStream = this.get('postStream');
|
||||
if (!postStream) { return; }
|
||||
|
||||
if (arguments.length > 1) {
|
||||
postStream.set('streamFilters.username_filters', value);
|
||||
}
|
||||
return postStream.get('streamFilters.username_filters');
|
||||
}.property('postStream.streamFilters.username_filters'),
|
||||
|
||||
init: function() {
|
||||
this._super();
|
||||
|
|
|
@ -81,9 +81,13 @@ DiscourseGroupedEach.prototype = {
|
|||
data.insideEach = true;
|
||||
for (var i = 0; i < contentLength; i++) {
|
||||
var row = content.objectAt(i);
|
||||
var keywords = Em.get(data, 'keywords');
|
||||
if (!keywords) {
|
||||
keywords = {};
|
||||
Em.set(data, 'keywords', keywords);
|
||||
}
|
||||
if (keyword) {
|
||||
data.keywords = data.keywords || {};
|
||||
data.keywords[keyword] = row;
|
||||
Em.set(keywords, keyword, row);
|
||||
}
|
||||
template(row, { data: data });
|
||||
}
|
||||
|
|
|
@ -3,7 +3,10 @@ export function renderAvatar(user, options) {
|
|||
|
||||
if (user) {
|
||||
var username = Em.get(user, 'username');
|
||||
if (!username) username = Em.get(user, options.usernamePath);
|
||||
if (!username) {
|
||||
if (!options.usernamePath) { return ''; }
|
||||
username = Em.get(user, options.usernamePath);
|
||||
}
|
||||
|
||||
var title;
|
||||
if (!options.ignoreTitle) {
|
||||
|
|
|
@ -112,24 +112,6 @@ Discourse.computed = {
|
|||
return computed.property.apply(computed, args);
|
||||
},
|
||||
|
||||
/**
|
||||
Creates a one way alias to a computed property, suitable for query params.
|
||||
|
||||
@method queryAlias
|
||||
@param {String} path to the alias
|
||||
@param {String} defaultValue for the variable (omitted if equal)
|
||||
**/
|
||||
queryAlias: function(path, defaultValue) {
|
||||
return Em.computed(function(key, value) {
|
||||
if (value) {
|
||||
// Annoying but this ensures the parameter is present
|
||||
}
|
||||
var result = this.get(path);
|
||||
if (typeof result !== "undefined" && result.toString() === defaultValue) { return; }
|
||||
return result;
|
||||
}).property(path);
|
||||
},
|
||||
|
||||
/**
|
||||
Creates a property from a SiteSetting. In the future the plan is for them to
|
||||
be able to update when changed.
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
<h3><i class='fa fa-envelope'></i> {{i18n private_message_info.title}}</h3>
|
||||
<div class='participants clearfix'>
|
||||
{{#grouped-each details.allowed_groups}}
|
||||
{{#each details.allowed_groups}}
|
||||
<div class='user group'>
|
||||
#{{unbound name}}
|
||||
</div>
|
||||
{{/grouped-each}}
|
||||
{{#grouped-each details.allowed_users}}
|
||||
{{/each}}
|
||||
{{#each details.allowed_users}}
|
||||
<div class='user'>
|
||||
{{#link-to 'user' this}}
|
||||
{{avatar this imageSize="small"}}
|
||||
|
@ -17,7 +17,7 @@
|
|||
<a class='remove-invited' {{action "removeAllowedUser" this}}><i class="fa fa-times"></i></a>
|
||||
{{/if}}
|
||||
</div>
|
||||
{{/grouped-each}}
|
||||
{{/each}}
|
||||
</div>
|
||||
{{#if details.can_invite_to}}
|
||||
<div class='controls'>
|
||||
|
|
|
@ -46,7 +46,9 @@
|
|||
{{/if}}
|
||||
{{#if showPosterAvatar}}
|
||||
<li {{bind-attr class=":avatars mapCollapsed::hidden"}}>
|
||||
{{#grouped-each participant in details.fewParticipants}}{{topic-participant participant=participant}}{{/grouped-each}}
|
||||
{{#each details.fewParticipants}}
|
||||
{{topic-participant participant=this}}
|
||||
{{/each}}
|
||||
</li>
|
||||
{{/if}}
|
||||
</ul>
|
||||
|
@ -54,14 +56,16 @@
|
|||
|
||||
{{#unless mapCollapsed}}
|
||||
<section class='avatars clearfix'>
|
||||
{{#grouped-each participant in details.participants}}{{topic-participant participant=participant}}{{/grouped-each}}
|
||||
{{#each details.participants}}
|
||||
{{topic-participant participant=this}}
|
||||
{{/each}}
|
||||
</section>
|
||||
|
||||
{{#if infoLinks}}
|
||||
<section class='links'>
|
||||
|
||||
<table class='topic-links'>
|
||||
{{#grouped-each infoLinks}}
|
||||
{{#each infoLinks}}
|
||||
<tr>
|
||||
<td>
|
||||
<span class='badge badge-notification clicks' title='{{i18n topic_map.clicks count=clicks}}'>{{clicks}}</span>
|
||||
|
@ -73,7 +77,7 @@
|
|||
{{link-domain this}}
|
||||
</td>
|
||||
</tr>
|
||||
{{/grouped-each}}
|
||||
{{/each}}
|
||||
</table>
|
||||
|
||||
{{#if showAllLinksControls}}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue