auto-type group ui

This commit is contained in:
antelle 2016-04-17 15:31:08 +03:00
parent b7586f5be9
commit 3de0836c85
5 changed files with 54 additions and 5 deletions

View File

@ -17,7 +17,9 @@ var GroupModel = MenuItemModel.extend({
top: false,
drag: true,
drop: true,
enableSearching: true
enableSearching: true,
enableAutoType: null,
autoTypeSeq: null
}),
initialize: function() {
@ -35,6 +37,8 @@ var GroupModel = MenuItemModel.extend({
entries: new EntryCollection(),
filterValue: group.uuid.id,
enableSearching: group.enableSearching,
enableAutoType: group.enableAutoType,
autoTypeSeq: group.defaultAutoTypeSeq,
top: !parentGroup,
drag: !!parentGroup
}, { silent: true });
@ -157,6 +161,18 @@ var GroupModel = MenuItemModel.extend({
this.set('enableSearching', enabled);
},
setEnableAutoType: function(enabled) {
this._groupModified();
this.group.enableAutoType = enabled;
this.set('enableAutoType', enabled);
},
setAutoTypeSeq: function(seq) {
this._groupModified();
this.group.defaultAutoTypeSeq = seq || undefined;
this.set('autoTypeSeq', seq || undefined);
},
moveToTrash: function() {
this.file.setModified();
this.file.db.remove(this.group);

View File

@ -71,6 +71,9 @@ var Locale = {
grpTitle: 'Group',
grpSearch: 'Enable searching entries in this group',
grpAutoType: 'Enable auto-type',
grpAutoTypeSeq: 'Auto-type sequence',
grpAutoTypeSeqDefault: 'Use default auto-type sequence',
keyChangeTitle: 'Master Key Changed',
keyChangeMessage: 'Master key was changed for this database. Please enter a new key',
@ -113,6 +116,7 @@ var Locale = {
openDemo: 'Demo',
openSettings: 'Settings',
openCaps: 'Caps Lock is on',
openClickToOpen: 'Click to open a file',
openKeyFile: 'key file',
openKeyFileDropbox: '(from dropbox)',
openDropHere: 'drop files here',

View File

@ -2,7 +2,8 @@
var Backbone = require('backbone'),
Scrollable = require('../mixins/scrollable'),
IconSelectView = require('./icon-select-view');
IconSelectView = require('./icon-select-view'),
Launcher = require('../comp/launcher');
var GrpView = Backbone.View.extend({
template: require('templates/grp.hbs'),
@ -12,7 +13,9 @@ var GrpView = Backbone.View.extend({
'click .grp__buttons-trash': 'moveToTrash',
'click .grp__back-button': 'returnToApp',
'input #grp__field-title': 'changeTitle',
'change #grp__check-search': 'setEnableSearching'
'input #grp__field-auto-type-seq': 'changeAutoTypeSeq',
'change #grp__check-search': 'setEnableSearching',
'change #grp__check-auto-type': 'setEnableAutoType'
},
initialize: function() {
@ -27,7 +30,10 @@ var GrpView = Backbone.View.extend({
icon: this.model.get('icon') || 'folder',
customIcon: this.model.get('customIcon'),
enableSearching: this.model.get('enableSearching') !== false,
readonly: this.model.get('top')
readonly: this.model.get('top'),
canAutoType: !!Launcher,
autoTypeSeq: this.model.get('autoTypeSeq'),
autoTypeEnabled: this.model.get('enableAutoType') !== false
}, { plain: true });
if (!this.model.get('title')) {
this.$el.find('#grp__field-title').focus();
@ -68,6 +74,11 @@ var GrpView = Backbone.View.extend({
}
},
changeAutoTypeSeq: function(e) {
var seq = $.trim(e.target.value);
this.model.setAutoTypeSeq(seq);
},
showIconsSelect: function() {
if (this.views.sub) {
this.removeSubView();
@ -107,6 +118,11 @@ var GrpView = Backbone.View.extend({
this.model.setEnableSearching(enabled);
},
setEnableAutoType: function(e) {
var enabled = e.target.checked;
this.model.setEnableAutoType(enabled);
},
returnToApp: function() {
Backbone.trigger('edit-group');
}

View File

@ -22,6 +22,19 @@
<i class="fa fa-{{icon}} grp__icon"></i>
{{/if}}
<div class="grp__icons"></div>
{{#if canAutoType}}
{{#unless readonly}}
<div>
<input type="checkbox" class="input-base" id="grp__check-auto-type" {{#if autoTypeEnabled}}checked{{/if}} />
<label for="grp__check-auto-type">{{res 'grpAutoType'}}</label>
</div>
{{/unless}}
<div class="grp__field">
<label for="grp__field-auto-type-seq">{{res 'grpAutoTypeSeq'}}:</label>
<input type="text" class="input-base" id="grp__field-auto-type-seq" value="{{autoTypeSeq}}"
size="50" maxlength="1024" placeholder="{{res 'grpAutoTypeSeqDefault'}}: {{defaultAutoTypeSeq}}" />
</div>
{{/if}}
</div>
<div class="scroller__bar-wrapper"><div class="scroller__bar"></div></div>
{{#unless readonly}}

View File

@ -49,7 +49,7 @@
</div>
<div class="open__pass-field-wrap">
<input class="open__pass-input" type="password" size="30" autocomplete="off" maxlength="128"
placeholder="Click to open a file" readonly />
placeholder="{{res 'openClickToOpen'}}" readonly />
<div class="open__pass-enter-btn"><i class="fa fa-level-down fa-rotate-90"></i></div>
<div class="open__pass-opening-icon"><i class="fa fa-spinner fa-spin"></i></div>
</div>