fix #33: save groups collapsed/expanded state

This commit is contained in:
antelle 2016-04-17 19:16:51 +03:00
parent e14e97efda
commit 7e205e6958
6 changed files with 23 additions and 5 deletions

View File

@ -40,7 +40,8 @@ var GroupModel = MenuItemModel.extend({
enableAutoType: group.enableAutoType,
autoTypeSeq: group.defaultAutoTypeSeq,
top: !parentGroup,
drag: !!parentGroup
drag: !!parentGroup,
collapsible: !!parentGroup
}, { silent: true });
this.group = group;
this.file = file;
@ -74,7 +75,8 @@ var GroupModel = MenuItemModel.extend({
iconId: this.group.icon,
icon: this._iconFromId(this.group.icon),
customIcon: this._buildCustomIcon(),
customIconId: this.group.customIcon ? this.group.customIcon.toString() : null
customIconId: this.group.customIcon ? this.group.customIcon.toString() : null,
expanded: this.group.expanded !== false
}, { silent: silent });
},
@ -97,7 +99,8 @@ var GroupModel = MenuItemModel.extend({
if (this.isJustCreated) {
this.isJustCreated = false;
}
// this.group.times.update(); // for now, we don't remember this setting
this.file.setModified();
this.group.times.update();
},
forEachGroup: function(callback, includeDisabled) {
@ -150,7 +153,7 @@ var GroupModel = MenuItemModel.extend({
},
setExpanded: function(expanded) {
this._groupModified();
// this._groupModified(); // it's not good to mark the file as modified when a group is collapsed
this.group.expanded = expanded;
this.set('expanded', expanded);
},

View File

@ -20,7 +20,8 @@ var MenuItemModel = Backbone.Model.extend({
drag: false,
drop: false,
filterKey: null,
filterValue: null
filterValue: null,
collapsible: false
},
initialize: function(model) {

View File

@ -39,6 +39,7 @@ var Locale = {
menuEmptyTrash: 'Empty Trash',
menuEmptyTrashAlert: 'Empty Trash?',
menuEmptyTrashAlertBody: 'You will not be able to put items back',
menuItemCollapsed: 'Double-click to expand',
alertYes: 'Yes',
alertNo: 'No',

View File

@ -57,6 +57,17 @@
display: none;
}
&-collapse {
display: none;
.menu__item--collapsed>& {
display: block;
position: absolute;
cursor: pointer;
@include position(absolute, 50% null null 1em);
@include transform(translateY(-50%));
}
}
&-body {
@include area-selectable();
padding: $base-padding;

View File

@ -4,6 +4,7 @@
{{~#if options.length}} menu__item--with-options {{/if~}}
{{~#if cls}} {{cls}}{{/if~}}
">
{{#if collapsible}}<i class="menu__item-collapse fa fa-ellipsis-v muted-color" title="{{res 'menuItemCollapsed'}}"></i>{{/if}}
<div class="menu__item-body" {{#if drag}}draggable="true"{{/if}}>
{{#if customIcon~}}
<img src="{{{customIcon}}}" class="menu__item-icon menu__item-icon--image" />

View File

@ -3,6 +3,7 @@ Release notes
##### v1.2.0 (TBD)
`+` allow selecting attachments with click
`+` save groups collapsed/expanded state
`+` register file associations
`-` prevent second app instance on windows