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