# MEASURE FILTERS
#
#------------------------------------------------------------------------------
+measure_filter.display_as=Display as
+measure_filter.shared_with_all_users=Shared with all users
+measure_filter.private=Private
+measure_filter.manage.shared_filters=Shared Filters
+measure_filter.manage.my_filters=My Filters
+measure_filter.criteria.age=Age
+measure_filter.criteria.date=Date
+measure_filter.criteria.only_favourites=Favourites only
+measure_filter.criteria.key=Key
+measure_filter.criteria.name=Name
+measure_filter.criteria.language=Language
+measure_filter.criteria.metric=Metric
+measure_filter.criteria.age.from_date=From date
+measure_filter.criteria.age.to_date=To date
+measure_filter.criteria.age.note=year-month-day (2012-01-31)
+measure_filter.criteria.age.more_than=More than
+measure_filter.criteria.age.within_last=Within the last
+measure_filter.criteria.age.days_ago=days ago
+measure_filter.criteria.age.days=days
+measure_filter.new_search=New search
+measure_filter.more_criteria=+ More Criteria
+measure_filter.languages=Languages
measure_filter.col.date=Date
measure_filter.col.description=Description
measure_filter.col.key=Key
measure_filter.col.name=Name
measure_filter.col.short_name=Short Name
measure_filter.col.version=Version
-measure_filter.short_col.language=Lang.
-measure_filter.short_col.short_name=Name
measure_filter.missing_name=Name is missing
measure_filter.name_too_long=Name is too long
measure_filter.sharing=Sharing
measure_filter.title_shared_filters=Shared Filters
measure_filter.key_like=Key like
measure_filter.name_contains=Name contains
-measure_filter.only_favourites=Favourites only
measure_filter.manage_filters=Manage Filters
measure_filter.display.list=List
measure_filter.display.treemap=Treemap
measure_filter.configure_columns=Configure Columns
+measure_filter.too_many_results=Too many results. Please refine your search.
#------------------------------------------------------------------------------
#
@metrics ||= []
end
- def metrics=(array)
- @metrics = array
+ # Set the metrics of the result measures to load. Array of Metric or String.
+ def metrics=(array=[])
+ @metrics = array.map{|m| m.is_a?(Metric) ? m : Metric.by_key(m)}.compact
end
+ # Enable the loading of result links. False by default
def require_links=(flag)
@require_links=flag
end
KEY = :treemap
PROPERTY_KEYS = Set.new(['tmSize', 'tmColor'])
+ MAX_RESULTS = 1000
attr_reader :id, :size, :size_metric, :color_metric
def initialize(filter, options)
filter.set_criteria_value('sort', "metric:#{@size_metric.key}") if @size_metric
filter.set_criteria_value('asc', 'true')
- filter.pagination.per_page = 500
+ filter.pagination.per_page = MAX_RESULTS
filter.pagination.page = 1
end
</table>
<% end %>
-<% content_for :script do %>
+<% unless defined? widget
+ content_for :script do %>
<script>
$j(document).ready(function () {
$j("#update-treemap").on("click", function (e) {
});
});
</script>
-<% end %>
+<% end
+end %>
<% if filter.results.empty? %>
<p><%= message('no_data') -%></p>
+<% elsif filter.pagination.pages>1 %>
+ <p><%= message('measure_filter.too_many_results') -%></p>
<% else %>
<div id="tm-<%= treemap_id -%>" class="treemap width100">
<%= filter.display.html -%>
}
var hiddenConditionIndexes = [<%= hidden_condition_indexes.join(',') -%>];
$j(document).ready(function () {
- $j('#select-lang').select2({allowClear:true, width:'100%', placeholder:'Languages'});
+ $j('#select-lang').select2({allowClear:true, width:'100%', placeholder:'<%= message 'measure_filter.languages' -%>'});
$j('#select-qualifiers').select2({allowClear:true, width:'100%', placeholder:'Resources'});
$j('#more-criteria')
- .select2({allowClear:true, width:'100%', placeholder:'+ More Criteria'})
+ .select2({allowClear:true, width:'100%', placeholder:'<%= message 'measure_filter.more_criteria' -%>'})
.on("change", function (e) {
$j("#criteria-" + e.val).insertBefore($j("#more-td")).show();
if (e.val == 'lang') {
<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>
+ <%= message 'measure_filter.criteria.only_favourites' %>:<br>
<%= check_box_tag 'onFavourites', 'true', @filter.criteria['onFavourites']=='true' -%>
</li>
</li>
<% end %>
<li id="criteria-date" <%= "style='display:none'" unless @filter.criteria('fromDate') || @filter.criteria('toDate') -%>>
- From date:
+ <%= message 'measure_filter.criteria.age.from_date' -%>:
<input type="text" name="fromDate" value="<%= @filter.criteria['fromDate'] -%>" size="10" maxlength="10">
<br>
- To date:
+ <%= message 'measure_filter.criteria.age.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>
+ <span class="note"><%= message 'measure_filter.criteria.age.note' -%>:</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
+ <%= message 'measure_filter.criteria.age.more_than' -%>:
+ <input type="text" name="ageMinDays" value="<%= @filter.criteria['ageMinDays'] -%>" size="3"> <%= message 'measure_filter.criteria.age.days_ago' -%>
+ <br><%= message 'measure_filter.criteria.age.within_last' -%>:
+ <input type="text" name="ageMaxDays" value="<%= @filter.criteria['ageMaxDays'] -%>" size="3"> <%= message 'measure_filter.criteria.age.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>
+ <option value="age"><%= message 'measure_filter.criteria.age' -%></option>
+ <option value="date"><%= message 'measure_filter.criteria.date' -%></option>
+ <option value="fav"><%= message 'measure_filter.criteria.only_favourites' -%></option>
+ <option value="key"><%= message 'measure_filter.criteria.key' -%></option>
+ <option value="lang"><%= message 'measure_filter.criteria.language' -%></option>
+ <option value="metric"><%= message 'measure_filter.criteria.metric' -%></option>
+ <option value="name"><%= message 'measure_filter.criteria.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>
+ <a href="<%= ApplicationController.root_context -%>/measures" class="link-action"><%= message 'measure_filter.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>
</div>
<div class="page-split-right">
<div id="content">
- <h2>My Filters</h2>
+ <h2><%= message 'measure_filter.manage.my_filters' -%></h2>
<table class="data marginbottom10" id="my-filters">
<thead>
<tr>
</td>
<td>
<% if filter.shared %>
- Shared with all users
+ <%= message 'measure_filter.shared_with_all_users' -%>
<% else %>
- Private
+ <%= message 'measure_filter.private' -%>
<% end %>
</td>
<td class="thin nowrap right">
<br/>
- <h2>Shared Filters</h2>
+ <h2><%= message 'measure_filter.manage.shared_filters' -%></h2>
<table class="data" id="shared-filters">
<thead>
<tr>
</li>
<% end %>
<li class="last">
- Display as:
+ <%= message 'measure_filter.display_as' -%>:
<% MeasureFilterDisplay.keys.each do |display_key| %>
<%= link_to_if display_key!=@filter.display.key, message("measure_filter.display.#{display_key}"), params.merge(:action => 'search', :display => display_key, :id => @filter.id) -%>
<% end %>
height: 24px;
padding: 0 8px;
cursor: pointer !important;
- color: red !important;
float: none !important;
}
.dropdown-menu li:hover a {
color: #fff !important;
- font-weight: bold !important;
}
.dropdown-menu a {