o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1381142256.308782: @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.1.0/app/assets/javascripts/locomotive/views/inline_editor/toolbar_view.js.coffee;TI"content_type;FI"application/javascript;FI" mtime;FI"2013-10-07T10:55:40+02:00;FI" length;Fi I" digest;F"%5280f2dfee655e56881e5716ba203de8I" 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-long-text, .editable-short-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"%765b7b66125d468ef425d3c595f4967aI"required_paths;F[I"Ž/Users/papipo/.rvm/gems/ruby-1.9.3-p448/gems/locomotive_cms-2.1.0/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.1.0/app/assets/javascripts/locomotive/views/inline_editor/toolbar_view.js.coffee;TI" mtime;FI"2013-10-07T10:55:40+02:00;FI" digest;F"%75cb2f34890c1095c24aa08cf8f3a3b1I" _version;F"%ffd318ca8b794f42f5029101c2cf5d91