diff options
19 files changed, 643 insertions, 645 deletions
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties b/plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties index b6e1241c950..e76e1e232cd 100644 --- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties +++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties @@ -300,7 +300,6 @@ layout.dashboards=Dashboards layout.tools=Tools layout.user_panel.my_profile=My profile layout.user_panel.recent_history.title=Recent history -layout.user_panel.recent_history.clear=Clear layout.user_panel.me=Me layout.user_panel.anonymous_user=Anonymous @@ -521,7 +520,7 @@ reviews.filtered_by.to=To date #------------------------------------------------------------------------------ comparison.compare=Compare -comparison.add_a_new_metric=Add a new metric +comparison.add_metric=Add metric comparison.select_resource_to_compare=Select a resource to compare comparison.select_version=Select a version comparison.remove_resource=Remove resource diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/account_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/account_controller.rb index fa963c06168..beac85292fb 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/account_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/account_controller.rb @@ -19,8 +19,6 @@ # class AccountController < ApplicationController - SECTION=Navigation::SECTION_CONFIGURATION - before_filter :login_required def index 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 19c5c8b8f1a..ce19f9f8982 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 @@ -91,6 +91,7 @@ class MeasuresController < ApplicationController def manage access_denied unless logged_in? add_breadcrumbs(ROOT_BREADCRUMB, message('measure_filter.manage')) + @filter = MeasureFilter.new @shared_filters = MeasureFilter.find(:all, :include => :user, :conditions => ['shared=? and (user_id is null or user_id<>?)', true, current_user.id]) diff --git a/sonar-server/src/main/webapp/WEB-INF/app/helpers/dashboard_helper.rb b/sonar-server/src/main/webapp/WEB-INF/app/helpers/dashboard_helper.rb index 49b9cbdf1bc..582bf95e120 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/helpers/dashboard_helper.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/helpers/dashboard_helper.rb @@ -21,6 +21,7 @@ module DashboardHelper include WidgetPropertiesHelper include MetricsHelper include FiltersHelper + include MeasuresHelper def dashboard_action(action_name, opts={}) if @resource { :action => action_name, :did => @dashboard.id, :id => @resource.id }.merge!(opts) diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/account/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/account/index.html.erb index 52ee54f7a63..aaabf828d4d 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/account/index.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/account/index.html.erb @@ -1,86 +1,91 @@ -<h1 class="marginbottom10"><%= message('my_profile.page') -%></h1> -<div class="admin marginbottom10"> -<table class="form"> - <tr> - <td><b><%= message('my_profile.login') -%>:</b></td> - <td id="login"><%= current_user.login %></td> - </tr> - <tr> - <td><b><%= message('my_profile.name') -%>:</b></td> - <td id="name"><%= current_user.name %></td> - </tr> - <tr> - <td><b><%= message('my_profile.email') -%>:</b></td> - <td id="email"><%= current_user.email %></td> - </tr> - <tr> - <td><b><%= message('my_profile.groups') -%>:</b></td> - <td id="groups"><%= current_user.groups.sort.map(&:name).join(', ') %></td> - </tr> -</table> -</div> +<div id="content"> + <h1 class="marginbottom10"><%= message('my_profile.page') -%></h1> -<% if User.editable_password? %> -<h2><%= message('my_profile.password.title') -%></h2> -<div class="admin marginbottom10"> - <% form_tag( {:action => 'change_password' }, :id => 'pass_form_tag', :name => 'pass_form_tag') do -%> - <table class="form"> - <tr> - <td class="keyCell"><label for="old_password"><b><%= message('my_profile.password.old') -%>:</b></label></td> - <td><%= password_field_tag 'old_password' %></td> - </tr> - <tr> - <td class="keyCell"><label for="password"><b><%= message('my_profile.password.new') -%>:</b></label></td> - <td><%= password_field_tag 'password' %></td> - </tr> - <tr> - <td class="keyCell"><label for="password_confirmation"><b><%= message('my_profile.password.confirm') -%>:</b></label></td> - <td><%= password_field_tag 'password_confirmation' %></td> - </tr> - <tr> - <td></td> - <td><%= submit_tag message('my_profile.password.submit') %></td> - </tr> - </table> - <% end %> + <div class="admin marginbottom10"> + <table class="form"> + <tr> + <td><b><%= message('my_profile.login') -%>:</b></td> + <td id="login"><%= current_user.login %></td> + </tr> + <tr> + <td><b><%= message('my_profile.name') -%>:</b></td> + <td id="name"><%= current_user.name %></td> + </tr> + <tr> + <td><b><%= message('my_profile.email') -%>:</b></td> + <td id="email"><%= current_user.email %></td> + </tr> + <tr> + <td><b><%= message('my_profile.groups') -%>:</b></td> + <td id="groups"><%= current_user.groups.sort.map(&:name).join(', ') %></td> + </tr> + </table> + </div> - <script type="text/javascript"> - //<![CDATA[ - $('pass_form_tag').focusFirstElement(); - //]]> - </script> -</div> -<% end -%> + <% if User.editable_password? %> + <h2><%= message('my_profile.password.title') -%></h2> -<h2><%= message('my_profile.notifications.title') -%></h2> -<div class="admin marginbottom10"> -<% form_tag({:action => 'update_notifications'}, {:method => 'post'}) do %> - <table class="form"> - <tr> - <td></td> - <% for channel in @channels %> - <td><b><%= message('notification.channel.' + channel.getKey()) -%></b></td> + <div class="admin marginbottom10"> + <% form_tag({:action => 'change_password'}, :id => 'pass_form_tag', :name => 'pass_form_tag') do -%> + <table class="form"> + <tr> + <td class="keyCell"><label for="old_password"><b><%= message('my_profile.password.old') -%>:</b></label></td> + <td><%= password_field_tag 'old_password' %></td> + </tr> + <tr> + <td class="keyCell"><label for="password"><b><%= message('my_profile.password.new') -%>:</b></label></td> + <td><%= password_field_tag 'password' %></td> + </tr> + <tr> + <td class="keyCell"><label for="password_confirmation"><b><%= message('my_profile.password.confirm') -%>:</b></label></td> + <td><%= password_field_tag 'password_confirmation' %></td> + </tr> + <tr> + <td></td> + <td><%= submit_tag message('my_profile.password.submit') %></td> + </tr> + </table> <% end %> - </tr> - <% for dispatcher in @dispatchers %> - <tr> - <td><%= message('notification.dispatcher.' + dispatcher.getKey()) -%></td> - <td> - <% - for channel in @channels - notification_id = dispatcher.getKey() + '.' + channel.getKey() - check_box_id = 'notifications[' + notification_id + ']' - check_box_checked = @notifications[notification_id] - %> - <%= check_box_tag check_box_id, 'true', check_box_checked %> + + <script type="text/javascript"> + //<![CDATA[ + $('pass_form_tag').focusFirstElement(); + //]]> + </script> + </div> + <% end -%> + + <h2><%= message('my_profile.notifications.title') -%></h2> + + <div class="admin marginbottom10"> + <% form_tag({:action => 'update_notifications'}, {:method => 'post'}) do %> + <table class="form"> + <tr> + <td></td> + <% for channel in @channels %> + <td><b><%= message('notification.channel.' + channel.getKey()) -%></b></td> + <% end %> + </tr> + <% for dispatcher in @dispatchers %> + <tr> + <td><%= message('notification.dispatcher.' + dispatcher.getKey()) -%></td> + <td> + <% + for channel in @channels + notification_id = dispatcher.getKey() + '.' + channel.getKey() + check_box_id = 'notifications[' + notification_id + ']' + check_box_checked = @notifications[notification_id] + %> + <%= check_box_tag check_box_id, 'true', check_box_checked %> + <% end %> + </td> + </tr> <% end %> - </td> - </tr> + <tr> + <td></td> + <td><%= submit_tag message('my_profile.notifications.submit') %></td> + </tr> + </table> <% end %> - <tr> - <td></td> - <td><%= submit_tag message('my_profile.notifications.submit') %></td> - </tr> - </table> -<% end %> -</div> + </div> +</div>
\ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/alerts/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/alerts/index.html.erb index 2b8b029a0f9..65dcde48b01 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/alerts/index.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/alerts/index.html.erb @@ -1,4 +1,5 @@ -<%= render :partial => 'profiles/tabs', :locals => {:selected_tab=>'Alerts'} %> +<div id="content"> + <%= render :partial => 'profiles/tabs', :locals => {:selected_tab=>'Alerts'} %> <% if is_admin? %> <div class="tabs-panel marginbottom10 admin" id="new_alert_form"> @@ -44,3 +45,4 @@ </tbody> </table> </div> +</div>
\ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/comparison/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/comparison/index.html.erb index 9000761e3a4..589eb1fb02f 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/comparison/index.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/comparison/index.html.erb @@ -1,35 +1,87 @@ -<style type="text/css"> - #comparison-page td { - vertical-align: middle; - } - - .move-actions img { - visibility: hidden; - } - - .move-actions:hover img { - visibility: visible; - } -</style> +<% content_for :style do %> + <style> + #comparison-page td { + vertical-align: middle; + } -<div id="comparison-page"> - <form method="GET" id="compare-form" action="<%= ApplicationController.root_context -%>/comparison/index"> - <input type="hidden" name="sids" id="sids" value="<%= @snapshots.map {|s| s.id.to_s}.join(',') -%>"> - <input type="hidden" name="metrics" id="metrics" value="<%= @metrics.map {|m| m.key}.join(',') -%>"> - - <table class="data"> - - <thead> + .move-actions img { + visibility: hidden; + } + + .move-actions:hover img { + visibility: visible; + } + </style> +<% end %> +<% content_for :script do %> + <script> + function submitForm() { + $j('#compare-form').submit(); + } + + function moveLeft(index) { + sids = $j('#sids').val().split(','); + idToLeft = sids[index]; + idToRight = sids[index - 1]; + sids.splice(index - 1, 2, [idToLeft, idToRight]); + $j('#sids').val(sids.join(',')); + submitForm(); + } + + function moveRight(index) { + sids = $j('#sids').val().split(','); + idToRight = sids[index]; + idToLeft = sids[index + 1]; + sids.splice(index, 2, [idToLeft, idToRight]); + $j('#sids').val(sids.join(',')); + submitForm(); + } + + function moveUp(index) { + metrics = $j('#metrics').val().split(','); + idToUp = metrics[index]; + idToBottom = metrics[index - 1]; + metrics.splice(index - 1, 2, [idToUp, idToBottom]); + $j('#metrics').val(metrics.join(',')); + submitForm(); + } + + function moveDown(index) { + metrics = $j('#metrics').val().split(','); + idToBottom = metrics[index]; + idToUp = metrics[index + 1]; + metrics.splice(index, 2, [idToUp, idToBottom]); + $j('#metrics').val(metrics.join(',')); + submitForm(); + } + + function removeFromList(index, inputField) { + value = inputField.val().split(','); + value.splice(index, 1); + inputField.val(value.join(',')); + submitForm(); + } + </script> +<% end %> + +<div id="content"> + <div id="comparison-page"> + <form method="GET" id="compare-form" action="<%= ApplicationController.root_context -%>/comparison/index"> + <input type="hidden" name="sids" id="sids" value="<%= @snapshots.map { |s| s.id.to_s }.join(',') -%>"> + <input type="hidden" name="metrics" id="metrics" value="<%= @metrics.map { |m| m.key }.join(',') -%>"> + + <table class="data"> + <thead> <th class="thin" style="vertical-align: bottom"> <%= metric_select_tag 'new_metric', @metric_to_choose, { - :allow_empty => true, - :select2_options => {'placeholder' => "'" + message('comparison.add_a_new_metric') + "'"} - } -%> + :allow_empty => true, + :select2_options => {'placeholder' => "'" + message('comparison.add_metric') + "'"} + } -%> <script> // we don't want this parameter to be submitted, so we set its name to '' $j('#new_metric').attr('name', ''); - $j('#new_metric').on("change", function(e) { - if (e.val!=null) { + $j('#new_metric').on("change", function (e) { + if (e.val != null) { var currentMetrics = $j('#metrics').val(); if (currentMetrics.length > 0) { currentMetrics += ','; @@ -41,10 +93,10 @@ }); </script> </th> - + <% - last_index = @snapshots.size-1 - @snapshots.each_with_index do |s, index| + last_index = @snapshots.size-1 + @snapshots.each_with_index do |s, index| %> <th class="thin move-actions" style="padding: 5px !important;"> <table> @@ -62,7 +114,10 @@ <span class="note"><b><%= s.event(EventCategory::KEY_VERSION).name -%></b></span> <br/> <span class="note"><%= human_short_date s.created_at -%></span> - <div style="width: 100%; text-align: center;"><a href="#" onclick="removeFromList(<%= index -%>, $j('#sids'))"><img src="<%= ApplicationController.root_context -%>/images/controls/cross.png" title="<%= message('comparison.remove_resource') -%>"/></a></div> + + <div style="width: 100%; text-align: center;"> + <a href="#" onclick="removeFromList(<%= index -%>, $j('#sids'))"><img src="<%= ApplicationController.root_context -%>/images/controls/cross.png" title="<%= message('comparison.remove_resource') -%>"/></a> + </div> </td> <td class="thin" style="vertical-align: bottom;"> <% if index < last_index %> @@ -75,30 +130,30 @@ </table> </th> <% end %> - + <th style="padding-left: 20px; vertical-align: bottom"> <%= resource_select_tag 'new_resource', { - :resource_type_property => 'comparable', - :width => '250px', - :select2_options => {'placeholder' => "'" + message('comparison.select_resource_to_compare') + "'"} - } -%> + :resource_type_property => 'comparable', + :width => '250px', + :select2_options => {'placeholder' => "'" + message('comparison.select_resource_to_compare') + "'"} + } -%> <script> // we don't want this parameter to be submitted, so we set its name to '' $j('#new_resource').attr('name', ''); - $j('#new_resource').on("change", function(e) { - if (e.val!=null) { + $j('#new_resource').on("change", function (e) { + if (e.val != null) { $j.ajax({ - type: 'GET', - url: '<%= ApplicationController.root_context -%>/comparison/versions?resource=' - + e.val + '&sids=' - + $j('#sids').val(), - success: function(data){ - $j('#new_version').html(data); - $j('#new_version').select2({placeholder: '<%= message('comparison.select_version') -%>'}); - $j('#version_div').show(); - $j('#new_version').select2("focus"); - } - }); + type:'GET', + url:'<%= ApplicationController.root_context -%>/comparison/versions?resource=' + + e.val + '&sids=' + + $j('#sids').val(), + success:function (data) { + $j('#new_version').html(data); + $j('#new_version').select2({placeholder:'<%= message('comparison.select_version') -%>'}); + $j('#version_div').show(); + $j('#new_version').select2("focus"); + } + }); } }); $j('#new_resource').select2("focus"); @@ -108,8 +163,8 @@ <select id="new_version"> </select> <script> - $j('#new_version').on("change", function(e) { - if (e.val!=null) { + $j('#new_version').on("change", function (e) { + if (e.val != null) { var currentSnapshotIds = $j('#sids').val(); if (currentSnapshotIds.length > 0) { currentSnapshotIds += ','; @@ -120,14 +175,14 @@ } }); </script> - </span> + </span> </th> - </thead> - - <tbody> - <% - last_index = @metrics.size-1 - @metrics.each_with_index do |m, index| + </thead> + + <tbody> + <% + last_index = @metrics.size-1 + @metrics.each_with_index do |m, index| %> <tr class="<%= cycle 'even', 'odd' -%> move-actions"> <td> @@ -142,68 +197,17 @@ <a href="#" onclick="removeFromList(<%= index -%>, $j('#metrics'))"><img src="<%= ApplicationController.root_context -%>/images/controls/cross.png" title="<%= message('comparison.remove_metric') -%>"/></a> </div> </td> - + <% @snapshots.each do |s| %> <td style="text-align: center"> <%= format_measure s.measure(m) -%> </td> <% end %> - <td></td> </tr> - <% end %> - </tbody> - - </table> - - <form> + <% end %> + </tbody> + </table> + </form> + </div> </div> - -<script> - function submitForm() { - $j('#compare-form').submit(); - } - - function moveLeft(index) { - sids = $j('#sids').val().split(','); - idToLeft = sids[index]; - idToRight = sids[index-1]; - sids.splice(index-1, 2, [idToLeft, idToRight]); - $j('#sids').val(sids.join(',')); - submitForm(); - } - - function moveRight(index) { - sids = $j('#sids').val().split(','); - idToRight = sids[index]; - idToLeft = sids[index+1]; - sids.splice(index, 2, [idToLeft, idToRight]); - $j('#sids').val(sids.join(',')); - submitForm(); - } - - function moveUp(index) { - metrics = $j('#metrics').val().split(','); - idToUp = metrics[index]; - idToBottom = metrics[index-1]; - metrics.splice(index-1, 2, [idToUp, idToBottom]); - $j('#metrics').val(metrics.join(',')); - submitForm(); - } - - function moveDown(index) { - metrics = $j('#metrics').val().split(','); - idToBottom = metrics[index]; - idToUp = metrics[index+1]; - metrics.splice(index, 2, [idToUp, idToBottom]); - $j('#metrics').val(metrics.join(',')); - submitForm(); - } - - function removeFromList(index, inputField) { - value = inputField.val().split(','); - value.splice(index, 1); - inputField.val(value.join(',')); - submitForm(); - } -</script> diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/dependencies/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/dependencies/index.html.erb index 631e84f3563..0b310942b36 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/dependencies/index.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/dependencies/index.html.erb @@ -1,3 +1,4 @@ +<% content_for :style do %> <style> .drilldown_col { float: left; @@ -15,14 +16,16 @@ margin-right: 17px; // scrollbar width padding: 5px; } .drilldown_col div.col table { - + } .drilldown_col div.col td { padding: 3px 7px; min-width: 15em; - white-space: nowrap; + white-space: nowrap; } </style> +<% end %> +<div id="content"> <form action="<%= ApplicationController.root_context -%>/dependencies/index" id="search_form"> <input type="text" name="search" value="<%= params[:search] -%>" id="search_input"> </input> <input type="submit" value="<%= message('dependencies.search_library') -%>" id="search_submit"/><br/> @@ -98,4 +101,5 @@ padding: 5px; $$('#artifacts_col tr.selected').each(function(item) {item.scrollIntoView(true);}); $$('#versions_col tr.selected').each(function(item) {item.scrollIntoView(true);}); $$('#results_col tr.selected').each(function(item) {item.scrollIntoView(true);}); -</script>
\ No newline at end of file +</script> +</div>
\ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_user_panel.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_user_panel.html.erb index c4c2635f0c6..e1727eb5a77 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_user_panel.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_user_panel.html.erb @@ -1,9 +1,7 @@ <script> if (supports_html5_storage()) { - var sonarRecentHistory = new Sonar.RecentHistory('<%= ApplicationController.root_context -%>') - .addTranslation('clear', '<%= message('layout.user_panel.recent_history.clear') -%>'); + var sonarRecentHistory = new Sonar.RecentHistory(baseUrl); } - var shouldUpdateRecentHistory = true; </script> @@ -24,15 +22,15 @@ – <a href="<%= ApplicationController.root_context -%>/filters/manage" class="link-action"><%= message('default_filters.page') -%></a> – - <a href="<%= ApplicationController.root_context -%>/sessions/logout" class="link-action" onclick="if (sonarRecentHistory) { sonarRecentHistory.clear(); };"><%= message('layout.logout') -%></a> + <a href="<%= ApplicationController.root_context -%>/sessions/logout" class="link-action" onclick="if (sonarRecentHistory) { sonarRecentHistory.clear(); }"><%= message('layout.logout') -%></a> <% else %> <b><%= message('layout.user_panel.anonymous_user') -%></b> <% end %> </div> - <div id="sonar-recent-history" style="display: none"> + <div id="recent-history" style="display: none"> <b><%= message('layout.user_panel.recent_history.title') -%></b> - <ul id="sonar-recent-history-list"> + <ul id="recent-history-list"> </ul> </div> </div> @@ -41,10 +39,10 @@ <script> if (sonarRecentHistory == null) { - $j('#sonar-recent-history').detach(); + $j('#recent-history').detach(); } else { sonarRecentHistory.add('<%= @resource ? @resource.key : "" -%>', '<%= @resource ? @resource.name(true) : "" -%>', - '<%= @resource ? Java::OrgSonarServerUi::JRubyFacade.getInstance().getResourceType(@resource.qualifier).getIconPath() : "" -%>'); + '<%= @resource ? Api::Utils.java_facade.getResourceType(@resource.qualifier).getIconPath() : "" -%>'); } </script>
\ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/measures/_display_list.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/measures/_display_list.html.erb index 31f57645f72..54128af8d86 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/measures/_display_list.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/measures/_display_list.html.erb @@ -144,9 +144,9 @@ <td></td> <% end %> <% @filter.display.columns.each_with_index do |column, index| %> - <td class="<%= column.align -%>" index="<%= index -%>"> + <td class="nowrap <%= column.align -%>" index="<%= index -%>"> <a href="javascript:leftCol(<%= index -%>)" title="<%= message('move_left') -%>"><%= image_tag("controls/resultset_previous.png") -%></a> - <a href="javascript:deleteCol(<%= index -%>)" title="<%= message('delete_column') -%>"><%= image_tag("bin_closed.png") -%></a> + <a href="javascript:deleteCol(<%= index -%>)" title="<%= message('delete_column') -%>"><%= image_tag("cross-gray.png") -%></a> <a href="javascript:rightCol(<%= index -%>)" title="<%= message('move_right') -%>"><%= image_tag("controls/resultset_next.png") -%></a> </td> <% end %> diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/measures/_sidebar.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/measures/_sidebar.html.erb new file mode 100644 index 00000000000..2d8b5a07a54 --- /dev/null +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/measures/_sidebar.html.erb @@ -0,0 +1,172 @@ +<% + hidden_condition_indexes = [] + for i in 1..3 do + unless @filter.criteria("c#{i}_metric") && @filter.criteria("c#{i}_val") + hidden_condition_indexes << i + end + end +%> +<% content_for :script do %> + <script> + function submitSearch() { + // remove empty parameters from URL + var form = $j("#search-form"); + form.find(':input[value=""]').attr('name', ''); + form.submit(); + return false; + } + function removeUrlAttr(url, attribute_key) { + var regexp = new RegExp("&?" + attribute_key + "=([^&]$|[^&]*)", "g"); + return url.replace(regexp, ''); + } + function reloadParameters(params) { + var url = decodeURI(window.location.href); + $j.each(params, function (key, value) { + url = removeUrlAttr(url, key); + url += '&' + key + '=' + value; + }); + window.location = url; + } + var hiddenConditionIndexes = [<%= hidden_condition_indexes.join(',') -%>]; + $j(document).ready(function () { + $j('#select-lang').select2({allowClear:true, width:'100%', placeholder:'Languages'}); + $j('#select-qualifiers').select2({allowClear:true, width:'100%', placeholder:'Resources'}); + $j('#more-criteria') + .select2({allowClear:true, width:'100%', placeholder:'+ More Criteria'}) + .on("change", function (e) { + $j("#criteria-" + e.val).insertBefore($j("#more-td")).show(); + if (e.val == 'lang') { + $j("#select-" + e.val).select2("enable"); + $j("#select-" + e.val).select2("focus"); + } + if (e.val == 'metric') { + if (hiddenConditionIndexes.length > 0) { + var index = hiddenConditionIndexes.pop(); + $j("#criteria-metric-" + index).insertBefore($j("#more-td")).show(); + $j("#c" + index + "_metric").select2("focus"); + if (hiddenConditionIndexes.length == 0) { + $j("#more-criteria option[value='metric']").remove(); + } + } + } else { + $j("#more-criteria option[value='" + e.val + "']").remove(); + } + $j("#more-criteria").select2("val", ""); + }); + }); + </script> +<% end %> +<ul class="sidebar gray-sidebar"> + <% if logged_in? %> + <li class="sidebar-title">Favourite Filters</li> + <% current_user.favourited_measure_filters.each do |filter| %> + <li <%= "class='active'" if filter.id==@filter.id -%>> + <a href="<%= ApplicationController.root_context -%>/measures/filter/<%= filter.id -%>"><%= h filter.name -%></a> + </li> + <% end %> + <li><a href="<%= ApplicationController.root_context -%>/measures/manage" class="link-action"><%= message('manage') %></a></li> + <li class="spacer"></li> + <% end %> + + <form id="search-form" method="GET" action="<%= ApplicationController.root_context -%>/measures/search"> + <% if @filter.id %> + <input type="hidden" name="id" value="<%= @filter.id -%>"> + <% end %> + <% + if @filter.display + @filter.display.url_params.each do |k_v_array| + if k_v_array[1].is_a?(String) + %> + <%= hidden_field_tag k_v_array[0], k_v_array[1] -%> + <% else + k_v_array[1].each do |string_val| + %> + <%= hidden_field_tag "#{k_v_array[0]}[]", string_val -%> + <% end + end + end + end + %> + <li class="sidebar-title"> + <%= @filter.name.present? ? h(@filter.name) : 'New Search' -%> + </li> + <li> + <%= resource_select_tag 'baseId', :resource_type_property => 'supportsGlobalDashboards', :width => '100%', :selected_resource => @filter.base_resource, :placeholder => 'Path' -%> + </li> + <li> + <% + 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(qualifiers, @filter.criteria['qualifiers']||''), :multiple => true, :id => 'select-qualifiers' -%> + </li> + <li id="criteria-lang" <%= "style='display:none'" unless @filter.criteria('languages') -%>> + <% languages = [['', '']].concat(Api::Utils.languages.map { |lang| [lang.name, lang.key] }) %> + <%= select_tag 'languages[]', options_for_select(languages, @filter.criteria['languages']), :multiple => true, :id => 'select-lang' -%> + </li> + <li id="criteria-name" <%= "style='display:none'" unless @filter.criteria('nameSearch') -%>> + <%= message('measure_filter.name_contains') -%>:<br> + <input type="text" name="nameSearch" value="<%= h @filter.criteria['nameSearch'] -%>"> + </li> + <li id="criteria-key" <%= "style='display:none'" unless @filter.criteria('keyRegexp') -%>> + <%= message('measure_filter.key_like') -%>:<br> + <input type="text" name="keyRegexp" value="<%= h @filter.criteria['keyRegexp'] -%>"> + </li> + <li id="criteria-fav" <%= "style='display:none'" unless @filter.criteria('onFavourites') -%>> + <%= message 'measure_filter.only_favourites' %>:<br> + <%= check_box_tag 'onFavourites', 'true', @filter.criteria['onFavourites']=='true' -%> + </li> + + <% condition_metrics = Metric.all.select { |m| m.numeric? } %> + <% for i in 1..3 %> + <li id="criteria-metric-<%= i -%>" style="<%= "display: none" if hidden_condition_indexes.include?(i) -%>"> + <%= metric_select_tag "c#{i}_metric", condition_metrics, :allow_empty => true, :selected_key => @filter.criteria("c#{i}_metric"), :width => '100%', :placeholder => 'Metric' -%> + <%= select_tag "c#{i}_period", options_for_select([['Value', ''], ['Period 1', '1'], ['Period 2', '2'], ['Period 3', '3']], @filter.criteria("c#{i}_period")) -%> + <br> + <%= select_tag "c#{i}_op", options_for_select([['=', 'eq'], ['<', 'lt'], ['<=', 'lte'], ['>', 'gt'], ['>=', 'gte']], @filter.criteria("c#{i}_op")) -%> + <input type="text" size="5" name="c<%= i -%>_val" value="<%= h @filter.criteria("c#{i}_val") -%>"> + </li> + <% end %> + <li id="criteria-date" <%= "style='display:none'" unless @filter.criteria('fromDate') || @filter.criteria('toDate') -%>> + From date: + <input type="text" name="fromDate" value="<%= @filter.criteria['fromDate'] -%>" size="10" maxlength="10"> + <br> + To date: + <input type="text" name="toDate" value="<%= @filter.criteria['toDate'] -%>" size="10" maxlength="10"><br> + <span class="note">year-month-day (2012-01-31)</span> + </li> + <li id="criteria-age" <%= "style='display:none'" unless @filter.criteria('ageMinDays') || @filter.criteria('ageMaxDays') -%>> + More than + <input type="text" name="ageMinDays" value="<%= @filter.criteria['ageMinDays'] -%>" size="3"> days ago + <br>Within the last + <input type="text" name="ageMaxDays" value="<%= @filter.criteria['ageMaxDays'] -%>" size="3"> days + </li> + <li id="more-td"> + <select id="more-criteria"> + <option value=""></option> + <option value="age">Age</option> + <option value="date">Date</option> + <option value="fav">Favourites Only</option> + <option value="key">Key</option> + <option value="lang">Language</option> + <option value="metric">Metric</option> + <option value="name">Name</option> + </select> + </li> + <li> + <input type="button" name="search" value="<%= message('search_verb') -%>" onclick="submitSearch()"> + </li> + <li> + <a href="<%= ApplicationController.root_context -%>/measures" class="link-action">New search</a> + <% if logged_in? %> + <% if @filter.id==nil || @filter.user_id==current_user.id %> + - <a id="save" href="<%= url_for params.merge({:action => 'save_form', :id => @filter.id}) -%>" class="link-action open-modal"><%= message('save') -%></a> + <% end %> + <% if @filter.id %> + - <a id="copy" href="<%= url_for params.merge({:action => 'copy_form', :id => @filter.id}) -%>" class="link-action open-modal"><%= message('copy') -%></a> + <% end %> + <% end %> + </li> + </form> +</ul>
\ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/measures/manage.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/measures/manage.html.erb index f3f23198291..d54bf068d18 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/measures/manage.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/measures/manage.html.erb @@ -22,100 +22,105 @@ }); </script> <% end %> - -<h2>My Filters</h2> -<table class="data marginbottom10" id="my-filters"> - <thead> - <tr> - <th class="thin"></th> - <th><%= message('name') -%></th> - <th><%= message('measure_filter.sharing') -%></th> - <th class="right"><%= message('operations') -%></th> - </tr> - </thead> - <tbody> - <% if current_user.measure_filters.empty? %> - <tr class="even"> - <td colspan="4"><%= message('filters.no_filters') -%></td> - </tr> - <% else %> - <% current_user.measure_filters.each do |filter| %> - <tr id="my-<%= filter.name.parameterize -%>" class="<%= cycle('even', 'odd', :name => 'my-filters') -%>"> - <td> - <%= measure_filter_star(filter, @fav_filter_ids.include?(filter.id)) -%> - </td> - <td> - <%= link_to h(filter.name), :action => 'filter', :id => filter.id -%> - <% if filter.description %> - <div><%= h filter.description -%></div> - <% end %> - </td> - <td> - <% if filter.shared %> - Shared with all users - <% else %> - Private +<div> + <div class="page-split-left"> + <%= render :partial => 'measures/sidebar' -%> + </div> + <div class="page-split-right"> + <div id="content"> + <h2>My Filters</h2> + <table class="data marginbottom10" id="my-filters"> + <thead> + <tr> + <th class="thin"></th> + <th><%= message('name') -%></th> + <th><%= message('measure_filter.sharing') -%></th> + <th class="right"><%= message('operations') -%></th> + </tr> + </thead> + <tbody> + <% if current_user.measure_filters.empty? %> + <tr class="even"> + <td colspan="4"><%= message('filters.no_filters') -%></td> + </tr> + <% else %> + <% current_user.measure_filters.each do |filter| %> + <tr id="my-<%= filter.name.parameterize -%>" class="<%= cycle('even', 'odd', :name => 'my-filters') -%>"> + <td> + <%= measure_filter_star(filter, @fav_filter_ids.include?(filter.id)) -%> + </td> + <td> + <%= link_to h(filter.name), :action => 'filter', :id => filter.id -%> + <% if filter.description %> + <div><%= h filter.description -%></div> + <% end %> + </td> + <td> + <% if filter.shared %> + Shared with all users + <% else %> + Private + <% end %> + </td> + <td class="thin nowrap right"> + <a id="edit_<%= filter.name.parameterize -%>" href="<%= ApplicationController.root_context -%>/measures/edit_form/<%= filter.id -%>" class="link-action open-modal"><%= message('edit') -%></a> + + <a id="copy-<%= filter.name.parameterize -%>" href="<%= ApplicationController.root_context -%>/measures/copy_form/<%= filter.id -%>" class="link-action open-modal"><%= message('copy') -%></a> + + <%= link_to_action message('delete'), "#{ApplicationController.root_context}/measures/delete/#{filter.id}", + :class => 'link-action link-red', + :id => "delete_#{filter.name.parameterize}", + :confirm_button => message('delete'), + :confirm_title => 'measure_filter.delete_confirm_title', + :confirm_msg => 'measure_filter.are_you_sure_want_delete_filter_x', + :confirm_msg_params => [filter.name] -%> + </td> + </tr> <% end %> - </td> - <td class="thin nowrap right"> - <a id="edit_<%= filter.name.parameterize -%>" href="<%= ApplicationController.root_context -%>/measures/edit_form/<%= filter.id -%>" class="link-action open-modal"><%= message('edit') -%></a> - - <a id="copy-<%= filter.name.parameterize -%>" href="<%= ApplicationController.root_context -%>/measures/copy_form/<%= filter.id -%>" class="link-action open-modal"><%= message('copy') -%></a> - - <%= link_to_action message('delete'), "#{ApplicationController.root_context}/measures/delete/#{filter.id}", - :class => 'link-action link-red', - :id => "delete_#{filter.name.parameterize}", - :confirm_button => message('delete'), - :confirm_title => 'measure_filter.delete_confirm_title', - :confirm_msg => 'measure_filter.are_you_sure_want_delete_filter_x', - :confirm_msg_params => [filter.name] -%> - </td> - </tr> - <% end %> - <% end %> - </tbody> -</table> + <% end %> + </tbody> + </table> -<br/> + <br/> -<h2>Shared Filters</h2> -<table class="data" id="shared-filters"> - <thead> - <tr> - <th class="thin"></th> - <th><%= message('name') -%></th> - <th><%= message('shared_by') -%></th> - <th class="right"><%= message('operations') -%></th> - </tr> - </thead> - <tbody> - <% if @shared_filters.empty? %> - <tr class="even"> - <td colspan="4"><%= message('filters.no_filters') -%></td> - </tr> - <% else %> - <% @shared_filters.each do |filter| %> - <tr id="shared-<%= filter.name.parameterize -%>" class="<%= cycle('even', 'odd', :name => 'shared-filters') -%>"> - <td> - <%= measure_filter_star(filter, @fav_filter_ids.include?(filter.id)) -%> - </td> - <td> - <%= link_to h(filter.name), :action => 'filter', :id => filter.id -%> - <% if filter.description %> - <div><%= h filter.description -%></div> + <h2>Shared Filters</h2> + <table class="data" id="shared-filters"> + <thead> + <tr> + <th class="thin"></th> + <th><%= message('name') -%></th> + <th><%= message('shared_by') -%></th> + <th class="right"><%= message('operations') -%></th> + </tr> + </thead> + <tbody> + <% if @shared_filters.empty? %> + <tr class="even"> + <td colspan="4"><%= message('filters.no_filters') -%></td> + </tr> + <% else %> + <% @shared_filters.each do |filter| %> + <tr id="shared-<%= filter.name.parameterize -%>" class="<%= cycle('even', 'odd', :name => 'shared-filters') -%>"> + <td> + <%= measure_filter_star(filter, @fav_filter_ids.include?(filter.id)) -%> + </td> + <td> + <%= link_to h(filter.name), :action => 'filter', :id => filter.id -%> + <% if filter.description %> + <div><%= h filter.description -%></div> + <% end %> + </td> + <td> + <%= filter.user ? h(filter.user.name) : '-' -%> + </td> + <td class="thin nowrap right"> + <a id="copy-<%= filter.name.parameterize -%>" href="<%= ApplicationController.root_context -%>/measures/copy_form/<%= filter.id -%>" class="link-action open-modal"><%= message('copy') -%></a> + </td> + </tr> <% end %> - </td> - <td> - <%= filter.user ? h(filter.user.name) : '-' -%> - </td> - <td class="thin nowrap right"> - <a id="copy-<%= filter.name.parameterize -%>" href="<%= ApplicationController.root_context -%>/measures/copy_form/<%= filter.id -%>" class="link-action open-modal"><%= message('copy') -%></a> - </td> - </tr> - - <% end %> - <% end %> - </tbody> -</table> - - + <% end %> + </tbody> + </table> + </div> + </div> +</div>
\ No newline at end of file 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 f1052353d1e..531e1594cd0 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,230 +1,14 @@ -<% content_for :style do %> - <style type="text/css"> - #search-form [type="text"].large-input { - width: 180px; - } - - #search-form select.large-input { - width: 100%; - box-sizing: border-box; - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - } - - #search-form select option { - padding: 1px 10px 1px 4px; - } - </style> -<% end %> -<% - hidden_condition_indexes = [] - for i in 1..3 do - unless @filter.criteria("c#{i}_metric") && @filter.criteria("c#{i}_val") - hidden_condition_indexes << i - end - end -%> -<% content_for :script do %> - <script> - function submitSearch() { - // remove empty parameters from URL - var form = $j("#search-form"); - form.find(':input[value=""]').attr('name', ''); - form.submit(); - return false; - } - function removeUrlAttr(url, attribute_key) { - var regexp = new RegExp("&?" + attribute_key + "=([^&]$|[^&]*)", "g"); - return url.replace(regexp, ''); - } - function reloadParameters(params) { - var url = decodeURI(window.location.href); - $j.each(params, function (key, value) { - url = removeUrlAttr(url, key); - url += '&' + key + '=' + value; - }); - window.location = url; - } - var hiddenConditionIndexes = [<%= hidden_condition_indexes.join(',') -%>]; - $j(document).ready(function () { - $j('#select-lang').select2({allowClear:true, width:'100%', placeholder:'Languages'}); - $j('#select-qualifiers').select2({allowClear:true, width:'100%', placeholder:'Resources'}); - $j('#more-criteria') - .select2({allowClear:true, width:'100%', placeholder:'+ More Criteria'}) - .on("change", function (e) { - $j("#criteria-" + e.val).insertBefore($j("#more-td")).show(); - if (e.val == 'lang') { - $j("#select-" + e.val).select2("enable"); - $j("#select-" + e.val).select2("focus"); - } else if (e.val == 'metric') { - if (hiddenConditionIndexes.length > 0) { - var index = hiddenConditionIndexes.pop(); - $j("#criteria-metric-" + index).insertBefore($j("#more-td")).show(); - $j("#c" + index + "_metric").select2("focus"); - if (hiddenConditionIndexes.length == 0) { - $j("#more-criteria option[value='metric']").remove(); - } - } - } else { - $j("#more-criteria option[value='" + e.val + "']").remove(); - } - $j("#more-criteria").select2("val", ""); - }); - }); - </script> -<% end %> <div> <div class="page-split-left"> - <% if logged_in? %> - <ul id="filters"> - <% current_user.favourited_measure_filters.each do |filter| %> - <li> - <a href="<%= ApplicationController.root_context -%>/measures/filter/<%= filter.id -%>"><%= h filter.name -%></a> - </li> - <% end %> - </ul> - <a href="<%= ApplicationController.root_context -%>/measures/manage" class="link-action"><%= message('manage') %></a> - <hr> - <% end %> - - <form id="search-form" method="GET" action="<%= ApplicationController.root_context -%>/measures/search"> - <% if @filter.id %> - <input type="hidden" name="id" value="<%= @filter.id -%>"> - <% end %> - <% - if @filter.display - @filter.display.url_params.each do |k_v_array| - if k_v_array[1].is_a?(String) - %> - <%= hidden_field_tag k_v_array[0], k_v_array[1] -%> - <% else - k_v_array[1].each do |string_val| - %> - <%= hidden_field_tag "#{k_v_array[0]}[]", string_val -%> - <% end - end - end - end - %> - <table class="spaced width100"> - <tbody> - <tr> - <td> - <%= resource_select_tag 'baseId', :resource_type_property => 'supportsGlobalDashboards', :width => '100%', :selected_resource => @filter.base_resource, :placeholder => 'Path' -%> - </td> - </tr> - <tr> - <td> - <% - 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(qualifiers, @filter.criteria['qualifiers']||''), :multiple => true, :id => 'select-qualifiers' -%> - </td> - </tr> - <tr id="criteria-lang" <%= "style='display:none'" unless @filter.criteria('languages') -%>> - <td> - <% languages = [['', '']].concat(Api::Utils.languages.map { |lang| [lang.name, lang.key] }) %> - <%= select_tag 'languages[]', options_for_select(languages, @filter.criteria['languages']), :multiple => true, :id => 'select-lang', 'data-placeholder' => 'Languages' -%> - </td> - </tr> - <tr id="criteria-name" <%= "style='display:none'" unless @filter.criteria('nameSearch') -%>> - <td> - <%= message('measure_filter.name_contains') -%>:<br> - <input type="text" name="nameSearch" value="<%= h @filter.criteria['nameSearch'] -%>"></td> - </tr> - <tr id="criteria-key" <%= "style='display:none'" unless @filter.criteria('keyRegexp') -%>> - <td> - <%= message('measure_filter.key_like') -%>:<br> - <input type="text" name="keyRegexp" value="<%= h @filter.criteria['keyRegexp'] -%>" class="large-input"></td> - </tr> - <tr id="criteria-fav" <%= "style='display:none'" unless @filter.criteria('onFavourites') -%>> - <td> - <%= message 'measure_filter.only_favourites' %>:<br> - <%= check_box_tag 'onFavourites', 'true', @filter.criteria['onFavourites']=='true' -%> - </td> - </tr> - - <% condition_metrics = Metric.all.select { |m| m.numeric? } %> - <% for i in 1..3 %> - <tr id="criteria-metric-<%= i -%>" <%= "style='display: none'" if hidden_condition_indexes.include?(i) -%>> - <td style="padding:10px 5px"> - <%= metric_select_tag "c#{i}_metric", condition_metrics, :allow_empty => true, :selected_key => @filter.criteria("c#{i}_metric"), :width => '100%', :placeholder => 'Metric' -%> - <%= select_tag "c#{i}_period", options_for_select([['Value', ''], ['Period 1', '1'], ['Period 2', '2'], ['Period 3', '3']], @filter.criteria("c#{i}_period")) -%> - <br> - <%= select_tag "c#{i}_op", options_for_select([['=', 'eq'], ['<', 'lt'], ['<=', 'lte'], ['>', 'gt'], ['>=', 'gte']], @filter.criteria("c#{i}_op")) -%> - <input type="text" size="5" name="c<%= i -%>_val" value="<%= h @filter.criteria("c#{i}_val") -%>"> - </td> - </tr> - <% end %> - <tr id="criteria-date" <%= "style='display:none'" unless @filter.criteria('fromDate') || @filter.criteria('toDate') -%>> - <td> - From date: - <input type="text" name="fromDate" value="<%= @filter.criteria['fromDate'] -%>" size="10" maxlength="10"> - <br> - To date: - <input type="text" name="toDate" value="<%= @filter.criteria['toDate'] -%>" size="10" maxlength="10"><br> - <span class="note">year-month-day (2012-01-31)</span> - </td> - </tr> - <tr id="criteria-age" <%= "style='display:none'" unless @filter.criteria('ageMinDays') || @filter.criteria('ageMaxDays') -%>> - <td> - More than - <input type="text" name="ageMinDays" value="<%= @filter.criteria['ageMinDays'] -%>" size="3"> days ago - <br>Within the last - <input type="text" name="ageMaxDays" value="<%= @filter.criteria['ageMaxDays'] -%>" size="3"> days - </td> - </tr> - <tr id="more-td"> - <td> - <select id="more-criteria"> - <option value=""></option> - <option value="age">Age</option> - <option value="date">Date</option> - <option value="fav">Favourites Only</option> - <option value="key">Key</option> - <option value="lang">Language</option> - <option value="metric">Metric</option> - <option value="name">Name</option> - </select> - </td> - </tr> - - <tr> - <td> - <input type="button" name="search" value="<%= message('search_verb') -%>" onclick="submitSearch()"> - </td> - </tr> - <tr> - <td> - <a href="<%= ApplicationController.root_context -%>/measures" class="link-action">New search</a> - <% if logged_in? %> - <% if @filter.id==nil || @filter.user_id==current_user.id %> - - <a id="save" href="<%= url_for params.merge({:action => 'save_form', :id => @filter.id}) -%>" class="link-action open-modal"><%= message('save') -%></a> - <% end %> - <% if @filter.id %> - - <a id="copy" href="<%= url_for params.merge({:action => 'copy_form', :id => @filter.id}) -%>" class="link-action open-modal"><%= message('copy') -%></a> - <% end %> - <% end %> - </td> - </tr> - </tbody> - </table> - </form> + <%= render :partial => 'measures/sidebar' -%> </div> <% if @filter.results && @filter.display %> <div class="page-split-right"> <div id="content"> - <% if @filter.name %> - <p> - <span class="h3"><%= h @filter.name -%></span> - <% if @filter.description.present? %> - - <span><%= h @filter.description -%></span> - <% end %> - </p> + <% if @filter.description.present? %> + <p><%= h @filter.description -%></p> <% end %> <% 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 c581f4f1e5c..1d824c35d5c 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 @@ -1,3 +1,4 @@ +<div id="content"> <div class="line-block marginbottom10"> <ul style="float: right" class="operations"> <li> @@ -109,4 +110,5 @@ </tbody> </table> <br/><br/> -<% end %>
\ No newline at end of file +<% end %> +</div>
\ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/reviews/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/reviews/index.html.erb index f618f2a8a78..9a7831cd11c 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/reviews/index.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/reviews/index.html.erb @@ -18,102 +18,82 @@ <% end %> <div id="reviews-search"> - <div class="page-split-left"> - <form id="search-form" method="GET" action="<%= ApplicationController.root_context -%>/reviews/index"> - <table class="width100"> - <tbody> - <tr> - <td class="width100"> - <%= message('identifier_abbreviated') -%>: - <br/> - <%= text_field_tag "review_id", @id, :size => 10, :onkeyup => "reviewIdFieldModified(this)" -%> - </td> - </tr> - <tr> - <td class="width100"> - <%= message('status') -%>: - <br/> - <select size="6" name="statuses[]" multiple="multiple" id="statuses" class="withIcons large-input"> - <option <%= 'selected' if @statuses.include?('') -%> value=""><%= message('any') -%></option> - <option value="<%= Review::STATUS_OPEN -%>" class="status_open" <%= 'selected' if @statuses.include?(Review::STATUS_OPEN) -%>><%= message('reviews.status.OPEN') -%></option> - <option value="<%= Review::STATUS_REOPENED -%>" class="status_reopened" <%= 'selected' if @statuses.include?(Review::STATUS_REOPENED) -%>><%= message('reviews.status.REOPENED') -%></option> - <option value="<%= Review::STATUS_RESOLVED -%>" class="status_resolved" <%= 'selected' if @statuses.include?(Review::STATUS_RESOLVED) -%>><%= message('reviews.status.RESOLVED') -%></option> - <option value="<%= Review::STATUS_CLOSED -%>" class="status_closed" <%= 'selected' if @statuses.include?(Review::STATUS_CLOSED) -%>><%= message('reviews.status.CLOSED') -%></option> - </select> - </td> - </tr> - <tr> - <td class="width100"> - <%= message('severity') -%>: - <br/> - <select size="6" name="severities[]" multiple="multiple" id="severities" class="withIcons large-input"> - <option <%= 'selected' if @severities.include?('') -%> value=""><%= message('any') -%></option> - <option value="<%= Severity::BLOCKER -%>" class="sev_BLOCKER" <%= 'selected' if @severities.include?(Severity::BLOCKER) -%>><%= message('blocker') -%></option> - <option value="<%= Severity::CRITICAL -%>" class="sev_CRITICAL" <%= 'selected' if @severities.include?(Severity::CRITICAL) -%>><%= message('critical') -%></option> - <option value="<%= Severity::MAJOR -%>" class="sev_MAJOR" <%= 'selected' if @severities.include?(Severity::MAJOR) -%>><%= message('major') -%></option> - <option value="<%= Severity::MINOR -%>" class="sev_MINOR" <%= 'selected' if @severities.include?(Severity::MINOR) -%>><%= message('minor') -%></option> - <option value="<%= Severity::INFO -%>" class="sev_INFO" <%= 'selected' if @severities.include?(Severity::INFO) -%>><%= message('info') -%></option> - </select> - </td> - </tr> - <tr> - <td class="width100"> - <%= message('project') -%>: - <br/> - <select size="6" name="projects[]" multiple="multiple" id="projects" class="large-input"> - <option <%= 'selected' if @projects.include?('') -%> value=""><%= message('any') -%></option> - <% projects_for_select.each do |project| - name=project.name(true) - %> - <option value="<%= project.id -%>" title="<%= h(name) -%>" <%= 'selected' if @projects.include?(project.id.to_s) -%>><%= h(truncate(name, :length => 20)) -%></option> - <% end %> - </select> - </td> - </tr> - <tr> - <td class="width100"> - <%= message('created_by') -%>: - <br/> - <%= user_autocomplete_field "author_login", @author_login, {:class => "large-input"} -%> - </td> - </tr> - <tr> - <td class="width100"> - <%= message('assigned_to') -%>: - <br/> - <%= user_autocomplete_field "assignee_login", @assignee_login, {:class => "large-input"} -%> - </td> - </tr> - <tr> - <td class="width100" style="padding-top: 5px;"> - <select name="false_positives" id="false_positives" onchange="if(this.value=='only' || this.value=='with') {$('assignee_login').value = ''; $('autocompleteText-assignee_login').value = ''; $('statuses').value = '';};"> - <option <%= 'selected' if @false_positives=='without' -%> value="without"><%= message('reviews.without_false_positives') -%></option> - <option <%= 'selected' if @false_positives=='only' -%> value="only"><%= message('reviews.only_false_positives') -%></option> - </select> - </td> - </tr> - <tr> - <td class="width100"> - <input type="hidden" name="sort" id="sort" value="<%= @sort -%>"/> - <input type="hidden" name="asc" id="asc" value="<%= @asc -%>"/> - <br/> - <%= submit_tag message('search_verb'), :id => 'submit_search' %> - </td> - </tr> - </tbody> - </table> - </form> + <ul class="sidebar gray-sidebar"> + <form id="search-form" method="GET" action="<%= ApplicationController.root_context -%>/reviews/index"> + <li> + <%= message('identifier_abbreviated') -%>: + <br/> + <%= text_field_tag "review_id", @id, :size => 10, :onkeyup => "reviewIdFieldModified(this)" -%> + </li> + <li> + <%= message('status') -%>: + <br/> + <select size="6" name="statuses[]" multiple="multiple" id="statuses" class="withIcons large-input"> + <option <%= 'selected' if @statuses.include?('') -%> value=""><%= message('any') -%></option> + <option value="<%= Review::STATUS_OPEN -%>" class="status_open" <%= 'selected' if @statuses.include?(Review::STATUS_OPEN) -%>><%= message('reviews.status.OPEN') -%></option> + <option value="<%= Review::STATUS_REOPENED -%>" class="status_reopened" <%= 'selected' if @statuses.include?(Review::STATUS_REOPENED) -%>><%= message('reviews.status.REOPENED') -%></option> + <option value="<%= Review::STATUS_RESOLVED -%>" class="status_resolved" <%= 'selected' if @statuses.include?(Review::STATUS_RESOLVED) -%>><%= message('reviews.status.RESOLVED') -%></option> + <option value="<%= Review::STATUS_CLOSED -%>" class="status_closed" <%= 'selected' if @statuses.include?(Review::STATUS_CLOSED) -%>><%= message('reviews.status.CLOSED') -%></option> + </select> + </li> + <li> + <%= message('severity') -%>: + <br/> + <select size="6" name="severities[]" multiple="multiple" id="severities" class="withIcons large-input"> + <option <%= 'selected' if @severities.include?('') -%> value=""><%= message('any') -%></option> + <option value="<%= Severity::BLOCKER -%>" class="sev_BLOCKER" <%= 'selected' if @severities.include?(Severity::BLOCKER) -%>><%= message('blocker') -%></option> + <option value="<%= Severity::CRITICAL -%>" class="sev_CRITICAL" <%= 'selected' if @severities.include?(Severity::CRITICAL) -%>><%= message('critical') -%></option> + <option value="<%= Severity::MAJOR -%>" class="sev_MAJOR" <%= 'selected' if @severities.include?(Severity::MAJOR) -%>><%= message('major') -%></option> + <option value="<%= Severity::MINOR -%>" class="sev_MINOR" <%= 'selected' if @severities.include?(Severity::MINOR) -%>><%= message('minor') -%></option> + <option value="<%= Severity::INFO -%>" class="sev_INFO" <%= 'selected' if @severities.include?(Severity::INFO) -%>><%= message('info') -%></option> + </select> + </li> + <li> + <%= message('project') -%>: + <br/> + <select size="6" name="projects[]" multiple="multiple" id="projects" class="large-input"> + <option <%= 'selected' if @projects.include?('') -%> value=""><%= message('any') -%></option> + <% projects_for_select.each do |project| + name=project.name(true) + %> + <option value="<%= project.id -%>" title="<%= h(name) -%>" <%= 'selected' if @projects.include?(project.id.to_s) -%>><%= h(truncate(name, :length => 20)) -%></option> + <% end %> + </select> + </li> + <li> + <%= message('created_by') -%>: + <br/> + <%= user_autocomplete_field "author_login", @author_login, {:class => "large-input"} -%> + </li> + <li> + <%= message('assigned_to') -%>: + <br/> + <%= user_autocomplete_field "assignee_login", @assignee_login, {:class => "large-input"} -%> + </li> + <li> + <select name="false_positives" id="false_positives" onchange="if(this.value=='only' || this.value=='with') {$('assignee_login').value = ''; $('autocompleteText-assignee_login').value = ''; $('statuses').value = '';};"> + <option <%= 'selected' if @false_positives=='without' -%> value="without"><%= message('reviews.without_false_positives') -%></option> + <option <%= 'selected' if @false_positives=='only' -%> value="only"><%= message('reviews.only_false_positives') -%></option> + </select> + </li> + <li> + <input type="hidden" name="sort" id="sort" value="<%= @sort -%>"/> + <input type="hidden" name="asc" id="asc" value="<%= @asc -%>"/> + <br/> + <%= submit_tag message('search_verb'), :id => 'submit_search' %> + </li> + </form> + </ul> </div> - - <div class="page-split-right width100"> - <% if @false_positives=='only' %> - <span class="falsePositive"><%= message('reviews.showing_false_positives_only') -%></span> - <% end %> - - <%= render :partial => "list" -%> + <div class="page-split-right"> + <div id="content"> + <% if @false_positives=='only' %> + <span class="falsePositive"><%= message('reviews.showing_false_positives_only') -%></span> + <% end %> + <%= render :partial => "list" -%> + </div> </div> - </div> <script> diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/rules_configuration/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/rules_configuration/index.html.erb index 0dd28270377..779f2bc486e 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/rules_configuration/index.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/rules_configuration/index.html.erb @@ -30,7 +30,7 @@ }); } </script> - +<div id="content"> <%= render :partial => 'profiles/tabs', :locals => {:selected_tab=>'Coding rules'} %> <% enable_modification = is_admin? %> @@ -132,3 +132,4 @@ $(span_id).replace(text_area); } </script> +</div>
\ No newline at end of file diff --git a/sonar-server/src/main/webapp/javascripts/recent-history.js b/sonar-server/src/main/webapp/javascripts/recent-history.js index 1bb4aed9c10..d7eabd53a37 100644 --- a/sonar-server/src/main/webapp/javascripts/recent-history.js +++ b/sonar-server/src/main/webapp/javascripts/recent-history.js @@ -2,11 +2,6 @@ window.Sonar = {}; Sonar.RecentHistory = function (applicationContext) { this.appContext = applicationContext; - this.translations = {}; - this.addTranslation = function (key, value) { - this.translations[key] = value; - return this; - }; }; Sonar.RecentHistory.prototype.getRecentHistory = function() { @@ -46,12 +41,12 @@ Sonar.RecentHistory.prototype.add = function (resourceKey, resourceName, iconPat }; Sonar.RecentHistory.prototype.populateRecentHistoryPanel = function () { - var historyLinksList = $j('#sonar-recent-history-list'); + var historyLinksList = $j('#recent-history-list'); historyLinksList.empty(); var recentHistory = this.getRecentHistory(); if (recentHistory.length == 0) { - $j("#sonar-recent-history").hide(); + $j("#recent-history").hide(); } else { recentHistory.forEach(function (resource) { historyLinksList.append('<li><img width="16" height="16" src="' @@ -65,6 +60,6 @@ Sonar.RecentHistory.prototype.populateRecentHistoryPanel = function () { + resource['name'] + '</a></li>'); }); - $j("#sonar-recent-history").show(); + $j("#recent-history").show(); } }; diff --git a/sonar-server/src/main/webapp/stylesheets/layout.css b/sonar-server/src/main/webapp/stylesheets/layout.css index 3b23ed5a9d0..3fd78010772 100644 --- a/sonar-server/src/main/webapp/stylesheets/layout.css +++ b/sonar-server/src/main/webapp/stylesheets/layout.css @@ -148,6 +148,10 @@ body, a { padding: 0 5px 0 0; } +#content { + padding: 10px; +} + #hd .dropdown-menu a { color: #000; } @@ -163,7 +167,7 @@ body, a { box-shadow: 10px 10px 20px rgba(0, 0, 0, 0.5); z-index: 999999; line-height: 18px; - color: #000; + color: #111; } #user-panel > div { @@ -174,25 +178,25 @@ body, a { color: #000; } -#sonar-recent-history { +#recent-history { border-top: 1px solid #ccc; } -#sonar-recent-history li { +#recent-history li { list-style-type: none !important; - padding: 2px 8px 2px 0px !important; + padding: 2px 8px 2px 0 !important; cursor: pointer !important; } -#sonar-recent-history li:hover { +#recent-history li:hover { background-color: #4b9fd5 !important; } -#sonar-recent-history li:hover a { +#recent-history li:hover a { color: #fff !important; } -#sonar-recent-history a { +#recent-history a { text-decoration: none !important; } @@ -266,6 +270,47 @@ body, a { color: #FEFEFE; } +ul.sidebar { + text-align: left; + line-height: 1.1em; + border-top: none; + padding: 10px 0; +} + +ul.sidebar li { + list-style-type: none; + padding: 3px 10px 3px 10px; +} + +ul.sidebar li a { + text-decoration: none; +} + +ul.sidebar li a:hover { + text-decoration: underline; +} + +ul.sidebar li.active { + background-color: #4b9fd5; +} + +ul.sidebar li.active a, ul.sidebar li.active a:hover { + color: #FFF; +} + +.sidebar-title { + text-transform: uppercase; + font-size: 93%; + font-weight: bold; +} + +ul.sidebar li.spacer { + border: 0 none; + height: 10px; + margin: 0; + padding: 0; +} + #logo { text-align: center; padding: 8px 0 0 0; @@ -294,26 +339,28 @@ body, a { } .page-split-left { - min-width: 180px; - width: 180px; + min-width: 200px; + width: 200px; margin: 0; display: table-cell; vertical-align: top; - background-color: #EFEFEF; - border: 1px solid #CCC; - color: #666; - line-height: 1.1em; border-top: none; border-left: none; - padding: 10px 5px; } .page-split-right { position: relative; - -moz-box-sizing: border-box; display: table-cell; margin: 0; vertical-align: top; width: 100%; - padding: 0 0 0 10px; -}
\ No newline at end of file + padding: 0; +} + +.gray-sidebar { + background-color: #EFEFEF; + border: 1px solid #CCC; + color: #666; + border-top: none; + border-left: none; +} diff --git a/sonar-server/src/main/webapp/stylesheets/style.css b/sonar-server/src/main/webapp/stylesheets/style.css index fec5df6f81f..e96f52f5e51 100644 --- a/sonar-server/src/main/webapp/stylesheets/style.css +++ b/sonar-server/src/main/webapp/stylesheets/style.css @@ -2088,7 +2088,7 @@ table.nowrap td, td.nowrap, th.nowrap { /* Used on links which are located inside a dense text place or in tables */ /* in order to rapidly identify them */ .link-action { - text-decoration: underline; + text-decoration: underline !important; color: #4183C4 !important; } |