mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-10-28 21:35:43 +00:00
Use address books search fields in Contacts module
Searches can now be scoped to one or multiple fields. Those fields are now dynamic and can be defined using SearchFieldNames in external contacts sources (SQL and LDAP).
This commit is contained in:
1 parent
aed62cab26
commit
eb90760b39
19 files changed
+275
-137
No files matched your search
@@ -20,7 +20,7 @@
|
||||
<md-input-container>
|
||||
<input name="search" type="search"/>
|
||||
</md-input-container>
|
||||
<md-select class="sg-toolbar-sort md-contrast-light">
|
||||
<md-select multiple>
|
||||
<md-option value="subject">Subject</md-option>
|
||||
<md-option value="sender">sender</md-option>
|
||||
</md-select>
|
||||
@@ -67,6 +67,9 @@
|
||||
// Associate the sg-allow-dot parameter (boolean) to the controller
|
||||
controller.allowDot = $parse(iElement.attr('sg-allow-dot'))(scope);
|
||||
|
||||
// Associate the sg-search-fields parameter (array) to the controller
|
||||
controller.fields = $parse(iElement.attr('sg-search-fields'))(scope);
|
||||
|
||||
// Associate callback to controller
|
||||
controller.doSearch = $parse(iElement.attr('sg-search'));
|
||||
|
||||
@@ -114,6 +117,14 @@
|
||||
}
|
||||
};
|
||||
|
||||
if ($element.attr('sg-search-fields')) {
|
||||
var waitforFieldsOnce = $scope.$watch(vm.fields, function(value) {
|
||||
// Select all fields by default
|
||||
vm.searchField = _.clone(vm.fields);
|
||||
waitforFieldsOnce();
|
||||
});
|
||||
}
|
||||
|
||||
// Method to call on data changes
|
||||
vm.onChange = function() {
|
||||
var form = $scope[vm.formName],
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
$Card: Card,
|
||||
$$Acl: Acl,
|
||||
$Preferences: Preferences,
|
||||
$query: {search: 'name_or_address', value: '', sort: 'c_cn', asc: 1},
|
||||
$query: {value: '', sort: 'c_cn', asc: 1},
|
||||
activeUser: Settings.activeUser(),
|
||||
selectedFolder: null,
|
||||
$refreshTimeout: null
|
||||
@@ -497,7 +497,7 @@
|
||||
query.value = search;
|
||||
|
||||
return _this.$id().then(function(addressbookId) {
|
||||
var futureData = AddressBook.$$resource.fetch(addressbookId, 'view', query);
|
||||
var futureData = AddressBook.$$resource.post(addressbookId, 'view', query);
|
||||
|
||||
if (dry) {
|
||||
return futureData.then(function(response) {
|
||||
|
||||
Reference in new issue
Block a user