mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-07-17 14:24:52 +00:00
(feat) chips for mail labels
This commit is contained in:
committed by
Francis Lachapelle
parent
8e0230488f
commit
b0318ca7b6
@@ -40,7 +40,8 @@
|
||||
$timeout: $timeout,
|
||||
$log: $log,
|
||||
$sce: $sce,
|
||||
$$resource: new Resource(Settings.baseURL, Settings.activeUser)
|
||||
$$resource: new Resource(Settings.baseURL, Settings.activeUser),
|
||||
$tags: window.UserDefaults.SOGoMailLabelsColors
|
||||
});
|
||||
|
||||
return Message; // return constructor
|
||||
@@ -50,6 +51,21 @@
|
||||
angular.module('SOGo.MailerUI')
|
||||
.factory('sgMessage', Message.$factory);
|
||||
|
||||
/**
|
||||
* @function filterTags
|
||||
* @memberof Message.prototype
|
||||
* @desc Search for tags (ie., mail labels) matching some criterias
|
||||
* @param {string} search - the search string to match
|
||||
* @returns a collection of strings
|
||||
*/
|
||||
Message.filterTags = function(query) {
|
||||
var re = new RegExp(query, 'i');
|
||||
return _.filter(_.keys(Message.$tags), function(tag) {
|
||||
var value = Message.$tags[tag];
|
||||
return value[0].search(re) != -1;
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @function $absolutePath
|
||||
* @memberof Message.prototype
|
||||
@@ -193,6 +209,16 @@
|
||||
return deferred.promise;
|
||||
};
|
||||
|
||||
Message.prototype.$addOrRemoveTag = function(operation, tag) {
|
||||
var data = {};
|
||||
|
||||
data['operation'] = operation;
|
||||
data['msgUIDs'] = [ this.uid ];
|
||||
data['flags'] = tag;
|
||||
|
||||
return Message.$$resource.post(this.$mailbox.$id(), 'addOrRemoveLabel', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @function $reload
|
||||
* @memberof Message.prototype
|
||||
@@ -342,7 +368,7 @@
|
||||
deferred = Message.$q.defer();
|
||||
|
||||
// Expose the promise
|
||||
this.$futureMessageData = futureMessageData;
|
||||
this.$futureMessageData = futureMessageData;
|
||||
|
||||
// Resolve the promise
|
||||
this.$futureMessageData.then(function(data) {
|
||||
|
||||
@@ -239,6 +239,12 @@
|
||||
|
||||
.controller('MessageCtrl', ['$scope', '$rootScope', '$stateParams', '$state', 'stateAccount', 'stateMailbox', 'stateMessage', '$timeout', 'encodeUriFilter', 'sgFocus', 'sgDialog', 'sgAccount', 'sgMailbox', function($scope, $rootScope, $stateParams, $state, stateAccount, stateMailbox, stateMessage, $timeout, encodeUriFilter, focus, Dialog, Account, Mailbox) {
|
||||
$rootScope.message = stateMessage;
|
||||
$scope.tags = {};
|
||||
$scope.addOrRemoveTag = function(operation, tag) {
|
||||
if (tag) {
|
||||
stateMessage.$addOrRemoveTag(operation, tag);
|
||||
}
|
||||
};
|
||||
$scope.doDelete = function() {
|
||||
stateMailbox.$deleteMessages([stateMessage.uid]).then(function() {
|
||||
// Remove card from list of addressbook
|
||||
|
||||
Reference in New Issue
Block a user