Redmine 3.4.4
This commit is contained in:
commit
64924a6376
2112 changed files with 259028 additions and 0 deletions
46
app/views/queries/_columns.html.erb
Normal file
46
app/views/queries/_columns.html.erb
Normal file
|
@ -0,0 +1,46 @@
|
|||
<% tag_id = tag_name.gsub(/[\[\]]+/, '_').sub(/_+$/, '') %>
|
||||
<% available_tag_id = "available_#{tag_id}" %>
|
||||
<% selected_tag_id = "selected_#{tag_id}" %>
|
||||
|
||||
<table class="query-columns">
|
||||
<tr>
|
||||
<td style="padding-left:0">
|
||||
<%= label_tag available_tag_id, l(:description_available_columns) %>
|
||||
<br />
|
||||
<%= select_tag 'available_columns',
|
||||
options_for_select(query_available_inline_columns_options(query)),
|
||||
:id => available_tag_id,
|
||||
:multiple => true, :size => 10, :style => "width:150px",
|
||||
:ondblclick => "moveOptions(this.form.#{available_tag_id}, this.form.#{selected_tag_id});" %>
|
||||
</td>
|
||||
<td class="buttons">
|
||||
<input type="button" value="→"
|
||||
onclick="moveOptions(this.form.<%= available_tag_id %>, this.form.<%= selected_tag_id %>);" /><br />
|
||||
<input type="button" value="←"
|
||||
onclick="moveOptions(this.form.<%= selected_tag_id %>, this.form.<%= available_tag_id %>);" />
|
||||
</td>
|
||||
<td>
|
||||
<%= label_tag selected_tag_id, l(:description_selected_columns) %>
|
||||
<br />
|
||||
<%= select_tag tag_name,
|
||||
options_for_select(query_selected_inline_columns_options(query)),
|
||||
:id => selected_tag_id,
|
||||
:multiple => true, :size => 10, :style => "width:150px",
|
||||
:ondblclick => "moveOptions(this.form.#{selected_tag_id}, this.form.#{available_tag_id});" %>
|
||||
</td>
|
||||
<td class="buttons">
|
||||
<input type="button" value="⇈" onclick="moveOptionTop(this.form.<%= selected_tag_id %>);" /><br />
|
||||
<input type="button" value="↑" onclick="moveOptionUp(this.form.<%= selected_tag_id %>);" /><br />
|
||||
<input type="button" value="↓" onclick="moveOptionDown(this.form.<%= selected_tag_id %>);" /><br />
|
||||
<input type="button" value="⇊" onclick="moveOptionBottom(this.form.<%= selected_tag_id %>);" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<%= javascript_tag do %>
|
||||
$(document).ready(function(){
|
||||
$('.query-columns').closest('form').submit(function(){
|
||||
$('#<%= selected_tag_id %> option').prop('selected', true);
|
||||
});
|
||||
});
|
||||
<% end %>
|
26
app/views/queries/_filters.html.erb
Normal file
26
app/views/queries/_filters.html.erb
Normal file
|
@ -0,0 +1,26 @@
|
|||
<%= javascript_tag do %>
|
||||
var operatorLabels = <%= raw_json Query.operators_labels %>;
|
||||
var operatorByType = <%= raw_json Query.operators_by_filter_type %>;
|
||||
var availableFilters = <%= raw_json query.available_filters_as_json %>;
|
||||
var labelDayPlural = <%= raw_json l(:label_day_plural) %>;
|
||||
|
||||
var filtersUrl = <%= raw_json queries_filter_path(:project_id => @query.project.try(:id), :type => @query.type) %>;
|
||||
|
||||
$(document).ready(function(){
|
||||
initFilters();
|
||||
<% query.filters.each do |field, options| %>
|
||||
addFilter("<%= field %>", <%= raw_json query.operator_for(field) %>, <%= raw_json query.values_for(field) %>);
|
||||
<% end %>
|
||||
});
|
||||
<% end %>
|
||||
|
||||
<table id="filters-table">
|
||||
</table>
|
||||
|
||||
<div class="add-filter">
|
||||
<%= label_tag('add_filter_select', l(:label_filter_add)) %>
|
||||
<%= select_tag 'add_filter_select', filters_options_for_select(query), :name => nil %>
|
||||
</div>
|
||||
|
||||
<%= hidden_field_tag 'f[]', '' %>
|
||||
<% include_calendar_headers_tags %>
|
92
app/views/queries/_form.html.erb
Normal file
92
app/views/queries/_form.html.erb
Normal file
|
@ -0,0 +1,92 @@
|
|||
<%= error_messages_for 'query' %>
|
||||
|
||||
<div class="box">
|
||||
<div class="tabular">
|
||||
<%= hidden_field_tag 'gantt', '1' if params[:gantt] %>
|
||||
|
||||
<p><label for="query_name"><%=l(:field_name)%></label>
|
||||
<%= text_field 'query', 'name', :size => 80 %></p>
|
||||
|
||||
<% if User.current.admin? || User.current.allowed_to?(:manage_public_queries, @query.project) %>
|
||||
<p><label><%=l(:field_visible)%></label>
|
||||
<label class="block"><%= radio_button 'query', 'visibility', Query::VISIBILITY_PRIVATE %> <%= l(:label_visibility_private) %></label>
|
||||
<label class="block"><%= radio_button 'query', 'visibility', Query::VISIBILITY_PUBLIC %> <%= l(:label_visibility_public) %></label>
|
||||
<label class="block"><%= radio_button 'query', 'visibility', Query::VISIBILITY_ROLES %> <%= l(:label_visibility_roles) %>:</label>
|
||||
<% Role.givable.sorted.each do |role| %>
|
||||
<label class="block role-visibility"><%= check_box_tag 'query[role_ids][]', role.id, @query.roles.include?(role), :id => nil %> <%= role.name %></label>
|
||||
<% end %>
|
||||
<%= hidden_field_tag 'query[role_ids][]', '' %>
|
||||
</p>
|
||||
<% end %>
|
||||
|
||||
<p><label for="query_is_for_all"><%=l(:field_is_for_all)%></label>
|
||||
<%= check_box_tag 'query_is_for_all', 1, @query.project.nil?, :class => (User.current.admin? ? '' : 'disable-unless-private') %></p>
|
||||
|
||||
<% unless params[:gantt] %>
|
||||
<fieldset id="options"><legend><%= l(:label_options) %></legend>
|
||||
<p><label for="query_default_columns"><%=l(:label_default_columns)%></label>
|
||||
<%= check_box_tag 'default_columns', 1, @query.has_default_columns?, :id => 'query_default_columns',
|
||||
:data => {:disables => "#columns, .block_columns input"} %></p>
|
||||
|
||||
<p><label for="query_group_by"><%= l(:field_group_by) %></label>
|
||||
<%= select 'query', 'group_by', @query.groupable_columns.collect {|c| [c.caption, c.name.to_s]}, :include_blank => true %></p>
|
||||
|
||||
<p class="block_columns"><label><%= l(:button_show) %></label>
|
||||
<%= available_block_columns_tags(@query) %></p>
|
||||
|
||||
<p><label><%= l(:label_total_plural) %></label>
|
||||
<%= available_totalable_columns_tags(@query) %></p>
|
||||
</fieldset>
|
||||
<% else %>
|
||||
<fieldset id="options"><legend><%= l(:label_options) %></legend>
|
||||
<p><label><%= l(:button_show) %></label>
|
||||
<label class="inline"><%= check_box_tag "query[draw_relations]", "1", @query.draw_relations %> <%= l(:label_related_issues) %></label>
|
||||
<label class="inline"><%= check_box_tag "query[draw_progress_line]", "1", @query.draw_progress_line %> <%= l(:label_gantt_progress_line) %></label>
|
||||
</p>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<fieldset id="filters"><legend><%= l(:label_filter_plural) %></legend>
|
||||
<%= render :partial => 'queries/filters', :locals => {:query => query}%>
|
||||
</fieldset>
|
||||
|
||||
<% unless params[:gantt] %>
|
||||
<fieldset><legend><%= l(:label_sort) %></legend>
|
||||
<% 3.times do |i| %>
|
||||
<%= content_tag(:span, "#{i+1}:", :class => 'query_sort_criteria_count')%>
|
||||
<%= label_tag "query_sort_criteria_attribute_" + i.to_s,
|
||||
l(:description_query_sort_criteria_attribute), :class => "hidden-for-sighted" %>
|
||||
<%= select_tag("query[sort_criteria][#{i}][]",
|
||||
options_for_select([[]] + query.available_columns.select(&:sortable?).collect {|column| [column.caption, column.name.to_s]}, @query.sort_criteria_key(i)),
|
||||
:id => "query_sort_criteria_attribute_" + i.to_s)%>
|
||||
<%= label_tag "query_sort_criteria_direction_" + i.to_s,
|
||||
l(:description_query_sort_criteria_direction), :class => "hidden-for-sighted" %>
|
||||
<%= select_tag("query[sort_criteria][#{i}][]",
|
||||
options_for_select([[], [l(:label_ascending), 'asc'], [l(:label_descending), 'desc']], @query.sort_criteria_order(i)),
|
||||
:id => "query_sort_criteria_direction_" + i.to_s) %>
|
||||
<br />
|
||||
<% end %>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
|
||||
<% unless params[:gantt] %>
|
||||
<%= content_tag 'fieldset', :id => 'columns' do %>
|
||||
<legend><%= l(:field_column_names) %></legend>
|
||||
<%= render_query_columns_selection(query) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
|
||||
<%= javascript_tag do %>
|
||||
$(document).ready(function(){
|
||||
$("input[name='query[visibility]']").change(function(){
|
||||
var roles_checked = $('#query_visibility_1').is(':checked');
|
||||
var private_checked = $('#query_visibility_0').is(':checked');
|
||||
$("input[name='query[role_ids][]'][type=checkbox]").attr('disabled', !roles_checked);
|
||||
if (!private_checked) $("input.disable-unless-private").attr('checked', false);
|
||||
$("input.disable-unless-private").attr('disabled', !private_checked);
|
||||
}).trigger('change');
|
||||
});
|
||||
<% end %>
|
63
app/views/queries/_query_form.html.erb
Normal file
63
app/views/queries/_query_form.html.erb
Normal file
|
@ -0,0 +1,63 @@
|
|||
<%= hidden_field_tag 'set_filter', '1' %>
|
||||
<%= hidden_field_tag 'type', @query.type, :disabled => true, :id => 'query_type' %>
|
||||
<%= query_hidden_sort_tag(@query) %>
|
||||
|
||||
<div id="query_form_with_buttons" class="hide-when-print">
|
||||
<div id="query_form_content">
|
||||
<fieldset id="filters" class="collapsible <%= @query.new_record? ? "" : "collapsed" %>">
|
||||
<legend onclick="toggleFieldset(this);"><%= l(:label_filter_plural) %></legend>
|
||||
<div style="<%= @query.new_record? ? "" : "display: none;" %>">
|
||||
<%= render :partial => 'queries/filters', :locals => {:query => @query} %>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset id="options" class="collapsible collapsed">
|
||||
<legend onclick="toggleFieldset(this);"><%= l(:label_options) %></legend>
|
||||
<div style="display: none;">
|
||||
<table>
|
||||
<tr>
|
||||
<td class="field"><%= l(:field_column_names) %></td>
|
||||
<td><%= render_query_columns_selection(@query) %></td>
|
||||
</tr>
|
||||
<% if @query.groupable_columns.any? %>
|
||||
<tr>
|
||||
<td class="field"><label for='group_by'><%= l(:field_group_by) %></label></td>
|
||||
<td><%= group_by_column_select_tag(@query) %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if @query.available_block_columns.any? %>
|
||||
<tr>
|
||||
<td class="field"><%= l(:button_show) %></td>
|
||||
<td><%= available_block_columns_tags(@query) %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if @query.available_totalable_columns.any? %>
|
||||
<tr>
|
||||
<td><%= l(:label_total_plural) %></td>
|
||||
<td><%= available_totalable_columns_tags(@query) %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<p class="buttons">
|
||||
<%= link_to_function l(:button_apply), '$("#query_form").submit()', :class => 'icon icon-checked' %>
|
||||
<%= link_to l(:button_clear), { :set_filter => 1, :sort => '', :project_id => @project }, :class => 'icon icon-reload' %>
|
||||
<% if @query.new_record? %>
|
||||
<% if User.current.allowed_to?(:save_queries, @project, :global => true) %>
|
||||
<%= link_to_function l(:button_save),
|
||||
"$('#query_type').prop('disabled',false);$('#query_form').attr('action', '#{ @project ? new_project_query_path(@project) : new_query_path }').submit()",
|
||||
:class => 'icon icon-save' %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<% if @query.editable_by?(User.current) %>
|
||||
<%= link_to l(:button_edit), edit_query_path(@query), :class => 'icon icon-edit' %>
|
||||
<%= delete_link query_path(@query) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<%= error_messages_for @query %>
|
6
app/views/queries/edit.html.erb
Normal file
6
app/views/queries/edit.html.erb
Normal file
|
@ -0,0 +1,6 @@
|
|||
<h2><%= l(:label_query) %></h2>
|
||||
|
||||
<%= form_tag(query_path(@query), :method => :put, :id => "query-form") do %>
|
||||
<%= render :partial => 'form', :locals => {:query => @query} %>
|
||||
<%= submit_tag l(:button_save) %>
|
||||
<% end %>
|
10
app/views/queries/index.api.rsb
Normal file
10
app/views/queries/index.api.rsb
Normal file
|
@ -0,0 +1,10 @@
|
|||
api.array :queries, api_meta(:total_count => @query_count, :offset => @offset, :limit => @limit) do
|
||||
@queries.each do |query|
|
||||
api.query do
|
||||
api.id query.id
|
||||
api.name query.name
|
||||
api.is_public query.is_public?
|
||||
api.project_id query.project_id
|
||||
end
|
||||
end
|
||||
end
|
25
app/views/queries/index.html.erb
Normal file
25
app/views/queries/index.html.erb
Normal file
|
@ -0,0 +1,25 @@
|
|||
<div class="contextual">
|
||||
<%= link_to_if_authorized l(:label_query_new), new_project_query_path(:project_id => @project), :class => 'icon icon-add' %>
|
||||
</div>
|
||||
|
||||
<h2><%= l(:label_query_plural) %></h2>
|
||||
|
||||
<% if @queries.empty? %>
|
||||
<p><i><%=l(:label_no_data)%></i></p>
|
||||
<% else %>
|
||||
<table class="list">
|
||||
<% @queries.each do |query| %>
|
||||
<tr>
|
||||
<td class="name">
|
||||
<%= link_to query.name, :controller => 'issues', :action => 'index', :project_id => @project, :query_id => query %>
|
||||
</td>
|
||||
<td class="buttons">
|
||||
<% if query.editable_by?(User.current) %>
|
||||
<%= link_to l(:button_edit), edit_query_path(query), :class => 'icon icon-edit' %>
|
||||
<%= delete_link query_path(query) %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
<% end %>
|
7
app/views/queries/new.html.erb
Normal file
7
app/views/queries/new.html.erb
Normal file
|
@ -0,0 +1,7 @@
|
|||
<h2><%= l(:label_query_new) %></h2>
|
||||
|
||||
<%= form_tag(@project ? project_queries_path(@project) : queries_path, :id => "query-form") do %>
|
||||
<%= hidden_field_tag 'type', @query.class.name %>
|
||||
<%= render :partial => 'form', :locals => {:query => @query} %>
|
||||
<%= submit_tag l(:button_save) %>
|
||||
<% end %>
|
Loading…
Add table
Add a link
Reference in a new issue