mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-30 20:49:20 +03:00
Contacts improvements (Added URL and Nickname fields)
This commit is contained in:
parent
f36cb72b82
commit
ef880319c6
42 changed files with 831 additions and 279 deletions
|
|
@ -296,6 +296,8 @@ Enums.ContactPropertyType = {
|
|||
'Phone': 31,
|
||||
'Web': 32,
|
||||
|
||||
'Birthday': 40,
|
||||
|
||||
'Facebook': 90,
|
||||
'Skype': 91,
|
||||
'GitHub': 92,
|
||||
|
|
|
|||
|
|
@ -22,4 +22,9 @@ function ContactPropertyModel(iType, sTypeStr, sValue, bFocused, sPlaceholder)
|
|||
var sPlaceholder = this.placeholder();
|
||||
return sPlaceholder ? Utils.i18n(sPlaceholder) : '';
|
||||
}, this);
|
||||
|
||||
this.largeValue = ko.computed(function () {
|
||||
return Enums.ContactPropertyType.Note === this.type();
|
||||
}, this);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -255,7 +255,7 @@
|
|||
-webkit-overflow-scrolling: touch;
|
||||
}
|
||||
|
||||
.contactValueStatic {
|
||||
.contactValueStatic, .contactValueLargeStatic, .contactValueTextAreaStatic {
|
||||
height: 20px;
|
||||
line-height: 20px;
|
||||
font-size: 18px;
|
||||
|
|
@ -266,11 +266,11 @@
|
|||
}
|
||||
|
||||
&.read-only {
|
||||
.contactValueStatic {
|
||||
.contactValueStatic, .contactValueLargeStatic, .contactValueTextAreaStatic {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.contactValueInput {
|
||||
.contactValueInput, .contactValueInputLarge, .contactValueTextArea {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
|
@ -303,12 +303,12 @@
|
|||
color: #aaa;
|
||||
}
|
||||
|
||||
.contactValueStatic {
|
||||
.contactValueStatic, .contactValueLargeStatic, .contactValueTextAreaStatic {
|
||||
font-size: 18px;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.contactValueInput {
|
||||
.contactValueInput, .contactValueInputLarge, .contactValueTextArea {
|
||||
.box-shadow(none);
|
||||
border-color: #fff;
|
||||
font-size: 18px;
|
||||
|
|
@ -337,6 +337,14 @@
|
|||
color: #ddd;
|
||||
}
|
||||
}
|
||||
|
||||
.contactValueTextArea {
|
||||
width: 300px;
|
||||
}
|
||||
|
||||
.contactValueInputLarge {
|
||||
width: 400px;
|
||||
}
|
||||
|
||||
.hasError {
|
||||
.contactValueInput {
|
||||
|
|
@ -376,6 +384,12 @@
|
|||
}
|
||||
}
|
||||
|
||||
.button-add-prop {
|
||||
position: absolute;
|
||||
top: 60px;
|
||||
right: 20px;
|
||||
}
|
||||
|
||||
&.read-only {
|
||||
.e-read-only-sign {
|
||||
display: inline-block;
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ html.ssm-state-desktop-large {
|
|||
}
|
||||
|
||||
.b-contacts-content.modal {
|
||||
width: 800px;
|
||||
width: 900px;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -112,7 +112,7 @@ html.ssm-state-desktop {
|
|||
}
|
||||
|
||||
.b-contacts-content.modal {
|
||||
width: 800px;
|
||||
width: 900px;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -169,7 +169,7 @@ html.ssm-state-tablet {
|
|||
}
|
||||
|
||||
.b-contacts-content.modal {
|
||||
width: 700px;
|
||||
width: 800px;
|
||||
}
|
||||
|
||||
.b-contacts-content.modal {
|
||||
|
|
|
|||
|
|
@ -175,6 +175,18 @@ html.rgba.textshadow {
|
|||
border-bottom-right-radius: @btnBorderRadius;
|
||||
}
|
||||
|
||||
.dropdown.colored-toggle.open .btn.dropdown-toggle {
|
||||
color: #BD362F;
|
||||
|
||||
.caret {
|
||||
border-top-color: #BD362F;
|
||||
}
|
||||
|
||||
[class^="icon-"]:before {
|
||||
color: #BD362F;
|
||||
}
|
||||
}
|
||||
|
||||
textarea, input[type="text"], input[type="password"], input[type="email"], input[type="search"] {
|
||||
|
||||
border: @rlInputBorderSize solid @inputBorder;
|
||||
|
|
|
|||
|
|
@ -47,8 +47,30 @@ function PopupsContactsViewModel()
|
|||
this.viewSaveTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.viewPropertiesNames = this.viewProperties.filter(function(oProperty) {
|
||||
return -1 < Utils.inArray(oProperty.type(), [Enums.ContactPropertyType.FirstName, Enums.ContactPropertyType.LastName]);
|
||||
return -1 < Utils.inArray(oProperty.type(), [
|
||||
Enums.ContactPropertyType.FirstName, Enums.ContactPropertyType.LastName
|
||||
]);
|
||||
});
|
||||
|
||||
this.viewPropertiesOther = this.viewProperties.filter(function(oProperty) {
|
||||
return -1 < Utils.inArray(oProperty.type(), [
|
||||
Enums.ContactPropertyType.Note
|
||||
]);
|
||||
});
|
||||
|
||||
this.viewPropertiesOther = ko.computed(function () {
|
||||
|
||||
var aList = _.filter(this.viewProperties(), function (oProperty) {
|
||||
return -1 < Utils.inArray(oProperty.type(), [
|
||||
Enums.ContactPropertyType.Nick
|
||||
]);
|
||||
});
|
||||
|
||||
return _.sortBy(aList, function (oProperty) {
|
||||
return oProperty.type();
|
||||
});
|
||||
|
||||
}, this);
|
||||
|
||||
this.viewPropertiesEmails = this.viewProperties.filter(function(oProperty) {
|
||||
return Enums.ContactPropertyType.Email === oProperty.type();
|
||||
|
|
@ -94,6 +116,13 @@ function PopupsContactsViewModel()
|
|||
return '' === Utils.trim(oProperty.value()) && !bF;
|
||||
});
|
||||
|
||||
this.viewPropertiesOtherEmptyAndOnFocused = ko.computed(function () {
|
||||
return _.filter(this.viewPropertiesOther(), function (oProperty) {
|
||||
var bF = oProperty.focused();
|
||||
return '' === Utils.trim(oProperty.value()) && !bF;
|
||||
});
|
||||
}, this);
|
||||
|
||||
this.viewPropertiesEmailsEmptyAndOnFocused.subscribe(function(aList) {
|
||||
fFastClearEmptyListHelper(aList);
|
||||
});
|
||||
|
|
@ -106,6 +135,10 @@ function PopupsContactsViewModel()
|
|||
fFastClearEmptyListHelper(aList);
|
||||
});
|
||||
|
||||
this.viewPropertiesOtherEmptyAndOnFocused.subscribe(function(aList) {
|
||||
fFastClearEmptyListHelper(aList);
|
||||
});
|
||||
|
||||
this.viewSaving = ko.observable(false);
|
||||
|
||||
this.useCheckboxesInList = RL.data().useCheckboxesInList;
|
||||
|
|
@ -314,11 +347,44 @@ function PopupsContactsViewModel()
|
|||
|
||||
Utils.extendAsViewModel('PopupsContactsViewModel', PopupsContactsViewModel);
|
||||
|
||||
PopupsContactsViewModel.prototype.getPropertyPlceholder = function (sType)
|
||||
{
|
||||
var sResult = '';
|
||||
switch (sType)
|
||||
{
|
||||
case Enums.ContactPropertyType.LastName:
|
||||
sResult = 'CONTACTS/PLACEHOLDER_ENTER_LAST_NAME';
|
||||
break;
|
||||
case Enums.ContactPropertyType.FirstName:
|
||||
sResult = 'CONTACTS/PLACEHOLDER_ENTER_FIRST_NAME';
|
||||
break;
|
||||
case Enums.ContactPropertyType.Nick:
|
||||
sResult = 'CONTACTS/PLACEHOLDER_ENTER_NICK_NAME';
|
||||
break;
|
||||
}
|
||||
|
||||
return sResult;
|
||||
};
|
||||
|
||||
PopupsContactsViewModel.prototype.addNewProperty = function (sType, sTypeStr)
|
||||
{
|
||||
var oItem = new ContactPropertyModel(sType, sTypeStr || '', '');
|
||||
oItem.focused(true);
|
||||
this.viewProperties.push(oItem);
|
||||
this.viewProperties.push(new ContactPropertyModel(sType, sTypeStr || '', '', true, this.getPropertyPlceholder(sType)));
|
||||
};
|
||||
|
||||
PopupsContactsViewModel.prototype.addNewOrFocusProperty = function (sType, sTypeStr)
|
||||
{
|
||||
var oItem = _.find(this.viewProperties(), function (oItem) {
|
||||
return sType === oItem.type();
|
||||
});
|
||||
|
||||
if (oItem)
|
||||
{
|
||||
oItem.focused(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.addNewProperty(sType, sTypeStr);
|
||||
}
|
||||
};
|
||||
|
||||
PopupsContactsViewModel.prototype.addNewEmail = function ()
|
||||
|
|
@ -336,6 +402,25 @@ PopupsContactsViewModel.prototype.addNewWeb = function ()
|
|||
this.addNewProperty(Enums.ContactPropertyType.Web);
|
||||
};
|
||||
|
||||
PopupsContactsViewModel.prototype.addNewNickname = function ()
|
||||
{
|
||||
this.addNewOrFocusProperty(Enums.ContactPropertyType.Nick);
|
||||
};
|
||||
|
||||
PopupsContactsViewModel.prototype.addNewNotes = function ()
|
||||
{
|
||||
this.addNewOrFocusProperty(Enums.ContactPropertyType.Note);
|
||||
};
|
||||
|
||||
PopupsContactsViewModel.prototype.addNewBirthday = function ()
|
||||
{
|
||||
this.addNewOrFocusProperty(Enums.ContactPropertyType.Birthday);
|
||||
};
|
||||
|
||||
//PopupsContactsViewModel.prototype.addNewAddress = function ()
|
||||
//{
|
||||
//};
|
||||
|
||||
PopupsContactsViewModel.prototype.exportVcf = function ()
|
||||
{
|
||||
RL.download(RL.link().exportContactsVcf());
|
||||
|
|
@ -507,8 +592,11 @@ PopupsContactsViewModel.prototype.populateViewContact = function (oContact)
|
|||
this.viewReadOnly(!!oContact.readOnly);
|
||||
}
|
||||
|
||||
aList.unshift(new ContactPropertyModel(Enums.ContactPropertyType.LastName, '', sLastName, false, 'CONTACTS/PLACEHOLDER_ENTER_LAST_NAME'));
|
||||
aList.unshift(new ContactPropertyModel(Enums.ContactPropertyType.FirstName, '', sFirstName, !oContact, 'CONTACTS/PLACEHOLDER_ENTER_FIRST_NAME'));
|
||||
aList.unshift(new ContactPropertyModel(Enums.ContactPropertyType.LastName, '', sLastName, false,
|
||||
this.getPropertyPlceholder(Enums.ContactPropertyType.LastName)));
|
||||
|
||||
aList.unshift(new ContactPropertyModel(Enums.ContactPropertyType.FirstName, '', sFirstName, !oContact,
|
||||
this.getPropertyPlceholder(Enums.ContactPropertyType.FirstName)));
|
||||
|
||||
this.viewID(sId);
|
||||
this.viewProperties([]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue