mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-23 03:26:07 +10:00
Merge branch 'issue_3799' into 'master'
Allow filtering by Owned projects on dashboard page Closes #3799  See merge request !3762
This commit is contained in:
@@ -108,6 +108,7 @@ v 8.7.0 (unreleased)
|
||||
- Updated print style for issues
|
||||
- Use GitHub Issue/PR number as iid to keep references
|
||||
- Import GitHub labels
|
||||
- Add option to filter by "Owned projects" on dashboard page
|
||||
- Import GitHub milestones
|
||||
- Fix emoji catgories in the emoji picker
|
||||
- Execute system web hooks on push to the project
|
||||
|
||||
@@ -10,6 +10,8 @@ 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?
|
||||
projects = projects.personal(current_user) if params[:personal].present? && current_user
|
||||
|
||||
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,11 @@
|
||||
%li
|
||||
= link_to filter_projects_path(sort: @sort, archived: true), class: ("is-active" if params[:archived].present?) do
|
||||
Show archived projects
|
||||
- if current_user
|
||||
%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
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe "Dashboard projects filters", feature: true, js: true do
|
||||
|
||||
context 'filtering personal projects' do
|
||||
before do
|
||||
user = create(:user)
|
||||
project = create(:project, name: "Victorialand", namespace: user.namespace)
|
||||
project.team << [user, :master]
|
||||
|
||||
login_as(user)
|
||||
visit dashboard_projects_path
|
||||
|
||||
open_filter_dropdown
|
||||
click_link "Owned by me"
|
||||
end
|
||||
|
||||
it 'filters by projects "Owned by me"' do
|
||||
sleep 1
|
||||
open_filter_dropdown
|
||||
page.within('ul.dropdown-menu.dropdown-menu-align-right') do
|
||||
expect(page).to have_css('.is-active', text: 'Owned by me')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def open_filter_dropdown
|
||||
find('button.dropdown-toggle.btn').click
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user