o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1384093246.006069: @value"²{I" class:ETI"ProcessedAsset;FI"logical_path;TI"3locomotive/views/inline_editor/toolbar_view.js;FI" pathname;TI"~/Users/didier/Documents/LocomotiveCMS/engine/app/assets/javascripts/locomotive/views/inline_editor/toolbar_view.js.coffee;FI"content_type;TI"application/javascript;TI" mtime;TI"2013-06-21T15:35:51+02:00;TI" length;TiìI" digest;TI"%72147323226af371cfef5e3d3fb20198;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).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;TI"%0572cd8c25db68e8401846917330121b;FI"required_paths;T[I"~/Users/didier/Documents/LocomotiveCMS/engine/app/assets/javascripts/locomotive/views/inline_editor/toolbar_view.js.coffee;FI"dependency_paths;T[{I" path;TI"~/Users/didier/Documents/LocomotiveCMS/engine/app/assets/javascripts/locomotive/views/inline_editor/toolbar_view.js.coffee;FI" mtime;TI"2013-06-21T15:35:51+02:00;TI" digest;TI"%7d2ddd28ba2efe485dc7e578d854e9b0;FI" _version;TI"%ffd318ca8b794f42f5029101c2cf5d91;F