o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1384093244.9781692: @value"¸{I" class:ETI"ProcessedAsset;FI"logical_path;TI":locomotive/views/content_types/select_options_view.js;FI" pathname;TI"€/Users/didier/Documents/LocomotiveCMS/engine/app/assets/javascripts/locomotive/views/content_types/select_options_view.js.coffee;FI"content_type;TI"application/javascript;TI" mtime;TI"2013-03-19T10:26:36+01:00;TI" length;TiÓI" digest;TI"%3f27a3b6261d1510371079ef3d2c1e60;FI" source;TI"Ó(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;TI"%13893b455e0d3a38ed4cf89d45879d78;FI"required_paths;T[I"€/Users/didier/Documents/LocomotiveCMS/engine/app/assets/javascripts/locomotive/views/content_types/select_options_view.js.coffee;FI"dependency_paths;T[{I" path;TI"€/Users/didier/Documents/LocomotiveCMS/engine/app/assets/javascripts/locomotive/views/content_types/select_options_view.js.coffee;FI" mtime;TI"2013-03-19T10:26:36+01:00;TI" digest;TI"%64f7e47ab26ceafee8118a6df2de3c7a;FI" _version;TI"%ffd318ca8b794f42f5029101c2cf5d91;F