]> source.dussan.org Git - sonarqube.git/commitdiff
Revert "SONAR-6146 clean up /resources/index"
authorStas Vilchik <vilchiks@gmail.com>
Wed, 18 Feb 2015 12:50:09 +0000 (13:50 +0100)
committerStas Vilchik <vilchiks@gmail.com>
Wed, 18 Feb 2015 12:51:01 +0000 (13:51 +0100)
This reverts commit 45d09ec06ee543bdae2732cb06eb1d51d9c46a10.

server/sonar-web/src/main/webapp/WEB-INF/app/controllers/resource_controller.rb [new file with mode: 0644]
server/sonar-web/src/main/webapp/WEB-INF/app/views/resource/_extension.html.erb [new file with mode: 0644]
server/sonar-web/src/main/webapp/WEB-INF/app/views/resource/_tabs.html.erb [new file with mode: 0644]
server/sonar-web/src/main/webapp/WEB-INF/app/views/resource/_view.html.erb [new file with mode: 0644]

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 (file)
index 0000000..e384ae0
--- /dev/null
@@ -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 (file)
index 0000000..a19fdb4
--- /dev/null
@@ -0,0 +1,5 @@
+<div>
+  <%= render :inline => @extension.getTarget().getTemplate() -%>
+</div>
+
+<a class="js-extension-close extension-close link-action"><%= message('close') -%></a>
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 (file)
index 0000000..9b1e13a
--- /dev/null
@@ -0,0 +1,37 @@
+<%
+   if @extensions.empty?
+%>
+  <span class="note"><%= message('code_viewer.no_info_displayed_due_to_security') -%></span>
+<%
+   else
+     display_title=(params[:display_title]=='true')
+%>
+
+  <% if display_title %>
+    <div class="source_title">
+      <% if @resource.project %>
+        <div class="subtitle">
+          <%= h @resource.ancestor_projects.reverse.map{|p| p.name(true)}.join(' / ') -%>
+        </div>
+      <% end %>
+      <% if logged_in? %><%= link_to_favourite(@resource) -%><% end %>
+      <span class="h1"><%= qualifier_icon(@resource) -%> <%= h @resource.name(true) -%></span>
+    </div>
+  <% end %>
+
+  <div class="source_tabs">
+    <ul class="tabs">
+      <% @extensions.each do |extension| %>
+        <li>
+          <a href="#" onclick="return loadResourceViewer('<%= @resource.id -%>','<%= extension.getId() -%>',<%= display_title -%>,'<%= params[:period] -%>', this)"
+             class="<%= 'selected' if @extension && @extension.getId()==extension.getId() -%>"><%= message(extension.getId() + '.page', :default => extension.getTitle()) %></a>
+        </li>
+      <% end %>
+      <li>
+        <img src="<%= ApplicationController.root_context -%>/images/loading.gif" id="resource_loading" class="accordion-loading" style="display:none"/>
+      </li>
+    </ul>
+  </div>
+
+
+<%  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 (file)
index 0000000..33f134f
--- /dev/null
@@ -0,0 +1,10 @@
+<div>
+  <div class="accordion-item-header">
+    <%= render :partial => 'tabs' -%>
+  </div>
+  <div class="accordion-item-body">
+    <% if @extension.getTarget() # ruby on rails page %>
+      <%= render :inline => @extension.getTarget().getTemplate() -%>
+    <% end %>
+  </div>
+</div>