o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1364984315.223236: @value"Á{I" class:EFI"ProcessedAsset;FI"logical_path;FI"2locomotive/views/shared/fields/select_view.js;TI" pathname;FI"y/Users/papipo/Projects/locomotive/engine/app/assets/javascripts/locomotive/views/shared/fields/select_view.js.coffee;TI"content_type;FI"application/javascript;FI" mtime;FI"2013-04-03T11:01:13+02:00;FI" length;FiI" digest;F"%7fe3ca25d8cf388730a4f71a20f377d0I" source;FI"(function() { var _base, _base1, _ref, __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, __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).Shared || (_base.Shared = {}); (_base1 = Locomotive.Views.Shared).Fields || (_base1.Fields = {}); Locomotive.Views.Shared.Fields.SelectView = (function(_super) { __extends(SelectView, _super); function SelectView() { this.on_save = __bind(this.on_save, this); _ref = SelectView.__super__.constructor.apply(this, arguments); return _ref; } SelectView.prototype.el = '#edit-select-option-entries'; SelectView.prototype.select_options_view = null; SelectView.prototype.initialize = function() { _.bindAll(this, 'save', 'on_save'); this.create_dialog(); return SelectView.__super__.initialize.call(this); }; SelectView.prototype.render = function() { this.render_select_options_view(); return this.open(); }; SelectView.prototype.render_for = function(name, callback) { this.name = name; this.on_save_callback = callback; this.custom_field = this.model.find_entries_custom_field(this.name); return this.render(); }; SelectView.prototype.create_dialog = function() { var _this = this; return this.dialog = $(this.el).dialog({ autoOpen: false, modal: true, zIndex: window.application_view.unique_dialog_zindex(), width: 770, create: function(event, ui) { $(_this.el).prev().find('.ui-dialog-title').html(_this.$('h2').html()); _this.$('h2').remove(); _this.$form = _this.$('.placeholder').formSubmitNotification(); _this.$buttons_pane = _this.$('.dialog-actions').appendTo($(_this.el).parent()).addClass('ui-dialog-buttonpane ui-widget-content ui-helper-clearfix'); _this.$buttons_pane.find('#close-link').click(function(event) { return _this.close(event); }); return _this.$buttons_pane.find('input[type=submit]').click(_this.save); }, open: function(event, ui, extra) { return $(_this.el).dialog('overlayEl').bind('click', function() { return _this.close(); }); } }); }; SelectView.prototype.save = function(event) { event.stopPropagation() & event.preventDefault(); this.$form.trigger('ajax:beforeSend'); $.rails.disableFormElements(this.$buttons_pane); return this.model.save({}, { success: this.on_save, error: this.on_save }); }; SelectView.prototype.on_save = function(model, response) { $.rails.enableFormElements(this.$buttons_pane); model._normalize(); this.custom_field = model.find_entries_custom_field(this.custom_field.get('name')); this.$form.trigger('ajax:complete'); if (this.on_save_callback != null) { this.on_save_callback(this.custom_field.get('select_options').sortBy(function(option) { return option.get('position'); })); } return this.close(); }; SelectView.prototype.render_select_options_view = function() { if (this.select_options_view != null) { this.select_options_view.remove(); } this.select_options_view = new Locomotive.Views.ContentTypes.SelectOptionsView({ model: this.custom_field, collection: this.custom_field.get('select_options') }); return this.$('.placeholder').append(this.select_options_view.render().el); }; SelectView.prototype.open = function() { return $(this.el).dialog('open'); }; SelectView.prototype.close = function(event) { if (event != null) { event.stopPropagation() & event.preventDefault(); } $(this.el).dialog('overlayEl').unbind('click'); return $(this.el).dialog('close'); }; SelectView.prototype.center = function() { return $(this.el).dialog('option', 'position', 'center'); }; return SelectView; })(Backbone.View); }).call(this); ;TI"dependency_digest;F"%0dfe9968393023d09b13ea799d288d06I"required_paths;F[I"y/Users/papipo/Projects/locomotive/engine/app/assets/javascripts/locomotive/views/shared/fields/select_view.js.coffee;TI"dependency_paths;F[{I" path;FI"y/Users/papipo/Projects/locomotive/engine/app/assets/javascripts/locomotive/views/shared/fields/select_view.js.coffee;TI" mtime;FI"2013-04-03T11:01:13+02:00;FI" digest;F"%a037c5fee8b5840376ae5cdadeb2e170I" _version;F"%6776f581a4329e299531e1d52aa59832