Upgrade to Ember 1.7.1 + group patch

This commit is contained in:
Robin Ward
2014-10-31 17:35:27 -04:00
parent c32df362d4
commit a6b1be81b1
15 changed files with 47411 additions and 46233 deletions

View File

@@ -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);
});
}

View File

@@ -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);
}
}
});

View File

@@ -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);
});
}

View File

@@ -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'),

View File

@@ -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);
}
}
});