mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-04-13 01:08:50 +00:00
(fix #147) can now add multiple mail labels
This commit is contained in:
@@ -353,3 +353,11 @@ function contrast(hex) {
|
||||
return 'white';
|
||||
}
|
||||
}
|
||||
|
||||
function guid() {
|
||||
function S4() {
|
||||
return (((1+Math.random())*0x10000)|0).toString(16).substring(1);
|
||||
}
|
||||
|
||||
return (S4() + S4() + "-" + S4() + "-4" + S4().substr(0,3) + "-" + S4() + "-" + S4() + S4() + S4()).toLowerCase();
|
||||
}
|
||||
|
||||
@@ -166,8 +166,13 @@
|
||||
|
||||
// We swap _$key -> $key to avoid an Angular bug (https://github.com/angular/angular.js/issues/6266)
|
||||
labels = _.object(_.map(preferences.defaults.SOGoMailLabelsColors, function(value, key) {
|
||||
if (key.charAt(0) == '_' && key.charAt(1) == '$')
|
||||
if (key.charAt(0) == '_' && key.charAt(1) == '$') {
|
||||
// New key, let's take the value and flatten it
|
||||
if (key.length > 2 && key.charAt(2) == '$') {
|
||||
return [value[0].toLowerCase().replace(/[ \(\)\/\{%\*<>\\\"]/g, "_"), value];
|
||||
}
|
||||
return [key.substring(1), value];
|
||||
}
|
||||
return [key, value];
|
||||
}));
|
||||
|
||||
|
||||
@@ -148,7 +148,9 @@
|
||||
}
|
||||
|
||||
function addMailLabel() {
|
||||
vm.preferences.defaults.SOGoMailLabelsColors.new_label = ["New label", "#aaa"];
|
||||
// See $omit() in the Preferences services for real key generation
|
||||
var key = '_$$' + guid();
|
||||
vm.preferences.defaults.SOGoMailLabelsColors[key] = ["New label", "#aaa"];
|
||||
}
|
||||
|
||||
function removeMailLabel(key) {
|
||||
|
||||
Reference in New Issue
Block a user