diff --git a/js/app.js b/js/app.js index b50db74d..978e62de 100644 --- a/js/app.js +++ b/js/app.js @@ -53,7 +53,7 @@ requirejs.config({ blueImpGalleryHelper: 'lib/blueimp-helper', // helper function for Blue Imp Gallery blueImpGalleryBootstrap: 'lib/bootstrap-image-gallery', // v3.4.2 Bootstrap extension for Blue Imp Gallery - https://blueimp.github.io/Bootstrap-Image-Gallery bootstrapConfirmation: 'lib/bootstrap-confirmation', // v1.0.5 Bootstrap extension for inline confirm dialog - https://github.com/tavicu/bs-confirmation - bootstrapToggle: 'lib/bootstrap2-toggle.min', // v2.2.0 Bootstrap Toggle (Checkbox) - http://www.bootstraptoggle.com + bootstrapToggle: 'lib/bootstrap-toggle.min', // v2.2.0 Bootstrap Toggle (Checkbox) - http://www.bootstraptoggle.com lazyload: 'lib/jquery.lazyload.min', // v1.9.5 LazyLoader images - http://www.appelsiini.net/projects/lazyload sortable: 'lib/sortable.min', // v1.6.0 Sortable - drag&drop reorder - https://github.com/rubaxa/Sortable diff --git a/js/app/ui/dialog/account_settings.js b/js/app/ui/dialog/account_settings.js index 2311e193..e8d18cc7 100644 --- a/js/app/ui/dialog/account_settings.js +++ b/js/app/ui/dialog/account_settings.js @@ -200,7 +200,7 @@ define([ off: 'Disable ', onstyle: 'success', offstyle: 'warning', - width: 90, + width: 100, height: 30 }); diff --git a/js/app/ui/system_signature.js b/js/app/ui/system_signature.js index 76690cc1..5d6e46c1 100644 --- a/js/app/ui/system_signature.js +++ b/js/app/ui/system_signature.js @@ -36,6 +36,7 @@ define([ signatureScannedProgressBarClass: 'pf-system-progress-scanned', // class for signature progress bar // toolbar + sigTableLazyToggleButtonClass: 'pf-sig-table-lazy-button', // class for "lazy update" toggle button sigTableClearButtonClass: 'pf-sig-table-clear-button', // class for "clear" signatures button // signature table @@ -970,19 +971,19 @@ define([ if( clearButton.is(':hidden') ){ // show button - clearButton.velocity('transition.bounceIn', { - duration: 180 + clearButton.velocity('transition.expandIn', { + duration: 100 }); }else{ // highlight button clearButton.velocity('callout.pulse', { - duration: 240 + duration: 200 }); } }else{ // hide button - clearButton.velocity('transition.bounceOut', { - duration: 180 + clearButton.velocity('transition.expandOut', { + duration: 100 }); } }; @@ -1053,6 +1054,12 @@ define([ checkDeleteSignaturesButton(moduleElement); } }) + ).append( + $('', { + type: 'checkbox', + class: [config.sigTableLazyToggleButtonClass, 'btn-labeled'].join(' '), + value: 1, + }).attr('data-toggle', 'toggle') ).append( getLabledButton({ type: 'danger', @@ -1078,6 +1085,24 @@ define([ moduleElement.append(tableToolbar); + // "lazy update" toggle button -------------------------------------------------------------------------------- + let lazyToggleCheckbox = moduleElement.find('.' + config.sigTableLazyToggleButtonClass).bootstrapToggle({ + size: 'small' , + on: '  lazy delete', + off: '  lazy update', + onstyle: 'warning' , + offstyle: 'default' , + width: 110 + }); + + let lazyToggleButton = lazyToggleCheckbox.parent(); + lazyToggleButton.find('.toggle-on').attr('title', 'lazy \'update\' and \'delete\' old
from clipboard |ctrl + v|'); + lazyToggleButton.find('.toggle-off').attr('title', 'lazy \'update\' signatures
from clipboard |ctrl + v|'); + lazyToggleButton.initTooltips({ + container: 'body', + html: true + }); + // add toolbar action for table ------------------------------------------------------------------------------- let tableToolbarAction = $('
', { class: config.tableToolsActionClass @@ -2327,7 +2352,12 @@ define([ // event listener for global "paste" signatures into the page ------------------------------------------------- moduleElement.on('pf:updateSystemSignatureModuleByClipboard', function(e, clipboard){ - $(this).updateSignatureTableByClipboard(systemData, clipboard, {}); + // check "lazy update" toggle button + let signatureOptions = { + deleteOld: moduleElement.find('.' + config.sigTableLazyToggleButtonClass).is(':checked') ? 1 : 0 + }; + + $(this).updateSignatureTableByClipboard(systemData, clipboard, signatureOptions); }); }; diff --git a/js/lib/bootstrap-toggle.min.js b/js/lib/bootstrap-toggle.min.js new file mode 100644 index 00000000..5bed0ff7 --- /dev/null +++ b/js/lib/bootstrap-toggle.min.js @@ -0,0 +1,8 @@ +/*! ======================================================================== + * Bootstrap Toggle: bootstrap-toggle.js v2.2.0 + * http://www.bootstraptoggle.com + * ======================================================================== + * Copyright 2014 Min Hur, The New York Times Company + * Licensed under MIT + * ======================================================================== */ ++function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.toggle"),f="object"==typeof b&&b;e||d.data("bs.toggle",e=new c(this,f)),"string"==typeof b&&e[b]&&e[b]()})}var c=function(b,c){this.$element=a(b),this.options=a.extend({},this.defaults(),c),this.render()};c.VERSION="2.2.0",c.DEFAULTS={on:"On",off:"Off",onstyle:"primary",offstyle:"default",size:"normal",style:"",width:null,height:null},c.prototype.defaults=function(){return{on:this.$element.attr("data-on")||c.DEFAULTS.on,off:this.$element.attr("data-off")||c.DEFAULTS.off,onstyle:this.$element.attr("data-onstyle")||c.DEFAULTS.onstyle,offstyle:this.$element.attr("data-offstyle")||c.DEFAULTS.offstyle,size:this.$element.attr("data-size")||c.DEFAULTS.size,style:this.$element.attr("data-style")||c.DEFAULTS.style,width:this.$element.attr("data-width")||c.DEFAULTS.width,height:this.$element.attr("data-height")||c.DEFAULTS.height}},c.prototype.render=function(){this._onstyle="btn-"+this.options.onstyle,this._offstyle="btn-"+this.options.offstyle;var b="large"===this.options.size?"btn-lg":"small"===this.options.size?"btn-sm":"mini"===this.options.size?"btn-xs":"",c=a('