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, 'MailBoxListSize': 2,
'ExpandedFolders': 3, 'ExpandedFolders': 3,
'FolderListSize': 4, 'FolderListSize': 4,
'MessageListSize': 5 'MessageListSize': 5,
'LastReplyAction': 6
}; };
/** /**

View file

@ -18,6 +18,7 @@
Utils = require('Common/Utils'), Utils = require('Common/Utils'),
Events = require('Common/Events'), Events = require('Common/Events'),
Local = require('Storage/Local'),
Cache = require('Storage/User/Cache'), Cache = require('Storage/User/Cache'),
Data = require('Storage/User/Data'), Data = require('Storage/User/Data'),
Remote = require('Storage/User/Remote'), Remote = require('Storage/User/Remote'),
@ -39,6 +40,7 @@
sLastEmail = '', sLastEmail = '',
createCommandHelper = function (sType) { createCommandHelper = function (sType) {
return Utils.createCommand(self, function () { return Utils.createCommand(self, function () {
this.lastReplyAction(sType);
this.replyOrforward(sType); this.replyOrforward(sType);
}, self.canBeRepliedOrForwarded); }, self.canBeRepliedOrForwarded);
} }
@ -67,6 +69,23 @@
this.fullScreenMode = Data.messageFullScreenMode; 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.showFullInfo = ko.observable(false);
this.moreDropdownTrigger = ko.observable(false); this.moreDropdownTrigger = ko.observable(false);
this.messageDomFocused = ko.observable(false).extend({'rateLimit': 0}); this.messageDomFocused = ko.observable(false).extend({'rateLimit': 0});

View file

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