From f98a7a5101bf946627e6f794a556724e8c9d52b0 Mon Sep 17 00:00:00 2001
From: sgiehl <stefangiehl@gmail.com>
Date: Tue, 29 Jun 2010 15:56:40 +0000
Subject: [PATCH] fixes #1425 load feedback popup only if required

git-svn-id: http://dev.piwik.org/svn/trunk@2398 59fd770c-687e-43c8-a1e3-f5a4ff64c105
---
 plugins/Feedback/templates/feedback.js | 33 +++++++++++++++-----------
 1 file changed, 19 insertions(+), 14 deletions(-)

diff --git a/plugins/Feedback/templates/feedback.js b/plugins/Feedback/templates/feedback.js
index adaaa45448..381ad89ced 100644
--- a/plugins/Feedback/templates/feedback.js
+++ b/plugins/Feedback/templates/feedback.js
@@ -3,21 +3,25 @@ $(function() {
 	if (feedback.size()) {
 		var fbDiv = $('<div id="feedback-dialog"></div>').appendTo('body');
 
-		$.get(feedback.attr('href'), function(data) {
-			fbDiv.html(data);
-		});
-
-		fbDiv.dialog({
-			title: feedback.html(),
-			bgiframe: true,
-			modal: true,
-			height: 480,
-			width: 500,
-			resizable: false,
-			autoOpen: false
-		});
-
 		$('#topbar-feedback').click(function() {
+			if(fbDiv.html() == '') {
+				fbDiv.html('<div id="feedback-loading"><img alt="" src="themes/default/images/loading-blue.gif"> '+translations.CoreHome_Loading_js+'</div>');
+			}
+			if($('#feedback-loading' ,fbDiv).length) {
+				$.get(feedback.attr('href'), function(data) {
+					fbDiv.html(data);
+				});
+
+				fbDiv.dialog({
+					title: feedback.html(),
+					bgiframe: true,
+					modal: true,
+					height: 480,
+					width: 500,
+					resizable: false,
+					autoOpen: false
+				});
+			}
 			$('#feedback-faq').show();
 			$('#feedback-form').hide();
 			$('#feedback-sent').hide().empty();
@@ -25,4 +29,5 @@ $(function() {
 			return false;
 		});
 	}
+	
 });
-- 
GitLab