mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-31 04:59:21 +03:00
Minor contacts interface improvements.
Move intervals to pub/sub system
This commit is contained in:
parent
b4e52e768c
commit
975947a948
31 changed files with 691 additions and 524 deletions
|
|
@ -14,6 +14,30 @@ function RainLoopApp()
|
|||
|
||||
this.quotaDebounce = _.debounce(this.quota, 1000 * 30);
|
||||
|
||||
window.setInterval(function () {
|
||||
RL.pub('interval.30s');
|
||||
}, 30000);
|
||||
|
||||
window.setInterval(function () {
|
||||
RL.pub('interval.1m');
|
||||
}, 60000);
|
||||
|
||||
window.setInterval(function () {
|
||||
RL.pub('interval.2m');
|
||||
}, 60000 * 2);
|
||||
|
||||
window.setInterval(function () {
|
||||
RL.pub('interval.3m');
|
||||
}, 60000 * 3);
|
||||
|
||||
window.setInterval(function () {
|
||||
RL.pub('interval.5m');
|
||||
}, 60000 * 5);
|
||||
|
||||
window.setInterval(function () {
|
||||
RL.pub('interval.10m');
|
||||
}, 60000 * 10);
|
||||
|
||||
$.wakeUp(function () {
|
||||
RL.remote().jsVersion(function (sResult, oData) {
|
||||
if (Enums.StorageResultType.Success === sResult && oData && !oData.Result)
|
||||
|
|
@ -690,6 +714,14 @@ RainLoopApp.prototype.bootstart = function ()
|
|||
});
|
||||
}, 1000);
|
||||
|
||||
RL.sub('interval.5m', function () {
|
||||
RL.quota();
|
||||
});
|
||||
|
||||
RL.sub('interval.2m', function () {
|
||||
RL.folderInformation('INBOX');
|
||||
});
|
||||
|
||||
Plugins.runHook('rl-start-user-screens');
|
||||
}
|
||||
else
|
||||
|
|
@ -764,6 +796,10 @@ RainLoopApp.prototype.bootstart = function ()
|
|||
};
|
||||
}
|
||||
|
||||
RL.sub('interval.1m', function () {
|
||||
Globals.momentTrigger(!Globals.momentTrigger());
|
||||
});
|
||||
|
||||
Plugins.runHook('rl-start-screens');
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -8,17 +8,12 @@ Globals.now = (new Date()).getTime();
|
|||
/**
|
||||
* @type {?}
|
||||
*/
|
||||
Globals.minuteTick = ko.observable(true);
|
||||
Globals.momentTrigger = ko.observable(true);
|
||||
|
||||
/**
|
||||
* @type {?}
|
||||
*/
|
||||
Globals.fiveMinuteTick = ko.observable(true);
|
||||
|
||||
/**
|
||||
* @type {?}
|
||||
*/
|
||||
Globals.langChangeTick = ko.observable(true);
|
||||
Globals.langChangeTrigger = ko.observable(true);
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
|
|
|
|||
|
|
@ -348,7 +348,7 @@ Utils.i18nToDoc = function ()
|
|||
I18n = window.rainloopI18N || {};
|
||||
Utils.i18nToNode($document);
|
||||
|
||||
Globals.langChangeTick(!Globals.langChangeTick());
|
||||
Globals.langChangeTrigger(!Globals.langChangeTrigger());
|
||||
}
|
||||
|
||||
window.rainloopI18N = {};
|
||||
|
|
@ -368,7 +368,7 @@ Utils.initOnStartOrLangChange = function (fCallback, oScope, fLangCallback)
|
|||
|
||||
if (fLangCallback)
|
||||
{
|
||||
Globals.langChangeTick.subscribe(function () {
|
||||
Globals.langChangeTrigger.subscribe(function () {
|
||||
if (fCallback)
|
||||
{
|
||||
fCallback.call(oScope);
|
||||
|
|
@ -379,7 +379,7 @@ Utils.initOnStartOrLangChange = function (fCallback, oScope, fLangCallback)
|
|||
}
|
||||
else if (fCallback)
|
||||
{
|
||||
Globals.langChangeTick.subscribe(fCallback, oScope);
|
||||
Globals.langChangeTrigger.subscribe(fCallback, oScope);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -934,8 +934,13 @@ Utils.initDataConstructorBySettings = function (oData)
|
|||
*/
|
||||
Utils.createMomentDate = function (oObject)
|
||||
{
|
||||
if (Utils.isUnd(oObject.moment))
|
||||
{
|
||||
oObject.moment = ko.observable(moment());
|
||||
}
|
||||
|
||||
return ko.computed(function () {
|
||||
Globals.minuteTick();
|
||||
Globals.momentTrigger();
|
||||
return this.moment().fromNow();
|
||||
}, oObject);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -27,14 +27,6 @@ window['__RLBOOT'] = function (fCall) {
|
|||
if (window['rainloopTEMPLATES'] && window['rainloopTEMPLATES'][0])
|
||||
{
|
||||
$('#rl-templates').html(window['rainloopTEMPLATES'][0]);
|
||||
|
||||
window.setInterval(function () {
|
||||
Globals.minuteTick(!Globals.minuteTick());
|
||||
}, 1000 * 60);
|
||||
|
||||
window.setInterval(function () {
|
||||
Globals.fiveMinuteTick(!Globals.fiveMinuteTick());
|
||||
}, 1000 * 60 * 5);
|
||||
|
||||
_.delay(function () {
|
||||
window['rainloopAppData'] = {};
|
||||
|
|
|
|||
|
|
@ -3,12 +3,13 @@
|
|||
/**
|
||||
* @param {number=} iType = Enums.ContactPropertyType.Unknown
|
||||
* @param {string=} sValue = ''
|
||||
* @param {boolean=} bFocused = false
|
||||
*
|
||||
* @constructor
|
||||
*/
|
||||
function ContactPropertyModel(iType, sValue)
|
||||
function ContactPropertyModel(iType, sValue, bFocused)
|
||||
{
|
||||
this.type = ko.observable(Utils.isUnd(iType) ? Enums.ContactPropertyType.Unknown : iType);
|
||||
this.focused = ko.observable(false);
|
||||
this.focused = ko.observable(Utils.isUnd(bFocused) ? false : !!bFocused);
|
||||
this.value = ko.observable(Utils.pString(sValue));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ FolderModel.prototype.initComputed = function ()
|
|||
|
||||
this.localName = ko.computed(function () {
|
||||
|
||||
Globals.langChangeTick();
|
||||
Globals.langChangeTrigger();
|
||||
|
||||
var
|
||||
iType = this.type(),
|
||||
|
|
@ -203,7 +203,7 @@ FolderModel.prototype.initComputed = function ()
|
|||
|
||||
this.manageFolderSystemName = ko.computed(function () {
|
||||
|
||||
Globals.langChangeTick();
|
||||
Globals.langChangeTrigger();
|
||||
|
||||
var
|
||||
sSuffix = '',
|
||||
|
|
|
|||
|
|
@ -83,10 +83,6 @@ MailBoxScreen.prototype.onStart = function ()
|
|||
RL.accountsAndIdentities();
|
||||
}
|
||||
|
||||
_.delay(function () {
|
||||
RL.quota();
|
||||
}, 1000 * 5);
|
||||
|
||||
_.delay(function () {
|
||||
if ('INBOX' !== oData.currentFolderFullNameRaw())
|
||||
{
|
||||
|
|
@ -111,16 +107,12 @@ MailBoxScreen.prototype.onStart = function ()
|
|||
}, 2000);
|
||||
|
||||
_.delay(function () {
|
||||
RL.remote().appDelayStart(Utils.emptyFunction);
|
||||
}, 1000 * 35);
|
||||
|
||||
window.setInterval(function () {
|
||||
RL.folderInformation('INBOX');
|
||||
}, 1000 * 60 * 2);
|
||||
|
||||
window.setInterval(function () {
|
||||
RL.quota();
|
||||
}, 1000 * 60 * 5);
|
||||
}, 5000);
|
||||
|
||||
_.delay(function () {
|
||||
RL.remote().appDelayStart(Utils.emptyFunction);
|
||||
}, 35000);
|
||||
|
||||
$html.toggleClass('rl-no-preview-pane', !oData.usePreviewPane());
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,15 @@
|
|||
|
||||
.b-contacts-content {
|
||||
|
||||
.control-group {
|
||||
.control-label.fix-width {
|
||||
width: 110px;
|
||||
}
|
||||
.controls.fix-width {
|
||||
margin-left: 135px;
|
||||
}
|
||||
}
|
||||
|
||||
&.modal {
|
||||
|
||||
position: absolute;
|
||||
|
|
|
|||
|
|
@ -232,3 +232,7 @@ html.no-rgba .modal {
|
|||
.picker.modal-dialog, .picker.picker-dialog {
|
||||
z-index: 2001 !important;
|
||||
}
|
||||
|
||||
.control-label.remove-padding-top {
|
||||
padding-top: 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,13 +9,18 @@
|
|||
vertical-align: text-top;
|
||||
}
|
||||
|
||||
.icon-folder, .icon-folder-add, .icon-address-book, .icon-list {
|
||||
.icon-folder, .icon-folder-add, .icon-list {
|
||||
line-height: 18px;
|
||||
font-size: 18px;
|
||||
margin-top: -2px;
|
||||
margin-left: -2px;
|
||||
}
|
||||
|
||||
.iconsize24 {
|
||||
line-height: 24px;
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
/* White icons with optional class, or on hover/active states of certain elements */
|
||||
.icon-white,
|
||||
.nav > .active > a > [class^="icon-"],
|
||||
|
|
|
|||
|
|
@ -335,7 +335,7 @@ function PopupsComposeViewModel()
|
|||
|
||||
}, this.canBeSendedOrSaved);
|
||||
|
||||
Globals.minuteTick.subscribe(function () {
|
||||
RL.sub('interval.1m', function () {
|
||||
if (this.modalVisibility() && !RL.data().draftFolderNotEnabled() && !this.isEmptyForm(false) &&
|
||||
!this.saving() && !this.sending() && !this.savedError())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -9,13 +9,17 @@ function PopupsContactsViewModel()
|
|||
KnoinAbstractViewModel.call(this, 'Popups', 'PopupsContacts');
|
||||
|
||||
var
|
||||
oT = Enums.ContactPropertyType,
|
||||
self = this,
|
||||
aNameTypes = [Enums.ContactPropertyType.FullName, Enums.ContactPropertyType.FirstName, Enums.ContactPropertyType.SurName, Enums.ContactPropertyType.MiddleName],
|
||||
aEmailTypes = [Enums.ContactPropertyType.EmailPersonal, Enums.ContactPropertyType.EmailBussines, Enums.ContactPropertyType.EmailOther],
|
||||
aNameTypes = [oT.FullName, oT.FirstName, oT.SurName, oT.MiddleName],
|
||||
aEmailTypes = [oT.EmailPersonal, oT.EmailBussines, oT.EmailOther],
|
||||
aPhonesTypes = [
|
||||
Enums.ContactPropertyType.PhonePersonal, Enums.ContactPropertyType.PhoneBussines, Enums.ContactPropertyType.PhoneOther,
|
||||
Enums.ContactPropertyType.MobilePersonal, Enums.ContactPropertyType.MobileBussines, Enums.ContactPropertyType.MobileOther,
|
||||
Enums.ContactPropertyType.FaxPesonal, Enums.ContactPropertyType.FaxBussines, Enums.ContactPropertyType.FaxOther
|
||||
oT.PhonePersonal, oT.PhoneBussines, oT.PhoneOther,
|
||||
oT.MobilePersonal, oT.MobileBussines, oT.MobileOther,
|
||||
oT.FaxPesonal, oT.FaxBussines, oT.FaxOther
|
||||
],
|
||||
aOtherTypes = [
|
||||
oT.Facebook, oT.Skype, oT.GitHub
|
||||
],
|
||||
fFastClearEmptyListHelper = function (aList) {
|
||||
if (aList && 0 < aList.length) {
|
||||
|
|
@ -69,6 +73,10 @@ function PopupsContactsViewModel()
|
|||
return -1 < Utils.inArray(oProperty.type(), aPhonesTypes);
|
||||
});
|
||||
|
||||
this.viewPropertiesOther = this.viewProperties.filter(function(oProperty) {
|
||||
return -1 < Utils.inArray(oProperty.type(), aOtherTypes);
|
||||
});
|
||||
|
||||
this.viewPropertiesEmailsEmptyAndOnFocused = this.viewPropertiesEmails.filter(function(oProperty) {
|
||||
var bF = oProperty.focused();
|
||||
return '' === Utils.trim(oProperty.value()) && !bF;
|
||||
|
|
@ -126,10 +134,6 @@ function PopupsContactsViewModel()
|
|||
});
|
||||
}, this);
|
||||
|
||||
this.newCommand = Utils.createCommand(this, function () {
|
||||
this.populateViewContact(null);
|
||||
});
|
||||
|
||||
this.selector = new Selector(this.contacts, this.currentContact,
|
||||
'.e-contact-item .actionHandle', '.e-contact-item.selected', '.e-contact-item .checkboxItem');
|
||||
|
||||
|
|
@ -152,6 +156,7 @@ function PopupsContactsViewModel()
|
|||
|
||||
this.deleteCommand = Utils.createCommand(this, function () {
|
||||
this.deleteSelectedContacts();
|
||||
this.emptySelection(true);
|
||||
}, function () {
|
||||
return 0 < this.contactsCheckedOrSelected().length;
|
||||
});
|
||||
|
|
@ -242,18 +247,22 @@ function PopupsContactsViewModel()
|
|||
|
||||
Utils.extendAsViewModel('PopupsContactsViewModel', PopupsContactsViewModel);
|
||||
|
||||
PopupsContactsViewModel.prototype.addNewEmail = function ()
|
||||
|
||||
PopupsContactsViewModel.prototype.addNewProperty = function (sType)
|
||||
{
|
||||
var oItem = new ContactPropertyModel(Enums.ContactPropertyType.EmailPersonal, '');
|
||||
var oItem = new ContactPropertyModel(sType, '');
|
||||
oItem.focused(true);
|
||||
this.viewProperties.push(oItem);
|
||||
};
|
||||
|
||||
PopupsContactsViewModel.prototype.addNewEmail = function ()
|
||||
{
|
||||
this.addNewProperty(Enums.ContactPropertyType.EmailPersonal);
|
||||
};
|
||||
|
||||
PopupsContactsViewModel.prototype.addNewPhone = function ()
|
||||
{
|
||||
var oItem = new ContactPropertyModel(Enums.ContactPropertyType.PhonePersonal, '');
|
||||
oItem.focused(true);
|
||||
this.viewProperties.push(oItem);
|
||||
this.addNewProperty(Enums.ContactPropertyType.PhonePersonal);
|
||||
};
|
||||
|
||||
PopupsContactsViewModel.prototype.removeCheckedOrSelectedContactsFromList = function ()
|
||||
|
|
@ -367,7 +376,7 @@ PopupsContactsViewModel.prototype.populateViewContact = function (oContact)
|
|||
|
||||
if (!bHasName)
|
||||
{
|
||||
aList.push(new ContactPropertyModel(Enums.ContactPropertyType.FullName, ''));
|
||||
aList.push(new ContactPropertyModel(Enums.ContactPropertyType.FullName, '', true));
|
||||
}
|
||||
|
||||
this.viewID(sId);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue