mirror of https://github.com/keeweb/keeweb.git
fix #292: option to disable open, new and demo buttons
This commit is contained in:
parent
701c296ba7
commit
7eef501d88
|
@ -28,6 +28,11 @@ var AppSettingsModel = Backbone.Model.extend({
|
|||
fontSize: 0,
|
||||
tableViewColumns: null,
|
||||
generatorPresets: null,
|
||||
canOpen: true,
|
||||
canOpenDemo: true,
|
||||
canOpenSettings: true,
|
||||
canCreate: true,
|
||||
canImportXml: true,
|
||||
dropbox: true,
|
||||
webdav: true,
|
||||
gdrive: true,
|
||||
|
|
|
@ -65,7 +65,7 @@ var OpenView = Backbone.View.extend({
|
|||
if (this.dragTimeout) {
|
||||
clearTimeout(this.dragTimeout);
|
||||
}
|
||||
var storageProviders = [];
|
||||
let storageProviders = [];
|
||||
Object.keys(Storage).forEach(name => {
|
||||
var prv = Storage[name];
|
||||
if (!prv.system && prv.enabled) {
|
||||
|
@ -73,11 +73,21 @@ var OpenView = Backbone.View.extend({
|
|||
}
|
||||
});
|
||||
storageProviders.sort((x, y) => (x.uipos || Infinity) - (y.uipos || Infinity));
|
||||
let showMore = storageProviders.length || this.model.settings.get('canOpenSettings');
|
||||
let showLogo = !showMore && !this.model.settings.get('canOpen') && !this.model.settings.get('canCreate') &&
|
||||
!(this.model.settings.get('canOpenDemo') && !this.model.settings.get('demoOpened'));
|
||||
this.renderTemplate({
|
||||
lastOpenFiles: this.getLastOpenFiles(),
|
||||
canOpenKeyFromDropbox: DropboxLink.canChooseFile() && Storage.dropbox.enabled,
|
||||
demoOpened: this.model.settings.get('demoOpened'),
|
||||
storageProviders: storageProviders
|
||||
storageProviders: storageProviders,
|
||||
canOpen: this.model.settings.get('canOpen'),
|
||||
canOpenDemo: this.model.settings.get('canOpenDemo'),
|
||||
canOpenSettings: this.model.settings.get('canOpenSettings'),
|
||||
canCreate: this.model.settings.get('canCreate'),
|
||||
canImportXml: this.model.settings.get('canImportXml'),
|
||||
showMore: showMore,
|
||||
showLogo: showLogo
|
||||
});
|
||||
this.inputEl = this.$el.find('.open__pass-input');
|
||||
this.passwordInput.setElement(this.inputEl);
|
||||
|
@ -364,6 +374,9 @@ var OpenView = Backbone.View.extend({
|
|||
},
|
||||
|
||||
dragover: function(e) {
|
||||
if (this.model.settings.get('canOpen') === false) {
|
||||
return;
|
||||
}
|
||||
e.preventDefault();
|
||||
if (this.dragTimeout) {
|
||||
clearTimeout(this.dragTimeout);
|
||||
|
@ -374,6 +387,9 @@ var OpenView = Backbone.View.extend({
|
|||
},
|
||||
|
||||
dragleave: function() {
|
||||
if (this.model.settings.get('canOpen') === false) {
|
||||
return;
|
||||
}
|
||||
if (this.dragTimeout) {
|
||||
clearTimeout(this.dragTimeout);
|
||||
}
|
||||
|
@ -383,6 +399,9 @@ var OpenView = Backbone.View.extend({
|
|||
},
|
||||
|
||||
drop: function(e) {
|
||||
if (this.model.settings.get('canOpen') === false) {
|
||||
return;
|
||||
}
|
||||
e.preventDefault();
|
||||
if (this.busy) {
|
||||
return;
|
||||
|
|
|
@ -1,24 +1,38 @@
|
|||
<div class="open">
|
||||
<input type="file" class="open__file-ctrl hide-by-pos" />
|
||||
<div class="open__icons">
|
||||
{{#if canOpen}}
|
||||
<div class="open__icon open__icon-open">
|
||||
<i class="fa fa-lock open__icon-i"></i>
|
||||
<div class="open__icon-text">{{res 'openOpen'}}</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{#if canCreate}}
|
||||
<div class="open__icon open__icon-new">
|
||||
<i class="fa fa-plus open__icon-i"></i>
|
||||
<div class="open__icon-text">{{res 'openNew'}}</div>
|
||||
</div>
|
||||
{{#ifeq demoOpened false}}
|
||||
<div class="open__icon open__icon-demo">
|
||||
<i class="fa fa-magic open__icon-i"></i>
|
||||
<div class="open__icon-text">{{res 'openDemo'}}</div>
|
||||
</div>
|
||||
{{/ifeq}}
|
||||
{{/if}}
|
||||
{{#if canOpenDemo}}
|
||||
{{#ifeq demoOpened false}}
|
||||
<div class="open__icon open__icon-demo">
|
||||
<i class="fa fa-magic open__icon-i"></i>
|
||||
<div class="open__icon-text">{{res 'openDemo'}}</div>
|
||||
</div>
|
||||
{{/ifeq}}
|
||||
{{/if}}
|
||||
{{#if showMore}}
|
||||
<div class="open__icon open__icon-more">
|
||||
<i class="fa fa-ellipsis-h open__icon-i"></i>
|
||||
<div class="open__icon-text">{{res 'openMore'}}</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{#if showLogo}}
|
||||
<div class="open__icon open__icon-more">
|
||||
<i class="fa fa-key open__icon-i"></i>
|
||||
<div class="open__icon-text">KeeWeb</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
<div class="open__icons open__icons--lower hide">
|
||||
{{#each storageProviders as |prv|}}
|
||||
|
@ -28,20 +42,26 @@
|
|||
<div class="open__icon-text">{{res prv.name}}</div>
|
||||
</div>
|
||||
{{/each}}
|
||||
{{#if canImportXml}}
|
||||
<div class="open__icon open__icon-import-xml">
|
||||
<i class="fa fa-code open__icon-i"></i>
|
||||
<div class="open__icon-text">Import XML</div>
|
||||
</div>
|
||||
{{#if demoOpened}}
|
||||
<div class="open__icon open__icon-demo">
|
||||
<i class="fa fa-magic open__icon-i"></i>
|
||||
<div class="open__icon-text">{{res 'openDemo'}}</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{#if canOpenDemo}}
|
||||
{{#if demoOpened}}
|
||||
<div class="open__icon open__icon-demo">
|
||||
<i class="fa fa-magic open__icon-i"></i>
|
||||
<div class="open__icon-text">{{res 'openDemo'}}</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{#if canOpenSettings}}
|
||||
<div class="open__icon open__icon-settings">
|
||||
<i class="fa fa-cog open__icon-i"></i>
|
||||
<div class="open__icon-text">{{res 'openSettings'}}</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
<div class="open__pass-area">
|
||||
<div class="open__pass-warn-wrap">
|
||||
|
|
|
@ -16,6 +16,7 @@ Audit, generator presets, auto-type and ui improvements
|
|||
`+` inline generator keyboard management
|
||||
`+` field references decoding
|
||||
`+` copy entries
|
||||
`+` option to disable open, new and demo buttons
|
||||
`-` fix app redraw in background
|
||||
`-` fix idle timer on computer sleep
|
||||
`-` fix storage popup when no action is required
|
||||
|
|
Loading…
Reference in New Issue