I"�(function() { var extend = 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; }, hasProp = {}.hasOwnProperty; window.Alchemy.ConfirmDialog = (function(superClass) { extend(ConfirmDialog, superClass); ConfirmDialog.prototype.DEFAULTS = { header_height: 36, size: '300x100', padding: true, modal: true, title: 'Please confirm', ok_label: 'Yes', cancel_label: 'No', on_ok: function() {} }; function ConfirmDialog(message1, options1) { this.message = message1; this.options = options1 != null ? options1 : {}; ConfirmDialog.__super__.constructor.call(this, '', this.options); } ConfirmDialog.prototype.load = function() { this.dialog_title.text(this.options.title); this.dialog_body.html("<p>" + this.message + "</p>"); this.dialog_body.append(this.build_buttons()); return this.bind_buttons(); }; ConfirmDialog.prototype.build_buttons = function() { var $btn_container; $btn_container = $('<div class="alchemy-dialog-buttons" />'); this.cancel_button = $("<button class=\"cancel secondary\">" + this.options.cancel_label + "</button>"); this.ok_button = $("<button class=\"confirm\">" + this.options.ok_label + "</button>"); $btn_container.append(this.cancel_button); $btn_container.append(this.ok_button); return $btn_container; }; ConfirmDialog.prototype.bind_buttons = function() { this.cancel_button.focus(); this.cancel_button.click((function(_this) { return function() { _this.close(); Alchemy.Buttons.enable(); return false; }; })(this)); return this.ok_button.click((function(_this) { return function() { _this.close(); _this.options.on_ok(); return false; }; })(this)); }; return ConfirmDialog; })(Alchemy.Dialog); window.Alchemy.openConfirmDialog = function(message, options) { var dialog; if (options == null) { options = {}; } dialog = new Alchemy.ConfirmDialog(message, options); return dialog.open(); }; window.Alchemy.confirmToDeleteDialog = function(url, opts) { var options; options = { on_ok: function() { Alchemy.pleaseWaitOverlay(); return $.ajax({ url: url, type: "DELETE", error: function(xhr, status, error) { var type; type = xhr.status === 403 ? 'warning' : 'error'; Alchemy.pleaseWaitOverlay(false); return Alchemy.growl(xhr.responseText || error, type); } }); } }; $.extend(options, opts); return Alchemy.openConfirmDialog(options.message, options); }; }).call(this); :ET