]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-4851 feed HTML with names of selected assignees/reporters
authorSimon Brandhof <simon.brandhof@gmail.com>
Fri, 22 Nov 2013 14:08:53 +0000 (15:08 +0100)
committerSimon Brandhof <simon.brandhof@gmail.com>
Fri, 22 Nov 2013 14:08:53 +0000 (15:08 +0100)
sonar-server/src/main/webapp/WEB-INF/app/helpers/issues_helper.rb
sonar-server/src/main/webapp/WEB-INF/app/views/issues/search.html.erb

index 8190a687ca67ba5514e2100f99f9cc604e1f689d..b30e66f6f5f942007c02ff08615c0ea6f8b250ea 100644 (file)
@@ -57,4 +57,14 @@ module IssuesHelper
     options
   end
 
+  def user_labels(logins)
+    logins.map do |login|
+      if login=='<unassigned>'
+        Api::Utils.message('unassigned')
+      else
+        user = Api.users.findByLogin(login)
+        user ? "#{user.name} (#{user.login})" : login
+      end
+    end
+  end
 end
index 8f7ad8c833016b0c81cd8ae38098a2df3b1fdc0e..97da5ce96f3d1294531afd81d0f542de764f8dec 100644 (file)
   </ul>
 </script>
 
+<%
+   component_labels = Project.by_keys(@issues_query.componentRoots).map{|c| c ? c.name : nil}
+   assignee_labels = user_labels(@issues_query.assignees)
+   reporter_labels = user_labels(@issues_query.reporters)
+%>
 <script>
   _.templateSettings = {
     interpolate: /\{\{(.+?)\}\}/g,
   });
 
   var queryParams = [
-    { key: 'componentRoots', value: <%= @issues_query.componentRoots.to_json -%>, text: <%= Project.by_keys(@issues_query.componentRoots).map{|c| c ? c.name : nil}.to_json -%> },
+    { key: 'componentRoots', value: <%= @issues_query.componentRoots.to_json -%>, text: <%= component_labels.to_json -%> },
     { key: 'severities[]', value: <%= @issues_query.severities.to_json -%> },
     { key: 'statuses[]', value: <%= @issues_query.statuses.to_json -%> },
     { key: 'resolutions[]', value: <%= @issues_query.resolutions.to_json -%> },
-    { key: 'assignees', value: <%= @issues_query.assignees.to_json -%> },
-    { key: 'reporters', value: <%= @issues_query.reporters.to_json -%> },
+    { key: 'assignees', value: <%= @issues_query.assignees.to_json -%>, text: <%= assignee_labels.to_json -%> },
+    { key: 'reporters', value: <%= @issues_query.reporters.to_json -%>, text: <%= reporter_labels.to_json -%> },
     { key: 'createdAfter', value: '<%= Api::Utils.format_date(@issues_query.createdAfter) -%>' },
     { key: 'createdBefore', value: '<%= Api::Utils.format_date(@issues_query.createdBefore) -%>' }
   ];