From: Stas Vilchik Date: Wed, 18 Feb 2015 12:50:09 +0000 (+0100) Subject: Revert "SONAR-6146 clean up /resources/index" X-Git-Tag: 5.1-RC1~210 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=20e71db3add04928ea8981ca6d50b2192c2bf54e;p=sonarqube.git Revert "SONAR-6146 clean up /resources/index" This reverts commit 45d09ec06ee543bdae2732cb06eb1d51d9c46a10. --- diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/resource_controller.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/resource_controller.rb new file mode 100644 index 00000000000..e384ae00248 --- /dev/null +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/resource_controller.rb @@ -0,0 +1,45 @@ +# +# SonarQube, open source software quality management tool. +# Copyright (C) 2008-2014 SonarSource +# mailto:contact AT sonarsource DOT com +# +# SonarQube is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# SonarQube is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# + +class ResourceController < ApplicationController + + SECTION=Navigation::SECTION_RESOURCE + + helper :dashboard + helper UsersHelper + + # DO NOT REMOVE - used by eclipse plugin + def index + 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 url_for(:controller => 'component', :action => 'index') + '#' + anchor + end + +end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/resource/_extension.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/resource/_extension.html.erb new file mode 100644 index 00000000000..a19fdb49080 --- /dev/null +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/resource/_extension.html.erb @@ -0,0 +1,5 @@ +
+ <%= render :inline => @extension.getTarget().getTemplate() -%> +
+ +<%= message('close') -%> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/resource/_tabs.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/resource/_tabs.html.erb new file mode 100644 index 00000000000..9b1e13a610f --- /dev/null +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/resource/_tabs.html.erb @@ -0,0 +1,37 @@ +<% + if @extensions.empty? +%> + <%= message('code_viewer.no_info_displayed_due_to_security') -%> +<% + else + display_title=(params[:display_title]=='true') +%> + + <% if display_title %> +
+ <% if @resource.project %> +
+ <%= h @resource.ancestor_projects.reverse.map{|p| p.name(true)}.join(' / ') -%> +
+ <% end %> + <% if logged_in? %><%= link_to_favourite(@resource) -%><% end %> + <%= qualifier_icon(@resource) -%> <%= h @resource.name(true) -%> +
+ <% end %> + +
+ +
+ + +<% end %> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/resource/_view.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/resource/_view.html.erb new file mode 100644 index 00000000000..33f134f19a2 --- /dev/null +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/resource/_view.html.erb @@ -0,0 +1,10 @@ +
+
+ <%= render :partial => 'tabs' -%> +
+
+ <% if @extension.getTarget() # ruby on rails page %> + <%= render :inline => @extension.getTarget().getTemplate() -%> + <% end %> +
+