Merge pull request #2569 from lreeves/group-selector-datasource-finder

Move finder logic out of the group-selector component
This commit is contained in:
Robin Ward 2014-07-23 11:28:29 -04:00
commit b29b94046c
3 changed files with 11 additions and 4 deletions

View File

@ -34,8 +34,8 @@ export default Em.Component.extend({
return g.name;
},
dataSource: function(term) {
// TODO: Components should definitely not perform queries
return Discourse.Group.findAll({search: term, ignore_automatic: true}).then(function(groups){
return self.get("groupFinder")(term).then(function(groups){
if(!selectedGroups){
return groups;
}

View File

@ -80,6 +80,13 @@ export default Discourse.ObjectController.extend(Discourse.ModalFunctionality, {
}
}.property('isPrivateTopic'),
/**
Function to find groups.
**/
groupFinder: function(term) {
return Discourse.Group.findAll({search: term, ignore_automatic: true});
},
/**
The "success" text for when the invite was created.

View File

@ -15,7 +15,7 @@
{{#if isAdmin}}
<label>{{{groupInstructions}}}</label>
{{group-selector includeAuto=false groupNames=groupNames placeholderKey="topic.invite_private.group_name"}}
{{group-selector includeAuto=false groupFinder=groupFinder groupNames=groupNames placeholderKey="topic.invite_private.group_name"}}
{{/if}}
{{/if}}
</div>