{I" class:ETI"ProcessedAsset;FI"logical_path;TI"alchemy/alchemy.dirty.js;FI" pathname;TI"|/Users/tvd/.rvm/gems/ruby-2.1.2/bundler/gems/alchemy_cms-7fe2839068da/app/assets/javascripts/alchemy/alchemy.dirty.js.coffee;FI"content_type;TI"application/javascript;TI" mtime;Tl+/-TI" length;TiU I" digest;TI"%716a8575ea504065be7b1735c9d58918;FI" source;TI"U (function() { if (typeof window.Alchemy === "undefined") { window.Alchemy = {}; } $.extend(Alchemy, { ElementDirtyObserver: function(selector) { var $elements; $elements = $(selector); $elements.find('input[type="text"], select').change(function() { var $this; $this = $(this); $this.addClass('dirty'); return Alchemy.setElementDirty($this.parents(".element_editor")); }); return $elements.find('.element_foot input[type="checkbox"]').click(function() { var $this; $this = $(this); $this.addClass("dirty"); return Alchemy.setElementDirty($this.parents(".element_editor")); }); }, setElementDirty: function(element) { var $element; $element = $(element); $element.addClass('dirty').find('.element_head .icon[class*="element_"]').addClass('element_dirty'); return window.onbeforeunload = this.pageUnload; }, pageUnload: function() { Alchemy.pleaseWaitOverlay(false); return Alchemy._t('page_dirty_notice'); }, setElementClean: function(element) { var $element; $element = $(element); $element.removeClass('dirty').find('.element_foot input[type="checkbox"], input[type="text"], select').removeClass('dirty'); $element.find('.element_head .icon').removeClass('element_dirty'); return window.onbeforeunload = void 0; }, isPageDirty: function() { return $('#element_area').find('.element_editor.dirty').length > 0; }, isElementDirty: function(element) { return $(element).hasClass('dirty'); }, checkPageDirtyness: function(element) { var callback; callback = void 0; if ($(element).is("form")) { callback = function() { var $form; $form = $("
"); $form.append($(element).find("input")); $form.appendTo("body"); return $form.submit(); }; } else if ($(element).is("a")) { callback = function() { return window.location.href = element.pathname; }; } if (Alchemy.isPageDirty()) { Alchemy.openConfirmDialog(Alchemy._t('page_dirty_notice'), { title: Alchemy._t('warning'), ok_label: Alchemy._t('ok'), cancel_label: Alchemy._t('cancel'), on_ok: function() { window.onbeforeunload = void 0; Alchemy.pleaseWaitOverlay(); return callback(); } }); return false; } else { return true; } }, PageLeaveObserver: function() { return $('#main_navi a').click(function(event) { if (!Alchemy.checkPageDirtyness(event.currentTarget)) { return event.preventDefault(); } }); } }); }).call(this); ;TI"dependency_digest;TI"%8b1db50207f04795b69f3b0545155a3b;FI"required_paths;T[I"|/Users/tvd/.rvm/gems/ruby-2.1.2/bundler/gems/alchemy_cms-7fe2839068da/app/assets/javascripts/alchemy/alchemy.dirty.js.coffee;FI"dependency_paths;T[{I" path;TI"|/Users/tvd/.rvm/gems/ruby-2.1.2/bundler/gems/alchemy_cms-7fe2839068da/app/assets/javascripts/alchemy/alchemy.dirty.js.coffee;FI" mtime;TI"2014-10-02T11:38:55+02:00;TI" digest;TI"%8dae3ec6f5df1eecc8b47b6afee0447f;FI" _version;TI"%1005ed9f20e25fb0a0599a7017dd0e6b;F