aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-server/src
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@gmail.com>2013-07-05 18:33:25 +0200
committerJulien Lancelot <julien.lancelot@gmail.com>2013-07-05 18:33:25 +0200
commitf505d27019e7c666de484e657dc3c98eb64a1dfd (patch)
treec039ca206be7c3d257910acf43e43cc73a39c248 /sonar-server/src
parentd9244f27b13da4409797b477399060ef1c050d90 (diff)
downloadsonarqube-f505d27019e7c666de484e657dc3c98eb64a1dfd.tar.gz
sonarqube-f505d27019e7c666de484e657dc3c98eb64a1dfd.zip
SONAR-4418 Refactor the bulk change redirection to fix bug when displaying resource from search box
Diffstat (limited to 'sonar-server/src')
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/controllers/dashboard_controller.rb8
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/controllers/issues_controller.rb9
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/no_dashboard.html.erb5
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/drilldown/_header.html.erb6
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/issues/_bulk_change_form.html.erb17
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/issues/search.html.erb8
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/resource/_tabs.html.erb3
7 files changed, 30 insertions, 26 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/dashboard_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/dashboard_controller.rb
index 8e9232a1e39..7d096f9931a 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/dashboard_controller.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/dashboard_controller.rb
@@ -148,9 +148,9 @@ class DashboardController < ApplicationController
if logged_in?
if params[:did]
- @dashboard=Dashboard.find(:first, :conditions => ['id=? AND user_id=?', params[:did].to_i, current_user.id])
+ @dashboard=Dashboard.first(:conditions => ['id=? AND user_id=?', params[:did].to_i, current_user.id])
elsif params[:name]
- @dashboard=Dashboard.find(:first, :conditions => ['name=? AND user_id=?', params[:name], current_user.id])
+ @dashboard=Dashboard.first(:conditions => ['name=? AND user_id=?', params[:name], current_user.id])
elsif params[:id]
active=ActiveDashboard.user_dashboards(current_user, false).first
else
@@ -161,9 +161,9 @@ class DashboardController < ApplicationController
unless active or @dashboard
# anonymous or not found in user dashboards
if params[:did]
- @dashboard=Dashboard.find(:first, :conditions => ['id=? AND shared=?', params[:did].to_i, true])
+ @dashboard=Dashboard.first(:conditions => ['id=? AND shared=?', params[:did].to_i, true])
elsif params[:name]
- @dashboard=Dashboard.find(:first, :conditions => ['name=? AND shared=?', params[:name], true])
+ @dashboard=Dashboard.first(:conditions => ['name=? AND shared=?', params[:name], true])
elsif params[:id]
active=ActiveDashboard.user_dashboards(nil, false).first
else
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/issues_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/issues_controller.rb
index dc520aaa140..b30592b268d 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/issues_controller.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/issues_controller.rb
@@ -144,12 +144,11 @@ class IssuesController < ApplicationController
# GET /issues/bulk_change_form?[&criteria]
def bulk_change_form
- params[:from] ||= 'issue_filters'
- params_for_query = params.clone.merge({'pageSize' => -1})
+ issues_query_params = params.clone.merge({'pageSize' => -1})
if params[:id]
- @issue_filter_result = Internal.issues.execute(params[:id].to_i, params_for_query)
+ @issue_filter_result = Internal.issues.execute(params[:id].to_i, issues_query_params)
else
- @issue_filter_result = Internal.issues.execute(params_for_query)
+ @issue_filter_result = Internal.issues.execute(issues_query_params)
end
render :partial => 'issues/bulk_change_form'
end
@@ -158,7 +157,7 @@ class IssuesController < ApplicationController
def bulk_change
verify_post_request
Internal.issues.bulkChange(params, params[:comment])
- render :text => params[:criteria_params], :status => 200
+ render :text => params[:issues_query_params], :status => 200
end
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/no_dashboard.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/no_dashboard.html.erb
index e125579a9e4..097babb7f52 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/no_dashboard.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/no_dashboard.html.erb
@@ -12,6 +12,11 @@
anchor = stripped_url[1];
}
+ // refresh page after issues bulk change
+ function onBulkIssues(issues_query_params, component_key){
+ window.location.reload();
+ }
+
openAccordionItem('<%= url_for(params.merge({:controller => 'resource', :action => :index, :id => @file.id, :display_title => 'false', :popup => 'false'})) -%>', this, false)
.done(function () {
if (anchor != null) {
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/drilldown/_header.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/drilldown/_header.html.erb
index 41ce9d5d988..f076a1c8d58 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/drilldown/_header.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/drilldown/_header.html.erb
@@ -11,4 +11,10 @@
openAccordionItem(url, this);
return false;
}
+
+ // refresh page after issues bulk change
+ function onBulkIssues(issues_query_params, component_key){
+ d(component_key);
+ closeModalWindow();
+ }
</script>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/issues/_bulk_change_form.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/issues/_bulk_change_form.html.erb
index 8dafa130e39..43d066db14f 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/issues/_bulk_change_form.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/issues/_bulk_change_form.html.erb
@@ -24,7 +24,7 @@
%>
<form id="bulk-change-form" method="post" action="<%= ApplicationController.root_context -%>/issues/bulk_change">
<input type="hidden" name="issues" value="<%= issues.map { |issue| issue.key() }.join(',') -%>">
- <input type="hidden" name="criteria_params" value="<%= params.to_query -%>">
+ <input type="hidden" name="issues_query_params" value="<%= params.to_query -%>">
<input type="hidden" name="actions[]" id="bulk-change-transition-action">
<fieldset>
<div class="modal-head">
@@ -54,11 +54,7 @@
unless plans.empty?
first_plan = plans[0]
options = plans.map { |plan|
- if plan.deadLine
- label = "#{h plan.name} (#{format_date(plan.deadLine)})"
- else
- label = h plan.name
- end
+ label = plan.deadLine ? "#{h plan.name} (#{format_date(plan.deadLine)})" : h(plan.name)
[label, plan.key]
}
options.unshift([escape_javascript(message('issue.unplan.submit')), ''])
@@ -122,14 +118,7 @@
<script>
$j("#bulk-change-form").modalForm({
success: function (data) {
- <% if params[:from] == 'issue_filters' %>
- window.location = baseUrl + '/issues/search?' + data;
- <% elsif params[:from] == 'drilldown' %>
- d('<%= component_key %>');
- closeModalWindow();
- <% else %>
- alert('Unknown origin : <%= params[:from] %>');
- <% end %>
+ onBulkIssues(data, '<%= component_key %>');
},
error: function (xhr, textStatus, errorThrown) {
$j('#bulk-change-loading-image').addClass("hidden");
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/issues/search.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/issues/search.html.erb
index 0c75a11caa5..dd06fe00f3c 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/issues/search.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/issues/search.html.erb
@@ -55,4 +55,10 @@
<%= render :partial => 'list' -%>
</div>
</div>
-</div> \ No newline at end of file
+</div>
+
+<script type="text/javascript">
+ function onBulkIssues(issues_query_params, component_key){
+ window.location = baseUrl + '/issues/search?' + issues_query_params;
+ }
+</script> \ No newline at end of file
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_tabs.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_tabs.html.erb
index a81e243c1bb..cacbdfd7fba 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_tabs.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_tabs.html.erb
@@ -24,7 +24,7 @@
<% first=true %>
<% if logged_in? && @display_issues %>
<li class="<%= 'first' if first -%>">
- <a href="<%= url_for @issues_params.merge({:controller => 'issues', :action => 'bulk_change_form', :from => 'drilldown'}) -%>"
+ <a href="<%= url_for @issues_params.merge({:controller => 'issues', :action => 'bulk_change_form'}) -%>"
class="bulk-change-link open-modal"><%= message('bulk_change') -%></a>
</li>
<% first=false
@@ -57,5 +57,4 @@
</ul>
</div>
-
<% end %>