{I" class:ETI"BundledAsset;FI"logical_path;TI"mercury/panel.js;FI" pathname;TI"…/home/edik/.rvm/gems/ruby-2.0.0-p247@very_simple_cms/bundler/gems/mercury-3e0245e33195/app/assets/javascripts/mercury/panel.js.coffee;FI"content_type;TI"application/javascript;TI" mtime;Tl+½¡9RI" length;TixI" digest;TI"%3266a52b5a87b492e4494e23d8bba0b3;FI" source;TI"x(function() { var __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; }; this.Mercury.Panel = (function(_super) { __extends(Panel, _super); function Panel(url, name, options) { this.url = url; this.name = name; this.options = options != null ? options : {}; Panel.__super__.constructor.apply(this, arguments); } Panel.prototype.build = function() { var _ref; this.element = jQuery('
', { "class": 'mercury-panel loading', style: 'display:none;' }); this.titleElement = jQuery("

" + (Mercury.I18n(this.options.title)) + "

").appendTo(this.element); this.paneElement = jQuery('
', { "class": 'mercury-panel-pane' }).appendTo(this.element); if (this.options.closeButton) { jQuery('', { "class": 'mercury-panel-close' }).appendTo(this.titleElement).css({ opacity: 0 }); } return this.element.appendTo((_ref = jQuery(this.options.appendTo).get(0)) != null ? _ref : 'body'); }; Panel.prototype.bindEvents = function() { var _this = this; Mercury.on('resize', function() { return _this.position(_this.visible); }); Mercury.on('hide:panels', function(event, panel) { if (panel === _this) { return; } _this.button.removeClass('pressed'); return _this.hide(); }); this.titleElement.find('.mercury-panel-close').on('click', function(event) { event.preventDefault(); return Mercury.trigger('hide:panels'); }); this.element.on('mousedown', function(event) { return event.stopPropagation(); }); this.element.on('ajax:beforeSend', function(event, xhr, options) { return options.success = function(content) { _this.loadContent(content); return _this.resize(); }; }); return Panel.__super__.bindEvents.apply(this, arguments); }; Panel.prototype.show = function() { Mercury.trigger('hide:panels', this); return Panel.__super__.show.apply(this, arguments); }; Panel.prototype.resize = function() { var position, postWidth, preWidth, _this = this; this.titleElement.find('.mercury-panel-close').css({ opacity: 0 }); this.paneElement.css({ display: 'none' }); preWidth = this.element.width(); this.paneElement.css({ visibility: 'hidden', width: 'auto', display: 'block' }); postWidth = this.element.width(); this.paneElement.css({ visibility: 'visible', display: 'none' }); position = this.element.offset(); this.element.animate({ left: position.left - (postWidth - preWidth), width: postWidth }, 200, 'easeInOutSine', function() { _this.titleElement.find('.mercury-panel-close').animate({ opacity: 1 }, 100); _this.paneElement.css({ display: 'block', width: postWidth }); jQuery(_this.paneElement.find('.focusable').get(0)).focus(); return _this.makeDraggable(); }); if (!this.visible) { return this.hide(); } }; Panel.prototype.position = function(keepVisible) { var elementWidth, height, left, offset, paneHeight; this.element.css({ display: 'block', visibility: 'hidden' }); offset = this.element.offset(); elementWidth = this.element.width(); height = Mercury.displayRect.height - 16; paneHeight = height - this.titleElement.outerHeight(); this.paneElement.css({ height: paneHeight, overflowY: paneHeight < 30 ? 'hidden' : 'auto' }); if (!this.moved) { left = Mercury.displayRect.width - elementWidth - 20; } if (left <= 8) { left = 8; } if (this.pinned || elementWidth + offset.left > Mercury.displayRect.width - 20) { left = Mercury.displayRect.width - elementWidth - 20; } this.element.css({ top: Mercury.displayRect.top + 8, left: left, height: height, display: keepVisible ? 'block' : 'none', visibility: 'visible' }); this.makeDraggable(); if (!keepVisible) { return this.element.hide(); } }; Panel.prototype.loadContent = function(data) { this.loaded = true; this.element.removeClass('loading'); this.paneElement.css({ visibility: 'hidden' }); this.paneElement.html(data); if (Mercury.config.localization.enabled) { return this.paneElement.localize(Mercury.locale()); } }; Panel.prototype.makeDraggable = function() { var elementWidth, _this = this; elementWidth = this.element.width(); return this.element.draggable({ handle: 'h1 span', axis: 'x', opacity: 0.70, scroll: false, addClasses: false, iframeFix: true, containment: [8, 0, Mercury.displayRect.width - elementWidth - 20, 0], stop: function() { var left; left = _this.element.offset().left; _this.moved = true; _this.pinned = left > Mercury.displayRect.width - elementWidth - 30 ? true : false; return true; } }); }; return Panel; })(Mercury.Dialog); }).call(this); ;TI"required_assets_digest;TI"%80a333dfa43801398f9347fab3431a7b;FI" _version;TI"%2cf3622cbba861b85d33ffabfa420c13;F