]> source.dussan.org Git - sonarqube.git/commitdiff
Cleanup resource/index and support component/index#component=<key>
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Tue, 24 Jun 2014 12:18:14 +0000 (14:18 +0200)
committerSimon Brandhof <simon.brandhof@sonarsource.com>
Tue, 24 Jun 2014 12:18:30 +0000 (14:18 +0200)
sonar-server/src/main/js/resource.js
sonar-server/src/main/webapp/WEB-INF/app/controllers/project_controller.rb
sonar-server/src/main/webapp/WEB-INF/app/controllers/resource_controller.rb
sonar-server/src/main/webapp/WEB-INF/app/views/issue/_show.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/test/_testable.html.erb

index ed3ed39306980a06fbe10f9ce8f0e2ac602e2640..35af666b403bfbdf78713f2af3e00b04c313f310 100644 (file)
@@ -2,28 +2,6 @@
  Functions used in resource viewers
  */
 
-function loadResourceViewer(resourceId, tab, display_title, period, elt) {
-  if (display_title == null) {
-    display_title = true;
-  }
-
-  var url = baseUrl + '/resource/index/' + resourceId + '?tab=' + tab + '&display_title=' + display_title
-    + '&period=' + period;
-  openAccordionItem(url, elt, true);
-
-  return false;
-}
-
-// Display GWT component
-function loadGWT(gwtId, resourceId, resourceKey, resourceName, resourceScope, resourceQualifier, resourceLanguage) {
-  config["resource"] = [
-    {"id":resourceId, "key":resourceKey, "name":resourceName, "scope":resourceScope, "qualifier":resourceQualifier,
-      "lang":resourceLanguage}
-  ];
-  config["resource_key"] = resourceId;
-  modules[gwtId]();
-}
-
 /*
  Functions used in tests viewer
  */
index 689d3cc57cee1b1b308a0cf29c366c2eb3fa3a73..98026c5479d3bba5c40d669b2e9764f8cd40930d 100644 (file)
@@ -24,9 +24,6 @@ class ProjectController < ApplicationController
 
   SECTION=Navigation::SECTION_RESOURCE
 
-  def index
-    redirect_to :overwrite_params => {:controller => :dashboard, :action => 'index'}
-  end
 
   def delete_form
     access_denied unless (is_admin?(@project))
index dd9debf98c739282e463d5c8653bd25624822408..4e7ccec4f81b16ecb58bf7393698e3b0ba58154a 100644 (file)
@@ -22,7 +22,17 @@ class ResourceController < ApplicationController
   SECTION=Navigation::SECTION_RESOURCE
 
   def index
-    anchor = "component=#{params[:id]}"
+    require_parameters 'id'
+
+    component_key = params[:id]
+    if Api::Utils.is_number?(component_key)
+      component=Project.by_key(component_key)
+      not_found unless component
+      access_denied unless has_role?(:user, component)
+      component_key = component.key
+    end
+
+    anchor = "component=#{component_key}"
     anchor += "&tab=#{params[:tab]}" if params[:tab]
     redirect_to :controller => 'component', :action => 'index', :anchor => anchor
   end
index 0e3ac01900a2093772d20848e05e6172d015254f..acbe92e6e71e75c8b0a03635945b9b0fd2896622 100644 (file)
@@ -13,7 +13,7 @@
     <span class="h1">
       <% if component %>
       <%= qualifier_icon(component) %>
-      <a href="<%= ApplicationController.root_context -%>/resource/index/<%= component.key() -%>?layout=false&tab=issues" class="issue-component-link"
+      <a href="<%= ApplicationController.root_context -%>/component/index#component=<%= component.key() -%>&tab=issues" class="issue-component-link"
          onclick="window.open(this.href,'resource-<%= component.key().parameterize -%>','height=800,width=900,scrollbars=1,resizable=1');return false;"><%= h component.longName() -%></a>
       <% else %>
         <%= h @issue.componentKey() %> [<del><%= message('issue.component_deleted') %></del>]
index 5b4dbe05d0e7879bfd5ad45a1a4aad2b25c2c805..c1907a5f48882205d1e8842b5f5e3f64862e56f0 100644 (file)
@@ -8,7 +8,7 @@
     <% @test_case_by_test_plan.sort_by { |test_plan, test_cases| test_plan.component.longName }.each do |test_plan, test_cases| %>
       <p style="padding: 0 0 2px 5px">
         <% resource_key = test_plan.component.key %>
-        <a href="<%= ApplicationController.root_context -%>/resource/index/<%= h resource_key -%>?display_title=true&tab=source"
+        <a href="<%= ApplicationController.root_context -%>/component/index#component=<%= resource_key -%>"
            class="testable-testplan-link" onclick="openAccordionItem(this.href, this); return false;"><%= h test_plan.component.longName %>
         </a>
       </p>