From b20a9dac37e67ff615ea0374d4f1bf38496a1186 Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Sun, 25 Nov 2012 22:29:02 +0100 Subject: [PATCH] SONAR-3825 support pages without sidebar --- .../app/controllers/alerts_controller.rb | 1 - .../controllers/dependencies_controller.rb | 1 - .../app/controllers/measures_controller.rb | 2 - .../app/controllers/profiles_controller.rb | 1 - .../app/controllers/reviews_controller.rb | 2 - .../rules_configuration_controller.rb | 2 - .../app/views/layouts/_layout.html.erb | 237 ++++++++++++------ .../app/views/measures/search.html.erb | 69 ++--- .../src/main/webapp/stylesheets/layout.css | 49 +++- 9 files changed, 229 insertions(+), 135 deletions(-) diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/alerts_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/alerts_controller.rb index f0d47d8e9df..c27ca5a90eb 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/alerts_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/alerts_controller.rb @@ -18,7 +18,6 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 # class AlertsController < ApplicationController - SECTION=Navigation::SECTION_CONFIGURATION verify :method => :post, :only => ['create', 'update', 'delete'], :redirect_to => { :action => 'index' } before_filter :admin_required, :except => [ 'index' ] diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/dependencies_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/dependencies_controller.rb index a3c03b63086..91c62d822f9 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/dependencies_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/dependencies_controller.rb @@ -18,7 +18,6 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 # class DependenciesController < ApplicationController - SECTION = Navigation::SECTION_HOME SEARCH_MINIMUM_SIZE=3 QUALIFIERS=['TRK', 'BRC', 'LIB'] diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/measures_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/measures_controller.rb index 40d74b6f14e..e99fb71704a 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/measures_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/measures_controller.rb @@ -19,8 +19,6 @@ # class MeasuresController < ApplicationController - SECTION=Navigation::SECTION_HOME - # GET /measures/index def index @filter = MeasureFilter.new 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 1dc5ab7d8a1..821b6313b56 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 @@ -18,7 +18,6 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 # class ProfilesController < ApplicationController - SECTION=Navigation::SECTION_CONFIGURATION # the backup action is allow to non-admin users : see http://jira.codehaus.org/browse/SONAR-2039 before_filter :admin_required, :only => ['create', 'delete', 'set_as_default', 'copy', 'restore', 'change_parent', 'set_projects', 'rename_form', 'rename'] diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/reviews_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/reviews_controller.rb index fb769042aea..a4b1c4cabf1 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/reviews_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/reviews_controller.rb @@ -20,8 +20,6 @@ class ReviewsController < ApplicationController - SECTION=Navigation::SECTION_HOME - verify :method => :post, :only => [:violation_assign, :violation_flag_as_false_positive, :violation_change_severity, :violation_save_comment, :violation_delete_comment, :violation_change_status, diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/rules_configuration_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/rules_configuration_controller.rb index 0b6f838924c..5d0ad9c1b68 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/rules_configuration_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/rules_configuration_controller.rb @@ -21,8 +21,6 @@ require 'cgi' class RulesConfigurationController < ApplicationController - SECTION=Navigation::SECTION_CONFIGURATION - STATUS_ACTIVE = "ACTIVE" STATUS_INACTIVE = "INACTIVE" ANY_SELECTION = [["Any", '']] diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb index 63c220d9ad5..f55bca5f408 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb @@ -1,5 +1,6 @@ <% - selected_section = controller.class::SECTION + selected_section = controller.class::SECTION if defined?(controller.class::SECTION) + if selected_section==Navigation::SECTION_RESOURCE && !@project && !@resource selected_section = Navigation::SECTION_HOME end @@ -45,20 +46,45 @@
+ + +
+ <%= render 'layouts/breadcrumb' if selected_section==Navigation::SECTION_RESOURCE -%> - <% controller.java_facade.getPages(Navigation::SECTION_HOME, nil, nil, nil, nil).each do |page| - page_url = (page.isController() ? page.getId() : "/plugins/home/#{page.getId()}") - selected=request.request_uri.include?("/plugins/home/#{page_url}") - %> -
  • - <%= message(page.getId() + '.page', :default => page.getTitle()) -%>
  • - <% end %> +
    + <% if selected_section %> +
    + + <% if @sidebar %> +
    <%= render :partial => @sidebar %>
    + <% else %> + <% end %> - - <%= yield :sidebar %> - -
    - - <% if @sidebar %> -
    <%= render :partial => @sidebar %>
    - <% else %> - <% end %> -
    -
    - <% if @project %> -

    <%= @project.name(true) %>

    - <% end %> - - -
    - <% unless params[:hd]=='false' %> <%= yield :footer %> diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/measures/search.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/measures/search.html.erb index deb3d90ab37..ca88e75f055 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/measures/search.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/measures/search.html.erb @@ -1,77 +1,75 @@ <% content_for :style do %> <% end %> -
    -
    +
    +
    <% if @filter.id %> <% end %> - +
    - - - - + - + @@ -99,6 +97,7 @@ @@ -107,9 +106,8 @@
    + Base:
    - +
    + On components:
    <%= check_box_tag 'onBaseComponents', 'true', @filter.criteria['onBaseComponents'] -%>
    + Qualifiers:
    <% - qualifiers = Api::Utils.java_facade.getResourceTypesForFilter().map do |resource_type| - [message("qualifiers.#{resource_type.getQualifier()}"), resource_type.getQualifier()] - end + qualifiers = Api::Utils.java_facade.getResourceTypesForFilter().map do |resource_type| + [message("qualifiers.#{resource_type.getQualifier()}"), resource_type.getQualifier()] + end %> - <%= select_tag 'qualifiers[]', options_for_select([[message('any'), '']].concat(qualifiers), @filter.criteria['qualifiers']||''), :size => 5, :multiple => true -%> + <%= select_tag 'qualifiers[]', options_for_select([[message('any'), '']].concat(qualifiers), @filter.criteria['qualifiers']||''), :size => 5, :multiple => true, :class => 'large-input' -%>
    Language:
    <% languages = [[message('any'), '']].concat(Api::Utils.languages.map { |lang| [lang.name, lang.key] }) %> - <%= select_tag 'languages[]', options_for_select(languages, @filter.criteria['languages']||''), :size => 5, :multiple => true -%> + <%= select_tag 'languages[]', options_for_select(languages, @filter.criteria['languages']||''), :size => 5, :multiple => true, :class => 'large-input' -%>
    + Name:
    -
    + Key:
    -
    Favourites only:
    - <%= check_box_tag 'onFavourites', 'true', @filter.criteria['onFavourites']=='true' %> + <%= check_box_tag 'onFavourites', 'true', @filter.criteria['onFavourites']=='true' -%>
    +
    New search
    -
    - <% if logged_in? %> +
      <% current_user.favourited_measure_filters.each do |my_filter| %>
    • @@ -122,12 +120,15 @@
    <% if @filter.results %> -
    +
    <% if @filter.name %> -

    <%= h @filter.name -%>

    - <% if @filter.description %> -

    <%= h @filter.description -%>

    - <% end %> +

    + <%= h @filter.name -%> + <% if @filter.description.present? %> + - <%= h @filter.description -%> + <% end %> +

    + <% end %> Display as: diff --git a/sonar-server/src/main/webapp/stylesheets/layout.css b/sonar-server/src/main/webapp/stylesheets/layout.css index 551d37ad0fa..df7dadddd53 100644 --- a/sonar-server/src/main/webapp/stylesheets/layout.css +++ b/sonar-server/src/main/webapp/stylesheets/layout.css @@ -53,11 +53,11 @@ body, a { #hd { color: #FFF; background: #262626; - padding: 0 5px; + padding: 0 8px 0 18px; height: 30px; line-height: 30px; font-size: 93%; - margin: 0 10px; + margin: 0; position: relative; } @@ -87,7 +87,7 @@ body, a { #nav-left > ul> li { float: left; - padding: 0 10px 0 5px; + padding: 0 10px 0 0; } #nav > ul> li { @@ -106,13 +106,14 @@ body, a { #crumbs { color: #444; background: #EFEFEF; - height: 22px; - line-height: 22px; + height: 26px; + line-height: 26px; font-size: 93%; - margin: 0 10px; + margin: 0; + padding: 0 8px 0 18px; border-bottom: 1px solid #CCC; - border-right: 1px solid #CCC; } + #crumbs img { vertical-align: text-bottom; } @@ -127,8 +128,7 @@ body, a { #bc li.first { background: #EFEFEF; - border-left: 2px solid #CCC; - padding: 0 10px 0 5px; + padding: 0 10px 0 0; } #bc li img { @@ -193,22 +193,22 @@ body, a { } .with_sidebar { - margin: 0 10px 0 170px; + margin: 0 8px 0 168px; } .wo_sidebar { - margin: 0 10px 0 10px; + margin: 0 8px; } #content { - padding-top: 10px; + padding-top: 8px; width: auto; } #sb { width: 150px; position: absolute; - margin: 0 10px; + margin: 0 8px; top: 0; left: 0; } @@ -279,3 +279,26 @@ body, a { .nolayout { padding: 10px; } + +.page-split-left { + min-width: 180px; + width: 180px; + margin: 0; + -moz-box-sizing: border-box; + display: table-cell; + vertical-align: top; + background-color: #EFEFEF; + border: 1px solid #CCC; + color: #666; + line-height: 1.1em; + padding: 10px; +} + +.page-split-right { + position: relative; + padding: 10px 0 0 10px; + -moz-box-sizing: border-box; + display: table-cell; + margin: 0; + vertical-align: top; +} \ No newline at end of file -- 2.39.5