option to disable searching for group

This commit is contained in:
Antelle 2015-12-08 20:21:12 +03:00
parent 5fb1f57151
commit 5fc6780912
5 changed files with 25 additions and 3 deletions

View File

@ -16,7 +16,8 @@ var GroupModel = MenuItemModel.extend({
editable: true,
top: false,
drag: true,
drop: true
drop: true,
enableSearching: true
}),
initialize: function() {
@ -33,6 +34,7 @@ var GroupModel = MenuItemModel.extend({
items: new GroupCollection(),
entries: new EntryCollection(),
filterValue: group.uuid.id,
enableSearching: group.enableSearching,
top: !parentGroup,
drag: !!parentGroup
}, { silent: true });
@ -150,6 +152,12 @@ var GroupModel = MenuItemModel.extend({
this.set('expanded', expanded);
},
setEnableSearching: function(enabled) {
this._groupModified();
this.group.enableSearching = enabled;
this.set('enableSearching', enabled);
},
moveToTrash: function() {
this.file.setModified();
this.file.db.remove(this.group);

View File

@ -12,7 +12,8 @@ var GrpView = Backbone.View.extend({
'click .grp__icon': 'showIconsSelect',
'click .grp__buttons-trash': 'moveToTrash',
'click .grp__back-button': 'returnToApp',
'blur #grp__field-title': 'titleBlur'
'blur #grp__field-title': 'titleBlur',
'change #grp__check-search': 'setEnableSearching'
},
initialize: function() {
@ -26,6 +27,7 @@ var GrpView = Backbone.View.extend({
title: this.model.get('title'),
icon: this.model.get('icon') || 'folder',
customIcon: this.model.get('customIcon'),
enableSearching: this.model.get('enableSearching') !== false,
readonly: this.model.get('top')
}));
if (!this.model.get('title')) {
@ -107,6 +109,11 @@ var GrpView = Backbone.View.extend({
Backbone.trigger('select-all');
},
setEnableSearching: function(e) {
var enabled = e.target.checked;
this.model.setEnableSearching(enabled);
},
returnToApp: function() {
Backbone.trigger('edit-group');
}

View File

@ -155,7 +155,7 @@ option {
input[type=checkbox] {
display: none;
& + label:hover:before {
&:not([disabled]) + label:hover:before {
@include th {
color: action-color();
}

View File

@ -9,6 +9,12 @@
<input type="text" class="input-base" id="grp__field-title" value="<%- title %>" size="50" maxlength="1024"
required <%= readonly ? 'readonly' : '' %> />
</div>
<% if (!readonly) { %>
<div>
<input type="checkbox" class="input-base" id="grp__check-search" <%= enableSearching ? 'checked' : '' %> />
<label for="grp__check-search">Enable searching entries in this group</label>
</div>
<% } %>
<label>Icon:</label>
<% if (customIcon) { %>
<img src="<%= customIcon %>" class="grp__icon grp__icon--image" />

View File

@ -6,6 +6,7 @@ Release notes
`*` default theme is now blue
`+` #46: option to show colorful icons
`+` #45: optional auto-lock on minimize
`+` option to disable searching for group
`-` #55: custom scrollbar issues
##### v0.4.6 (2015-11-25)