fix #272: save displayed table columns

This commit is contained in:
antelle 2016-07-27 01:01:32 +03:00
parent f779809994
commit f3e1ccdb3c
3 changed files with 19 additions and 0 deletions

View File

@ -26,6 +26,7 @@ var AppSettingsModel = Backbone.Model.extend({
skipHttpsWarning: false,
demoOpened: false,
fontSize: 0,
tableViewColumns: null,
dropbox: true,
webdav: true,
gdrive: true,

View File

@ -57,6 +57,8 @@ var ListView = Backbone.View.extend({
this.listenTo(this.model.settings, 'change:tableView', this.setTableView);
this.readTableColumnsEnabled();
this.items = [];
},
@ -266,6 +268,21 @@ var ListView = Backbone.View.extend({
col.enabled = !col.enabled;
e.el.find('i:first').toggleClass('fa-check-square-o fa-square-o');
this.render();
this.saveTableColumnsEnabled();
},
readTableColumnsEnabled() {
let tableViewColumns = AppSettingsModel.instance.get('tableViewColumns');
if (tableViewColumns && tableViewColumns.length) {
this.tableColumns.forEach(col => {
col.enabled = tableViewColumns.indexOf(col.name) >= 0;
});
}
},
saveTableColumnsEnabled() {
let tableViewColumns = this.tableColumns.filter(column => column.enabled).map(column => column.name);
AppSettingsModel.instance.set('tableViewColumns', tableViewColumns);
}
});

View File

@ -5,6 +5,7 @@ Release notes
`+` solarized themes
`+` select field contents on search hotkey
`+` option to preload default config
`+` save displayed table columns
`-` fix app redraw in background
##### v1.2.4 (2016-07-20)