copy fields tip

This commit is contained in:
Antelle 2016-01-13 20:46:43 +03:00
parent 071ac42f83
commit 9e588869ce
5 changed files with 28 additions and 5 deletions

View File

@ -2,7 +2,8 @@
var Timeouts = {
AutoSync: 30 * 1000 * 60,
CopyTip: 1500
CopyTip: 1500,
AutoHideHint: 3000
};
module.exports = Timeouts;

View File

@ -17,7 +17,8 @@ var AppSettingsModel = Backbone.Model.extend({
minimizeOnClose: false,
tableView: false,
colorfulIcons: false,
lockOnMinimize: true
lockOnMinimize: true,
helpTipCopyShown: false
},
initialize: function() {

View File

@ -129,6 +129,7 @@ var Locale = {
detDelFromTrashBodyHint: 'To quickly remove all items from trash, click empty icon in Trash menu.',
detPassCopied: 'Password copied',
detPassCopiedTime: 'Password copied for {} seconds',
detCopyHint: 'You can copy field value with click on its title',
appSecWarn: 'Not Secure!',
appSecWarnBody1: 'You have loaded this app with insecure connection. ' +

View File

@ -2,6 +2,7 @@
var Backbone = require('backbone'),
GroupModel = require('../../models/group-model'),
AppSettingsModel = require('../../models/app-settings-model'),
Scrollable = require('../../mixins/scrollable'),
FieldViewText = require('../fields/field-view-text'),
FieldViewDate = require('../fields/field-view-date'),
@ -33,6 +34,7 @@ var DetailsView = Backbone.View.extend({
fieldViews: null,
views: null,
passEditView: null,
addNewFieldView: null,
passCopyTip: null,
events: {
@ -111,6 +113,7 @@ var DetailsView = Backbone.View.extend({
clearTimeout(this.dragTimeout);
}
this.pageResized();
this.showCopyTip();
return this;
},
@ -151,8 +154,9 @@ var DetailsView = Backbone.View.extend({
}
}
}
this.fieldViews.push(new FieldViewCustom({ model: { name: '', title: Locale.detAddField, newField: newFieldTitle,
value: function() { return ''; } } }));
this.addNewFieldView = new FieldViewCustom({ model: { name: '', title: Locale.detAddField, newField: newFieldTitle,
value: function() { return ''; } } });
this.fieldViews.push(this.addNewFieldView);
var fieldsMainEl = this.$el.find('.details__body-fields');
var fieldsAsideEl = this.$el.find('.details__body-aside');
@ -298,6 +302,22 @@ var DetailsView = Backbone.View.extend({
}
},
showCopyTip: function() {
if (this.helpTipCopyShown) {
return;
}
this.helpTipCopyShown = AppSettingsModel.instance.get('helpTipCopyShown');
if (this.helpTipCopyShown) {
return;
}
AppSettingsModel.instance.set('helpTipCopyShown', true);
this.helpTipCopyShown = true;
var newFieldLabel = this.addNewFieldView.labelEl;
var tip = new Tip(newFieldLabel, { title: Locale.detCopyHint, placement: 'right' });
tip.show();
setTimeout(function() { tip.hide(); }, Timeouts.AutoHideHint);
},
fieldChanged: function(e) {
if (e.field) {
if (e.field[0] === '$') {

View File

@ -7,7 +7,7 @@
pointer-events: none;
animation: tip $tip-transition-in;
@include dropdown();
&--fast {
&.tip--fast, &.tip--fast:before, &.tip--fast:after {
animation-duration: $base-duration;
}
&--hide.tip, &--hide.tip:before, &--hide.tip:after {