diff --git a/app/models/timeline.rb b/app/models/timeline.rb index 2623722535..b6c63d74ca 100644 --- a/app/models/timeline.rb +++ b/app/models/timeline.rb @@ -66,9 +66,9 @@ class Timeline < ActiveRecord::Base "compare_to_relative", "compare_to_relative_unit", "comparison", + "exclude_empty", "exclude_own_planning_elements", "exclude_reporters", - "exclude_empty", "exist", "grouping_one_enabled", "grouping_one_selection", @@ -81,19 +81,20 @@ class Timeline < ActiveRecord::Base "initial_outline_expansion", "parents", "planning_element_responsibles", - "planning_element_types", - "planning_element_time_types", + "planning_element_status", + "planning_element_time", "planning_element_time_absolute_one", "planning_element_time_absolute_two", "planning_element_time_relative_one", - "planning_element_time_relative_two", "planning_element_time_relative_one_unit", + "planning_element_time_relative_two", "planning_element_time_relative_two_unit", - "planning_element_time", + "planning_element_time_types", + "planning_element_types", "project_responsibles", + "project_sort", "project_status", "project_types", - "project_sort", "timeframe_end", "timeframe_start", "vertical_planning_elements", @@ -187,6 +188,17 @@ class Timeline < ActiveRecord::Base Type.find(:all, :order => :name) end + def available_planning_element_status + types = Project.visible.includes(:types).map(&:types).flatten.uniq + types.map(&:issue_statuses).flatten.uniq + end + + def selected_planning_element_status + resolve_with_none_element(:planning_element_status) do |ary| + IssueStatus.find(ary) + end + end + def selected_planning_element_types resolve_with_none_element(:planning_element_types) do |ary| Type.find(ary) diff --git a/app/views/timelines/filter/_planning_elements.html.erb b/app/views/timelines/filter/_planning_elements.html.erb index 9227f61a7c..fc7189b525 100644 --- a/app/views/timelines/filter/_planning_elements.html.erb +++ b/app/views/timelines/filter/_planning_elements.html.erb @@ -44,6 +44,33 @@ See doc/COPYRIGHT.rdoc for more details.

+

+ <%= label_tag 'timeline_options_planning_element_status', + l("timelines.filter.status") %> + + <% if User.current.impaired? %> + <%= select("timeline[options]", + :planning_element_status, + filter_select_with_none( + @timeline.available_planning_element_status, + :name, :id), + {:selected => @timeline.selected_planning_element_status.map(&:id)}, + {:multiple => true, + :size => 12}) %> + <% else %> + <%= select("timeline[options]", :planning_element_status, + options_for_select([]), + {}, + { :'data-ajaxURL' => url_for({:controller => "/api/v2/planning_element_status", + :action => "paginate_planning_element_status"}), + :multiple => true, + :'data-selected' => filter_select( + timeline.selected_planning_element_status, + :name, :id).to_json + }) %> + <% end %> +

+

<%= label_tag 'timeline_options_planning_element_types', l("timelines.filter.types") %>