o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1364984311.505814: @value"{I" class:EFI"ProcessedAsset;FI"logical_path;FI"8locomotive/views/editable_elements/edit_all_view.js;TI" pathname;FI"/Users/papipo/Projects/locomotive/engine/app/assets/javascripts/locomotive/views/editable_elements/edit_all_view.js.coffee;TI"content_type;FI"application/javascript;FI" mtime;FI"2013-04-03T11:01:13+02:00;FI" length;FiI" digest;F"%0d61227c3d1ee5749a9f77bdf8720fc9I" source;FI"(function() { var _base, _ref, __hasProp = {}.hasOwnProperty, __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; (_base = Locomotive.Views).EditableElements || (_base.EditableElements = {}); Locomotive.Views.EditableElements.EditAllView = (function(_super) { __extends(EditAllView, _super); function EditAllView() { _ref = EditAllView.__super__.constructor.apply(this, arguments); return _ref; } EditAllView.prototype.id = 'editable-elements'; EditAllView.prototype.tagName = 'div'; EditAllView.prototype._editable_elements_views = []; EditAllView.prototype.render = function() { window.bar = this; if (this.collection.isEmpty()) { $(this.el).hide(); } else { this.blocks = this.collection.blocks(); $(this.el).html(ich.editable_elements_edit({ blocks: this.blocks })); this.render_elements(); this.enable_nav(); } return this; }; EditAllView.prototype.after_render = function() { var _this = this; return _.each(this._editable_elements_views, function(view) { return view.after_render(); }); }; EditAllView.prototype.refresh = function() { var _this = this; return _.each(this._editable_elements_views, function(view) { view.model = _this.collection.get(view.model.get('id')); return view.refresh(); }); }; EditAllView.prototype.unbind_model = function() { var _this = this; return _.each(this._editable_elements_views, function(view) { return Backbone.ModelBinding.unbind(view); }); }; EditAllView.prototype.render_elements = function() { var index, _this = this; index = 0; return _.each(this.blocks, function(block) { var list; list = _this.collection.by_block(block.name); return _.each(list, function(element) { var view, view_class; element.set({ index: index }); view_class = (function() { switch (element.get('type')) { case 'EditableShortText': return Locomotive.Views.EditableElements.ShortTextView; case 'EditableLongText': return Locomotive.Views.EditableElements.LongTextView; case 'EditableFile': return Locomotive.Views.EditableElements.FileView; case 'EditableControl': return Locomotive.Views.EditableElements.ControlView; } })(); view = new view_class({ model: element }); _this.$("#block-" + block.index + " > fieldset > ol").append(view.render().el); _this._editable_elements_views.push(view); return index += 1; }); }); }; EditAllView.prototype.enable_nav = function() { var _this = this; return this.$('.nav a').click(function(event) { var index, link; event.stopPropagation() & event.preventDefault(); link = $(event.target); index = parseInt(link.prop('href').match(/block-(.+)/)[1]); _this.$('.wrapper ul li.block').hide(); _this.$("#block-" + index).show(); _this._hide_last_separator(); link.parent().find('.on').removeClass('on'); return link.addClass('on'); }); }; EditAllView.prototype._hide_last_separator = function() { var _this = this; return _.each(this.$('fieldset'), function(fieldset) { $(fieldset).find('li.last').removeClass('last'); return $(_.last($(fieldset).find('li.input:visible'))).addClass('last'); }); }; EditAllView.prototype.remove = function() { var _this = this; _.each(this._editable_elements_views, function(view) { return view.remove(); }); this._editable_elements_views.length = 0; return EditAllView.__super__.remove.apply(this, arguments); }; return EditAllView; })(Backbone.View); }).call(this); ;TI"dependency_digest;F"%cf734ab287275bbba129635933e9fc9eI"required_paths;F[I"/Users/papipo/Projects/locomotive/engine/app/assets/javascripts/locomotive/views/editable_elements/edit_all_view.js.coffee;TI"dependency_paths;F[{I" path;FI"/Users/papipo/Projects/locomotive/engine/app/assets/javascripts/locomotive/views/editable_elements/edit_all_view.js.coffee;TI" mtime;FI"2013-04-03T11:01:13+02:00;FI" digest;F"%e4d7220da8e7dcee967d00e1664367fdI" _version;F"%6776f581a4329e299531e1d52aa59832