@@ -1,84 +1,85 | |||
|
1 | 1 | <div class="contextual"> |
|
2 | 2 | <% if !@query.new_record? && @query.editable_by?(User.current) %> |
|
3 | 3 | <%= link_to l(:button_edit), {:controller => 'queries', :action => 'edit', :id => @query}, :class => 'icon icon-edit' %> |
|
4 | 4 | <%= link_to l(:button_delete), {:controller => 'queries', :action => 'destroy', :id => @query}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %> |
|
5 | 5 | <% end %> |
|
6 | 6 | </div> |
|
7 | 7 | |
|
8 | 8 | <h2><%= @query.new_record? ? l(:label_issue_plural) : h(@query.name) %></h2> |
|
9 | 9 | <% html_title(@query.new_record? ? l(:label_issue_plural) : @query.name) %> |
|
10 | 10 | |
|
11 | 11 | <% form_tag({ :controller => 'queries', :action => 'new' }, :id => 'query_form') do %> |
|
12 | 12 | <%= hidden_field_tag('project_id', @project.to_param) if @project %> |
|
13 | 13 | <div id="query_form_content" class="hide-when-print"> |
|
14 | 14 | <fieldset id="filters" class="collapsible <%= @query.new_record? ? "" : "collapsed" %>"> |
|
15 | 15 | <legend onclick="toggleFieldset(this);"><%= l(:label_filter_plural) %></legend> |
|
16 | 16 | <div style="<%= @query.new_record? ? "" : "display: none;" %>"> |
|
17 | 17 | <%= render :partial => 'queries/filters', :locals => {:query => @query} %> |
|
18 | 18 | </div> |
|
19 | 19 | </fieldset> |
|
20 | 20 | <fieldset class="collapsible collapsed"> |
|
21 | 21 | <legend onclick="toggleFieldset(this);"><%= l(:label_options) %></legend> |
|
22 | 22 | <div style="display: none;"> |
|
23 | 23 | <table> |
|
24 | 24 | <tr> |
|
25 | 25 | <td><%= l(:field_column_names) %></td> |
|
26 | 26 | <td><%= render :partial => 'queries/columns', :locals => {:query => @query} %></td> |
|
27 | 27 | </tr> |
|
28 | 28 | <tr> |
|
29 | 29 | <td><%= l(:field_group_by) %></td> |
|
30 | 30 | <td><%= select_tag('group_by', options_for_select([[]] + @query.groupable_columns.collect {|c| [c.caption, c.name.to_s]}, @query.group_by)) %></td> |
|
31 | 31 | </tr> |
|
32 | 32 | </table> |
|
33 | 33 | </div> |
|
34 | 34 | </fieldset> |
|
35 | 35 | </div> |
|
36 | 36 | <p class="buttons hide-when-print"> |
|
37 | 37 | |
|
38 | 38 | <%= link_to_remote l(:button_apply), |
|
39 | 39 | { :url => { :set_filter => 1 }, |
|
40 | 40 | :before => 'selectAllOptions("selected_columns");', |
|
41 | 41 | :update => "content", |
|
42 | :complete => "apply_filters_observer()", | |
|
42 | 43 | :with => "Form.serialize('query_form')" |
|
43 | 44 | }, :class => 'icon icon-checked' %> |
|
44 | 45 | |
|
45 | 46 | <%= link_to_remote l(:button_clear), |
|
46 | 47 | { :url => { :set_filter => 1, :project_id => @project }, |
|
47 | 48 | :method => :get, |
|
48 | 49 | :update => "content", |
|
49 | 50 | }, :class => 'icon icon-reload' %> |
|
50 | 51 | |
|
51 | 52 | <% if @query.new_record? && User.current.allowed_to?(:save_queries, @project, :global => true) %> |
|
52 | 53 | <%= link_to l(:button_save), {}, :onclick => "selectAllOptions('selected_columns'); $('query_form').submit(); return false;", :class => 'icon icon-save' %> |
|
53 | 54 | <% end %> |
|
54 | 55 | </p> |
|
55 | 56 | <% end %> |
|
56 | 57 | |
|
57 | 58 | <%= error_messages_for 'query' %> |
|
58 | 59 | <% if @query.valid? %> |
|
59 | 60 | <% if @issues.empty? %> |
|
60 | 61 | <p class="nodata"><%= l(:label_no_data) %></p> |
|
61 | 62 | <% else %> |
|
62 | 63 | <%= render :partial => 'issues/list', :locals => {:issues => @issues, :query => @query} %> |
|
63 | 64 | <p class="pagination"><%= pagination_links_full @issue_pages, @issue_count %></p> |
|
64 | 65 | <% end %> |
|
65 | 66 | |
|
66 | 67 | <% other_formats_links do |f| %> |
|
67 | 68 | <%= f.link_to 'Atom', :url => { :project_id => @project, :query_id => (@query.new_record? ? nil : @query), :key => User.current.rss_key } %> |
|
68 | 69 | <%= f.link_to 'CSV', :url => { :project_id => @project } %> |
|
69 | 70 | <%= f.link_to 'PDF', :url => { :project_id => @project } %> |
|
70 | 71 | <% end %> |
|
71 | 72 | |
|
72 | 73 | <% end %> |
|
73 | 74 | <%= call_hook(:view_issues_index_bottom, { :issues => @issues, :project => @project, :query => @query }) %> |
|
74 | 75 | |
|
75 | 76 | <% content_for :sidebar do %> |
|
76 | 77 | <%= render :partial => 'issues/sidebar' %> |
|
77 | 78 | <% end %> |
|
78 | 79 | |
|
79 | 80 | <% content_for :header_tags do %> |
|
80 | 81 | <%= auto_discovery_link_tag(:atom, {:query_id => @query, :format => 'atom', :page => nil, :key => User.current.rss_key}, :title => l(:label_issue_plural)) %> |
|
81 | 82 | <%= auto_discovery_link_tag(:atom, {:controller => 'journals', :action => 'index', :query_id => @query, :format => 'atom', :page => nil, :key => User.current.rss_key}, :title => l(:label_changes_details)) %> |
|
82 | 83 | <% end %> |
|
83 | 84 | |
|
84 | 85 | <%= context_menu issues_context_menu_path %> |
@@ -1,104 +1,116 | |||
|
1 | 1 | <script type="text/javascript"> |
|
2 | 2 | //<![CDATA[ |
|
3 | 3 | function add_filter() { |
|
4 | 4 | select = $('add_filter_select'); |
|
5 | 5 | field = select.value |
|
6 | 6 | Element.show('tr_' + field); |
|
7 | 7 | check_box = $('cb_' + field); |
|
8 | 8 | check_box.checked = true; |
|
9 | 9 | toggle_filter(field); |
|
10 | 10 | select.selectedIndex = 0; |
|
11 | 11 | |
|
12 | 12 | for (i=0; i<select.options.length; i++) { |
|
13 | 13 | if (select.options[i].value == field) { |
|
14 | 14 | select.options[i].disabled = true; |
|
15 | 15 | } |
|
16 | 16 | } |
|
17 | 17 | } |
|
18 | 18 | |
|
19 | 19 | function toggle_filter(field) { |
|
20 | 20 | check_box = $('cb_' + field); |
|
21 | 21 | |
|
22 | 22 | if (check_box.checked) { |
|
23 | 23 | Element.show("operators_" + field); |
|
24 | 24 | toggle_operator(field); |
|
25 | 25 | } else { |
|
26 | 26 | Element.hide("operators_" + field); |
|
27 | 27 | Element.hide("div_values_" + field); |
|
28 | 28 | } |
|
29 | 29 | } |
|
30 | 30 | |
|
31 | 31 | function toggle_operator(field) { |
|
32 | 32 | operator = $("operators_" + field); |
|
33 | 33 | switch (operator.value) { |
|
34 | 34 | case "!*": |
|
35 | 35 | case "*": |
|
36 | 36 | case "t": |
|
37 | 37 | case "w": |
|
38 | 38 | case "o": |
|
39 | 39 | case "c": |
|
40 | 40 | Element.hide("div_values_" + field); |
|
41 | 41 | break; |
|
42 | 42 | default: |
|
43 | 43 | Element.show("div_values_" + field); |
|
44 | 44 | break; |
|
45 | 45 | } |
|
46 | 46 | } |
|
47 | 47 | |
|
48 | 48 | function toggle_multi_select(field) { |
|
49 | 49 | select = $('values_' + field); |
|
50 | 50 | if (select.multiple == true) { |
|
51 | 51 | select.multiple = false; |
|
52 | 52 | } else { |
|
53 | 53 | select.multiple = true; |
|
54 | 54 | } |
|
55 | 55 | } |
|
56 | ||
|
57 | function apply_filters_observer() { | |
|
58 | $$("#query_form input[type=text]").invoke("observe", "keypress", function(e){ | |
|
59 | if(e.keyCode == Event.KEY_RETURN) { | |
|
60 | <%= remote_function(:url => { :set_filter => 1}, | |
|
61 | :update => "content", | |
|
62 | :with => "Form.serialize('query_form')", | |
|
63 | :complete => "e.stop(); apply_filters_observer()") %> | |
|
64 | } | |
|
65 | }); | |
|
66 | } | |
|
67 | Event.observe(document,"dom:loaded", apply_filters_observer); | |
|
56 | 68 |
|
|
57 | 69 | </script> |
|
58 | 70 | |
|
59 | 71 | <table width="100%"> |
|
60 | 72 | <tr> |
|
61 | 73 | <td> |
|
62 | 74 | <table> |
|
63 | 75 | <% query.available_filters.sort{|a,b| a[1][:order]<=>b[1][:order]}.each do |filter| %> |
|
64 | 76 | <% field = filter[0] |
|
65 | 77 | options = filter[1] %> |
|
66 | 78 | <tr <%= 'style="display:none;"' unless query.has_filter?(field) %> id="tr_<%= field %>" class="filter"> |
|
67 | 79 | <td style="width:200px;"> |
|
68 | 80 | <%= check_box_tag 'fields[]', field, query.has_filter?(field), :onclick => "toggle_filter('#{field}');", :id => "cb_#{field}" %> |
|
69 | 81 | <label for="cb_<%= field %>"><%= filter[1][:name] || l(("field_"+field.to_s.gsub(/\_id$/, "")).to_sym) %></label> |
|
70 | 82 | </td> |
|
71 | 83 | <td style="width:150px;"> |
|
72 | 84 | <%= select_tag "operators[#{field}]", options_for_select(operators_for_select(options[:type]), query.operator_for(field)), :id => "operators_#{field}", :onchange => "toggle_operator('#{field}');", :class => "select-small", :style => "vertical-align: top;" %> |
|
73 | 85 | </td> |
|
74 | 86 | <td> |
|
75 | 87 | <div id="div_values_<%= field %>" style="display:none;"> |
|
76 | 88 | <% case options[:type] |
|
77 | 89 | when :list, :list_optional, :list_status, :list_subprojects %> |
|
78 | 90 | <select <%= "multiple=true" if query.values_for(field) and query.values_for(field).length > 1 %> name="values[<%= field %>][]" id="values_<%= field %>" class="select-small" style="vertical-align: top;"> |
|
79 | 91 | <%= options_for_select options[:values], query.values_for(field) %> |
|
80 | 92 | </select> |
|
81 | 93 | <%= link_to_function image_tag('bullet_toggle_plus.png'), "toggle_multi_select('#{field}');", :style => "vertical-align: bottom;" %> |
|
82 | 94 | <% when :date, :date_past %> |
|
83 | 95 | <%= text_field_tag "values[#{field}][]", query.values_for(field), :id => "values_#{field}", :size => 3, :class => "select-small" %> <%= l(:label_day_plural) %> |
|
84 | 96 | <% when :string, :text %> |
|
85 | 97 | <%= text_field_tag "values[#{field}][]", query.values_for(field), :id => "values_#{field}", :size => 30, :class => "select-small" %> |
|
86 | 98 | <% when :integer %> |
|
87 | 99 | <%= text_field_tag "values[#{field}][]", query.values_for(field), :id => "values_#{field}", :size => 3, :class => "select-small" %> |
|
88 | 100 | <% end %> |
|
89 | 101 | </div> |
|
90 | 102 | <script type="text/javascript">toggle_filter('<%= field %>');</script> |
|
91 | 103 | </td> |
|
92 | 104 | </tr> |
|
93 | 105 | <% end %> |
|
94 | 106 | </table> |
|
95 | 107 | </td> |
|
96 | 108 | <td class="add-filter"> |
|
97 | 109 | <%= label_tag('add_filter_select', l(:label_filter_add)) %>: |
|
98 | 110 | <%= select_tag 'add_filter_select', options_for_select([["",""]] + query.available_filters.sort{|a,b| a[1][:order]<=>b[1][:order]}.collect{|field| [ field[1][:name] || l(("field_"+field[0].to_s.gsub(/_id$/, "")).to_sym), field[0]] unless query.has_filter?(field[0])}.compact), |
|
99 | 111 | :onchange => "add_filter();", |
|
100 | 112 | :class => "select-small", |
|
101 | 113 | :name => nil %> |
|
102 | 114 | </td> |
|
103 | 115 | </tr> |
|
104 | 116 | </table> |
General Comments 0
You need to be logged in to leave comments.
Login now