0003-Filter-after-parent-project.patch

Marius BALTEANU, 2019-09-28 18:45

Download (1.91 KB)

View differences:

app/models/project_query.rb
37 37
    )
38 38
    add_available_filter "name", :type => :text
39 39
    add_available_filter "description", :type => :text
40
    add_available_filter("parent_id",
41
      :type => :list_subprojects, :values => lambda { project_values }, :label => :field_parent
42
    )
40 43
    add_available_filter "is_public",
41 44
      :type => :list,
42 45
      :values => [[l(:general_text_yes), "1"], [l(:general_text_no), "0"]]
test/functional/projects_controller_test.rb
75 75
    end
76 76
  end
77 77

  
78
  def test_index_with_subproject_filter
79
    @request.session[:user_id] = 1
80

  
81
    get :index, :params => {
82
      :f => ['parent_id'],
83
      :op => {'parent_id' => '='},
84
      :v => {'parent_id' => ['1']}
85
    }
86

  
87
    assert_response :success
88

  
89
    assert_select 'div#projects-index ul' do
90
      assert_select 'a.project',  3
91
      assert_select 'a', :text => 'eCookbook Subproject 1'
92
      assert_select 'a', :text => 'eCookbook Subproject 2'
93
      assert_select 'a', :text => 'Private child of eCookbook'
94
    end
95
  end
96

  
78 97
  def test_autocomplete_js
79 98
    get :autocomplete, :params => {
80 99
        :format => 'js',
81
-