1
0
mirror of https://github.com/moparisthebest/mail synced 2025-01-10 21:18:02 -05:00

[WO-283] Implement BCC and dynamic address headers for writer

This commit is contained in:
Tankred Hase 2014-04-22 16:41:07 +02:00
parent d0c59fc58f
commit 138a462862
6 changed files with 95 additions and 11 deletions

View File

@ -48,9 +48,11 @@ define(function(require) {
$scope.to = [{
address: ''
}];
$scope.showCC = false;
$scope.cc = [{
address: ''
}];
$scope.showBCC = false;
$scope.bcc = [{
address: ''
}];
@ -85,6 +87,7 @@ define(function(require) {
$scope.cc.unshift({
address: recipient.address
});
$scope.showCC = true;
});
$scope.cc.forEach($scope.verify);
}
@ -404,6 +407,11 @@ define(function(require) {
scope.$apply();
}
function removeInput(field, index, scope) {
field.splice(index, 1);
scope.$apply();
}
function checkForEmptyInput(field) {
var emptyFieldExists = false;
field.forEach(function(recipient) {
@ -415,6 +423,18 @@ define(function(require) {
return emptyFieldExists;
}
function cleanupEmptyInputs(field, scope) {
var i;
for (i = field.length - 2; i >= 0; i--) {
if (!field[i].address) {
field.splice(i, 1);
}
}
scope.$apply();
}
ngModule.directive('field', function() {
return {
//scope: true, // optionally create a child scope
@ -455,6 +475,8 @@ define(function(require) {
// create new field input
addInput(field, scope);
}
cleanupEmptyInputs(field, scope);
});
element.on('keydown', function(e) {
@ -476,8 +498,7 @@ define(function(require) {
// backspace, delete on empty input
// remove input
e.preventDefault();
field.splice(index, 1);
scope.$apply();
removeInput(field, index, scope);
// focus on previous id
var previousId = fieldName + (index - 1);
document.getElementById(previousId).focus();

18
src/sass/_angular-csp.scss Executable file
View File

@ -0,0 +1,18 @@
/* Include this file in your html if you are using the CSP mode. */
@charset "UTF-8";
[ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak],
.ng-cloak, .x-ng-cloak,
.ng-hide {
display: none !important;
}
ng\:form {
display: block;
}
.ng-animate-block-transitions {
transition:0s all!important;
-webkit-transition:0s all!important;
}

View File

@ -8,6 +8,7 @@
@import "fonts";
@import "responsive";
@import "scaffolding";
@import "angular-csp"; // use angular csp specific classes
// Components
@import "components/buttons";

View File

@ -46,6 +46,14 @@
}
}
.label-blank {
background-color: transparent;
color: $color-black;
text-align: left;
padding-left: 0;
padding-right: 0;
}
.label-light {
background-color: $label-light-back-color;
color: $label-light-color;

View File

@ -25,18 +25,44 @@
margin-top: 10px;
p {
margin: 0.2em 0;
padding: 0.2em 0;
margin: 0.4em 0 0.2em;
cursor: text;
}
span {
.label {
margin-bottom: 0.2em;
}
label {
display: inline-block;
width: 2em;
color: $color-grey;
}
input {
margin-left: 0.3em;
width: 80%;
}
}
.headers-more {
float: right;
margin: 0.4em 0;
button {
display: inline-block;
background: none;
padding: 0 0.5em;
margin: 0;
text-decoration: none;
color: $color-black;
transition: color 0.3s;
outline: 0;
&:hover,
&:focus {
color: $color-blue;
text-decoration: underline;
}
}
}

View File

@ -7,16 +7,26 @@
<div class="view-write">
<div class="headers">
<div class="headers-more">
<button ng-click="showCC = true;" ng-hide="showCC">Cc</button>
<button ng-click="showBCC = true;" ng-hide="showBCC">Bcc</button>
</div>
<p field="to">
<span>To:</span>
<label>To:</label>
<span ng-repeat="recipient in to track by $index">
<input id="to{{$index}}" value="{{recipient.address}}" ng-model="recipient.address" ng-trim="false" ng-class="{'label': recipient.secure === true, 'label label-primary': recipient.secure === false && recipient.valid !== true}" auto-size="recipient.address" spellcheck="false" ng-change="onAddressUpdate(to, $index)" address-input="to" tabindex="1" ng-mouseover="getKeyId(recipient)" focus-me="state.writer.open && writerTitle !== 'Reply'">
<input id="to{{$index}}" value="{{recipient.address}}" ng-model="recipient.address" ng-trim="false" class="label" ng-class="{'label-blank': !recipient.address || recipient.secure === undefined, 'label-primary': recipient.secure === false}" auto-size="recipient.address" spellcheck="false" ng-change="onAddressUpdate(to, $index)" address-input="to" tabindex="1" ng-mouseover="getKeyId(recipient)" focus-me="state.writer.open && writerTitle !== 'Reply'">
</span>
</p>
<p field="cc">
<span>Cc:</span>
<p field="cc" ng-show="showCC === true">
<label>Cc:</label>
<span ng-repeat="recipient in cc track by $index">
<input id="cc{{$index}}" value="{{recipient.address}}" ng-model="recipient.address" ng-trim="false" ng-class="{'label': recipient.secure === true, 'label label-primary': recipient.secure === false && recipient.valid !== true}" auto-size="recipient.address" spellcheck="false" ng-change="onAddressUpdate(cc, $index)" address-input="cc" tabindex="1" ng-mouseover="getKeyId(recipient)">
<input id="cc{{$index}}" value="{{recipient.address}}" ng-model="recipient.address" ng-trim="false" class="label" ng-class="{'label-blank': !recipient.address || recipient.secure === undefined, 'label-primary': recipient.secure === false}" auto-size="recipient.address" spellcheck="false" ng-change="onAddressUpdate(cc, $index)" address-input="cc" tabindex="1" ng-mouseover="getKeyId(recipient)">
</span>
</p>
<p field="bcc" ng-show="showBCC === true">
<label>Bcc:</label>
<span ng-repeat="recipient in bcc track by $index">
<input id="bcc{{$index}}" value="{{recipient.address}}" ng-model="recipient.address" ng-trim="false" class="label" ng-class="{'label-blank': !recipient.address || recipient.secure === undefined, 'label-primary': recipient.secure === false}" auto-size="recipient.address" spellcheck="false" ng-change="onAddressUpdate(bcc, $index)" address-input="bcc" tabindex="1" ng-mouseover="getKeyId(recipient)">
</span>
</p>
</div><!--/.headers-->