o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1381401969.398722: @value"ã{I" class:EFI"ProcessedAsset;FI"logical_path;FI":locomotive/views/content_types/select_options_view.js;TI" pathname;FI"•/Users/papipo/.rvm/gems/ruby-1.9.3-p448/gems/locomotive_cms-2.2.3/app/assets/javascripts/locomotive/views/content_types/select_options_view.js.coffee;TI"content_type;FI"application/javascript;FI" mtime;FI"2013-10-10T12:39:17+02:00;FI" length;FiÓI" digest;F"%3f27a3b6261d1510371079ef3d2c1e60I" 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"%13893b455e0d3a38ed4cf89d45879d78I"required_paths;F[I"•/Users/papipo/.rvm/gems/ruby-1.9.3-p448/gems/locomotive_cms-2.2.3/app/assets/javascripts/locomotive/views/content_types/select_options_view.js.coffee;TI"dependency_paths;F[{I" path;FI"•/Users/papipo/.rvm/gems/ruby-1.9.3-p448/gems/locomotive_cms-2.2.3/app/assets/javascripts/locomotive/views/content_types/select_options_view.js.coffee;TI" mtime;FI"2013-10-10T12:39:17+02:00;FI" digest;F"%64f7e47ab26ceafee8118a6df2de3c7aI" _version;F"%ffd318ca8b794f42f5029101c2cf5d91