{I" class:ETI"ProcessedAsset;FI"logical_path;TI"(type_station/editables/admin_bar.js;FI" pathname;TI"Q/workspace/app/assets/javascripts/type_station/editables/admin_bar.js.coffee;FI"content_type;TI"application/javascript;TI" mtime;Tl+;4ĂVI" length;Tiu I" digest;TI"%131cbef76ea616c063c757ee278e2d4b;FI" source;TI"u (function() { this.TypeStation.AdminBarEditor = (function() { function AdminBarEditor(ts, $el, data) { var $editEditor, $titleEditor, editor, template; this.ts = ts; this.$el = $el; this.data = data; template = this.$el.html(); $('body').append(template); vex.defaultOptions.className = 'vex-theme-os'; $titleEditor = $('#ts-admin-bar-title'); editor = new TypeStation.TextHtmlEditor(this.ts, $titleEditor, $titleEditor.data('ts')); this.ts.editors.set($titleEditor.attr('id'), editor); $editEditor = $('#ts-admin-bar-settings'); editor = new TypeStation.EntityEditor(this.ts, $editEditor, $editEditor.data('ts')); this.ts.editors.set($editEditor.attr('id'), editor); $('#ts-admin-bar-edit').on('click', (function(_this) { return function() { _this.ts.enable(); return false; }; })(this)); $('#ts-admin-bar-cancel').on('click', (function(_this) { return function() { _this.ts.disable(); if (_this.ts.isChanged()) { vex.dialog.confirm({ message: 'You have unsaved changes, Do you want to discard them?', callback: function(value) { if (value) { return window.location.reload(); } } }); } return false; }; })(this)); $('#ts-admin-bar-save').on('click', (function(_this) { return function() { var canSave; canSave = _this.checkValue($titleEditor.html()); if (canSave) { vex.dialog.buttons.YES.text = 'Save'; vex.dialog.confirm({ message: 'Are you sure you want to save changes?', callback: function(value) { if (value) { return _this.ts.save(); } } }); } else { vex.dialog.buttons.YES.text = 'Ok'; vex.dialog.alert({ message: 'Unable to save: Invalid inputs please check and try again' }); } return false; }; })(this)); } AdminBarEditor.prototype.enable = function() { $('#ts-admin-bar').removeClass('ts-hidden'); return $('#ts-admin-bar-edit').addClass('ts-hidden'); }; AdminBarEditor.prototype.disable = function() { $('#ts-admin-bar').addClass('ts-hidden').removeClass('insert-open'); return $('#ts-admin-bar-edit').removeClass('ts-hidden'); }; AdminBarEditor.prototype.checkValue = function(raw_value) { var valid, value; value = raw_value.replace(/[\'\"\=\|\@\{\}\.\,\:\;\/\&\?\!\(\)]/g, ''); console.log(value); if (value.length > 0) { if (value.length > 1) { try { console.log('sdsdsd'); valid = !$(value).is('*'); } catch (_error) { valid = false; } } else { valid = true; } } else { valid = false; } console.log(valid); return valid; }; return AdminBarEditor; })(); }).call(this); ;TI"dependency_digest;TI"%41ddb144134a7a507c55e5fb352949e5;FI"required_paths;T[I"Q/workspace/app/assets/javascripts/type_station/editables/admin_bar.js.coffee;FI"dependency_paths;T[{I" path;TI"Q/workspace/app/assets/javascripts/type_station/editables/admin_bar.js.coffee;F@I"2016-02-16T14:37:47+00:00;T@I"%fcec6cc75f198bc8a547414e00c42461;FI" _version;TI"%64e62ddc273c2f5847f30d698ca14b67;F