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