mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-10 13:16:09 +10:00
Allow filtering by Owned projects
This commit is contained in:
@@ -10,6 +10,11 @@ module FilterProjects
|
||||
def filter_projects(projects)
|
||||
projects = projects.search(params[:filter_projects]) if params[:filter_projects].present?
|
||||
projects = projects.non_archived if params[:archived].blank?
|
||||
|
||||
if params[:personal].present? and current_user
|
||||
projects = projects.personal(current_user)
|
||||
end
|
||||
|
||||
projects
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
- @sort ||= sort_value_recently_updated
|
||||
- personal = params[:personal]
|
||||
- archived = params[:archived]
|
||||
.dropdown.inline
|
||||
%button.dropdown-toggle.btn{type: 'button', 'data-toggle' => 'dropdown'}
|
||||
@@ -10,7 +11,7 @@
|
||||
Sort by
|
||||
- projects_sort_options_hash.each do |value, title|
|
||||
%li
|
||||
= link_to filter_projects_path(sort: value, archived: archived), class: ("is-active" if @sort == value) do
|
||||
= link_to filter_projects_path(sort: value, archived: archived, personal: personal), class: ("is-active" if @sort == value) do
|
||||
= title
|
||||
|
||||
%li.divider
|
||||
@@ -20,3 +21,10 @@
|
||||
%li
|
||||
= link_to filter_projects_path(sort: @sort, archived: true), class: ("is-active" if params[:archived].present?) do
|
||||
Show archived projects
|
||||
%li.divider
|
||||
%li
|
||||
= link_to filter_projects_path(sort: @sort, personal: nil), class: ("is-active" unless personal) do
|
||||
Owned by anyone
|
||||
%li
|
||||
= link_to filter_projects_path(sort: @sort, personal: true), class: ("is-active" if personal) do
|
||||
Owned by me
|
||||
|
||||
@@ -79,3 +79,8 @@ Feature: Dashboard
|
||||
And I sort the list by "Oldest updated"
|
||||
And I visit project "Shop" merge requests page
|
||||
Then The list should be sorted by "Oldest updated"
|
||||
|
||||
@javascript @focus
|
||||
Scenario: Sort owned Projects
|
||||
Then I filter the list by "Owned by me"
|
||||
Then The list should be filtered by "Owned by me"
|
||||
|
||||
@@ -138,6 +138,20 @@ module SharedIssuable
|
||||
end
|
||||
end
|
||||
|
||||
step 'I filter the list by "Owned by me"' do
|
||||
find('button.dropdown-toggle.btn').click
|
||||
|
||||
page.within('ul.dropdown-menu.dropdown-menu-align-right') do
|
||||
click_link "Owned by me"
|
||||
end
|
||||
end
|
||||
|
||||
step 'The list should be filtered by "Owned by me"' do
|
||||
page.within('ul.dropdown-menu.dropdown-menu-align-right') do
|
||||
expect(page).to have_selector('a', text: 'Owned by me')
|
||||
end
|
||||
end
|
||||
|
||||
step 'I should see "1 of 1" in the sidebar' do
|
||||
expect_sidebar_content('1 of 1')
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user