{I" class:ETI"BundledAsset;FI"logical_path;TI"(type_station/editables/admin_bar.js;FI" pathname;TI"n/Users/richardadams/github/type_station/app/assets/javascripts/type_station/editables/admin_bar.js.coffee;FI"content_type;TI"application/javascript;TI" mtime;Tl+þ`×TI" length;Tip I" digest;TI"%543120ba0439a25c665dfa2411fff1ea;FI" source;TI"p (function() { window.TS.AdminBar = (function() { function AdminBar(_at_element) { var drop, template; this.element = _at_element; template = this.element.html(); $('body').append(template); vex.defaultOptions.className = 'vex-theme-os'; $('#ts-admin-bar-edit').on('click', function() { window.TS.enable(); return false; }); $('#ts-admin-bar-cancel').on('click', function() { window.TS.disable(); return false; }); $('#ts-admin-bar-save').on('click', function() { vex.dialog.confirm({ message: 'Are you sure you want to save changes?', callback: function(value) { if (value) { return window.TS.save(); } } }); return false; }); $('#ts-admin-bar input').on('change', function() { var model; model = window.TS.getModel($(this).data('ts-url')); return model.set($(this).data('ts-key'), { field: $(this).data('ts-key'), value: $(this).val(), type: 'text' }); }); drop = new Drop({ target: $('#ts-admin-bar .ts-options i')[0], content: $('#ts-admin-bar-options')[0], position: 'bottom center', openOn: 'click', classes: 'drop-theme-arrows-bounce-dark' }); drop.on('open', function() { $('#ts-page-settings').off('click'); return $('#ts-page-settings').on('click', function() { vex.dialog.buttons.YES.text = 'Save'; return vex.dialog.open({ message: 'Manage page settings', input: "" + ($('#ts-admin-bar-settings').html()), callback: function(data) { var model; if (data) { model = window.TS.getModel($('#ts-admin-bar-settings').data('ts-url')); return vex.dialog.confirm({ message: 'Are you sure you want to save changes?', callback: function(value) { var k, v; if (value) { for (k in data) { v = data[k]; model.set(k, { field: k, value: v, type: 'text' }); } window.TS.save(); return model.save(function() { return window.location.reload(); }); } } }); } } }); }); }); } AdminBar.prototype.enable = function() { $('body').addClass('ts-edit-mode'); $('#ts-admin-bar').removeClass('ts-hidden'); return $('#ts-admin-bar-edit').addClass('ts-hidden'); }; AdminBar.prototype.disable = function() { $('body').removeClass('ts-edit-mode'); $('#ts-admin-bar').addClass('ts-hidden').removeClass('insert-open'); return $('#ts-admin-bar-edit').removeClass('ts-hidden'); }; return AdminBar; })(); }).call(this); ;TI"required_assets_digest;TI"%7eb07ef0e9510ee69fc3b8c1bc4051ef;FI" _version;TI"%64e62ddc273c2f5847f30d698ca14b67;F