Merge pull request #4487 from BigFunger/pluralization-fix

Fixes pluralization on saved object finder
This commit is contained in:
Jonathan Budzenski 2015-07-23 16:27:21 -05:00
commit 632a019514
2 changed files with 7 additions and 4 deletions

View file

@ -11,7 +11,7 @@ define(function (require) {
service: savedSearches,
name: 'searches',
noun: 'Saved Search',
nouns: 'searches'
nouns: 'saved searches'
},
visualizations: {
service: savedVisualizations,
@ -220,6 +220,10 @@ define(function (require) {
$location.url('/settings/objects?_a=' + rison.encode({tab: type}));
};
self.hitCountNoun = function () {
return ((self.hitCount === 1) ? self.objectType.noun : self.objectType.nouns).toLowerCase();
};
function selectTopHit() {
setTimeout(function () {
//triggering a focus event kicks off a new angular digest cycle.
@ -244,7 +248,7 @@ define(function (require) {
// ensure that we don't display old results
// as we can't really cancel requests
if (currentFilter === filter) {
$scope.hitCount = hits.total;
self.hitCount = hits.total;
self.hits = _.sortBy(hits.hits, 'title');
}
});

View file

@ -13,7 +13,7 @@
name="filter"
type="text" />
<span class="finder-hit-count"><strong>{{hitCount}}</strong> {{finder.objectType.name}}</span>
<span class="finder-hit-count"><strong>{{finder.hitCount}}</strong> {{finder.hitCountNoun()}}</span>
</div>
</form>
<paginate list="finder.hits" per-page="5">
@ -40,7 +40,6 @@
<li
class="list-group-item list-group-no-results"
ng-if="finder.hits.length === 0">
<p ng-bind="'No matching ' + finder.objectType.nouns + ' found.'"></p>
</li>
</ul>