Sha256: b516d2aeda89134770335f06ca3d44c4ea2c14ab2b4c3396a0762bf93c21d766

Contents?: true

Size: 992 Bytes

Versions: 5

Compression:

Stored size: 992 Bytes

Contents

Spider.defineWidget('Spider.Forms.FileInput', 'Spider.Forms.Input', {
	
	autoInit: true,
	
	ready: function(){
		var self = this;
		var fileLink = $('.file-link', this.el);
		if (fileLink.size() == 1){
			var changeLabel = $('.change-label', this.el).text();
			var changeDiv = $('.change', this.el);
			changeDiv.hide();
			$('.clear', this.el).hide();
			var clearCheckBox = $('.clear input:checkbox', this.el);
			var fileInput = $('.change input', this.el);
			
			var link = $('<a href="#" class="js-change-link"/>');
			link.text(changeLabel+'...')
				.insertAfter(fileLink)
				.click(function(e){
					e.preventDefault();
					if (clearCheckBox.is(':checked')){
						link.removeClass('open');
						fileLink.removeClass('deleted');
						clearCheckBox.attr('checked', false);
						changeDiv.hide();
					}
					else{
						fileLink.addClass('deleted');
						clearCheckBox.attr('checked', true);
						link.addClass('open');
						changeDiv.show();
					}
				});
		}
		
	}    
});

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
spiderfw-0.5.13 apps/core/forms/public/file_input.js
spiderfw-0.5.12 apps/core/forms/public/file_input.js
spiderfw-0.5.11 apps/core/forms/public/file_input.js
spiderfw-0.5.10 apps/core/forms/public/file_input.js
spiderfw-0.5.9 apps/core/forms/public/file_input.js