Commit 5e843a176982ed78cc2a6cf28618839e130cf608

Authored by Dmitriy Zaporozhets
1 parent a85c58c7

Explain on dashboard that limit amount of projects displayed

app/controllers/dashboard_controller.rb
@@ -5,10 +5,14 @@ class DashboardController < ApplicationController @@ -5,10 +5,14 @@ class DashboardController < ApplicationController
5 before_filter :event_filter, only: :show 5 before_filter :event_filter, only: :show
6 6
7 def show 7 def show
  8 + # Fetch only 30 projects.
  9 + # If user needs more - point to Dashboard#projects page
  10 + @projects_limit = 30
  11 +
8 @groups = current_user.authorized_groups.sort_by(&:human_name) 12 @groups = current_user.authorized_groups.sort_by(&:human_name)
9 @has_authorized_projects = @projects.count > 0 13 @has_authorized_projects = @projects.count > 0
10 @projects_count = @projects.count 14 @projects_count = @projects.count
11 - @projects = @projects.limit(20) 15 + @projects = @projects.limit(@projects_limit)
12 16
13 @events = Event.in_projects(current_user.authorized_projects.pluck(:id)) 17 @events = Event.in_projects(current_user.authorized_projects.pluck(:id))
14 @events = @event_filter.apply_filter(@events) 18 @events = @event_filter.apply_filter(@events)
app/views/dashboard/_project.html.haml 0 → 100644
@@ -0,0 +1,12 @@ @@ -0,0 +1,12 @@
  1 += link_to project_path(project), class: dom_class(project) do
  2 + %span.namespace-name
  3 + - if project.namespace
  4 + = project.namespace.human_name
  5 + \/
  6 + %span.project-name.filter-title
  7 + = truncate(project.name, length: 25)
  8 + %span.arrow
  9 + %i.icon-angle-right
  10 + %span.last-activity
  11 + %span Last activity:
  12 + %span.date= project_last_activity(project)
app/views/dashboard/_projects.html.haml
@@ -10,21 +10,16 @@ @@ -10,21 +10,16 @@
10 %ul.well-list.dash-list 10 %ul.well-list.dash-list
11 - projects.each do |project| 11 - projects.each do |project|
12 %li.project-row 12 %li.project-row
13 - = link_to project_path(project), class: dom_class(project) do  
14 - %span.namespace-name  
15 - - if project.namespace  
16 - = project.namespace.human_name  
17 - \/  
18 - %span.project-name.filter-title  
19 - = truncate(project.name, length: 25)  
20 - %span.arrow  
21 - %i.icon-angle-right  
22 - %span.last-activity  
23 - %span Last activity:  
24 - %span.date= project_last_activity(project) 13 + = render "project", project: project
  14 +
25 - if projects.blank? 15 - if projects.blank?
26 %li 16 %li
27 %h3.nothing_here_message There are no projects here. 17 %h3.nothing_here_message There are no projects here.
28 - - if @projects_count > 20 18 + - if @projects_count > @projects_limit
29 %li.bottom 19 %li.bottom
30 - %strong= link_to "show all projects", projects_dashboard_path 20 + %span.light
  21 + #{@projects_limit} of #{pluralize(@projects_count, 'project')} displayed.
  22 + .pull-right.append-right-10
  23 + = link_to projects_dashboard_path do
  24 + Show all
  25 + %i.icon-angle-right