@@ -1,92 +1,92 | |||
|
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, @query.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_PUBLIC %> <%= l(:label_visibility_public) %></label> |
|
14 | 14 | <label class="block"><%= radio_button 'query', 'visibility', Query::VISIBILITY_ROLES %> <%= l(:label_visibility_roles) %>:</label> |
|
15 | 15 | <% Role.givable.sorted.each do |role| %> |
|
16 | 16 | <label class="block role-visibility"><%= check_box_tag 'query[role_ids][]', role.id, @query.roles.include?(role), :id => nil %> <%= role.name %></label> |
|
17 | 17 | <% end %> |
|
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?, :class => (User.current.admin? ? '' : 'disable-unless-private') %></p> |
|
24 | 24 | |
|
25 | 25 | <% unless params[:gantt] %> |
|
26 | 26 | <fieldset id="options"><legend><%= l(:label_options) %></legend> |
|
27 | 27 | <p><label for="query_default_columns"><%=l(:label_default_columns)%></label> |
|
28 | 28 | <%= 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> | |
|
29 | :data => {:disables => "#columns, .block_columns input"} %></p> | |
|
30 | 30 | |
|
31 | 31 | <p><label for="query_group_by"><%= l(:field_group_by) %></label> |
|
32 | 32 | <%= select 'query', 'group_by', @query.groupable_columns.collect {|c| [c.caption, c.name.to_s]}, :include_blank => true %></p> |
|
33 | 33 | |
|
34 | <p><label><%= l(:button_show) %></label> | |
|
34 | <p class="block_columns"><label><%= l(:button_show) %></label> | |
|
35 | 35 | <%= available_block_columns_tags(@query) %></p> |
|
36 | 36 | |
|
37 | 37 | <p><label><%= l(:label_total_plural) %></label> |
|
38 | 38 | <%= available_totalable_columns_tags(@query) %></p> |
|
39 | 39 | </fieldset> |
|
40 | 40 | <% else %> |
|
41 | 41 | <fieldset id="options"><legend><%= l(:label_options) %></legend> |
|
42 | 42 | <p><label><%= l(:button_show) %></label> |
|
43 | 43 | <label class="inline"><%= check_box_tag "query[draw_relations]", "1", @query.draw_relations %> <%= l(:label_related_issues) %></label> |
|
44 | 44 | <label class="inline"><%= check_box_tag "query[draw_progress_line]", "1", @query.draw_progress_line %> <%= l(:label_gantt_progress_line) %></label> |
|
45 | 45 | </p> |
|
46 | 46 | </fieldset> |
|
47 | 47 | <% end %> |
|
48 | 48 | </div> |
|
49 | 49 | |
|
50 | 50 | <fieldset id="filters"><legend><%= l(:label_filter_plural) %></legend> |
|
51 | 51 | <%= render :partial => 'queries/filters', :locals => {:query => query}%> |
|
52 | 52 | </fieldset> |
|
53 | 53 | |
|
54 | 54 | <% unless params[:gantt] %> |
|
55 | 55 | <fieldset><legend><%= l(:label_sort) %></legend> |
|
56 | 56 | <% 3.times do |i| %> |
|
57 | 57 | <%= content_tag(:span, "#{i+1}:", :class => 'query_sort_criteria_count')%> |
|
58 | 58 | <%= label_tag "query_sort_criteria_attribute_" + i.to_s, |
|
59 | 59 | l(:description_query_sort_criteria_attribute), :class => "hidden-for-sighted" %> |
|
60 | 60 | <%= select_tag("query[sort_criteria][#{i}][]", |
|
61 | 61 | options_for_select([[]] + query.available_columns.select(&:sortable?).collect {|column| [column.caption, column.name.to_s]}, @query.sort_criteria_key(i)), |
|
62 | 62 | :id => "query_sort_criteria_attribute_" + i.to_s)%> |
|
63 | 63 | <%= label_tag "query_sort_criteria_direction_" + i.to_s, |
|
64 | 64 | l(:description_query_sort_criteria_direction), :class => "hidden-for-sighted" %> |
|
65 | 65 | <%= select_tag("query[sort_criteria][#{i}][]", |
|
66 | 66 | options_for_select([[], [l(:label_ascending), 'asc'], [l(:label_descending), 'desc']], @query.sort_criteria_order(i)), |
|
67 | 67 | :id => "query_sort_criteria_direction_" + i.to_s) %> |
|
68 | 68 | <br /> |
|
69 | 69 | <% end %> |
|
70 | 70 | </fieldset> |
|
71 | 71 | <% end %> |
|
72 | 72 | |
|
73 | 73 | <% unless params[:gantt] %> |
|
74 |
<%= content_tag 'fieldset', :id => 'columns' |
|
|
74 | <%= content_tag 'fieldset', :id => 'columns' do %> | |
|
75 | 75 | <legend><%= l(:field_column_names) %></legend> |
|
76 | 76 | <%= render_query_columns_selection(query) %> |
|
77 | 77 | <% end %> |
|
78 | 78 | <% end %> |
|
79 | 79 | |
|
80 | 80 | </div> |
|
81 | 81 | |
|
82 | 82 | <%= javascript_tag do %> |
|
83 | 83 | $(document).ready(function(){ |
|
84 | 84 | $("input[name='query[visibility]']").change(function(){ |
|
85 | 85 | var roles_checked = $('#query_visibility_1').is(':checked'); |
|
86 | 86 | var private_checked = $('#query_visibility_0').is(':checked'); |
|
87 | 87 | $("input[name='query[role_ids][]'][type=checkbox]").attr('disabled', !roles_checked); |
|
88 | 88 | if (!private_checked) $("input.disable-unless-private").attr('checked', false); |
|
89 | 89 | $("input.disable-unless-private").attr('disabled', !private_checked); |
|
90 | 90 | }).trigger('change'); |
|
91 | 91 | }); |
|
92 | 92 | <% end %> |
General Comments 0
You need to be logged in to leave comments.
Login now