o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1368149842.185864: @value"L {I" class:ETI"ProcessedAsset;FI"logical_path;TI"manage_repeating_fields.js;FI" pathname;TI"Z/Users/jfriesen/Repositories/curate/app/assets/javascripts/manage_repeating_fields.js;FI"content_type;TI"application/javascript;TI" mtime;TI"2013-05-08T14:06:51-04:00;TI" length;Ti I" digest;TI"%d38aa496b8ce6f1a65ad6cd745de4b00;FI" source;TI" // This widget manages the adding and removing of repeating fields. // There are a lot of assumptions about the structure of the classes and elements. // These assumptions are reflected in the MultiValueInput class. (function($){ $.widget( "curate.manage_fields", { options: { change: null, add: null, remove: null }, _create: function() { this.element.addClass("managed"); $('.field-wrapper', this.element).addClass("input-append"); this.controls = $(""); this.remover = $(""); this.adder = $(""); $('.field-wrapper', this.element).append(this.controls); $('.field-wrapper:not(:last-child) .field-controls', this.element).append(this.remover); $('.field-controls:last', this.element).append(this.adder); this._on( this.element, { "click .remove": "remove_from_list", "click .add": "add_to_list" }); }, add_to_list: function( event ) { event.preventDefault(); var $activeField = $(event.target).parents('.field-wrapper'), $activeFieldControls = $activeField.children('.field-controls'), $removeControl = this.remover.clone(), $newField = $activeField.clone(), $listing = $('.listing', this.element), $warningSpan = $("cannot add new empty field"); if ($activeField.children('input').val() === '') { $listing.children('.warning').remove(); $listing.append($warningSpan); } else{ $listing.children('.warning').remove(); $('.add', $activeFieldControls).remove(); $activeFieldControls.prepend($removeControl); $newChildren = $newField.children('input'); $newChildren. val(''). removeProp('required'); $listing.append($newField); $newChildren.first().focus(); this._trigger("add"); } }, remove_from_list: function( event ) { event.preventDefault(); $(event.target) .parents('.field-wrapper') .remove(); this._trigger("remove"); }, _destroy: function() { this.actions.remove(); $('.field-wrapper', this.element).removeClass("input-append"); this.element.removeClass( "managed" ); } }); })(jQuery); ;TI"dependency_digest;TI"%9daa9e899e315a966648891b20d33661;FI"required_paths;T[I"Z/Users/jfriesen/Repositories/curate/app/assets/javascripts/manage_repeating_fields.js;FI"dependency_paths;T[{I" path;TI"Z/Users/jfriesen/Repositories/curate/app/assets/javascripts/manage_repeating_fields.js;FI" mtime;TI"2013-05-08T14:06:51-04:00;TI" digest;TI"%d38aa496b8ce6f1a65ad6cd745de4b00;FI" _version;TI"%ffd318ca8b794f42f5029101c2cf5d91;F