Commit d36ee319 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Add starred projects page to dashboard

parent e89ffd54
......@@ -33,6 +33,7 @@ v 7.9.0 (unreleased)
- 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)
- Move groups page from profile to dashboard
- Starred projects page at dashboard
v 7.8.2
- Fix service migration issue when upgrading from versions prior to 7.3
......
......@@ -55,6 +55,9 @@ class Dispatcher
when 'dashboard:show'
new Dashboard()
new Activities()
when 'dashboard:projects:starred'
new Activities()
new ProjectsList()
when 'projects:commit:show'
new Commit()
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 @@
.tab-content
.tab-pane.active#projects
= render "projects", projects: @projects
= render "dashboard/projects", projects: @projects
.tab-pane#groups
= render "groups", groups: @groups
= render "dashboard/groups", groups: @groups
.prepend-top-20
= 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 @@
%i.fa.fa-cube
%span
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
= link_to dashboard_groups_path, title: 'Groups' do
%i.fa.fa-group
......
......@@ -221,6 +221,12 @@ Gitlab::Application.routes.draw do
delete :leave
end
end
resources :projects, only: [] do
collection do
get :starred
end
end
end
end
......
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