diff options
author | Fabrice Bellingard <fabrice.bellingard@sonarsource.com> | 2013-01-21 12:39:12 +0100 |
---|---|---|
committer | Fabrice Bellingard <fabrice.bellingard@sonarsource.com> | 2013-01-21 12:44:56 +0100 |
commit | a30ace7dbe2378263281fea489137e6171b96923 (patch) | |
tree | 9ddca73d4f44e530812d6a7fca338858c0900f5e | |
parent | f7de01e723f1ce7bf390e67d1960287037bfe50d (diff) | |
download | sonarqube-a30ace7dbe2378263281fea489137e6171b96923.tar.gz sonarqube-a30ace7dbe2378263281fea489137e6171b96923.zip |
SONAR-3981 Column sort broken on project_reviews page
3 files changed, 65 insertions, 27 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/project_reviews/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/project_reviews/index.html.erb index 4ba5a989c34..25c95cb71dc 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/project_reviews/index.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/project_reviews/index.html.erb @@ -1,3 +1,34 @@ +<% content_for :script do %> + <script> + + function launchSearch(columnName) { + var urlParts = document.URL.split('?'); + + var url = urlParts.shift() + '?'; + + if (urlParts[0]) { + urlParts[0].split('&').forEach( function(s) { + if (s != '' & s.indexOf('asc=') == -1 && s.indexOf('sort=') == -1 ) { + url += '&' + s; + } + }); + + if (url.indexOf('?') > 0) { + url += '&sort=' + columnName; + } else { + url += '?sort=' + columnName; + } + + if (!document.URL.contains('&asc=true')) { + url += '&asc=true'; + } + } + + window.location = url; + } + </script> +<% end %> + <div style="font-size: 85%; margin-bottom: 10px"> ยป <a href="#" onclick="javascript:history.back(-1);return false;"><%= message('back') -%></a> </div> @@ -5,6 +36,8 @@ <div id="reviews-search"> <h1><%= message('reviews') -%></h1> + <input type="hidden" name="asc" id="asc" value="<%= params[:asc] ? params[:asc] : 'true' -%>"/> + <div class="review-filters"> <%= message('reviews.filtered_by') -%>: <% if params[:statuses] %> diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/reviews/_list.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/reviews/_list.html.erb index 11d75bcb534..938b6870384 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/reviews/_list.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/reviews/_list.html.erb @@ -5,25 +5,25 @@ <thead> <tr> <th width="1%" nowrap> - <a href="#" onClick="launchSearch('status', this)"><%= message('status_abbreviated') -%></a> + <a href="#" onClick="launchSearch('status')"><%= message('status_abbreviated') -%></a> <%= image_tag(@asc ? "asc12.png" : "desc12.png") if @sort == 'status' -%> </th> <th width="1%" nowrap> - <a href="#" onClick="launchSearch('id', this)"><%= message('identifier_abbreviated') -%></a> + <a href="#" onClick="launchSearch('id')"><%= message('identifier_abbreviated') -%></a> <%= image_tag(@asc ? "asc12.png" : "desc12.png") if @sort == 'id' -%> </th> <th width="1%" nowrap> - <a href="#" onClick="launchSearch('severity', this)"><%= message('severity_abbreviated') -%></a> + <a href="#" onClick="launchSearch('severity')"><%= message('severity_abbreviated') -%></a> <%= image_tag(@asc ? "asc12.png" : "desc12.png") if @sort == 'severity' -%> </th> <th> - <a href="#" onClick="launchSearch('title', this)"><%= message('title') -%></a> + <a href="#" onClick="launchSearch('title')"><%= message('title') -%></a> <%= image_tag(@asc ? "asc12.png" : "desc12.png") if @sort == 'title' -%> </th> <th width="1%"><%= message('project') -%></th> <th><%= message('assignee') -%></th> <th> - <a href="#" onClick="launchSearch('updated_at', this)"><%= message('age') -%></a> + <a href="#" onClick="launchSearch('updated_at')"><%= message('age') -%></a> <%= image_tag(@asc ? "asc12.png" : "desc12.png") if @sort == 'updated_at' -%> </th> </tr> diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/reviews/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/reviews/index.html.erb index 3b863f0ec2a..d5a371cf08e 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/reviews/index.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/reviews/index.html.erb @@ -8,6 +8,33 @@ } </style> <% end %> +<% content_for :script do %> + <script> + + function reviewIdFieldModified(field) { + if (field.value != '') { + $('statuses').value = ''; + $('severities').value = ''; + $('projects').value = ''; + $('author_login').value = ''; + $('autocompleteText-author_login').value = ''; + $('assignee_login').value = ''; + $('autocompleteText-assignee_login').value = ''; + $('false_positives').value = 'with'; + } + } + function launchSearch(columnName) { + $('sort').value = columnName; + if ($('asc').value == "true") { + $('asc').value = "false"; + } else { + $('asc').value = "true"; + } + document.forms[0].submit(); + } + + </script> +<% end %> <div id="reviews-search"> <div class="page-split-left"> @@ -89,27 +116,5 @@ </div> <script> - function reviewIdFieldModified(field) { - if (field.value != '') { - $('statuses').value = ''; - $('severities').value = ''; - $('projects').value = ''; - $('author_login').value = ''; - $('autocompleteText-author_login').value = ''; - $('assignee_login').value = ''; - $('autocompleteText-assignee_login').value = ''; - $('false_positives').value = 'with'; - } - } - function launchSearch(columnName, link) { - $('sort').value = columnName - if ($('asc').value == "true") { - $('asc').value = "false"; - } else { - $('asc').value = "true"; - } - document.forms[0].submit() - } - $j('#review_id').focus(); </script>
\ No newline at end of file |