bootstrap-filestyle-rails 1.1.2 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: e04d6a4ded58685c039181d1704f42cfc9cbd29c
         | 
| 4 | 
            +
              data.tar.gz: edb35b4dcd6c9c4bcae792868a2179ee9c04076c
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 5f018b50874c6e64dae2fa4208e764c3acb1099ab93300aa2dc08da8ed861aeb565d74b40ee4160f7c085ddff987a7e657ddd6bea7ea4ba717ca1a61410815cf
         | 
| 7 | 
            +
              data.tar.gz: 3a0f455768bb08f571d440ad95c424a3c3e9be6526ca0eacfaba79a5b88bf1565b9d248f7be2c7ba6f7bd56b16d0ba76782882c6815979e31ba6674aa69b44f9
         | 
| @@ -4,11 +4,13 @@ | |
| 4 4 | 
             
             * github: https://github.com/markusslima/bootstrap-filestyle
         | 
| 5 5 | 
             
             *
         | 
| 6 6 | 
             
             * Copyright (c) 2014 Markus Vinicius da Silva Lima
         | 
| 7 | 
            -
             * Version 1.1 | 
| 7 | 
            +
             * Version 1.2.1
         | 
| 8 8 | 
             
             * Licensed under the MIT license.
         | 
| 9 9 | 
             
             */
         | 
| 10 10 | 
             
            (function($) {"use strict";
         | 
| 11 11 |  | 
| 12 | 
            +
                var nextId = 0;
         | 
| 13 | 
            +
             | 
| 12 14 | 
             
            	var Filestyle = function(element, options) {
         | 
| 13 15 | 
             
            		this.options = options;
         | 
| 14 16 | 
             
            		this.$elementFilestyle = [];
         | 
| @@ -23,7 +25,7 @@ | |
| 23 25 | 
             
            		},
         | 
| 24 26 |  | 
| 25 27 | 
             
            		destroy : function() {
         | 
| 26 | 
            -
            			this.$element.removeAttr('style').removeData('filestyle') | 
| 28 | 
            +
            			this.$element.removeAttr('style').removeData('filestyle');
         | 
| 27 29 | 
             
            			this.$elementFilestyle.remove();
         | 
| 28 30 | 
             
            		},
         | 
| 29 31 |  | 
| @@ -78,7 +80,7 @@ | |
| 78 80 | 
             
            			} else if (value === false) {
         | 
| 79 81 | 
             
            				if (this.options.icon) {
         | 
| 80 82 | 
             
            					this.options.icon = false;
         | 
| 81 | 
            -
            					this.$elementFilestyle.find('. | 
| 83 | 
            +
            					this.$elementFilestyle.find('.icon-span-filestyle').remove();
         | 
| 82 84 | 
             
            				}
         | 
| 83 85 | 
             
            			} else {
         | 
| 84 86 | 
             
            				return this.options.icon;
         | 
| @@ -132,10 +134,19 @@ | |
| 132 134 | 
             
            			}
         | 
| 133 135 | 
             
            		},
         | 
| 134 136 |  | 
| 137 | 
            +
            		placeholder : function(value) {
         | 
| 138 | 
            +
            			if (value !== undefined) {
         | 
| 139 | 
            +
            				this.options.placeholder = value;
         | 
| 140 | 
            +
            				this.$elementFilestyle.find('input').attr('placeholder', value);
         | 
| 141 | 
            +
            			} else {
         | 
| 142 | 
            +
            				return this.options.placeholder;
         | 
| 143 | 
            +
            			}
         | 
| 144 | 
            +
            		},
         | 
| 145 | 
            +
             | 
| 135 146 | 
             
            		buttonText : function(value) {
         | 
| 136 147 | 
             
            			if (value !== undefined) {
         | 
| 137 148 | 
             
            				this.options.buttonText = value;
         | 
| 138 | 
            -
            				this.$elementFilestyle.find('label  | 
| 149 | 
            +
            				this.$elementFilestyle.find('label .buttonText').html(this.options.buttonText);
         | 
| 139 150 | 
             
            			} else {
         | 
| 140 151 | 
             
            				return this.options.buttonText;
         | 
| 141 152 | 
             
            			}
         | 
| @@ -154,8 +165,8 @@ | |
| 154 165 |  | 
| 155 166 | 
             
            		iconName : function(value) {
         | 
| 156 167 | 
             
            			if (value !== undefined) {
         | 
| 157 | 
            -
            				this.$elementFilestyle.find('. | 
| 158 | 
            -
            					'class' : ' | 
| 168 | 
            +
            				this.$elementFilestyle.find('.icon-span-filestyle').attr({
         | 
| 169 | 
            +
            					'class' : 'icon-span-filestyle ' + this.options.iconName
         | 
| 159 170 | 
             
            				});
         | 
| 160 171 | 
             
            			} else {
         | 
| 161 172 | 
             
            				return this.options.iconName;
         | 
| @@ -164,7 +175,7 @@ | |
| 164 175 |  | 
| 165 176 | 
             
            		htmlIcon : function() {
         | 
| 166 177 | 
             
            			if (this.options.icon) {
         | 
| 167 | 
            -
            				return '<span class=" | 
| 178 | 
            +
            				return '<span class="icon-span-filestyle ' + this.options.iconName + '"></span> ';
         | 
| 168 179 | 
             
            			} else {
         | 
| 169 180 | 
             
            				return '';
         | 
| 170 181 | 
             
            			}
         | 
| @@ -172,7 +183,7 @@ | |
| 172 183 |  | 
| 173 184 | 
             
            		htmlInput : function() {
         | 
| 174 185 | 
             
            			if (this.options.input) {
         | 
| 175 | 
            -
            				return '<input type="text" class="form-control ' + (this.options.size == 'nr' ? '' : 'input-' + this.options.size) + '" disabled> ';
         | 
| 186 | 
            +
            				return '<input type="text" class="form-control ' + (this.options.size == 'nr' ? '' : 'input-' + this.options.size) + '" placeholder="'+ this.options.placeholder +'" disabled> ';
         | 
| 176 187 | 
             
            			} else {
         | 
| 177 188 | 
             
            				return '';
         | 
| 178 189 | 
             
            			}
         | 
| @@ -212,26 +223,27 @@ | |
| 212 223 | 
             
            				$label;
         | 
| 213 224 |  | 
| 214 225 | 
             
            			if (id === '' || !id) {
         | 
| 215 | 
            -
            				id = 'filestyle-' +  | 
| 226 | 
            +
            				id = 'filestyle-' + nextId;
         | 
| 216 227 | 
             
            				_self.$element.attr({
         | 
| 217 228 | 
             
            					'id' : id
         | 
| 218 229 | 
             
            				});
         | 
| 230 | 
            +
                            nextId++;
         | 
| 219 231 | 
             
            			}
         | 
| 220 232 |  | 
| 221 233 | 
             
            			btn = '<span class="group-span-filestyle ' + (_self.options.input ? 'input-group-btn' : '') + '">' +
         | 
| 222 | 
            -
             | 
| 223 | 
            -
             | 
| 224 | 
            -
             | 
| 225 | 
            -
             | 
| 226 | 
            -
             | 
| 227 | 
            -
             | 
| 234 | 
            +
            			  '<label for="' + id + '" class="btn ' + _self.options.buttonName + ' ' +
         | 
| 235 | 
            +
            			(_self.options.size == 'nr' ? '' : 'btn-' + _self.options.size) + '" ' +
         | 
| 236 | 
            +
            			(_self.options.disabled ? 'disabled="true"' : '') + '>' +
         | 
| 237 | 
            +
            			_self.htmlIcon() + '<span class="buttonText">' + _self.options.buttonText + '</span>' +
         | 
| 238 | 
            +
            			  '</label>' +
         | 
| 239 | 
            +
            			  '</span>';
         | 
| 228 240 |  | 
| 229 241 | 
             
            			html = _self.options.buttonBefore ? btn + _self.htmlInput() : _self.htmlInput() + btn;
         | 
| 230 242 |  | 
| 231 243 | 
             
            			_self.$elementFilestyle = $('<div class="bootstrap-filestyle input-group">' + html + '</div>');
         | 
| 232 244 | 
             
            			_self.$elementFilestyle.find('.group-span-filestyle').attr('tabindex', "0").keypress(function(e) {
         | 
| 233 | 
            -
             | 
| 234 | 
            -
             | 
| 245 | 
            +
            			if (e.keyCode === 13 || e.charCode === 32) {
         | 
| 246 | 
            +
            				_self.$elementFilestyle.find('label').click();
         | 
| 235 247 | 
             
            					return false;
         | 
| 236 248 | 
             
            				}
         | 
| 237 249 | 
             
            			});
         | 
| @@ -301,14 +313,15 @@ | |
| 301 313 |  | 
| 302 314 | 
             
            	$.fn.filestyle.defaults = {
         | 
| 303 315 | 
             
            		'buttonText' : 'Choose file',
         | 
| 304 | 
            -
            		'iconName' : 'glyphicon-folder-open',
         | 
| 316 | 
            +
            		'iconName' : 'glyphicon glyphicon-folder-open',
         | 
| 305 317 | 
             
            		'buttonName' : 'btn-default',
         | 
| 306 318 | 
             
            		'size' : 'nr',
         | 
| 307 319 | 
             
            		'input' : true,
         | 
| 308 320 | 
             
            		'badge' : true,
         | 
| 309 321 | 
             
            		'icon' : true,
         | 
| 310 322 | 
             
            		'buttonBefore' : false,
         | 
| 311 | 
            -
            		'disabled' : false
         | 
| 323 | 
            +
            		'disabled' : false,
         | 
| 324 | 
            +
            		'placeholder': ''
         | 
| 312 325 | 
             
            	};
         | 
| 313 326 |  | 
| 314 327 | 
             
            	$.fn.filestyle.noConflict = function() {
         | 
| @@ -316,7 +329,6 @@ | |
| 316 329 | 
             
            		return this;
         | 
| 317 330 | 
             
            	};
         | 
| 318 331 |  | 
| 319 | 
            -
            	// Data attributes register
         | 
| 320 332 | 
             
            	$(function() {
         | 
| 321 333 | 
             
            		$('.filestyle').each(function() {
         | 
| 322 334 | 
             
            			var $this = $(this), options = {
         | 
| @@ -329,7 +341,8 @@ | |
| 329 341 | 
             
            				'buttonText' : $this.attr('data-buttonText'),
         | 
| 330 342 | 
             
            				'buttonName' : $this.attr('data-buttonName'),
         | 
| 331 343 | 
             
            				'iconName' : $this.attr('data-iconName'),
         | 
| 332 | 
            -
            				'badge' : $this.attr('data-badge') === 'false' ? false : true
         | 
| 344 | 
            +
            				'badge' : $this.attr('data-badge') === 'false' ? false : true,
         | 
| 345 | 
            +
            				'placeholder': $this.attr('data-placeholder')
         | 
| 333 346 | 
             
            			};
         | 
| 334 347 |  | 
| 335 348 | 
             
            			$this.filestyle(options);
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: bootstrap-filestyle-rails
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1.1 | 
| 4 | 
            +
              version: 1.2.1
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Mauricio Pasquier Juan
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2016-05-30 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: bundler
         | 
| @@ -78,7 +78,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 78 78 | 
             
                  version: '0'
         | 
| 79 79 | 
             
            requirements: []
         | 
| 80 80 | 
             
            rubyforge_project: 
         | 
| 81 | 
            -
            rubygems_version: 2. | 
| 81 | 
            +
            rubygems_version: 2.5.1
         | 
| 82 82 | 
             
            signing_key: 
         | 
| 83 83 | 
             
            specification_version: 4
         | 
| 84 84 | 
             
            summary: Bootstrap Filestyle for the asset pipeline
         |