(feat) "Materialization" of the IMIP handling template

This commit is contained in:
Ludovic Marcotte
2015-06-12 12:03:59 -04:00
committed by Francis Lachapelle
parent fb992db5ad
commit 8124faa6d4
13 changed files with 453 additions and 220 deletions
@@ -291,6 +291,25 @@
return Message.$$resource.post(this.$mailbox.$id(), 'addOrRemoveLabel', data);
};
/**
* @function $imipAction
* @memberof Message.prototype
* @desc Perform IMIP actions on the current message.
* @param {string} path - the path of the IMIP calendar part
* @param {string} action - the the IMIP action to perform
* @param {object} data - the delegation info
*/
Message.prototype.$imipAction = function(path, action, data) {
var _this = this;
Message.$$resource.post([this.id, path].join('/'), action, data).then(function(data) {
Message.$timeout(function() {
_this.$reload();
}, function() {
// TODO: show toast
});
});
};
/**
* @function $markAsFlaggedOrUnflagged
* @memberof Message.prototype
@@ -0,0 +1,54 @@
/* -*- Mode: javascript; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
(function() {
'use strict';
/**
* sgIMIP - A directive to handle IMIP actions on emails
* @memberof SOGo.MailerUI
* @ngInject
* @example:
*/
function sgImip() {
return {
restrict: 'A',
link: link,
controller: controller
};
function link(scope, iElement, attrs, ctrl) {
ctrl.pathToAttachment = attrs.sgImipPath;
}
controller.$inject = ['$scope', 'User'];
function controller($scope, User) {
var vm = this;
$scope.delegateInvitation = false;
$scope.delegatedTo = '';
$scope.searchText = '';
$scope.userFilter = function($query) {
return User.$filter($query);
};
$scope.iCalendarAction = function(action) {
var data;
if (action == 'delegate') {
data = {receiveUpdates: false,
delegatedTo: $scope.delegatedTo.c_email};
}
$scope.message.$imipAction(vm.pathToAttachment, action, data);
};
}
}
angular
.module('SOGo.MailerUI')
.directive('sgImip', sgImip);
})();
@@ -85,3 +85,28 @@
margin-right: 0;
margin-left: 0;
}
.sg-accepted {
@extend .md-tile-left-accepted;
margin-right: 0;
margin-left: 0;
}
.sg-declined {
@extend .md-tile-left-declined;
margin-right: 0;
margin-left: 0;
}
.sg-delegated {
@extend .md-tile-left-delegated;
margin-right: 0;
margin-left: 0;
}
.sg-needs-action {
@extend .md-tile-left-needs-action;
margin-right: 0;
margin-left: 0;
}
.sg-tentative {
@extend .md-tile-left-tentative;
margin-right: 0;
margin-left: 0;
}
@@ -99,3 +99,31 @@ div.md-tile-left {
@extend .md-tile-left;
content: "\f299";
}
.md-tile-left-accepted:before {
@extend .md-tile-left;
background-color: rgba(0, 255, 0, 0.3) !important;
content: "\f299";
color: rgba(0, 0, 0, 0.5);
}
.md-tile-left-declined:before {
@extend .md-tile-left;
background-color: rgba(255, 0, 0, 0.3) !important;
content: "\f111";
color: rgba(0, 0, 0, 0.5);
}
.md-tile-left-delegated:before {
@extend .md-tile-left;
background-color: rgba(192, 192, 192, 0.3) !important;
content: "\f298";
color: rgba(0, 0, 0, 0.5);
}
.md-tile-left-needs-action:before {
@extend .md-tile-left;
background-color: rgba(255, 255, 0, 0.3) !important;
content: "?";
}
.md-tile-left-tentative:before {
@extend .md-tile-left;
background-color: rgba(255, 255, 0, 0.3) !important;
content: "\f2d8";
}