Commit b51e2a05 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'starred-projects' into 'master'

Add starred projects page to dashboard

For #1836 and #2069

See merge request !1659
parents 5a51a798 b8d73315
...@@ -33,6 +33,7 @@ v 7.9.0 (unreleased) ...@@ -33,6 +33,7 @@ v 7.9.0 (unreleased)
- Send notifications and leave system comments when bulk updating issues. - Send notifications and leave system comments when bulk updating issues.
- Automatically link commit ranges to compare page: sha1...sha4 or sha1..sha4 (includes sha1 in comparison) - Automatically link commit ranges to compare page: sha1...sha4 or sha1..sha4 (includes sha1 in comparison)
- Move groups page from profile to dashboard - Move groups page from profile to dashboard
- Starred projects page at dashboard
v 7.8.2 v 7.8.2
- Fix service migration issue when upgrading from versions prior to 7.3 - Fix service migration issue when upgrading from versions prior to 7.3
......
...@@ -55,6 +55,9 @@ class Dispatcher ...@@ -55,6 +55,9 @@ class Dispatcher
when 'dashboard:show' when 'dashboard:show'
new Dashboard() new Dashboard()
new Activities() new Activities()
when 'dashboard:projects:starred'
new Activities()
new ProjectsList()
when 'projects:commit:show' when 'projects:commit:show'
new Commit() new Commit()
new Diff() new Diff()
......
class Dashboard::ProjectsController < ApplicationController
before_filter :event_filter
def starred
@projects = current_user.starred_projects
@projects = @projects.includes(:namespace, :forked_from_project, :tags)
@projects = @projects.sort(@sort = params[:sort])
@groups = []
respond_to do |format|
format.html
format.json do
load_events
pager_json("events/_events", @events.count)
end
end
end
private
def load_events
@events = Event.in_projects(@projects.pluck(:id))
@events = @event_filter.apply_filter(@events).with_associations
@events = @events.limit(20).offset(params[:offset] || 0)
end
end
...@@ -10,9 +10,9 @@ ...@@ -10,9 +10,9 @@
.tab-content .tab-content
.tab-pane.active#projects .tab-pane.active#projects
= render "projects", projects: @projects = render "dashboard/projects", projects: @projects
.tab-pane#groups .tab-pane#groups
= render "groups", groups: @groups = render "dashboard/groups", groups: @groups
.prepend-top-20 .prepend-top-20
= render 'shared/promo' = render 'shared/promo'
- if @projects.any?
.dashboard.row
%section.activities.col-md-8
= render 'dashboard/activities'
%aside.col-md-4
.panel.panel-default
.panel-heading.clearfix
.input-group
= search_field_tag :filter_projects, nil, placeholder: 'Filter by name', class: 'projects-list-filter form-control'
- if current_user.can_create_project?
.input-group-addon.dash-new-project
= link_to new_project_path do
%strong New project
= render 'shared/projects_list', projects: @projects,
projects_limit: 20, stars: true, avatar: false
= link_to '#aside', class: 'show-aside' do
%i.fa.fa-angle-left
- else
%h3 You dont have starred projects yet
%p.slead Visit project page and press on star icon and it will appear on this page.
= render @events = render partial: 'events/event', collection: @events
...@@ -9,6 +9,11 @@ ...@@ -9,6 +9,11 @@
%i.fa.fa-cube %i.fa.fa-cube
%span %span
Projects Projects
= nav_link(path: 'projects#starred') do
= link_to starred_dashboard_projects_path, title: 'Starred Projects' do
%i.fa.fa-star
%span
Starred Projects
= nav_link(controller: :groups) do = nav_link(controller: :groups) do
= link_to dashboard_groups_path, title: 'Groups' do = link_to dashboard_groups_path, title: 'Groups' do
%i.fa.fa-group %i.fa.fa-group
......
...@@ -221,6 +221,12 @@ Gitlab::Application.routes.draw do ...@@ -221,6 +221,12 @@ Gitlab::Application.routes.draw do
delete :leave delete :leave
end end
end end
resources :projects, only: [] do
collection do
get :starred
end
end
end end
end end
......
@dashboard
Feature: Dashboard Starred Projects
Background:
Given I sign in as a user
And public project "Community"
And I starred project "Community"
And I own project "Shop"
And I visit dashboard starred projects page
Scenario: I should see projects list
Then I should see project "Community"
And I should not see project "Shop"
class Spinach::Features::DashboardStarredProjects < Spinach::FeatureSteps
include SharedAuthentication
include SharedPaths
include SharedProject
step 'I starred project "Community"' do
current_user.toggle_star(Project.find_by(name: 'Community'))
end
step 'I should not see project "Shop"' do
within 'aside' do
page.should_not have_content('Shop')
end
end
end
...@@ -95,6 +95,10 @@ module SharedPaths ...@@ -95,6 +95,10 @@ module SharedPaths
current_path.should == dashboard_groups_path current_path.should == dashboard_groups_path
end end
step 'I visit dashboard starred projects page' do
visit starred_dashboard_projects_path
end
# ---------------------------------------- # ----------------------------------------
# Profile # Profile
# ---------------------------------------- # ----------------------------------------
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment