o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1364984310.465915: @value"ž{I" class:EFI"ProcessedAsset;FI"logical_path;FI":locomotive/views/content_types/select_options_view.js;TI" pathname;FI"|/Users/papipo/Projects/locomotive/engine/app/assets/javascripts/locomotive/views/content_types/select_options_view.js.coffee;TI"content_type;FI"application/javascript;FI" mtime;FI"2013-04-03T11:01:13+02:00;FI" length;FiÙI" digest;F"%1c11b4ca814209f8c2cb06fd0c641165I" 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).ContentTypes || (_base.ContentTypes = {}); Locomotive.Views.ContentTypes.SelectOptionsView = (function(_super) { __extends(SelectOptionsView, _super); function SelectOptionsView() { _ref = SelectOptionsView.__super__.constructor.apply(this, arguments); return _ref; } SelectOptionsView.prototype.tagName = 'div'; SelectOptionsView.prototype.className = 'list'; SelectOptionsView.prototype.events = { 'click a.add': 'add_entry', 'click span.name': 'edit_entry', 'click a.remove': 'remove_entry', 'click a.drag': 'do_nothing' }; SelectOptionsView.prototype.initialize = function() { _.bindAll(this, 'refresh_position_entries', '_insert_entry'); return this.collection.bind('add', this._insert_entry); }; SelectOptionsView.prototype.render = function() { $(this.el).html(ich.select_options_list()); this.prompt_message = this.$('> ul').data('prompt'); this.render_entries(); this.make_list_sortable(); return this; }; SelectOptionsView.prototype.render_entries = function() { return this.collection.each(this._insert_entry); }; SelectOptionsView.prototype.make_list_sortable = function() { return this.sortable_list = this.$('> ul').sortable({ handle: 'a.drag', items: 'li.entry', update: this.refresh_position_entries }); }; SelectOptionsView.prototype.refresh_position_entries = function() { var _this = this; return this.$('> ul li.entry').each(function(index, view_dom) { var select_option; select_option = _this.collection.getByCid($(view_dom).data('cid')); return select_option.set({ position: index }); }); }; SelectOptionsView.prototype.do_nothing = function(event) { return event.stopPropagation() & event.preventDefault(); }; SelectOptionsView.prototype.add_entry = function(event) { var name; event.stopPropagation() & event.preventDefault(); name = prompt(this.prompt_message); if (name !== '') { return this.collection.add([ { name: name } ]); } }; SelectOptionsView.prototype.edit_entry = function(event) { var name, select_option, span, view_dom; event.stopPropagation() & event.preventDefault(); span = $(event.target); view_dom = span.closest('li'); select_option = this.collection.getByCid(view_dom.data('cid')); if ((name = prompt(this.prompt_message, select_option.get('name'))) !== '') { select_option.set({ name: name }); return span.html(name); } }; SelectOptionsView.prototype.remove_entry = function(event) { var link, select_option, view_dom; event.stopPropagation() & event.preventDefault(); link = $(event.target); view_dom = link.closest('li'); select_option = this.collection.getByCid(view_dom.data('cid')); if (confirm(link.data('confirm'))) { if (select_option.isNew()) { this.collection.remove(select_option); } else { select_option.set({ _destroy: true }); } return view_dom.remove(); } }; SelectOptionsView.prototype._insert_entry = function(select_option) { var view_dom; view_dom = ich.select_option_entry(select_option.toJSON()); view_dom.data('cid', select_option.cid); this.$('> ul').append(view_dom); return this.refresh_position_entries; }; return SelectOptionsView; })(Backbone.View); }).call(this); ;TI"dependency_digest;F"%54367474a82da09ba182c79f98fa03a7I"required_paths;F[I"|/Users/papipo/Projects/locomotive/engine/app/assets/javascripts/locomotive/views/content_types/select_options_view.js.coffee;TI"dependency_paths;F[{I" path;FI"|/Users/papipo/Projects/locomotive/engine/app/assets/javascripts/locomotive/views/content_types/select_options_view.js.coffee;TI" mtime;FI"2013-04-03T11:01:13+02:00;FI" digest;F"%8e19e61720d551e1eb00f236ba109044I" _version;F"%6776f581a4329e299531e1d52aa59832