o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1355470625.231303:@value"m{I"
class:EFI"BundledAsset; FI"logical_path; FI"mercury/dialog.js; FI"
pathname; FI"x/Users/brownjohn/.rvm/gems/ruby-1.9.3-p194/gems/mercury-rails-0.8.0/app/assets/javascripts/mercury/dialog.js.coffee; FI"content_type; FI"application/javascript; FI"
mtime; FI"2012-08-08T16:13:36+08:00; FI"length; Fis
I"digest; F"%df4af23134308a62a109812bde4d9d19I"source; FI"s
(function() {
this.Mercury.Dialog = (function() {
function Dialog(url, name, options) {
this.url = url;
this.name = name;
this.options = options != null ? options : {};
this.button = this.options["for"];
this.build();
this.bindEvents();
this.preload();
}
Dialog.prototype.build = function() {
var _ref;
this.element = jQuery('
', {
"class": "mercury-dialog mercury-" + this.name + "-dialog loading",
style: 'display:none'
});
return this.element.appendTo((_ref = jQuery(this.options.appendTo).get(0)) != null ? _ref : 'body');
};
Dialog.prototype.bindEvents = function() {
return this.element.on('mousedown', function(event) {
return event.stopPropagation();
});
};
Dialog.prototype.preload = function() {
if (this.options.preload) {
return this.load();
}
};
Dialog.prototype.toggle = function() {
if (this.visible) {
return this.hide();
} else {
return this.show();
}
};
Dialog.prototype.resize = function() {
return this.show();
};
Dialog.prototype.show = function() {
Mercury.trigger('hide:dialogs', this);
this.visible = true;
if (this.loaded) {
this.element.css({
width: 'auto',
height: 'auto'
});
this.position(this.visible);
} else {
this.position();
}
return this.appear();
};
Dialog.prototype.position = function(keepVisible) {};
Dialog.prototype.appear = function() {
var _this = this;
this.element.css({
display: 'block',
opacity: 0
});
return this.element.animate({
opacity: 0.95
}, 200, 'easeInOutSine', function() {
if (!_this.loaded) {
return _this.load(function() {
return _this.resize();
});
}
});
};
Dialog.prototype.hide = function() {
this.element.hide();
return this.visible = false;
};
Dialog.prototype.load = function(callback) {
var _this = this;
if (!this.url) {
return;
}
if (Mercury.preloadedViews[this.url]) {
this.loadContent(Mercury.preloadedViews[this.url]);
if (Mercury.dialogHandlers[this.name]) {
Mercury.dialogHandlers[this.name].call(this);
}
if (callback) {
return callback();
}
} else {
return jQuery.ajax(this.url, {
success: function(data) {
_this.loadContent(data);
if (Mercury.dialogHandlers[_this.name]) {
Mercury.dialogHandlers[_this.name].call(_this);
}
if (callback) {
return callback();
}
},
error: function() {
_this.hide();
if (_this.button) {
_this.button.removeClass('pressed');
}
return Mercury.notify('Mercury was unable to load %s for the "%s" dialog.', _this.url, _this.name);
}
});
}
};
Dialog.prototype.loadContent = function(data) {
this.loaded = true;
this.element.removeClass('loading');
this.element.html(data);
if (Mercury.config.localization.enabled) {
return this.element.localize(Mercury.locale());
}
};
return Dialog;
})();
}).call(this);
; FI"required_assets_digest; F"%974bcd1f1cbee6c5dda9168857298990I"
_version; F"%9f3b95dd7ea3030dc35985c0a8020862