Commit 1d601616a33aaa95e2ac7b21ff041b4a840df33c
1 parent
60bf502b
Exists in
master
and in
4 other branches
Pagination and better perfomance for projects page.
Showing
6 changed files
with
42 additions
and
19 deletions
Show diff stats
app/assets/stylesheets/common.scss
@@ -668,12 +668,15 @@ p.time { | @@ -668,12 +668,15 @@ p.time { | ||
668 | } | 668 | } |
669 | } | 669 | } |
670 | } | 670 | } |
671 | + .bottom { | ||
672 | + padding:10px; | ||
673 | + } | ||
671 | } | 674 | } |
672 | 675 | ||
673 | .btn { | 676 | .btn { |
674 | &.very_small { | 677 | &.very_small { |
675 | font-size:11px; | 678 | font-size:11px; |
676 | - padding:4px; | 679 | + padding:2px 6px; |
677 | margin:2px; | 680 | margin:2px; |
678 | } | 681 | } |
679 | } | 682 | } |
app/assets/stylesheets/main.scss
@@ -104,6 +104,11 @@ $hover: #FDF5D9; | @@ -104,6 +104,11 @@ $hover: #FDF5D9; | ||
104 | @import "sections/issues.scss"; | 104 | @import "sections/issues.scss"; |
105 | 105 | ||
106 | /** | 106 | /** |
107 | + * Styles related to projects | ||
108 | + */ | ||
109 | +@import "sections/projects.scss"; | ||
110 | + | ||
111 | +/** | ||
107 | * This scss file redefine chozen selectbox styles for | 112 | * This scss file redefine chozen selectbox styles for |
108 | * project Branch/Tag select element | 113 | * project Branch/Tag select element |
109 | */ | 114 | */ |
app/controllers/commits_controller.rb
@@ -43,8 +43,8 @@ class CommitsController < ApplicationController | @@ -43,8 +43,8 @@ class CommitsController < ApplicationController | ||
43 | end | 43 | end |
44 | 44 | ||
45 | def compare | 45 | def compare |
46 | - first = project.commit(params[:to]) | ||
47 | - last = project.commit(params[:from]) | 46 | + first = project.commit(params[:to].try(:strip)) |
47 | + last = project.commit(params[:from].try(:strip)) | ||
48 | 48 | ||
49 | @diffs = [] | 49 | @diffs = [] |
50 | @commits = [] | 50 | @commits = [] |
app/controllers/projects_controller.rb
@@ -11,9 +11,9 @@ class ProjectsController < ApplicationController | @@ -11,9 +11,9 @@ class ProjectsController < ApplicationController | ||
11 | before_filter :require_non_empty_project, :only => [:blob, :tree, :graph] | 11 | before_filter :require_non_empty_project, :only => [:blob, :tree, :graph] |
12 | 12 | ||
13 | def index | 13 | def index |
14 | - @projects = current_user.projects | ||
15 | - @projects = @projects.select(&:last_activity_date).sort_by(&:last_activity_date).reverse | ||
16 | - @events = Event.where(:project_id => @projects.map(&:id)).recent.limit(20) | 14 | + @projects = current_user.projects.includes(:events).order("events.created_at DESC") |
15 | + @projects = @projects.page(params[:page]).per(40) | ||
16 | + @events = Event.where(:project_id => current_user.projects.map(&:id)).recent.limit(20) | ||
17 | end | 17 | end |
18 | 18 | ||
19 | def new | 19 | def new |
app/views/projects/index.html.haml
1 | - if @projects.any? | 1 | - if @projects.any? |
2 | - .row | ||
3 | - .span8 | 2 | + .projects |
3 | + .activities.span8 | ||
4 | - if current_user.require_ssh_key? | 4 | - if current_user.require_ssh_key? |
5 | .alert.alert-error.padded | 5 | .alert.alert-error.padded |
6 | %span | 6 | %span |
@@ -14,24 +14,24 @@ | @@ -14,24 +14,24 @@ | ||
14 | - else | 14 | - else |
15 | .padded | 15 | .padded |
16 | %strong.cgray Projects activity will be displayed here | 16 | %strong.cgray Projects activity will be displayed here |
17 | - .span4.right | ||
18 | - %div.leftbar.ui-box | 17 | + .side |
18 | + .projects_box | ||
19 | %h5 | 19 | %h5 |
20 | Projects | 20 | Projects |
21 | %small | 21 | %small |
22 | - (#{@projects.count}) | 22 | + (#{@projects.total_count}) |
23 | - if current_user.can_create_project? | 23 | - if current_user.can_create_project? |
24 | %span.right | 24 | %span.right |
25 | = link_to new_project_path, :class => "btn very_small info" do | 25 | = link_to new_project_path, :class => "btn very_small info" do |
26 | New Project | 26 | New Project |
27 | - .content_list | ||
28 | - - @projects.each do |project| | ||
29 | - = link_to project_path(project), :class => dom_class(project) do | ||
30 | - %h4 | ||
31 | - %span.ico.project | ||
32 | - = truncate(project.name, :length => 25) | ||
33 | - %span.right | ||
34 | - → | 27 | + - @projects.each do |project| |
28 | + = link_to project_path(project), :class => dom_class(project) do | ||
29 | + %h4 | ||
30 | + %span.ico.project | ||
31 | + = truncate(project.name, :length => 25) | ||
32 | + %span.right | ||
33 | + → | ||
34 | + .bottom= paginate @projects, :theme => "gitlab" | ||
35 | 35 | ||
36 | - else | 36 | - else |
37 | %h3 Nothing here | 37 | %h3 Nothing here |