fix #17: option to hide entries from subgroups

This commit is contained in:
Antelle 2015-11-06 23:42:37 +03:00
parent 9fd0ebd8a4
commit f6cb122ed8
6 changed files with 22 additions and 6 deletions

View File

@ -96,6 +96,7 @@ var AppModel = Backbone.Model.extend({
setFilter: function(filter) {
this.filter = filter;
this.filter.subGroups = this.settings.get('expandGroups');
var entries = this.getEntries();
Backbone.trigger('filter', { filter: this.filter, sort: this.sort, entries: entries });
Backbone.trigger('select-entry', entries.length ? entries.first() : null);

View File

@ -8,7 +8,8 @@ var FileName = 'app-settings.json';
var AppSettingsModel = Backbone.Model.extend({
defaults: {
theme: 'd',
lastOpenFile: ''
lastOpenFile: '',
expandGroups: true
},
initialize: function() {

View File

@ -151,9 +151,11 @@ var FileModel = Backbone.Model.extend({
if (top.forEachOwnEntry) {
top.forEachOwnEntry(filter, callback);
}
top.forEachGroup(function (group) {
group.forEachOwnEntry(filter, callback);
});
if (!filter.group || filter.subGroups) {
top.forEachGroup(function (group) {
group.forEachOwnEntry(filter, callback);
});
}
}
},

View File

@ -9,6 +9,7 @@ var SettingsGeneralView = Backbone.View.extend({
events: {
'change .settings__general-theme': 'changeTheme',
'change .settings__general-expand': 'changeExpandGroups',
'click .settings__general-dev-tools-link': 'openDevTools'
},
@ -19,10 +20,10 @@ var SettingsGeneralView = Backbone.View.extend({
},
render: function() {
var activeTheme = AppSettingsModel.instance.get('theme');
this.renderTemplate({
themes: this.allThemes,
activeTheme: activeTheme,
activeTheme: AppSettingsModel.instance.get('theme'),
expandGroups: AppSettingsModel.instance.get('expandGroups'),
devTools: Launcher && Launcher.devTools
});
},
@ -32,6 +33,12 @@ var SettingsGeneralView = Backbone.View.extend({
AppSettingsModel.instance.set('theme', theme);
},
changeExpandGroups: function(e) {
var expand = e.target.checked;
AppSettingsModel.instance.set('expandGroups', expand);
Backbone.trigger('refresh');
},
openDevTools: function() {
if (Launcher) {
Launcher.openDevTools();

View File

@ -9,6 +9,10 @@
<% }); %>
</select>
</div>
<div>
<input type="checkbox" class="settings__input input-base settings__general-expand" id="settings__general-expand" <%- expandGroups ? 'checked' : '' %> />
<label for="settings__general-expand">Show entries from all subgroups</label>
</div>
<% if (devTools) { %>
<h2>Advanced</h2>
<a class="settings__general-dev-tools-link">Show dev tools</a>

View File

@ -4,6 +4,7 @@ Release notes
Bugfixes and new features
`+` improved open page ux
`+` keyfiles from Dropbox
`+` #17: option to hide entries from subgroups
`-` #12: cannot edit entries without title
`+` #13: increase max generated password length