aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Baptiste Vilain <jean-baptiste.vilain@sonarsource.com>2013-06-21 11:45:35 +0200
committerJean-Baptiste Vilain <jean-baptiste.vilain@sonarsource.com>2013-06-21 11:45:50 +0200
commit1fdf944c476e3fe1dc989ca3faeced229a643a6b (patch)
treee41497ea5bedbb4ba015ccb88a46462bd3554f67
parent10fa39c7fdfce0c9f34054bd4da83587cc9673a2 (diff)
downloadsonarqube-1fdf944c476e3fe1dc989ca3faeced229a643a6b.tar.gz
sonarqube-1fdf944c476e3fe1dc989ca3faeced229a643a6b.zip
SONAR-4136 Fixed lost context when redirecting after a resource-level dashboard creation
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/controllers/dashboards_controller.rb4
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/dashboards/_create_form.html.erb3
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/dashboards/_edit_form.html.erb5
3 files changed, 7 insertions, 5 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/dashboards_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/dashboards_controller.rb
index ed206bab77c..aa6beb0f624 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/dashboards_controller.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/dashboards_controller.rb
@@ -65,7 +65,7 @@ class DashboardsController < ApplicationController
add_default_dashboards_if_first_user_dashboard(@dashboard.global?)
last_index=current_user.active_dashboards.max_by(&:order_index).order_index
current_user.active_dashboards.create(:dashboard => @dashboard, :user => current_user, :order_index => (last_index+1))
- render :text => @dashboard.id.to_s, :resource => params[:resource], :highlight => @dashboard.id, :status => 200
+ render :text => params[:resource], :highlight => @dashboard.id, :status => 200
else
render :partial => 'dashboards/create_form', :status => 400, :resource => params[:resource]
end
@@ -86,7 +86,7 @@ class DashboardsController < ApplicationController
if @dashboard.editable_by?(current_user)
load_dashboard_from_params(@dashboard)
if @dashboard.save
- render :text => @dashboard.id.to_s, :resource => params[:resource], :status => 200
+ render :text => params[:resource], :status => 200
else
render :partial => 'dashboards/edit_form', :status => 400, :resource => params[:resource]
end
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/dashboards/_create_form.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/dashboards/_create_form.html.erb
index 5cee02f7eaf..5fbe198f9fd 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/dashboards/_create_form.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/dashboards/_create_form.html.erb
@@ -38,7 +38,8 @@
<script>
$j("#create-dashboard-form").modalForm({success: function (data) {
- window.location = baseUrl + '/dashboards';
+ var contextParams = data.trim().length > 0 ? '?resource=' + data.trim() : '';
+ window.location = baseUrl + '/dashboards' + contextParams;
}});
</script>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/dashboards/_edit_form.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/dashboards/_edit_form.html.erb
index a3312878ae5..abce4ae6c3c 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/dashboards/_edit_form.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/dashboards/_edit_form.html.erb
@@ -45,6 +45,7 @@
<script>
$j("#edit-dashboard-form").modalForm({success: function (data) {
- window.location = baseUrl + '/dashboards';
+ var contextParams = data.trim().length > 0 ? '?resource=' + data.trim() : '';
+ window.location = baseUrl + '/dashboards' + contextParams;
}});
-</script> \ No newline at end of file
+</script>