2015-05-06 04:06:13 +02:00
|
|
|
/* -*- Mode: javascript; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
|
|
|
|
(function() {
|
2015-10-14 15:58:32 +02:00
|
|
|
/* jshint validthis: true */
|
2015-05-06 04:06:13 +02:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
/*
|
2015-11-14 20:29:21 +01:00
|
|
|
* sgFolderStylesheet - Add CSS stylesheet for a folder's color (addressbook or calendar)
|
2015-05-06 04:06:13 +02:00
|
|
|
* @memberof SOGo.Common
|
|
|
|
* @restrict attribute
|
|
|
|
* @param {object} ngModel - the object literal describing the folder (an Addressbook or Calendar instance)
|
|
|
|
* @example:
|
|
|
|
|
2015-11-14 20:29:21 +01:00
|
|
|
<sg-folder-stylesheet
|
2015-05-06 04:06:13 +02:00
|
|
|
ng-repeat="calendar in calendars.list"
|
|
|
|
ng-model="calendar" />
|
|
|
|
*/
|
|
|
|
function sgFolderStylesheet() {
|
|
|
|
return {
|
2015-11-14 20:29:21 +01:00
|
|
|
restrict: 'E',
|
2015-05-06 04:06:13 +02:00
|
|
|
require: 'ngModel',
|
|
|
|
scope: {
|
|
|
|
ngModel: '='
|
|
|
|
},
|
2015-11-14 20:29:21 +01:00
|
|
|
replace: true,
|
2015-10-14 15:58:32 +02:00
|
|
|
bindToController: true,
|
|
|
|
controller: sgFolderStylesheetController,
|
|
|
|
controllerAs: 'cssCtrl',
|
2015-05-06 04:06:13 +02:00
|
|
|
template: [
|
|
|
|
'<style type="text/css">',
|
2015-10-14 15:58:32 +02:00
|
|
|
/* Background color */
|
2016-04-21 19:40:47 +02:00
|
|
|
' .bg-folder{{ cssCtrl.ngModel.id }} {',
|
2015-10-14 15:58:32 +02:00
|
|
|
' background-color: {{ cssCtrl.ngModel.color }} !important;',
|
|
|
|
' color: {{ cssCtrl.contrast(cssCtrl.ngModel.color) }} !important;',
|
2015-05-06 04:06:13 +02:00
|
|
|
' }',
|
2015-11-14 20:29:21 +01:00
|
|
|
' .sg-event.bg-folder{{ cssCtrl.ngModel.id }} md-icon {',
|
|
|
|
' color: {{ cssCtrl.contrast(cssCtrl.ngModel.color) }} !important;',
|
|
|
|
' }',
|
2015-10-14 15:58:32 +02:00
|
|
|
// Set the contrast color of toolbar icons except the one of the background
|
|
|
|
' md-toolbar.bg-folder{{ cssCtrl.ngModel.id }} md-icon:not(.sg-icon-toolbar-bg) {',
|
|
|
|
' color: {{ cssCtrl.contrast(cssCtrl.ngModel.color) }} !important;',
|
2015-05-06 04:06:13 +02:00
|
|
|
' }',
|
2015-10-14 15:58:32 +02:00
|
|
|
// Set the contrast color of input labels
|
2016-03-08 19:20:34 +01:00
|
|
|
' .bg-folder{{ cssCtrl.ngModel.id }} label,',
|
|
|
|
' .bg-folder{{ cssCtrl.ngModel.id }} .md-input {',
|
2015-10-14 15:58:32 +02:00
|
|
|
' color: {{ cssCtrl.contrast(cssCtrl.ngModel.color) }} !important;',
|
|
|
|
' opacity: 0.8;',
|
2015-09-29 20:01:16 +02:00
|
|
|
' }',
|
2015-10-14 15:58:32 +02:00
|
|
|
/* Foreground color */
|
2015-11-20 19:30:26 +01:00
|
|
|
' .fg-folder{{ cssCtrl.ngModel.id }},',
|
|
|
|
' .sg-event.fg-folder{{ cssCtrl.ngModel.id }} md-icon {',
|
2015-10-14 15:58:32 +02:00
|
|
|
' color: {{ cssCtrl.ngModel.color }} !important;',
|
|
|
|
' }',
|
|
|
|
/* Border color */
|
|
|
|
' .bdr-folder{{ cssCtrl.ngModel.id }} {',
|
|
|
|
' border-color: {{ cssCtrl.ngModel.color }} !important;',
|
|
|
|
' }',
|
2016-04-22 16:50:19 +02:00
|
|
|
' .contrast-bdr-folder{{ cssCtrl.ngModel.id }} {',
|
|
|
|
' border-color: {{ cssCtrl.contrast(cssCtrl.ngModel.color) }} !important;',
|
|
|
|
' }',
|
2015-10-14 15:58:32 +02:00
|
|
|
/* Checkbox color */
|
2016-07-12 17:29:24 +02:00
|
|
|
' .checkbox-folder{{ cssCtrl.ngModel.id }} .md-icon {',
|
2015-10-14 15:58:32 +02:00
|
|
|
' background-color: {{ cssCtrl.ngModel.color }} !important;',
|
|
|
|
' }',
|
2016-07-12 17:29:24 +02:00
|
|
|
' .checkbox-folder{{ cssCtrl.ngModel.id }}.md-checked .md-icon:after {',
|
2015-10-14 15:58:32 +02:00
|
|
|
' border-color: {{ cssCtrl.contrast(cssCtrl.ngModel.color) }} !important;',
|
2015-05-06 04:06:13 +02:00
|
|
|
' }',
|
|
|
|
'</style>'
|
|
|
|
].join('')
|
2015-07-24 22:14:53 +02:00
|
|
|
};
|
2015-10-14 15:58:32 +02:00
|
|
|
|
|
|
|
function sgFolderStylesheetController() {
|
|
|
|
var vm = this;
|
|
|
|
|
2016-04-22 16:50:19 +02:00
|
|
|
vm.contrast = contrast; // defined in Common/utils.js
|
2015-10-14 15:58:32 +02:00
|
|
|
}
|
2015-05-06 04:06:13 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
angular
|
|
|
|
.module('SOGo.Common')
|
|
|
|
.directive('sgFolderStylesheet', sgFolderStylesheet);
|
|
|
|
})();
|