Fix no search result message.

This commit is contained in:
Alexander Weidinger 2016-03-17 02:09:33 +01:00 committed by Hendrik Leppelsack
parent 4f58b84938
commit 54a7de52c1
4 changed files with 74 additions and 15 deletions

View File

@ -4,12 +4,12 @@ app.controller('contactlistCtrl', function($scope, $filter, $route, $routeParams
ctrl.routeParams = $routeParams;
ctrl.t = {
addContact : t('contacts', 'Add contact'),
emptySearch : t('contacts', 'No search result for {ctrl.query}')
emptySearch : t('contacts', 'No search result for')
};
ctrl.contactList = [];
ctrl.query = '';
ctrl.selectedContactId = undefined;
ctrl.searchTerm = '';
$scope.query = function(contact) {
return contact.matches(SearchService.getSearchTerm());
@ -25,7 +25,7 @@ app.controller('contactlistCtrl', function($scope, $filter, $route, $routeParams
$scope.$apply();
}
if (ev.event === 'changeSearch') {
ctrl.query = ev.searchTerm;
ctrl.searchTerm = ev.searchTerm;
$scope.$apply();
}
});

File diff suppressed because one or more lines are too long

View File

@ -10,7 +10,7 @@ app.service('SearchService', function() {
var notifyObservers = function(eventName) {
var ev = {
event:eventName,
searchTerm:this.searchTerm
searchTerm:searchTerm
};
angular.forEach(observerCallbacks, function(callback) {
callback(ev);

View File

@ -1,12 +1,12 @@
<button class="app-content-list-button" type="button" name="button" ng-click="ctrl.createContact()">{{ctrl.t.addContact}}</button>
<div ng-if="ctrl.contactList===[]">
<div id="emptysearch" class="">
<div class="icon-search"></div>
<h2>{{ctrl.t.emptySearch}}</h2>
</div>
</div>
<div class="app-content-list-item"
ng-repeat="contact in ctrl.contactList = (ctrl.contacts | contactGroupFilter:ctrl.routeParams.gid | orderBy:'fullName()' | filter:query) track by contact.uid()"
contact data="contact"
ng-click="setSelected(contact.uid())" ng-class="{active: contact.uid() === ctrl.selectedContactId}">
</div>
<div ng-show="!ctrl.contactList.length">
<div id="emptysearch" class="">
<div class="icon-search"></div>
<h2>{{ctrl.t.emptySearch}} {{ctrl.searchTerm}}</h2>
</div>
</div>