Save showAttachmnetControls status to local storage (#1502)

This commit is contained in:
RainLoop 2017-09-21 23:28:14 +03:00
parent 650b655539
commit 230624b60c
3 changed files with 14 additions and 3 deletions

View file

@ -210,7 +210,8 @@ export const ClientSideKeyName = {
'LastReplyAction': 6,
'LastSignMe': 7,
'ComposeLastIdentityID': 8,
'MessageHeaderFullInfo': 9
'MessageHeaderFullInfo': 9,
'MessageAttachmnetControls': 10
};
/**

View file

@ -132,6 +132,10 @@ class MessageViewMailBoxUserView extends AbstractViewNext
this.showAttachmnetControls = ko.observable(false);
this.showAttachmnetControlsState = (v) => {
Local.set(ClientSideKeyName.MessageAttachmnetControls, !!v);
};
this.allowAttachmnetControls = ko.computed(
() => 0 < this.attachmentsActions().length && Settings.capa(Capa.AttachmentsActions)
);
@ -320,6 +324,12 @@ class MessageViewMailBoxUserView extends AbstractViewNext
if (message)
{
this.showAttachmnetControls(false);
if (Local.get(ClientSideKeyName.MessageAttachmnetControls))
{
_.delay(() => {
this.showAttachmnetControls(true);
}, Magics.Time50ms);
}
if (this.viewHash !== message.hash)
{

View file

@ -389,7 +389,7 @@
</div>
</li>
</ul>
<i class="icon-cog controls-handle" data-bind="visible: allowAttachmnetControls() && !showAttachmnetControls(), click: function () { showAttachmnetControls(true) }"></i>
<i class="icon-cog controls-handle" data-bind="visible: allowAttachmnetControls() && !showAttachmnetControls(), click: function () { showAttachmnetControls(true); showAttachmnetControlsState(true); }"></i>
</div>
<div class="attachmentsControls"
@ -430,7 +430,7 @@
</span>
<button type="button" class="close" style="margin-right: 5px;"
data-bind="click: function () { showAttachmnetControls(false); }">×</button>
data-bind="click: function () { showAttachmnetControls(false); showAttachmnetControlsState(false); }">×</button>
</div>
</div>