Remember last reply action

This commit is contained in:
RainLoop Team 2015-01-19 00:55:37 +04:00
parent f8512b01b9
commit 91b3f1a3e9
3 changed files with 31 additions and 12 deletions

View file

@ -155,7 +155,8 @@
'MailBoxListSize': 2,
'ExpandedFolders': 3,
'FolderListSize': 4,
'MessageListSize': 5
'MessageListSize': 5,
'LastReplyAction': 6
};
/**

View file

@ -18,6 +18,7 @@
Utils = require('Common/Utils'),
Events = require('Common/Events'),
Local = require('Storage/Local'),
Cache = require('Storage/User/Cache'),
Data = require('Storage/User/Data'),
Remote = require('Storage/User/Remote'),
@ -39,6 +40,7 @@
sLastEmail = '',
createCommandHelper = function (sType) {
return Utils.createCommand(self, function () {
this.lastReplyAction(sType);
this.replyOrforward(sType);
}, self.canBeRepliedOrForwarded);
}
@ -67,6 +69,23 @@
this.fullScreenMode = Data.messageFullScreenMode;
this.lastReplyAction_ = ko.observable('');
this.lastReplyAction = ko.computed({
read: this.lastReplyAction_,
write: function (sValue) {
sValue = -1 === Utils.inArray(sValue, [
Enums.ComposeType.Reply, Enums.ComposeType.ReplyAll, Enums.ComposeType.Forward
]) ? Enums.ComposeType.Reply : sValue;
this.lastReplyAction_(sValue);
},
owner: this
});
this.lastReplyAction(Local.get(Enums.ClientSideKeyName.LastReplyAction) || Enums.ComposeType.Reply);
this.lastReplyAction_.subscribe(function (sValue) {
Local.set(Enums.ClientSideKeyName.LastReplyAction, sValue);
});
this.showFullInfo = ko.observable(false);
this.moreDropdownTrigger = ko.observable(false);
this.messageDomFocused = ko.observable(false).extend({'rateLimit': 0});

View file

@ -62,42 +62,41 @@
<nobr>
<div class="btn-group colored-toggle pull-right">
<a class="btn btn-dark-disabled-border buttonReply" data-tooltip-placement="bottom"
data-bind="command: replyCommand, tooltip: 'MESSAGE/BUTTON_REPLY'">
data-bind="visible: 'reply' === lastReplyAction(), command: replyCommand, tooltip: 'MESSAGE/BUTTON_REPLY'">
<i class="icon-reply"></i>
</a>
<!--
<a class="btn btn-dark-disabled-border buttonReplyAll" data-tooltip-placement="bottom"
data-bind="command: replyAllCommand, tooltip: 'MESSAGE/BUTTON_REPLY_ALL'">
data-bind="visible: 'replyall' === lastReplyAction(), command: replyAllCommand, tooltip: 'MESSAGE/BUTTON_REPLY_ALL'">
<i class="icon-reply-all"></i>
</a>
<a class="btn btn-dark-disabled-border buttonForward" data-tooltip-placement="bottom"
data-bind="command: forwardCommand, tooltip: 'MESSAGE/BUTTON_FORWARD'">
<i class="icon-reply-all"></i>
data-bind="visible: 'forward' === lastReplyAction(), command: forwardCommand, tooltip: 'MESSAGE/BUTTON_FORWARD'">
<i class="icon-forward"></i>
</a>
-->
<a id="more-view-dropdown-id" class="btn btn-dark-disabled-border dropdown-toggle buttonMore"
href="#" tabindex="-1" data-toggle="dropdown" data-tooltip-placement="bottom"
data-bind="command: messageVisibilityCommand, tooltip: 'MESSAGE/BUTTON_MORE'">
<span class="caret"></span>
</a>
<ul class="dropdown-menu g-ui-menu" role="menu" aria-labelledby="more-view-dropdown-id">
<!--
<li class="e-item" role="presentation" data-bind="visible: !isDraftFolder()">
<li class="e-item" role="presentation"
data-bind="visible: 'reply' !== lastReplyAction() && !isDraftFolder()">
<a class="e-link menuitem" href="#" tabindex="-1" data-bind="command: replyCommand">
<i class="icon-reply"></i>
&nbsp;&nbsp;
<span class="i18n" data-i18n-text="MESSAGE/BUTTON_REPLY"></span>
</a>
</li>
-->
<li class="e-item" role="presentation" data-bind="visible: !isDraftFolder()">
<li class="e-item" role="presentation"
data-bind="visible: 'replyall' !== lastReplyAction() && !isDraftFolder()">
<a class="e-link menuitem" href="#" tabindex="-1" data-bind="command: replyAllCommand">
<i class="icon-reply-all"></i>
&nbsp;&nbsp;
<span class="i18n" data-i18n-text="MESSAGE/BUTTON_REPLY_ALL"></span>
</a>
</li>
<li class="e-item" role="presentation" data-bind="visible: !isDraftFolder()">
<li class="e-item" role="presentation"
data-bind="visible: 'forward' !== lastReplyAction() && !isDraftFolder()">
<a class="e-link menuitem" href="#" tabindex="-1" data-bind="command: forwardCommand">
<i class="icon-forward"></i>
&nbsp;&nbsp;