o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1381401970.593983: @value"à{I" class:EFI"ProcessedAsset;FI"logical_path;FI"3locomotive/views/inline_editor/toolbar_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/inline_editor/toolbar_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"%72147323226af371cfef5e3d3fb20198I" 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).InlineEditor || (_base.InlineEditor = {}); Locomotive.Views.InlineEditor.ToolbarView = (function(_super) { __extends(ToolbarView, _super); function ToolbarView() { _ref = ToolbarView.__super__.constructor.apply(this, arguments); return _ref; } ToolbarView.prototype.el = '#toolbar .inner'; ToolbarView.prototype.events = { 'change .editing-mode input[type=checkbox]': 'toggle_editing_mode', 'click .back a': 'back', 'click .element-actions a.save': 'save_changes', 'click .element-actions a.cancel': 'cancel_changes' }; ToolbarView.prototype.render = function() { ToolbarView.__super__.render.apply(this, arguments); this.enable_editing_mode_checkbox(); this.enable_content_locale_picker(); return this; }; ToolbarView.prototype.notify = function(aloha_editable) { var element_id; element_id = aloha_editable.obj.data('element-id'); this.model.get('editable_elements').get(element_id).set({ content: aloha_editable.getContents() }); this.$('.element-actions').show(); return this.hide_editing_mode_block(); }; ToolbarView.prototype.show_status = function(status, growl) { var message; growl || (growl = false); message = this.$('h1').attr("data-" + status + "-status"); this.$('h1').html(message).removeClass().addClass(status); if (growl) { $.growl('error', message); } return this; }; ToolbarView.prototype.save_changes = function(event) { var previous_attributes, _this = this; event.stopPropagation() & event.preventDefault(); previous_attributes = _.clone(this.model.attributes); return this.model.save({}, { success: function(model, response) { model.attributes = previous_attributes; _this.$('.element-actions').hide(); return _this.show_editing_mode_block(); }, error: function(model, xhr) { return _this.$('.element-actions').hide(); } }); }; ToolbarView.prototype.cancel_changes = function(event) { event.stopPropagation() & event.preventDefault(); return this.options.target[0].contentWindow.location.href = this.options.target[0].contentWindow.location.href; }; ToolbarView.prototype.back = function(event) { event.stopPropagation() & event.preventDefault(); if (this.model) { return window.location.href = this.model.get('edit_url'); } else { return window.location.href = window.Locomotive.mounted_on + '/pages'; } }; ToolbarView.prototype.show_editing_mode_block = function() { return this.$('.editing-mode').show(); }; ToolbarView.prototype.hide_editing_mode_block = function() { return this.$('.editing-mode').hide(); }; ToolbarView.prototype.toggle_editing_mode = function(event) { if (this.editable_elements() === null) { return; } if ($(event.target).is(':checked')) { return this.editable_elements().aloha(); } else { return this.editable_elements().removeClass('aloha-editable-highlight').mahalo(); } }; ToolbarView.prototype.editable_elements = function() { if (this.options.target[0].contentWindow.Aloha) { return this.options.target[0].contentWindow.Aloha.jQuery('.editable-text'); } else { return null; } }; ToolbarView.prototype.enable_editing_mode_checkbox = function() { return this.$('.editing-mode input[type=checkbox]').checkToggle({ on_label_color: '#fff', off_label_color: '#bbb' }); }; ToolbarView.prototype.enable_content_locale_picker = function() { var link, picker, _window, _this = this; _window = this.options.target[0].contentWindow; link = this.$('#content-locale-picker-link'); picker = $('#content-locale-picker'); if (picker.size() === 0) { return; } link.bind('click', function(event) { event.stopPropagation() & event.preventDefault(); return picker.toggle(); }); return picker.find('li').bind('click', function(event) { var locale, selected, url; selected = $(event.target).closest('li'); locale = selected.find('span.text').html(); picker.toggle(); window.content_locale = locale; url = _this.model.get('localized_fullpaths')[locale]; if (url === '') { url = 'index'; } url = "/" + url + "/_edit"; return _window.location.href = url; }); }; ToolbarView.prototype.select_locale = function(locale) { var entry, image, label, link, picker, _window; _window = this.options.target[0].contentWindow; link = this.$('#content-locale-picker-link'); picker = $('#content-locale-picker'); entry = picker.find("li[data-locale=" + locale + "]"); image = entry.find('img').attr('src'); label = entry.find('span.text').html(); link.find('img').attr('src', image); link.find('span.text').html(label); picker.find('li.selected').removeClass('selected'); return entry.addClass('selected'); }; ToolbarView.prototype.refresh = function() { this.select_locale(this.model.get('lang')); this.$('h1').html(this.model.get('title')).removeClass(); if (this.$('.editing-mode input[type=checkbox]').is(':checked')) { this.$('.editing-mode div.switchArea').trigger('click'); } this.$('.element-actions').hide(); return this.show_editing_mode_block(); }; return ToolbarView; })(Backbone.View); }).call(this); ;TI"dependency_digest;F"%0572cd8c25db68e8401846917330121bI"required_paths;F[I"Ž/Users/papipo/.rvm/gems/ruby-1.9.3-p448/gems/locomotive_cms-2.2.3/app/assets/javascripts/locomotive/views/inline_editor/toolbar_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/inline_editor/toolbar_view.js.coffee;TI" mtime;FI"2013-10-10T12:39:17+02:00;FI" digest;F"%7d2ddd28ba2efe485dc7e578d854e9b0I" _version;F"%ffd318ca8b794f42f5029101c2cf5d91