summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dzaporozhets@gitlab.com>2015-03-09 23:26:58 +0000
committerDmitriy Zaporozhets <dzaporozhets@gitlab.com>2015-03-09 23:26:58 +0000
commitb51e2a05592e09c6c64d5e28eafba8d4bbbcbe24 (patch)
tree35539e5ccf9b280489ad4dc30fa81f09b87d2ad7
parent5a51a798d6760ccb3485951c983528cb22cdd352 (diff)
parentb8d73315f5e094906111ab16607b5fa2685d2ea8 (diff)
downloadgitlab-ce-b51e2a05592e09c6c64d5e28eafba8d4bbbcbe24.tar.gz
Merge branch 'starred-projects' into 'master'
Add starred projects page to dashboard For #1836 and #2069 See merge request !1659
-rw-r--r--CHANGELOG1
-rw-r--r--app/assets/javascripts/dispatcher.js.coffee3
-rw-r--r--app/controllers/dashboard/projects_controller.rb27
-rw-r--r--app/views/dashboard/_sidebar.html.haml4
-rw-r--r--app/views/dashboard/projects/starred.html.haml23
-rw-r--r--app/views/events/_events.html.haml2
-rw-r--r--app/views/layouts/nav/_dashboard.html.haml5
-rw-r--r--config/routes.rb6
-rw-r--r--features/dashboard/starred_projects.feature12
-rw-r--r--features/steps/dashboard/starred_projects.rb15
-rw-r--r--features/steps/shared/paths.rb4
11 files changed, 99 insertions, 3 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 0333b1dc50f..b210a6b0155 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 bf94fa3aaa0..928232e95bd 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 00000000000..56e6fcc41ca
--- /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 a980f495427..983da4aba04 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 00000000000..94de6092563
--- /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 3d62d478869..68c19df092d 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 a22ddaf1cfd..b21f25e87cf 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 1b855cd7a32..637b855e661 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
diff --git a/features/dashboard/starred_projects.feature b/features/dashboard/starred_projects.feature
new file mode 100644
index 00000000000..9dfd2fbab9c
--- /dev/null
+++ b/features/dashboard/starred_projects.feature
@@ -0,0 +1,12 @@
+@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"
diff --git a/features/steps/dashboard/starred_projects.rb b/features/steps/dashboard/starred_projects.rb
new file mode 100644
index 00000000000..b9ad2f13e29
--- /dev/null
+++ b/features/steps/dashboard/starred_projects.rb
@@ -0,0 +1,15 @@
+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
diff --git a/features/steps/shared/paths.rb b/features/steps/shared/paths.rb
index db6417bf951..bb6c336d7cd 100644
--- a/features/steps/shared/paths.rb
+++ b/features/steps/shared/paths.rb
@@ -95,6 +95,10 @@ module SharedPaths
current_path.should == dashboard_groups_path
end
+ step 'I visit dashboard starred projects page' do
+ visit starred_dashboard_projects_path
+ end
+
# ----------------------------------------
# Profile
# ----------------------------------------