Introduces status filters in timeline UI.

pull/465/head
Martin Czuchra 11 years ago
parent 80964c1567
commit 6c94d20d83
  1. 24
      app/models/timeline.rb
  2. 27
      app/views/timelines/filter/_planning_elements.html.erb

@ -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)

@ -44,6 +44,33 @@ See doc/COPYRIGHT.rdoc for more details.
</p>
<p class="tl-form-overflow">
<%= 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 %>
</p>
<p class="tl-form-overflow">
<%= label_tag 'timeline_options_planning_element_types',
l("timelines.filter.types") %>

Loading…
Cancel
Save