Small fixes

This commit is contained in:
RainLoop Team 2016-07-17 18:03:38 +03:00
parent 278e98561d
commit 786873041f
8 changed files with 561 additions and 507 deletions

View file

@ -247,7 +247,7 @@ class MessageModel extends AbstractModel
this.bcc = emailArrayFromJson(json.Bcc); this.bcc = emailArrayFromJson(json.Bcc);
this.replyTo = emailArrayFromJson(json.ReplyTo); this.replyTo = emailArrayFromJson(json.ReplyTo);
this.deliveredTo = emailArrayFromJson(json.DeliveredTo); this.deliveredTo = emailArrayFromJson(json.DeliveredTo);
this.unsubsribeLinks = json.UnsubsribeLinks; this.unsubsribeLinks = isNonEmptyArray(json.UnsubsribeLinks) ? json.UnsubsribeLinks : [];
this.subject(json.Subject); this.subject(json.Subject);
if (isArray(json.SubjectParts)) if (isArray(json.SubjectParts))
@ -358,6 +358,20 @@ class MessageModel extends AbstractModel
return result; return result;
} }
/**
* @returns {boolean}
*/
hasUnsubsribeLinks() {
return this.unsubsribeLinks && 0 < this.unsubsribeLinks.length;
}
/**
* @returns {string}
*/
getFirstUnsubsribeLink() {
return this.unsubsribeLinks && 0 < this.unsubsribeLinks.length ? (this.unsubsribeLinks[0] || '') : '';
}
/** /**
* @param {AjaxJsonMessage} json * @param {AjaxJsonMessage} json
* @returns {boolean} * @returns {boolean}

View file

@ -4,7 +4,7 @@ import ko from 'ko';
import {createCommand, trim, boolToAjax} from 'Common/Utils'; import {createCommand, trim, boolToAjax} from 'Common/Utils';
import {phpInfo} from 'Common/Links'; import {phpInfo} from 'Common/Links';
import {StorageResultType} from 'Common/Enums'; import {StorageResultType, Magics} from 'Common/Enums';
import {settingsGet} from 'Storage/Settings'; import {settingsGet} from 'Storage/Settings';
@ -42,6 +42,10 @@ class SecurityAdminSettings
} }
}); });
this.isTwoFactorDropperShown = ko.observable(false);
this.twoFactorDropperUser = ko.observable('');
this.twoFactorDropperUser.focused = ko.observable(false);
this.adminLogin = ko.observable(settingsGet('AdminLogin')); this.adminLogin = ko.observable(settingsGet('AdminLogin'));
this.adminLoginError = ko.observable(false); this.adminLoginError = ko.observable(false);
this.adminPassword = ko.observable(''); this.adminPassword = ko.observable('');
@ -102,6 +106,15 @@ class SecurityAdminSettings
this.onNewAdminPasswordResponse = _.bind(this.onNewAdminPasswordResponse, this); this.onNewAdminPasswordResponse = _.bind(this.onNewAdminPasswordResponse, this);
} }
showTwoFactorDropper() {
this.twoFactorDropperUser('');
this.isTwoFactorDropperShown(true);
_.delay(() => {
this.twoFactorDropperUser.focused(true);
}, Magics.Time50ms);
}
onNewAdminPasswordResponse(result, data) { onNewAdminPasswordResponse(result, data) {
if (StorageResultType.Success === result && data && data.Result) if (StorageResultType.Success === result && data && data.Result)
{ {
@ -161,6 +174,10 @@ class SecurityAdminSettings
this.adminPassword(''); this.adminPassword('');
this.adminPasswordNew(''); this.adminPasswordNew('');
this.adminPasswordNew2(''); this.adminPasswordNew2('');
this.isTwoFactorDropperShown(false);
this.twoFactorDropperUser('');
this.twoFactorDropperUser.focused(false);
} }
/** /**

View file

@ -375,7 +375,7 @@ function MessageViewMailBoxUserView()
this.viewSize(oMessage.friendlySize()); this.viewSize(oMessage.friendlySize());
this.viewLineAsCss(oMessage.lineAsCss()); this.viewLineAsCss(oMessage.lineAsCss());
this.viewViewLink(oMessage.viewLink()); this.viewViewLink(oMessage.viewLink());
this.viewUnsubscribeLink(oMessage.unsubsribeLinks[0]); this.viewUnsubscribeLink(oMessage.getFirstUnsubsribeLink());
this.viewDownloadLink(oMessage.downloadLink()); this.viewDownloadLink(oMessage.downloadLink());
this.viewIsImportant(oMessage.isImportant()); this.viewIsImportant(oMessage.isImportant());
this.viewIsFlagged(oMessage.flagged()); this.viewIsFlagged(oMessage.flagged());

View file

@ -1,6 +1,6 @@
<div class="adminSecurity g-ui-user-select-none"> <div class="adminSecurity g-ui-user-select-none">
<div class="legend" data-i18n="TAB_SECURITY/LEGEND_SECURITY"></div>
<div class="form-horizontal"> <div class="form-horizontal">
<div class="legend" data-i18n="TAB_SECURITY/LEGEND_SECURITY"></div>
<div class="control-group"> <div class="control-group">
<div class="controls"> <div class="controls">
<div data-bind="component: { <div data-bind="component: {
@ -21,8 +21,34 @@
inline: true inline: true
} }
}"></div> }"></div>
<br /> </div>
<br /> </div>
</div>
<!--
<div class="form-horizontal">
<div class="control-group" data-bind="visible: isTwoFactorDropperShown()">
<div class="controls">
<div class="input-append">
<input type="text" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
data-bind="textInput: twoFactorDropperUser, hasfocus: twoFactorDropperUser.focused" placeholder="Email"/>
<button class="btn">
<i class="icon-spinner animated" data-bind="visible: true"></i>
<span data-bind="visible: false">OK</span>
</button>
</div>
</div>
</div>
<div class="control-group" data-bind="visible: !isTwoFactorDropperShown()">
<div class="controls">
<span class="g-ui-link" data-bind="click: showTwoFactorDropper">Drop user keys</span>
</div>
</div>
</div>
<br />
-->
<div class="form-horizontal">
<div class="control-group">
<div class="controls">
<div data-bind="component: { <div data-bind="component: {
name: 'Checkbox', name: 'Checkbox',
params: { params: {
@ -38,14 +64,11 @@
inline: true inline: true
} }
}"></div> }"></div>
&nbsp;&nbsp;
<span style="color:red">(<span data-i18n="HINTS/BETA"></span>)</span>
</div> </div>
</div> </div>
<div class="control-group"> <div class="control-group">
<div class="controls"> <div class="controls">
<a href="#" target="_blank" class="g-ui-link" data-bind="link: phpInfoLink()" <a href="#" target="_blank" class="g-ui-link" data-bind="link: phpInfoLink()" data-i18n="TAB_SECURITY/LABEL_SHOW_PHP_INFO"></a>
data-i18n="TAB_SECURITY/LABEL_SHOW_PHP_INFO"></a>
</div> </div>
</div> </div>
</div> </div>

View file

@ -147,7 +147,7 @@
<span class="i18n" data-i18n="MESSAGE/BUTTON_DELETE"></span> <span class="i18n" data-i18n="MESSAGE/BUTTON_DELETE"></span>
</a> </a>
</li> </li>
<li class="e-item" role="presentation" data-bind="visible: message() && message().unsubsribeLinks[0]"> <li class="e-item" role="presentation" data-bind="visible: message() && message().hasUnsubsribeLinks()">
<a target="_blank" class="e-link menuitem" href="#" tabindex="-1" data-bind="link: viewUnsubscribeLink()"> <a target="_blank" class="e-link menuitem" href="#" tabindex="-1" data-bind="link: viewUnsubscribeLink()">
<i class="icon-remove"></i> <i class="icon-remove"></i>
&nbsp;&nbsp; &nbsp;&nbsp;