Browse Source

SONAR-2589 Modification of web ruby templates to use bundles

- Add i18n to all filters page
- Modify the I18nManager to return the key if a translation has not
  been found (instead of throwing a SonarException)
tags/2.10
Fabrice Bellingard 13 years ago
parent
commit
dff9de8cb6
18 changed files with 187 additions and 149 deletions
  1. 11
    3
      plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/i18n/I18nManager.java
  2. 67
    10
      plugins/sonar-core-plugin/src/main/resources/org/sonar/i18n/core.properties
  3. 22
    15
      plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/i18n/I18nManagerTest.java
  4. 1
    1
      sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb
  5. 4
    4
      sonar-server/src/main/webapp/WEB-INF/app/helpers/filters_helper.rb
  6. 4
    38
      sonar-server/src/main/webapp/WEB-INF/app/models/filter_column.rb
  7. 9
    9
      sonar-server/src/main/webapp/WEB-INF/app/views/filters/_criterion.html.erb
  8. 17
    17
      sonar-server/src/main/webapp/WEB-INF/app/views/filters/_customize_list.html.erb
  9. 3
    3
      sonar-server/src/main/webapp/WEB-INF/app/views/filters/_customize_treemap.html.erb
  10. 7
    7
      sonar-server/src/main/webapp/WEB-INF/app/views/filters/_list.html.erb
  11. 3
    3
      sonar-server/src/main/webapp/WEB-INF/app/views/filters/_tabs.html.erb
  12. 1
    1
      sonar-server/src/main/webapp/WEB-INF/app/views/filters/_treemap.html.erb
  13. 16
    16
      sonar-server/src/main/webapp/WEB-INF/app/views/filters/manage.html.erb
  14. 4
    4
      sonar-server/src/main/webapp/WEB-INF/app/views/filters/new.html.erb
  15. 5
    5
      sonar-server/src/main/webapp/WEB-INF/app/views/filters/search_path.html.erb
  16. 2
    2
      sonar-server/src/main/webapp/WEB-INF/app/views/filters/treemap.html.erb
  17. 1
    1
      sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb
  18. 10
    10
      sonar-server/src/main/webapp/WEB-INF/lib/resourceable.rb

+ 11
- 3
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/i18n/I18nManager.java View File

@@ -153,7 +153,8 @@ public final class I18nManager implements I18n, ServerExtension, BatchExtension
String bundleBaseName = keys.get(key);
if (bundleBaseName == null) {
if (result == null) {
throw new MissingResourceException("UNKNOWN KEY : Key '" + key + "' not found in any bundle.", bundleBaseName, key);
throw new MissingResourceException("UNKNOWN KEY : Key '" + key
+ "' not found in any bundle, and no default value provided. The key is returned.", bundleBaseName, key);
}
LOG.warn("UNKNOWN KEY : Key '{}' not found in any bundle. Default value '{}' is returned.", key, defaultText);
unknownKeys.put(key, defaultText);
@@ -180,10 +181,17 @@ public final class I18nManager implements I18n, ServerExtension, BatchExtension
bundleBaseName, bundleClassLoader, defaultText });
}
}
} catch (MissingResourceException e) {
LOG.warn(e.getMessage());
if (result == null) {
// when no translation has been found, the key is returned
return key;
}
} catch (Exception e) {
LOG.error("Exception when retrieving I18n string.", e);
LOG.error("Exception when retrieving I18n string: ", e);
if (result == null) {
throw new SonarException("Exception when retrieving I18n string.", e);
// when no translation has been found, the key is returned
return key;
}
}


+ 67
- 10
plugins/sonar-core-plugin/src/main/resources/org/sonar/i18n/core.properties View File

@@ -16,55 +16,99 @@ view.size.methods_suffix=\ methods
view.size.accessors_suffix=\ accessors
view.size.paragraphs_suffix=\ paragraphs

general_columns.links=Links
general_columns.build_time=Build time
general_columns.language=Language
general_columns.version=Version
general_columns.date=Build date
general_columns.key=Key
general_columns.name=Name


#------------------------------------------------------------------------------
#
# GENERIC WORDS
# GENERIC WORDS, sorted alphabetically
#
#------------------------------------------------------------------------------

add_verb=Add
and=And
author=Author
ascending=Ascending
build_date=Build date
cancel=Cancel
change_verb=Change
class=Class
classes=Classes
color=Color
criteria=Criteria
date=Date
days=Days
delete=Delete
descending=Descending
directory=Directory
directories=Directories
display=Display
edit=Edit
file=File
files=Files
key=Key
language=Language
library=Library
links=Links
login=Login
max=Max
min=Min
name=Name
none=None
operations=Operations
order=Order
package=Package
packages=Packages
password=Password
path=Path
project=Project
projects=Projects
reset_verb=Reset
search_verb=Search
shared=Shared
view=View
views=Views
result=Result
select_verb=Select
size=Size
sub_project=Sub-project
sub_projects=Sub-projects
sub_view=Sub-view
sub_views=Sub-views
table=Table
treemap=Treemap
unfollow=Unfollow
unit_test=Unit test
unit_tests=Unit tests
value=Value
variarion=Variation
version=Version


#------------------------------------------------------------------------------
#
# GENERIC EXPRESSIONS
# GENERIC EXPRESSIONS, sorted alphabetically
#
#------------------------------------------------------------------------------

alerts_feed=Alerts feed
delta_since_previous_analysis=Δ since previous analysis
delta_over_x_days=Δ over {0} days
delta_since=Δ since {0}
delta_since_version=Δ since version {0}
equals=Equals
greater_or_equals=Greater or equals
greater_than=Greater than
less_or_equals=Less or equals
less_than=Less than
move_left=Move left
move_right=Move right
no_results=No results
page_size=Page size
remove_column=Remove this column
results_not_display_due_to_security=Due to security settings, some results are not being displayed.
save_and_close=Save & Close
save_and_preview=Save & Preview
select_a_metric=Select a metric
time_changes=Time changes


#------------------------------------------------------------------------------
@@ -144,6 +188,9 @@ sessions.log_in=Log in
#
#------------------------------------------------------------------------------

filters.add_filter=Add filter
filters.edit_filter=Edit filter
filters.manage_filters=Manage filters
filters.search_for=Search for
filters.advanced_search=Advanced search
filters.default_period=Default period
@@ -155,6 +202,16 @@ filters.resource_name_like=Resource name like
filters.do_you_want_to_delete=Do you want to delete this filter ?
filters.during_last=During last
filters.prior_to_last=Prior to last
filters.search_by_name=Search by name
filters.display_as=Display as
filters.add_column=Add column
filters.default_sorted_column=Default sorted column
filters.treemap_not_supported_for_period_selection=Treemap does not support yet the selection of a period.
filters.my_filters=My filters
filters.no_filters=No filters
filters.do_you_want_to_stop_following=Do you want to stop following this filter ?
filters.shared_filters=Shared filters
filters.shared_filters_description=These filters are shared by administrators and can be followed without copying them.


#------------------------------------------------------------------------------

+ 22
- 15
plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/i18n/I18nManagerTest.java View File

@@ -19,12 +19,8 @@
*/
package org.sonar.plugins.core.i18n;

import com.google.common.collect.Lists;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.sonar.api.i18n.LanguagePack;
import org.sonar.api.platform.PluginRepository;
import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.mock;

import java.net.URL;
import java.net.URLClassLoader;
@@ -32,8 +28,13 @@ import java.util.Arrays;
import java.util.List;
import java.util.Locale;

import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.mock;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.sonar.api.i18n.LanguagePack;
import org.sonar.api.platform.PluginRepository;

import com.google.common.collect.Lists;

public class I18nManagerTest {

@@ -46,11 +47,9 @@ public class I18nManagerTest {

@Before
public void createManager() throws Exception {
List<InstalledPlugin> plugins = Lists.newArrayList(
new InstalledPlugin("test", new TestClassLoader(getClass().getClassLoader().getResource("StandardPlugin.jar"))),
new InstalledPlugin("fake1", getClass().getClassLoader()),
new InstalledPlugin("fake2", getClass().getClassLoader())
);
List<InstalledPlugin> plugins = Lists.newArrayList(new InstalledPlugin("test", new TestClassLoader(getClass().getClassLoader()
.getResource("StandardPlugin.jar"))), new InstalledPlugin("fake1", getClass().getClassLoader()), new InstalledPlugin("fake2",
getClass().getClassLoader()));

TestClassLoader frenchPackClassLoader = new TestClassLoader(getClass().getClassLoader().getResource("FrenchPlugin.jar"));
LanguagePack frenchPack = (LanguagePack) frenchPackClassLoader.loadClass(FRENCH_PACK_CLASS_NAME).newInstance();
@@ -58,7 +57,7 @@ public class I18nManagerTest {
TestClassLoader quebecPackClassLoader = new TestClassLoader(getClass().getClassLoader().getResource("QuebecPlugin.jar"));
LanguagePack quebecPack = (LanguagePack) quebecPackClassLoader.loadClass(QUEBEC_PACK_CLASS_NAME).newInstance();

manager = new I18nManager(mock(PluginRepository.class), new LanguagePack[]{frenchPack, quebecPack});
manager = new I18nManager(mock(PluginRepository.class), new LanguagePack[] { frenchPack, quebecPack });
manager.doStart(plugins);
}

@@ -98,9 +97,17 @@ public class I18nManagerTest {
Assert.assertEquals("Default value for Unknown", manager.getUnknownKeys().getProperty("unknown"));
}

@Test
public void shouldReturnKeyIfTranslationMissingAndNotDefaultProvided() throws Exception {
String result = manager.message(Locale.ENGLISH, "unknown.key", null);
assertEquals("unknown.key", result);
Assert.assertEquals(0, manager.getUnknownKeys().size());
}

public static class TestClassLoader extends URLClassLoader {

public TestClassLoader(URL url) {
super(new URL[]{url, classSource}, Thread.currentThread().getContextClassLoader());
super(new URL[] { url, classSource }, Thread.currentThread().getContextClassLoader());
}

protected synchronized Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {

+ 1
- 1
sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb View File

@@ -41,7 +41,7 @@ module ApplicationHelper
def qualifier_icon(object)
qualifier=(object.respond_to?('qualifier') ? object.qualifier : object.to_s)
if qualifier
image_tag("q/#{qualifier}.png", :alt => Resourceable.qualifier_name(qualifier))
image_tag("q/#{qualifier}.png", :alt => message(Resourceable.qualifier_name(qualifier)))
else
image_tag('e16.gif')
end

+ 4
- 4
sonar-server/src/main/webapp/WEB-INF/app/helpers/filters_helper.rb View File

@@ -171,14 +171,14 @@ module FiltersHelper

def period_name(property)
if property=='previous_analysis'
"&Delta; since previous analysis"
message('delta_since_previous_analysis')
elsif property =~ /^[\d]+(\.[\d]+){0,1}$/
# is integer
"&Delta; over #{property} days"
message('delta_over_x_days', :params => property)
elsif property =~ /\d{4}-\d{2}-\d{2}/
"&Delta; since #{property}"
message('delta_since', :params => property)
elsif !property.blank?
"&Delta; since version #{property}"
message('delta_since_version', :params => property)
else
nil
end

+ 4
- 38
sonar-server/src/main/webapp/WEB-INF/app/models/filter_column.rb View File

@@ -23,7 +23,7 @@ class FilterColumn < ActiveRecord::Base

belongs_to :filter
validates_inclusion_of :sort_direction, :in => %w( ASC DESC ), :allow_nil => true
def self.create_from_string(string)
if FAMILIES.include?(string)
FilterColumn.new(:family => string)
@@ -39,48 +39,14 @@ class FilterColumn < ActiveRecord::Base

def name
if on_metric?
metric ? metric.short_name : kee
Java::OrgSonarServerUi::JRubyFacade.getInstance().getI18nMessage(I18n.locale, "metric." + kee + ".name", nil, [].to_java)
else
case family
when 'date'
'Build date'
when 'language'
'Language'
when 'name'
'Name'
when 'links'
'Links'
when 'version'
'Version'
when 'key'
'Key'
else
kee
end
Java::OrgSonarServerUi::JRubyFacade.getInstance().getI18nMessage(I18n.locale, family, kee, [].to_java)
end
end

def display_name
if on_metric?
metric ? metric.short_name : kee
else
case family
when 'date'
'Build date'
when 'language'
'Language'
when 'name'
'Name'
when 'links'
'Links'
when 'version'
'Version'
when 'key'
'Key'
else
kee
end
end
name
end

def metric

+ 9
- 9
sonar-server/src/main/webapp/WEB-INF/app/views/filters/_criterion.html.erb View File

@@ -7,7 +7,7 @@
}
</script>
<select name="criteria[<%= id -%>][metric_id]" id="metric-<%= id -%>">
<option value="">Select a metric</option>
<option value=""><%= message('select_a_metric') -%></option>
<% Metric.domains.each do |domain| %>
<optgroup label="<%= h domain -%>">
<% Metric.by_domain(domain).select{|m| !m.data? && !m.hidden?}.each do |metric| %>
@@ -17,16 +17,16 @@
<% end %>
</select>
<select name="criteria[<%= id -%>][type]" id="type-<%= id -%>">
<option value="value" <%= 'selected' unless (criterion && criterion.variation) -%>>Value</option>
<option value="variation" <%= 'selected' if criterion && criterion.variation -%>>Variation</option>
<option value="value" <%= 'selected' unless (criterion && criterion.variation) -%>><%= message('value') -%></option>
<option value="variation" <%= 'selected' if criterion && criterion.variation -%>><%= message('variation') -%></option>
</select>
<select name="criteria[<%= id -%>][operator]" id="op-<%= id -%>">
<option value=""></option>
<option value="<" <%= 'selected' if (criterion && criterion.operator=='<') -%>>Less than</option>
<option value="<=" <%= 'selected' if (criterion && criterion.operator=='<=') -%>>Less or equals</option>
<option value="=" <%= 'selected' if (criterion && criterion.operator=='=') -%>>Equals</option>
<option value=">" <%= 'selected' if (criterion && criterion.operator=='>') -%>>Greater than</option>
<option value=">=" <%= 'selected' if (criterion && criterion.operator=='>=') -%>>Greater or equals</option>
<option value="<" <%= 'selected' if (criterion && criterion.operator=='<') -%>><%= message('less_than') -%></option>
<option value="<=" <%= 'selected' if (criterion && criterion.operator=='<=') -%>><%= message('less_or_equals') -%></option>
<option value="=" <%= 'selected' if (criterion && criterion.operator=='=') -%>><%= message('equals') -%></option>
<option value=">" <%= 'selected' if (criterion && criterion.operator=='>') -%>><%= message('greater_than') -%></option>
<option value=">=" <%= 'selected' if (criterion && criterion.operator=='>=') -%>><%= message('greater_or_equals') -%></option>
</select>
<input type="text" name="criteria[<%= id -%>][value]" size="5" value="<%= criterion.value if criterion -%>" id="val-<%= id -%>"></input>
<a href="#" onClick="reset_criterion(<%= id -%>);return false;">Reset</a>
<a href="#" onClick="reset_criterion(<%= id -%>);return false;"><%= message('reset_verb') -%></a>

+ 17
- 17
sonar-server/src/main/webapp/WEB-INF/app/views/filters/_customize_list.html.erb View File

@@ -1,12 +1,12 @@
<tr>
<td class="first">
Add column:
<%= message('filters.add_column') -%>:
</td>
<td>
<form id="add_column_form" action="<%= url_for :action => 'add_column', :id => @filter.id -%>" method="post">
<select name="column_type" id="select_column_type">
<option value="value" selected>Value</option>
<option value="variation">Variation</option>
<option value="value" selected><%= message('value') -%></option>
<option value="variation"><%= message('variation') -%></option>
</select>

<select name="column" id="select_column">
@@ -17,22 +17,22 @@
<% if metric.display? %><option value="metric,<%= metric.id -%>"><%= metric.short_name -%></option><% end %>
<% end %>
<% if domain=='General' %>
<% unless @filter.column('date') %><option value="date">Build date</option><% end %>
<% unless @filter.column('key') %><option value="key">Key</option><% end %>
<% unless @filter.column('language') %><option value="language">Language</option><% end %>
<% unless @filter.column('links') %><option value="links">Links</option><% end %>
<% unless @filter.column('name') %><option value="name">Name</option><% end %>
<% unless @filter.column('version') %><option value="version">Version</option><% end %>
<% unless @filter.column('date') %><option value="date"><%= message('build_date') -%></option><% end %>
<% unless @filter.column('key') %><option value="key"><%= message('key') -%></option><% end %>
<% unless @filter.column('language') %><option value="language"><%= message('language') -%></option><% end %>
<% unless @filter.column('links') %><option value="links"><%= message('links') -%></option><% end %>
<% unless @filter.column('name') %><option value="name"><%= message('name') -%></option><% end %>
<% unless @filter.column('version') %><option value="version"><%= message('version') -%></option><% end %>
<% end %>
</optgroup>
<% end %>
</select>
<input type="submit" id="add_column_button" value="Add"></input>
<input type="submit" id="add_column_button" value="<%= message('add_verb') -%>"></input>
</form>
</td>
</tr>
<tr>
<td class="first">Default sorted column:</td>
<td class="first"><%= message('filters.default_sorted_column') -%>:</td>
<td>
<form id="sorted_column_form" action="<%= url_for :action => 'set_sorted_column' -%>" method="post">
<select name="id">
@@ -44,20 +44,20 @@
<% end %>
</select>
<select name="sort">
<option value="ASC" <%= 'selected' if default_sorted_column && default_sorted_column.ascending? -%>>Ascending</option>
<option value="DESC" <%= 'selected' if default_sorted_column && default_sorted_column.descending? -%>>Descending</option>
<option value="ASC" <%= 'selected' if default_sorted_column && default_sorted_column.ascending? -%>><%= message('ascending') -%></option>
<option value="DESC" <%= 'selected' if default_sorted_column && default_sorted_column.descending? -%>><%= message('descending') -%></option>
</select>
<input type="submit" id="add_column_submit" value="Change" />
<input type="submit" id="add_column_submit" value="<%= message('change_verb') -%>" />
</form>
</td>
</tr>
<tr>
<td class="first">Page size:</td>
<td class="first"><%= message('page_size') -%>:</td>
<td>
<form id="page_size_form" action="<%= url_for :action => 'set_page_size' -%>" method="post">
<input type="hidden" name="id" value="<%= @filter.id -%>"></input>
<input type="text" name="size" value="<%= @filter.page_size -%>" maxsize="3" size="3"></input>
<input type="submit" id="set_page_size_submit" value="Change"/>
<span class="comments">Min <%= ::Filter::MIN_PAGE_SIZE -%>, max <%= ::Filter::MAX_PAGE_SIZE -%></span>
<input type="submit" id="set_page_size_submit" value="<%= message('change_verb') -%>"/>
<span class="comments"><%= message('min') -%> <%= ::Filter::MIN_PAGE_SIZE -%>, <%= message('max').downcase -%> <%= ::Filter::MAX_PAGE_SIZE -%></span>
</td>
</tr>

+ 3
- 3
sonar-server/src/main/webapp/WEB-INF/app/views/filters/_customize_treemap.html.erb View File

@@ -5,14 +5,14 @@
%>
<form class="admin" action="<%= url_for :action => 'set_columns', :id => @filter.id -%>" method="POST">
<tr>
<td class="first">Size:</td>
<td class="first"><%= message('size') -%>:</td>
<td>
<%= select_tag 'columns[]', options_grouped_by_domain(Sonar::TreemapBuilder.size_metrics({:exclude_user_managed => true}), size_metric.key),
:id => 'size_metric' %>
</td>
</tr>
<tr>
<td class="first">Color:</td>
<td class="first"><%= message('color') -%>:</td>
<td>
<%= select_tag 'columns[]', options_grouped_by_domain(Sonar::TreemapBuilder.color_metrics, color_metric.key),
:id => 'color_metric' %>
@@ -22,7 +22,7 @@
<tr>
<td class="first"> </td>
<td>
<input type="submit" value="Change">
<input type="submit" value="<%= message('change_verb') -%>">
</td>
</tr>
</form>

+ 7
- 7
sonar-server/src/main/webapp/WEB-INF/app/views/filters/_list.html.erb View File

@@ -5,7 +5,7 @@
<div class="operations">
<form action="<%= url_for :overwrite_params => {:period => nil} -%>" style="display: inline" method="get">
<select name="period" onchange="submit()" class="small">
<option value="">Time changes...</option>
<option value=""><%= message('time_changes') -%>...</option>
<% period_names.each_with_index do |name, index| %>
<option value="<%= index+1 -%>" <%= 'selected' if @filter_context.period_index==index+1 -%>><%= name -%></value>
<% end %>
@@ -28,9 +28,9 @@
<tr class="admin"><th></th>
<% filter.columns.each do |column| %>
<th nowrap class="<%= column_align(column) -%>">
<%= link_to image_tag("controls/resultset_previous.png"), {:action => 'left_column', :id => column.id}, :title => 'Move left', :method => :post if filter.first_column!=column %>
<%= link_to image_tag("bin_closed.png"), {:action => 'delete_column', :id => column.id}, :title => 'Remove this column', :method => :post if column.deletable? %>
<%= link_to image_tag("controls/resultset_next.png"), {:action => 'right_column', :id => column.id}, :title => 'Move right', :method => :post if filter.last_column!=column %>
<%= link_to image_tag("controls/resultset_previous.png"), {:action => 'left_column', :id => column.id}, :title => message('move_left'), :method => :post if filter.first_column!=column %>
<%= link_to image_tag("bin_closed.png"), {:action => 'delete_column', :id => column.id}, :title => message('remove_column'), :method => :post if column.deletable? %>
<%= link_to image_tag("controls/resultset_next.png"), {:action => 'right_column', :id => column.id}, :title => message('move_right'), :method => :post if filter.last_column!=column %>
</th>
<% end %>
</tr>
@@ -40,7 +40,7 @@
<tfoot>
<tr>
<td colspan="<%= filter.columns.size + 1 -%>">
<span id="results_count"><%= pluralize(@filter_context.size, 'result') %></span>
<span id="results_count"><%= pluralize(@filter_context.size, message('result').downcase) %></span>

<% if @filter_context.page_count>1 %>
|
@@ -53,7 +53,7 @@

<% if @filter.projects_homepage? %>
&nbsp;&nbsp; <a href="<%= url_for :controller => :feeds, :action => 'projects', :id => EventCategory::KEY_ALERT -%>" class="nolink"><%= image_tag 'rss-12x12.png' %></a>
<a href="<%= url_for :controller => :feeds, :action => 'projects', :id => EventCategory::KEY_ALERT -%>" class="action">Alerts feed</a>
<a href="<%= url_for :controller => :feeds, :action => 'projects', :id => EventCategory::KEY_ALERT -%>" class="action"><%= message('alerts_feed') -%></a>
<% end %>
</td>
</tr>
@@ -129,6 +129,6 @@
</table>
<br/>
<% if @filter_context.security_exclusions? %>
<p class="notes">Due to security settings, some results are not being displayed.</p>
<p class="notes"><%= message('results_not_display_due_to_security') -%></p>
<% end %>
</div>

+ 3
- 3
sonar-server/src/main/webapp/WEB-INF/app/views/filters/_tabs.html.erb View File

@@ -1,11 +1,11 @@
<% if logged_in? %>
<div id="page-operations">
<ul class="operations">
<li><a href="<%= url_for :action => 'new' -%>" >Add filter</a></li>
<li><a href="<%= url_for :action => 'new' -%>" ><%= message('filters.add_filter') -%></a></li>
<% if @filter && @filter.id && editable_filter?(@filter) %>
<li><a href="<%= url_for :action => 'edit', :id => @filter.id -%>">Edit filter</a></li>
<li><a href="<%= url_for :action => 'edit', :id => @filter.id -%>"><%= message('filters.edit_filter') -%></a></li>
<% end %>
<li class="last"><%= link_to 'Manage filters', {:action => 'manage'} -%></li>
<li class="last"><%= link_to message('filters.manage_filters'), {:action => 'manage'} -%></li>
</ul>
</div>
<% end %>

+ 1
- 1
sonar-server/src/main/webapp/WEB-INF/app/views/filters/_treemap.html.erb View File

@@ -1,5 +1,5 @@
<% if @filter.period? %>
Treemap does not support yet the selection of a period.
<%= message('filters.treemap_not_supported_for_period_selection') -%>

<% else %>
<%

+ 16
- 16
sonar-server/src/main/webapp/WEB-INF/app/views/filters/manage.html.erb View File

@@ -1,20 +1,20 @@
<%= render :partial => 'filters/tabs', :locals => {:selected_tab => nil} %>

<h1>My filters</h1>
<h1><%= message('filters.my_filters') -%></h1>
<br/>
<table class="data" id="actives">
<thead>
<tr>
<th>Name</th>
<th>Author</th>
<th>Shared</th>
<th>Order</th>
<th>Operations</th>
<th><%= message('name') -%></th>
<th><%= message('author') -%></th>
<th><%= message('shared') -%></th>
<th><%= message('order') -%></th>
<th><%= message('operations') -%></th>
</tr>
</thead>
<tbody>
<% if @actives.nil? || @actives.empty? %>
<tr class="even"><td colspan="5">No filters</td></tr>
<tr class="even"><td colspan="5"><%= message('filters.no_filters') -%></td></tr>

<%
else
@@ -39,10 +39,10 @@
</td>
<td>
<% if editable_filter?(active.filter) %>
<%= link_to 'Edit', {:action => 'edit', :id => active.filter_id}, :id => "edit-#{u active.name}" %> |
<%= link_to 'Delete', {:action => 'deactivate', :id => active.filter_id}, :method => :post, :confirm => 'Do you want to delete this filter ?', :id => "delete-#{u active.name}" %>
<%= link_to message('edit'), {:action => 'edit', :id => active.filter_id}, :id => "edit-#{u active.name}" %> |
<%= link_to message('delete'), {:action => 'deactivate', :id => active.filter_id}, :method => :post, :confirm => message('filters.do_you_want_to_delete'), :id => "delete-#{u active.name}" %>
<% else %>
<%= link_to 'Unfollow', {:action => 'deactivate', :id => active.filter_id}, :method => :post, :confirm => 'Do you want to stop following this filter ?', :id => "unfollow-#{u active.name}" %>
<%= link_to message('unfollow'), {:action => 'deactivate', :id => active.filter_id}, :method => :post, :confirm => message('filters.do_you_want_to_stop_following'), :id => "unfollow-#{u active.name}" %>
<% end %>
</td>
</tr>
@@ -53,20 +53,20 @@
</table>

<br/><br/><br/>
<h1>Shared filters</h1>
<p>These filters are shared by administrators and can be followed without copying them.</p>
<h1><%= message('filters.shared_filters') -%></h1>
<p><%= message('filters.shared_filters_description') -%></p>
<br/>
<table class="data" id="shared">
<thead>
<tr>
<th>Name</th>
<th>Author</th>
<th>Operations</th>
<th><%= message('name') -%></th>
<th><%= message('author') -%></th>
<th><%= message('operations') -%></th>
</tr>
</thead>
<tbody>
<% if @shared_filters.nil? || @shared_filters.empty? %>
<tr class="even"><td colspan="3">No results.</td></tr>
<tr class="even"><td colspan="3"><%= message('no_results') -%>.</td></tr>
<% else %>
<% @shared_filters.each do |filter| %>
<tr class="<%= cycle('even', 'odd') -%>">

+ 4
- 4
sonar-server/src/main/webapp/WEB-INF/app/views/filters/new.html.erb View File

@@ -184,16 +184,16 @@ $('name').focus();
<br/>

<% if @filter_context %>
<h1>Display</h1>
<h1><%= message('display') -%></h1>
<div class="admin">
<table class="form" id="view-form">
<tr>
<td class="first">Display as:</td>
<td class="first"><%= message('filters.display_as') -%>:</td>
<td>
<form action="<%= url_for :action => :set_view, :id => @filter.id -%>" method="POST">
<input type="radio" name="view" value="list" <%= 'checked' if @filter.default_view==::Filter::VIEW_LIST -%> id="view-list" onClick="$('view-loading').show();submit();"></input> <label for="view-list">Table</label>
<input type="radio" name="view" value="list" <%= 'checked' if @filter.default_view==::Filter::VIEW_LIST -%> id="view-list" onClick="$('view-loading').show();submit();"></input> <label for="view-list"><%= message('table') -%></label>
<span class="spacer"> </span>
<input type="radio" name="view" value="treemap" <%= 'checked' if @filter.default_view==::Filter::VIEW_TREEMAP -%> id="view-treemap" onClick="$('view-loading').show();submit();"></input> <label for="view-treemap">Treemap</label>
<input type="radio" name="view" value="treemap" <%= 'checked' if @filter.default_view==::Filter::VIEW_TREEMAP -%> id="view-treemap" onClick="$('view-loading').show();submit();"></input> <label for="view-treemap"><%= message('treemap') -%></label>
<span class="spacer"> </span>
<%= image_tag 'loading.gif', :id => 'view-loading', :style=>'display: none' %>
</form>

+ 5
- 5
sonar-server/src/main/webapp/WEB-INF/app/views/filters/search_path.html.erb View File

@@ -1,10 +1,10 @@
<h1>Search</h1>
<h1><%= message('search_verb') -%></h1>
<br/>

<form action="<%= url_for :action => :search_path -%>" method="post" id="search_form">
<input type="text" name="search" id="search" value="<%= params[:search] -%>"></input>
<input type="submit" value="Search" id="search_submit" /><br/>
<p class="note">Search by name</p>
<input type="submit" value="<%= message('search_verb') -%>" id="search_submit" /><br/>
<p class="note"><%= message('filters.search_by_name') -%></p>
</form>
<br/>

@@ -28,7 +28,7 @@
</thead>
<tbody>
<% if @snapshots.empty? %>
<tr class="even"><td colspan="3">No results</td></tr>
<tr class="even"><td colspan="3"><%= message('no_results') -%></td></tr>

<% else
@snapshots.each do |snapshot| %>
@@ -38,7 +38,7 @@
<% path_name=snapshot.path_name %>
<%= path_name -%>
</td>
<td><a href="#" onClick="selectPath(<%= snapshot.project_id-%>, '<%= escape_javascript(path_name) -%>')">Select</a></td>
<td><a href="#" onClick="selectPath(<%= snapshot.project_id-%>, '<%= escape_javascript(path_name) -%>')"><%= message('select_verb') -%></a></td>
</tr>
<% end
end %>

+ 2
- 2
sonar-server/src/main/webapp/WEB-INF/app/views/filters/treemap.html.erb View File

@@ -3,13 +3,13 @@
<table>
<tr>
<td>
<span class="comments">Size:</span><br/>
<span class="comments"><%= message('size') -%>:</span><br/>
<%= select_tag 'size_metric', options_grouped_by_domain(Sonar::TreemapBuilder.size_metrics({:exclude_user_managed => true}), @size_metric.key),
:id => 'size_metric', :class => 'small', :onchange => "load_treemap(this.form.size_metric.value,this.form.color_metric.value, false);return false;" %>
</td>
<td class="sep"> </td>
<td>
<span class="comments">Color: <%= render :partial => 'components/treemap_gradient', :locals => {:color_metric => @color_metric} %></span>
<span class="comments"><%= message('color') -%>: <%= render :partial => 'components/treemap_gradient', :locals => {:color_metric => @color_metric} %></span>
<br/>
<%= select_tag 'color_metric', options_grouped_by_domain(Sonar::TreemapBuilder.color_metrics, @color_metric.key),
:id => 'color_metric', :class => 'small', :onchange => "load_treemap(this.form.size_metric.value,this.form.color_metric.value, false);return false;" %>

+ 1
- 1
sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb View File

@@ -3,7 +3,7 @@
<div id="hd">
<%= render :partial => 'layouts/breadcrumb' %>
<ol id="nav">
<li><input type="text" autocomplete="off" size="15" name="search" id="projectSearch" onFocus="this.size=30;this.value='';autocompleteProjects('<%= ApplicationController.root_context -%>/api/resources?scopes=<%= Project::SCOPE_SET -%>&qualifiers=<%= Project::QUALIFIER_VIEW-%>,<%= Project::QUALIFIER_SUBVIEW-%>,<%= Project::QUALIFIER_PROJECT-%>', '<%= ApplicationController.root_context -%>/dashboard/index/', this, $('projectResults'));return true;" onBlur="javacript:this.size=15" value="Search"/><div id="projectResults" style="display:none"></div></li>
<li><input type="text" autocomplete="off" size="15" name="search" id="projectSearch" onFocus="this.size=30;this.value='';autocompleteProjects('<%= ApplicationController.root_context -%>/api/resources?scopes=<%= Project::SCOPE_SET -%>&qualifiers=<%= Project::QUALIFIER_VIEW-%>,<%= Project::QUALIFIER_SUBVIEW-%>,<%= Project::QUALIFIER_PROJECT-%>', '<%= ApplicationController.root_context -%>/dashboard/index/', this, $('projectResults'));return true;" onBlur="javacript:this.size=15" value="<%= message('search_verb') -%>"/><div id="projectResults" style="display:none"></div></li>
<li>
<a href="javascript:window.print()"><img src="<%= ApplicationController.root_context -%>/images/print.gif" alt="<%= message('layout.print') -%>" title="<%=message('layout.print')-%>" /></a>
<% if @project %><a href="<%= url_for :overwrite_params => {:id => @project.key}-%>" id="permalink"><img src="<%= ApplicationController.root_context -%>/images/permalink.gif" alt="<%=message('layout.permalink')-%>" title="<%=message('layout.permalink')-%>" /></a><% end %>

+ 10
- 10
sonar-server/src/main/webapp/WEB-INF/lib/resourceable.rb View File

@@ -37,16 +37,16 @@ module Resourceable
QUALIFIER_LIB='LIB'
QUALIFIERS=[QUALIFIER_VIEW,QUALIFIER_SUBVIEW,QUALIFIER_PROJECT,QUALIFIER_MODULE,QUALIFIER_DIRECTORY,QUALIFIER_PACKAGE,QUALIFIER_FILE,QUALIFIER_CLASS,QUALIFIER_UNIT_TEST_CLASS,QUALIFIER_LIB]
QUALIFIER_NAMES={
QUALIFIER_VIEW => 'View',
QUALIFIER_SUBVIEW => 'Sub-view',
QUALIFIER_PROJECT => 'Project',
QUALIFIER_MODULE => 'Sub-project',
QUALIFIER_DIRECTORY => 'Directory',
QUALIFIER_PACKAGE => 'Package',
QUALIFIER_FILE => 'File',
QUALIFIER_CLASS => 'Class',
QUALIFIER_UNIT_TEST_CLASS => 'Unit test',
QUALIFIER_LIB => 'Library'
QUALIFIER_VIEW => 'view',
QUALIFIER_SUBVIEW => 'sub_view',
QUALIFIER_PROJECT => 'project',
QUALIFIER_MODULE => 'sub_project',
QUALIFIER_DIRECTORY => 'directory',
QUALIFIER_PACKAGE => 'package',
QUALIFIER_FILE => 'file',
QUALIFIER_CLASS => 'class',
QUALIFIER_UNIT_TEST_CLASS => 'unit_test',
QUALIFIER_LIB => 'library'
}
def set?
scope==SCOPE_SET

Loading…
Cancel
Save