From 07a6955c68693daaa19c7cf38892ac7281bad94d Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Mon, 16 Jun 2014 21:09:39 +0200 Subject: [PATCH] SONAR-5007 add skeleton for profiles/show --- .../WEB-INF/app/controllers/profiles_controller.rb | 12 +++++++++++- .../webapp/WEB-INF/app/views/profiles/_tabs.html.erb | 3 +++ .../webapp/WEB-INF/app/views/profiles/index.html.erb | 4 ++-- .../WEB-INF/app/views/profiles/permalinks.html.erb | 2 +- .../webapp/WEB-INF/app/views/profiles/show.html.erb | 7 +++++++ 5 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 sonar-server/src/main/webapp/WEB-INF/app/views/profiles/show.html.erb diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/profiles_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/profiles_controller.rb index f7bbec8d0ca..194ca1520e3 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/profiles_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/profiles_controller.rb @@ -30,10 +30,20 @@ class ProfilesController < ApplicationController add_breadcrumbs ProfilesController::root_breadcrumb call_backend do @profiles = Internal.quality_profiles.allProfiles().to_a + @stats = Internal.component(Java::OrgSonarServerQualityprofile::QProfileService.java_class).getAllProfileStats() end Api::Utils.insensitive_sort!(@profiles) { |profile| profile.name() } end + # GET /profiles/show?id= + def show + require_parameters 'id' + call_backend do + @profile = Internal.quality_profiles.profile(params[:id].to_i) + end + set_profile_breadcrumbs + end + # GET /profiles/create_form?language= def create_form require_parameters 'language' @@ -553,7 +563,7 @@ class ProfilesController < ApplicationController end def set_profile_breadcrumbs - add_breadcrumbs ProfilesController::root_breadcrumb, Api::Utils.language_name(@profile.language), {:name => @profile.name, :url => {:controller => 'rules_configuration', :action => 'index', :id => @profile.id}} + add_breadcrumbs ProfilesController::root_breadcrumb, {:name => "#{@profile.name} (#{Api::Utils.language_name(@profile.language)})"} end def profile_id_to_key(profile_id) diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/profiles/_tabs.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/profiles/_tabs.html.erb index d47993d8eff..4b7e62dbc95 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/profiles/_tabs.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/profiles/_tabs.html.erb @@ -3,6 +3,9 @@ selected_tab = nil unless defined?(:selected_tab) %>
    +
  • + id="tab-rules"><%= message('coding_rules') -%> +
  • id="tab-projects"><%= message('projects') -%>
  • diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/profiles/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/profiles/index.html.erb index 962e3cb3af5..b424bc0247d 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/profiles/index.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/profiles/index.html.erb @@ -55,10 +55,11 @@ projects_count = projects_count(profile) profile_rules_count = profile_rules_count(profile) is_default_profile = !default_profile.nil? && (default_profile.name() == profile.name()) + %> - <%= h profile.name() %> @@ -88,7 +89,6 @@ <% if profiles_administrator? %> -
    <%= message('backup_verb') -%> diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/profiles/permalinks.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/profiles/permalinks.html.erb index 94a0653f6cd..800dd1dd51b 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/profiles/permalinks.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/profiles/permalinks.html.erb @@ -5,7 +5,7 @@ <% exporters = Internal.profile_exporter.getProfileExportersForLanguage(@profile.language()) %>
    - +