Commit 14274cdc authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'refactor-starred-projects-page' into 'master'

Split starred projects list and activity

In same way like we did with your projects. For consistency
Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>

See merge request !1238
parents d9f794a8 774c523c
...@@ -21,7 +21,7 @@ v 8.0.0 (unreleased) ...@@ -21,7 +21,7 @@ v 8.0.0 (unreleased)
- Create cross-reference for closing references on commits pushed to non-default branches (Maël Valais) - Create cross-reference for closing references on commits pushed to non-default branches (Maël Valais)
- Ability to search milestones - Ability to search milestones
- Gracefully handle SMTP user input errors (e.g. incorrect email addresses) to prevent Sidekiq retries (Stan Hu) - Gracefully handle SMTP user input errors (e.g. incorrect email addresses) to prevent Sidekiq retries (Stan Hu)
- Move dashboard activity to separate page - Move dashboard activity to separate page (for your projects and starred projects)
- Improve performance of git blame - Improve performance of git blame
- Limit content width to 1200px for most of pages to improve readability on big screens - Limit content width to 1200px for most of pages to improve readability on big screens
- Fix 500 error when submit project snippet without body - Fix 500 error when submit project snippet without body
......
class DashboardController < Dashboard::ApplicationController class DashboardController < Dashboard::ApplicationController
before_action :load_projects before_action :load_projects, except: :activity
before_action :event_filter, only: :activity before_action :event_filter, only: :activity
respond_to :html respond_to :html
...@@ -55,7 +55,14 @@ class DashboardController < Dashboard::ApplicationController ...@@ -55,7 +55,14 @@ class DashboardController < Dashboard::ApplicationController
end end
def load_events def load_events
@events = Event.in_projects(current_user.authorized_projects.pluck(:id)) project_ids =
if params[:filter] == "starred"
current_user.starred_projects
else
current_user.authorized_projects
end.pluck(:id)
@events = Event.in_projects(project_ids)
@events = @event_filter.apply_filter(@events).with_associations @events = @event_filter.apply_filter(@events).with_associations
@events = @events.limit(20).offset(params[:offset] || 0) @events = @events.limit(20).offset(params[:offset] || 0)
end end
......
%ul.center-top-menu
%li{ class: ("active" unless params[:filter]) }
= link_to activity_dashboard_path, class: 'shortcuts-activity', data: {placement: 'right'} do
Your Projects
%li{ class: ("active" if params[:filter] == 'starred') }
= link_to activity_dashboard_path(filter: 'starred'), data: {placement: 'right'} do
Starred Projects
...@@ -2,5 +2,7 @@ ...@@ -2,5 +2,7 @@
- if current_user - if current_user
= auto_discovery_link_tag(:atom, dashboard_url(format: :atom, private_token: current_user.private_token), title: "All activity") = auto_discovery_link_tag(:atom, dashboard_url(format: :atom, private_token: current_user.private_token), title: "All activity")
= render 'dashboard/activity_head'
%section.activities %section.activities
= render 'activities' = render 'activities'
...@@ -2,23 +2,7 @@ ...@@ -2,23 +2,7 @@
= render 'dashboard/projects_head' = render 'dashboard/projects_head'
- if @projects.any? - if @projects.any?
= render 'shared/show_aside' = render 'dashboard/projects'
.dashboard.row
%section.activities.col-md-7
= render 'dashboard/activities'
%aside.col-md-5
.panel.panel-default.projects-list-holder
.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?
%span.input-group-btn
= link_to new_project_path, class: 'btn btn-success' do
New project
= render 'shared/projects/list', projects: @projects, projects_limit: 20
- else - else
%h3 You don't have starred projects yet %h3 You don't have starred projects yet
%p.slead Visit project page and press on star icon and it will appear on this page. %p.slead Visit project page and press on star icon and it will appear on this page.
...@@ -8,7 +8,7 @@ class Spinach::Features::DashboardStarredProjects < Spinach::FeatureSteps ...@@ -8,7 +8,7 @@ class Spinach::Features::DashboardStarredProjects < Spinach::FeatureSteps
end end
step 'I should not see project "Shop"' do step 'I should not see project "Shop"' do
page.within 'aside' do page.within '.projects-list' do
expect(page).not_to have_content('Shop') expect(page).not_to have_content('Shop')
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