1
0
mirror of https://github.com/nerzhul/ocsms.git synced 2025-06-09 00:46:17 +00:00

Simpler implementation for search & show search but it's not working yet

This commit is contained in:
Loic Blot 2016-12-15 23:16:08 +01:00
parent 4606fd1d39
commit 6527fe2d90
2 changed files with 17 additions and 33 deletions

View File

@ -39,31 +39,6 @@ function toBool(str) {
return null;
}
var SearchProxy = {};
(function(OC, _) {
'use strict';
var filter = function() {};
SearchProxy = {
attach: function(search) {
search.setFilter('phone', this.filterProxy);
},
filterProxy: function(query) {
filter(query);
},
setFilter: function(newFilter) {
filter = newFilter;
}
};
if (!_.isUndefined(OC.Plugins)) {
OC.Plugins.register('OCA.Search', SearchProxy);
}
})(OC, _);
app.directive('toInt', function() {
return {
require: 'ngModel',
@ -127,6 +102,7 @@ app.controller('OcSmsController', ['$scope', '$interval', '$timeout', '$compile'
$scope.totalMessageCount = 0;
$scope.photoVersion = 1;
$scope.selectedContact = {};
$scope.lastSearch = '';
// Settings
$scope.sendCountry = function () {
@ -313,9 +289,14 @@ app.controller('OcSmsController', ['$scope', '$interval', '$timeout', '$compile'
};
$scope.filterSms = function (query) {
alert('scope filter');
if (query != $scope.lastSearch) {
}
};
SearchProxy.setFilter($scope.filterSms);
OC.Plugins.register('OCA.Search', {
attach: function(search) {
search.setFilter('sms', $scope.filterSms);
}
});
/*
* Contact list management

View File

@ -78,6 +78,7 @@ use \OCA\OcSms\Lib\CountryCodes;
</div>
<div id="app-content-wrapper" ng-show="!isConvLoading">
<div ng-show="messages.length == 0" id="ocsms-empty-conversation">Please choose a conversation on the left menu</div>
<div ng-show="messages.length > 0">
<div ng-repeat="message in messages | orderBy:'date'">
<div class="msg-{{ message.type }}">
<div>{{ message.content }}</div>
@ -86,6 +87,8 @@ use \OCA\OcSms\Lib\CountryCodes;
</div>
<div class="msg-spacer"></div>
</div>
<div id="searchresults"></div>
</div>
</div>
</div>
</div>