diff --git a/CHANGELOG b/CHANGELOG index 0333b1dc50f1ec3ae5b594ee093c2ceaea153a01..b210a6b015580c5f595335ecfea402602f2111b8 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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 diff --git a/app/assets/javascripts/dispatcher.js.coffee b/app/assets/javascripts/dispatcher.js.coffee index bf94fa3aaa067646077df964073184267793e9a4..928232e95bdde6730279088390ae0446e0822a10 100644 --- a/app/assets/javascripts/dispatcher.js.coffee +++ b/app/assets/javascripts/dispatcher.js.coffee @@ -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() diff --git a/app/controllers/dashboard/projects_controller.rb b/app/controllers/dashboard/projects_controller.rb new file mode 100644 index 0000000000000000000000000000000000000000..56e6fcc41ca1445c54150b4f9653968d5091c166 --- /dev/null +++ b/app/controllers/dashboard/projects_controller.rb @@ -0,0 +1,27 @@ +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 diff --git a/app/views/dashboard/_sidebar.html.haml b/app/views/dashboard/_sidebar.html.haml index a980f495427be4c70a01acb186211938874314b6..983da4aba04a17df8acdde1d9391fa24dcabab90 100644 --- a/app/views/dashboard/_sidebar.html.haml +++ b/app/views/dashboard/_sidebar.html.haml @@ -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' diff --git a/app/views/dashboard/projects/starred.html.haml b/app/views/dashboard/projects/starred.html.haml new file mode 100644 index 0000000000000000000000000000000000000000..94de609256335fd37c57ef80483405a8dab7cc5e --- /dev/null +++ b/app/views/dashboard/projects/starred.html.haml @@ -0,0 +1,23 @@ +- 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. diff --git a/app/views/events/_events.html.haml b/app/views/events/_events.html.haml index 3d62d4788690528c4d2c3f06019d73605e466423..68c19df092da7f0ca114cbf5c958f10ba1d7e3d8 100644 --- a/app/views/events/_events.html.haml +++ b/app/views/events/_events.html.haml @@ -1 +1 @@ -= render @events += render partial: 'events/event', collection: @events diff --git a/app/views/layouts/nav/_dashboard.html.haml b/app/views/layouts/nav/_dashboard.html.haml index a22ddaf1cfdc5a1ce84100ee0fed6352a451a080..b21f25e87cf3fc8c123dc5c4c6972810467e1e48 100644 --- a/app/views/layouts/nav/_dashboard.html.haml +++ b/app/views/layouts/nav/_dashboard.html.haml @@ -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 diff --git a/config/routes.rb b/config/routes.rb index 1b855cd7a324392dc2919b1b1301b9b12466d5ae..637b855e661172ffbd424d9d99e63f3f9145f560 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -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