Project

General

Profile

Defect #30923 » 0001-Project-search-should-select-subprojects-scope-when-.patch

Marius BĂLTEANU, 2019-03-24 09:54

View differences:

app/views/layouts/base.html.erb
<%= hidden_field_tag 'scope', default_search_project_scope, :id => nil %>
<%= hidden_field_tag(controller.default_search_scope, 1, :id => nil) if controller.default_search_scope %>
<label for='q'>
<%= link_to l(:label_search), {:controller => 'search', :action => 'index', :id => @project}, :accesskey => accesskey(:search) %>:
<%= link_to l(:label_search), {:controller => 'search', :action => 'index', :id => @project, :scope => default_search_project_scope}, :accesskey => accesskey(:search) %>:
</label>
<%= text_field_tag 'q', @question, :size => 20, :class => 'small', :accesskey => accesskey(:quick_search) %>
<% end %>
test/functional/projects_controller_test.rb
:identifier => "blog",
:is_public => 1,
:custom_field_values => {
'3' => 'Beta'
},
'3' => 'Beta'
},
:tracker_ids => ['1', '3'],
# an issue custom field that is not for all project
:issue_custom_field_ids => ['9'],
......
:identifier => "blog",
:is_public => 1,
:custom_field_values => {
'3' => 'Beta'
},
'3' => 'Beta'
},
:parent_id => 1
}
}
assert_redirected_to '/projects/blog/settings'
......
:project => {
:name => "blog",
:identifier => "blog"
},
},
:continue => 'Create and continue'
}
end
......
:identifier => "blog",
:is_public => 1,
:custom_field_values => {
'3' => 'Beta'
},
'3' => 'Beta'
},
:tracker_ids => ['1', '3'],
:enabled_module_names => ['issue_tracking', 'news', 'repository']
}
}
......
:identifier => "blog",
:is_public => 1,
:custom_field_values => {
'3' => 'Beta'
},
'3' => 'Beta'
},
:parent_id => 1
}
}
end
......
:identifier => "blog",
:is_public => 1,
:custom_field_values => {
'3' => 'Beta'
},
'3' => 'Beta'
},
:parent_id => 1
}
}
assert_redirected_to '/projects/blog/settings'
......
:identifier => "blog",
:is_public => 1,
:custom_field_values => {
'3' => 'Beta'
}
'3' => 'Beta'
}
}
}
end
......
:identifier => "blog",
:is_public => 1,
:custom_field_values => {
'3' => 'Beta'
},
'3' => 'Beta'
},
:parent_id => 6
}
}
end
......
:name => "blog1",
:identifier => "blog1",
:enabled_module_names => ["issue_tracking", "repository"]
}
}
end
......
:name => "blog2",
:identifier => "blog2",
:enabled_module_names => ["issue_tracking", "repository"]
}
}
end
......
:identifier => 'inherited',
:parent_id => parent.id,
:inherit_members => '1'
}
}
assert_response 302
......
:name => "blog",
:identifier => "",
:enabled_module_names => %w(issue_tracking news)
}
}
end
......
@request.session[:user_id] = 1
project = Project.find_by_identifier('ecookbook')
project.archive
get :show, :params => {
:id => 'ecookbook'
}
......
:identifier => 'unique-copy',
:tracker_ids => ['1', '2', '3', ''],
:enabled_module_names => %w(issue_tracking time_tracking)
},
},
:only => %w(issues versions)
}
end
......
}
assert_select 'body.project-ecookbook'
end
def test_default_search_scope_in_global_page
get :index
assert_select 'div#quick-search form' do
assert_select 'input[name=scope][type=hidden]'
assert_select 'a[href=?]', '/search'
end
end
def test_default_search_scope_for_project_without_subprojects
get :show, :params => {
:id => 4,
}
assert_select 'div#quick-search form' do
assert_select 'input[name=scope][type=hidden]'
assert_select 'a[href=?]', '/projects/subproject2/search'
end
end
def test_default_search_scope_for_project_with_subprojects
get :show, :params => {
:id => 1,
}
assert_select 'div#quick-search form' do
assert_select 'input[name=scope][type=hidden][value=subprojects]'
assert_select 'a[href=?]', '/projects/ecookbook/search?scope=subprojects'
end
end
end
(3-3/3)