mirror of https://github.com/keeweb/keeweb.git
fix #46: option to show colorful icons
This commit is contained in:
parent
e6f7429213
commit
99baca4b45
|
@ -17,7 +17,8 @@ var AppSettingsModel = Backbone.Model.extend({
|
||||||
autoSave: true,
|
autoSave: true,
|
||||||
idleMinutes: 15,
|
idleMinutes: 15,
|
||||||
minimizeOnClose: false,
|
minimizeOnClose: false,
|
||||||
tableView: false
|
tableView: false,
|
||||||
|
colorfulIcons: false
|
||||||
},
|
},
|
||||||
|
|
||||||
initialize: function() {
|
initialize: function() {
|
||||||
|
|
|
@ -2,9 +2,10 @@
|
||||||
|
|
||||||
var Format = require('../util/format');
|
var Format = require('../util/format');
|
||||||
|
|
||||||
var EntryPresenter = function(descField) {
|
var EntryPresenter = function(descField, noColor) {
|
||||||
this.entry = null;
|
this.entry = null;
|
||||||
this.descField = descField;
|
this.descField = descField;
|
||||||
|
this.noColor = noColor || '';
|
||||||
};
|
};
|
||||||
|
|
||||||
EntryPresenter.prototype = {
|
EntryPresenter.prototype = {
|
||||||
|
@ -19,7 +20,7 @@ EntryPresenter.prototype = {
|
||||||
get id() { return this.entry ? this.entry.id : this.group.get('id'); },
|
get id() { return this.entry ? this.entry.id : this.group.get('id'); },
|
||||||
get icon() { return this.entry ? this.entry.icon : (this.group.get('icon') || 'folder'); },
|
get icon() { return this.entry ? this.entry.icon : (this.group.get('icon') || 'folder'); },
|
||||||
get customIcon() { return this.entry ? this.entry.customIcon : undefined; },
|
get customIcon() { return this.entry ? this.entry.customIcon : undefined; },
|
||||||
get color() { return this.entry ? this.entry.color : undefined; },
|
get color() { return this.entry ? (this.entry.color || (this.entry.customIcon ? this.noColor : undefined)) : undefined; },
|
||||||
get title() { return this.entry ? this.entry.title : this.group.get('title'); },
|
get title() { return this.entry ? this.entry.title : this.group.get('title'); },
|
||||||
get notes() { return this.entry ? this.entry.notes : undefined; },
|
get notes() { return this.entry ? this.entry.notes : undefined; },
|
||||||
get url() { return this.entry ? this.entry.url : undefined; },
|
get url() { return this.entry ? this.entry.url : undefined; },
|
||||||
|
|
|
@ -66,7 +66,8 @@ var ListView = Backbone.View.extend({
|
||||||
if (this.items.length) {
|
if (this.items.length) {
|
||||||
var itemTemplate = this.getItemTemplate();
|
var itemTemplate = this.getItemTemplate();
|
||||||
var itemsTemplate = this.getItemsTemplate();
|
var itemsTemplate = this.getItemsTemplate();
|
||||||
var presenter = new EntryPresenter(this.getDescField());
|
var noColor = AppSettingsModel.instance.get('colorfulIcons') ? '' : 'grayscale';
|
||||||
|
var presenter = new EntryPresenter(this.getDescField(), noColor);
|
||||||
var itemsHtml = '';
|
var itemsHtml = '';
|
||||||
this.items.forEach(function (item) {
|
this.items.forEach(function (item) {
|
||||||
presenter.present(item);
|
presenter.present(item);
|
||||||
|
|
|
@ -22,6 +22,7 @@ var SettingsGeneralView = Backbone.View.extend({
|
||||||
'change .settings__general-auto-save': 'changeAutoSave',
|
'change .settings__general-auto-save': 'changeAutoSave',
|
||||||
'change .settings__general-minimize': 'changeMinimize',
|
'change .settings__general-minimize': 'changeMinimize',
|
||||||
'change .settings__general-table-view': 'changeTableView',
|
'change .settings__general-table-view': 'changeTableView',
|
||||||
|
'change .settings__general-colorful-icons': 'changeColorfulIcons',
|
||||||
'click .settings__general-update-btn': 'checkUpdate',
|
'click .settings__general-update-btn': 'checkUpdate',
|
||||||
'click .settings__general-restart-btn': 'restartApp',
|
'click .settings__general-restart-btn': 'restartApp',
|
||||||
'click .settings__general-download-update-btn': 'downloadUpdate',
|
'click .settings__general-download-update-btn': 'downloadUpdate',
|
||||||
|
@ -61,7 +62,8 @@ var SettingsGeneralView = Backbone.View.extend({
|
||||||
updateReady: UpdateModel.instance.get('updateStatus') === 'ready',
|
updateReady: UpdateModel.instance.get('updateStatus') === 'ready',
|
||||||
updateFound: UpdateModel.instance.get('updateStatus') === 'found',
|
updateFound: UpdateModel.instance.get('updateStatus') === 'found',
|
||||||
updateManual: UpdateModel.instance.get('updateManual'),
|
updateManual: UpdateModel.instance.get('updateManual'),
|
||||||
releaseNotesLink: Links.ReleaseNotes
|
releaseNotesLink: Links.ReleaseNotes,
|
||||||
|
colorfulIcons: AppSettingsModel.instance.get('colorfulIcons')
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -144,6 +146,12 @@ var SettingsGeneralView = Backbone.View.extend({
|
||||||
Backbone.trigger('refresh');
|
Backbone.trigger('refresh');
|
||||||
},
|
},
|
||||||
|
|
||||||
|
changeColorfulIcons: function(e) {
|
||||||
|
var colorfulIcons = e.target.checked || false;
|
||||||
|
AppSettingsModel.instance.set('colorfulIcons', colorfulIcons);
|
||||||
|
Backbone.trigger('refresh');
|
||||||
|
},
|
||||||
|
|
||||||
restartApp: function() {
|
restartApp: function() {
|
||||||
if (Launcher) {
|
if (Launcher) {
|
||||||
Launcher.requestRestart();
|
Launcher.requestRestart();
|
||||||
|
|
|
@ -104,7 +104,6 @@
|
||||||
height: 14px;
|
height: 14px;
|
||||||
&--custom {
|
&--custom {
|
||||||
vertical-align: text-bottom;
|
vertical-align: text-bottom;
|
||||||
@include filter(grayscale(1));
|
|
||||||
&.yellow { @include filter(grayscale(1) sepia(1) hue-rotate(20deg) brightness(1.17) saturate(5.7)); }
|
&.yellow { @include filter(grayscale(1) sepia(1) hue-rotate(20deg) brightness(1.17) saturate(5.7)); }
|
||||||
&.green { @include filter(grayscale(1) sepia(1) hue-rotate(55deg) brightness(1.01) saturate(4.9)); }
|
&.green { @include filter(grayscale(1) sepia(1) hue-rotate(55deg) brightness(1.01) saturate(4.9)); }
|
||||||
&.red { @include filter(grayscale(1) sepia(1) hue-rotate(316deg) brightness(1.1) saturate(6)); }
|
&.red { @include filter(grayscale(1) sepia(1) hue-rotate(316deg) brightness(1.1) saturate(6)); }
|
||||||
|
|
|
@ -56,6 +56,10 @@
|
||||||
<label for="settings__general-table-view">Entries list table view</label>
|
<label for="settings__general-table-view">Entries list table view</label>
|
||||||
</div>
|
</div>
|
||||||
<% } %>
|
<% } %>
|
||||||
|
<div>
|
||||||
|
<input type="checkbox" class="settings__input input-base settings__general-colorful-icons" id="settings__general-colorful-icons" <%- colorfulIcons ? 'checked' : '' %> />
|
||||||
|
<label for="settings__general-colorful-icons">Colorful custom icons in list</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
<h2>Function</h2>
|
<h2>Function</h2>
|
||||||
<div>
|
<div>
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
Release notes
|
Release notes
|
||||||
-------------
|
-------------
|
||||||
|
##### v0.5 (not released yet)
|
||||||
|
2-way sync
|
||||||
|
`*` disallow opening same files twice
|
||||||
|
`+` #46: option to show colorful icons
|
||||||
|
|
||||||
##### v0.4.6 (2015-11-25)
|
##### v0.4.6 (2015-11-25)
|
||||||
`-` #32: visual glitches on Windows 10
|
`-` #32: visual glitches on Windows 10
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue