Replace findProperty and filterProperty with findBy and filterBy

This commit is contained in:
Robin Ward
2016-10-26 15:44:36 -04:00
parent 68b559d501
commit 7953a53cc5
35 changed files with 53 additions and 54 deletions
@@ -9,7 +9,7 @@ export default Ember.Controller.extend({
@computed('embedding.embeddable_hosts.@each.isCreated')
showSecondary() {
const hosts = this.get('embedding.embeddable_hosts');
return hosts.length && hosts.findProperty('isCreated');
return hosts.length && hosts.findBy('isCreated');
},
@computed('embedding.base_url')
@@ -5,7 +5,7 @@ export default Ember.Controller.extend({
filteredContent: function() {
if (!this.get('categoryNameKey')) { return []; }
const category = (this.get('adminSiteSettings.model') || []).findProperty('nameKey', this.get('categoryNameKey'));
const category = (this.get('adminSiteSettings.model') || []).findBy('nameKey', this.get('categoryNameKey'));
if (category) {
return category.siteSettings;
} else {
@@ -19,7 +19,7 @@ export default Ember.Controller.extend({
selectedCount: function() {
var model = this.get('model');
if (!model || !model.length) return 0;
return model.filterProperty('selected').length;
return model.filterBy('selected').length;
}.property('model.@each.selected'),
selectAllChanged: function() {
@@ -52,14 +52,14 @@ export default Ember.Controller.extend({
actions: {
approveUsers: function() {
AdminUser.bulkApprove(this.get('model').filterProperty('selected'));
AdminUser.bulkApprove(this.get('model').filterBy('selected'));
this._refreshUsers();
},
rejectUsers: function() {
var maxPostAge = this.siteSettings.delete_user_max_post_age;
var controller = this;
AdminUser.bulkReject(this.get('model').filterProperty('selected')).then(function(result){
AdminUser.bulkReject(this.get('model').filterBy('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});
@@ -13,7 +13,7 @@ export default Ember.Route.extend({
name: I18n.t('admin.badges.new_badge')
});
}
return this.modelFor('adminBadges').findProperty('id', parseInt(params.badge_id));
return this.modelFor('adminBadges').findBy('id', parseInt(params.badge_id));
},
actions: {
@@ -1,7 +1,7 @@
export default Ember.Route.extend({
model(params) {
const all = this.modelFor('adminCustomizeCssHtml');
const model = all.findProperty('id', parseInt(params.site_customization_id));
const model = all.findBy('id', parseInt(params.site_customization_id));
return model ? { model, section: params.section } : this.replaceWith('adminCustomizeCssHtml.index');
},
@@ -3,7 +3,7 @@ import { scrollTop } from 'discourse/mixins/scroll-top';
export default Ember.Route.extend({
model(params) {
const all = this.modelFor('adminCustomizeEmailTemplates');
return all.findProperty('id', params.id);
return all.findBy('id', params.id);
},
setupController(controller, emailTemplate) {
@@ -7,8 +7,7 @@ export default Discourse.Route.extend({
return Group.create({ automatic: false, visible: true });
}
const group = this.modelFor('adminGroupsType')
.findProperty('name', params.name);
const group = this.modelFor('adminGroupsType').findBy('name', params.name);
if (!group) { return this.transitionTo('adminGroups.index'); }