aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sonar-server/src/main/webapp/javascripts/application.js61
1 files changed, 33 insertions, 28 deletions
diff --git a/sonar-server/src/main/webapp/javascripts/application.js b/sonar-server/src/main/webapp/javascripts/application.js
index 87760930256..cb408cd7c4d 100644
--- a/sonar-server/src/main/webapp/javascripts/application.js
+++ b/sonar-server/src/main/webapp/javascripts/application.js
@@ -242,40 +242,45 @@ Treemap.prototype.initNodes = function () {
});
};
+function openModalWindow(url, options) {
+ var width = options['width']||540;
+ var $dialog = $j('#modal');
+ if (!$dialog.length) {
+ $dialog = $j('<div id="modal" class="ui-widget-overlay"></div>').appendTo('body');
+ }
+ $j.get(url,function (html) {
+ $dialog.removeClass('ui-widget-overlay');
+ $dialog.html(html);
+ $dialog
+ .dialog({
+ width: width,
+ draggable: false,
+ autoOpen: false,
+ modal: true,
+ minHeight: 50,
+ resizable: false,
+ close: function () {
+ $j('#modal').remove();
+ }
+ });
+ $dialog.dialog("open");
+ }).fail(function () {
+ alert("Server error. Please contact your administrator.");
+ }).always(function () {
+ $dialog.removeClass('ui-widget-overlay');
+ });
+
+ $dialog.dialog('open');
+ return false;
+}
+
(function ($j) {
$j.fn.extend({
openModal: function() {
return this.each(function () {
var obj = $j(this);
- var $dialog = $j('#modal');
- if (!$dialog.length) {
- $dialog = $j('<div id="modal" class="ui-widget-overlay"></div>').appendTo('body');
- }
var url = obj.attr('modal-url') || obj.attr('href');
- $j.get(url,function (html) {
- $dialog.removeClass('ui-widget-overlay');
- $dialog.html(html);
- $dialog
- .dialog({
- width: (obj.attr('modal-width') || 540),
- draggable: false,
- autoOpen: false,
- modal: true,
- minHeight: 50,
- resizable: false,
- close: function () {
- $j('#modal').remove();
- }
- });
- $dialog.dialog("open");
- }).fail(function () {
- alert("Server error. Please contact your administrator.");
- }).always(function () {
- $dialog.removeClass('ui-widget-overlay');
- });
-
- $dialog.dialog('open');
- return false;
+ return openModalWindow(url, {'width': obj.attr('modal-width')});
});
},
modal: function () {