To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
root / app / views / queries / _form.html.erb @ 1591:63650ae64bf2
History | View | Annotate | Download (3.99 KB)
| 1 |
<%= error_messages_for 'query' %>
|
|---|---|
| 2 |
|
| 3 |
<div class="box"> |
| 4 |
<div class="tabular"> |
| 5 |
<%= hidden_field_tag 'gantt', '1' if params[:gantt] %>
|
| 6 |
|
| 7 |
<p><label for="query_name"><%=l(:field_name)%></label> |
| 8 |
<%= text_field 'query', 'name', :size => 80 %></p> |
| 9 |
|
| 10 |
<% if User.current.admin? || User.current.allowed_to?(:manage_public_queries, @project) %>
|
| 11 |
<p><label><%=l(:field_visible)%></label> |
| 12 |
<label class="block"><%= radio_button 'query', 'visibility', Query::VISIBILITY_PRIVATE %> <%= l(:label_visibility_private) %></label> |
| 13 |
<label class="block"><%= radio_button 'query', 'visibility', Query::VISIBILITY_ROLES %> <%= l(:label_visibility_roles) %>:</label> |
| 14 |
<% Role.givable.sorted.each do |role| %>
|
| 15 |
<label class="block role-visibility"><%= check_box_tag 'query[role_ids][]', role.id, @query.roles.include?(role), :id => nil %> <%= role.name %></label> |
| 16 |
<% end %>
|
| 17 |
<label class="block"><%= radio_button 'query', 'visibility', Query::VISIBILITY_PUBLIC %> <%= l(:label_visibility_public) %></label> |
| 18 |
<%= hidden_field_tag 'query[role_ids][]', '' %>
|
| 19 |
</p>
|
| 20 |
<% end %>
|
| 21 |
|
| 22 |
<p><label for="query_is_for_all"><%=l(:field_is_for_all)%></label> |
| 23 |
<%= check_box_tag 'query_is_for_all', 1, @query.project.nil?,
|
| 24 |
:disabled => (!@query.new_record? && (@query.project.nil? || (@query.is_public? && !User.current.admin?))) %></p> |
| 25 |
|
| 26 |
<% unless params[:gantt] %>
|
| 27 |
<fieldset><legend><%= l(:label_options) %></legend> |
| 28 |
<p><label for="query_default_columns"><%=l(:label_default_columns)%></label> |
| 29 |
<%= check_box_tag 'default_columns', 1, @query.has_default_columns?, :id => 'query_default_columns',
|
| 30 |
:onclick => 'if (this.checked) {$("#columns").hide();} else {$("#columns").show();}' %></p> |
| 31 |
|
| 32 |
<p><label for="query_group_by"><%= l(:field_group_by) %></label> |
| 33 |
<%= select 'query', 'group_by', @query.groupable_columns.collect {|c| [c.caption, c.name.to_s]}, :include_blank => true %></p> |
| 34 |
|
| 35 |
<p><label><%= l(:button_show) %></label> |
| 36 |
<%= available_block_columns_tags(@query) %></p> |
| 37 |
</fieldset>
|
| 38 |
<% else %>
|
| 39 |
<fieldset><legend><%= l(:label_options) %></legend> |
| 40 |
<p><label><%= l(:button_show) %></label> |
| 41 |
<label class="inline"><%= check_box_tag "query[draw_relations]", "1", @query.draw_relations %> <%= l(:label_related_issues) %></label> |
| 42 |
<label class="inline"><%= check_box_tag "query[draw_progress_line]", "1", @query.draw_progress_line %> <%= l(:label_gantt_progress_line) %></label> |
| 43 |
</p>
|
| 44 |
</fieldset>
|
| 45 |
<% end %>
|
| 46 |
</div>
|
| 47 |
|
| 48 |
<fieldset id="filters"><legend><%= l(:label_filter_plural) %></legend> |
| 49 |
<%= render :partial => 'queries/filters', :locals => {:query => query}%>
|
| 50 |
</fieldset>
|
| 51 |
|
| 52 |
<% unless params[:gantt] %>
|
| 53 |
<fieldset><legend><%= l(:label_sort) %></legend> |
| 54 |
<% 3.times do |i| %>
|
| 55 |
<%= i+1 %>:
|
| 56 |
<%= label_tag "query_sort_criteria_attribute_" + i.to_s,
|
| 57 |
l(:description_query_sort_criteria_attribute), :class => "hidden-for-sighted" %>
|
| 58 |
<%= select_tag("query[sort_criteria][#{i}][]",
|
| 59 |
options_for_select([[]] + query.available_columns.select(&:sortable?).collect {|column| [column.caption, column.name.to_s]}, @query.sort_criteria_key(i)),
|
| 60 |
:id => "query_sort_criteria_attribute_" + i.to_s)%>
|
| 61 |
<%= label_tag "query_sort_criteria_direction_" + i.to_s,
|
| 62 |
l(:description_query_sort_criteria_direction), :class => "hidden-for-sighted" %>
|
| 63 |
<%= select_tag("query[sort_criteria][#{i}][]",
|
| 64 |
options_for_select([[], [l(:label_ascending), 'asc'], [l(:label_descending), 'desc']], @query.sort_criteria_order(i)),
|
| 65 |
:id => "query_sort_criteria_direction_" + i.to_s) %>
|
| 66 |
<br /> |
| 67 |
<% end %>
|
| 68 |
</fieldset>
|
| 69 |
<% end %>
|
| 70 |
|
| 71 |
<% unless params[:gantt] %>
|
| 72 |
<%= content_tag 'fieldset', :id => 'columns', :style => (query.has_default_columns? ? 'display:none;' : nil) do %>
|
| 73 |
<legend><%= l(:field_column_names) %></legend> |
| 74 |
<%= render_query_columns_selection(query) %>
|
| 75 |
<% end %>
|
| 76 |
<% end %>
|
| 77 |
|
| 78 |
</div>
|
| 79 |
|
| 80 |
<%= javascript_tag do %>
|
| 81 |
$(document).ready(function(){
|
| 82 |
$("input[name='query[visibility]']").change(function(){
|
| 83 |
var checked = $('#query_visibility_1').is(':checked');
|
| 84 |
$("input[name='query[role_ids][]'][type=checkbox]").attr('disabled', !checked);
|
| 85 |
}).trigger('change');
|
| 86 |
}); |
| 87 |
<% end %>
|