def period_select_options(alert, index)
if index
selected = (alert.period == index ? 'selected' : '')
- period_label = Api::Utils.java_facade.getPeriodLabel(index)
- "<option value='#{index}' #{selected}>Δ #{period_label}</option>"
+ "<option value='#{index}' #{selected}>Δ #{Api::Utils.period_label(index)}</option>"
else
selected = (alert.period ? 'selected' : '')
"<option value='' #{selected}>#{message('value')}</option>"
params['configuring']=='true'
end
- def period_label(snapshot, period_index)
- return nil if snapshot.nil? || snapshot.project_snapshot.nil?
- mode = snapshot.period_mode(period_index)
- mode_param = snapshot.period_param(period_index)
- date = snapshot.period_datetime(period_index)
- Api::Utils.java_facade.getPeriodLabel(mode, mode_param, date) if mode
- end
-
def configuration(key, default = nil)
prop_value = Java::OrgSonarServerUi::JRubyFacade.getInstance().getContainer().getComponentByType(Java::OrgApacheCommonsConfiguration::Configuration.java_class).getProperty(key)
prop_value.nil? ? default : prop_value
"<a href='#{url}' modal-width='#{width}' class='open-modal #{clazz}' #{id}>#{h label}</a>"
end
+
end
end
def period_select_options(snapshot, index)
- label=period_label(snapshot, index)
+ label=snapshot.period_label(index)
if label
selected=(params[:period]==index.to_s ? 'selected' : '')
"<option value='#{index}' #{selected}>Δ #{label}</option>"
html=h(column.title_label)
end
if column.period
- html += "<br><span class='note'>Period #{column.period}</small>"
+ html += "<br><span class='note'>#{Api::Utils.period_label(column.period)}</small>"
end
if filter.sort_key==column.key
html << (filter.sort_asc? ? image_tag("asc12.png") : image_tag("desc12.png"))
size.to_i
end
- def period_names
- period_name1 = Api::Utils.java_facade.getPeriodLabel(1)
- period_name2 = Api::Utils.java_facade.getPeriodLabel(2)
- period_name3 = Api::Utils.java_facade.getPeriodLabel(3)
- [period_name1, period_name2, period_name3]
+ def period_labels
+ [Api::Utils.period_label(1), Api::Utils.period_label(2), Api::Utils.period_label(3)]
end
end
end
def self.language(key)
- languages.find {|language| language.key == key}
+ languages.find { |language| language.key == key }
end
def self.language_name(key)
l ? l.name : key
end
+ # Label of global periods
+ # index is in [1..3]
+ def self.period_label(index)
+ java_facade.getPeriodLabel(index)
+ end
end
end
end
+ def period_label(period_index)
+ if project_snapshot
+ mode = period_mode(period_index)
+ mode_param = period_param(period_index)
+ date = period_datetime(period_index)
+ Api::Utils.java_facade.getPeriodLabel(mode, mode_param, date) if mode
+ end
+ end
+
private
def measures_hash
:extra_values => [[message('measure_filter.col.name'), 'name'], [message('measure_filter.col.short_name'), 'short_name'], [message('measure_filter.col.description'), 'description'], [message('measure_filter.col.language'), 'language'], [message('measure_filter.col.version'), 'version']] -%>
<select id="select-period" style="display: none;">
<option value="">Value</option>
- <% period_names.each_with_index do |period_name, index| %>
- <option value="<%= index + 1 -%>"><%= period_name -%></option>
+ <% period_labels.each_with_index do |period_label, index| %>
+ <option value="<%= index + 1 -%>"><%= period_label -%></option>
<% end %>
</select>
if @filter.display.key==:list && !edit_mode
%>
<li>
- <a id="edit" href="<%= url_for params.merge({:edit => true, :id => @filter.id}) -%>"><%= message('measure_filter.configure_columns') -%></a>
+ <a id="configure-columns" href="<%= url_for params.merge({:edit => true, :id => @filter.id}) -%>"><%= message('measure_filter.configure_columns') -%></a>
</li>
<% end %>
<li>