Patch by Marius BALTEANU. git-svn-id: http://svn.redmine.org/redmine/trunk@18762 e93f8b46-1217-0410-a6f0-8f06a7374b81tags/4.1.0
@@ -20,6 +20,7 @@ | |||
class ProjectQuery < Query | |||
self.queried_class = Project | |||
self.view_permission = :search_project | |||
self.available_columns = [] | |||
@@ -31,6 +32,9 @@ class ProjectQuery < Query | |||
def initialize_available_filters | |||
add_available_filter "status", | |||
:type => :list, :values => lambda { project_statuses_values } | |||
add_available_filter("id", | |||
:type => :list, :values => lambda { project_values }, :label => :field_project | |||
) | |||
add_available_filter "name", :type => :text | |||
add_available_filter "description", :type => :text | |||
add_available_filter "is_public", |
@@ -905,7 +905,7 @@ class Query < ActiveRecord::Base | |||
end | |||
end | |||
if field == 'project_id' | |||
if field == 'project_id' || (self.type == 'ProjectQuery' && field == 'id') | |||
if v.delete('mine') | |||
v += User.current.memberships.map(&:project_id).map(&:to_s) | |||
end |
@@ -56,6 +56,25 @@ class ProjectsControllerTest < Redmine::ControllerTest | |||
assert_select 'feed>entry', :count => Project.visible(User.current).count | |||
end | |||
def test_index_with_project_filter_is_my_projects | |||
@request.session[:user_id] = 2 | |||
get :index, :params => { | |||
:f => ['id'], | |||
:op => {'id' => '='}, | |||
:v => {'id' => ['mine']} | |||
} | |||
assert_response :success | |||
assert_select 'div#projects-index ul' do | |||
assert_select 'a.project', 3 | |||
assert_select 'a', :text => 'eCookbook' | |||
assert_select 'a', :text => 'OnlineStore' | |||
assert_select 'a', :text => 'Private child of eCookbook' | |||
end | |||
end | |||
def test_autocomplete_js | |||
get :autocomplete, :params => { | |||
:format => 'js', |