Pagination and better perfomance for projects page.

This commit is contained in:
randx 2012-04-20 19:11:49 +03:00
parent 60bf502bf1
commit 1d601616a3
6 changed files with 42 additions and 19 deletions

View file

@ -668,12 +668,15 @@ p.time {
} }
} }
} }
.bottom {
padding:10px;
}
} }
.btn { .btn {
&.very_small { &.very_small {
font-size:11px; font-size:11px;
padding:4px; padding:2px 6px;
margin:2px; margin:2px;
} }
} }

View file

@ -103,6 +103,11 @@ $hover: #FDF5D9;
*/ */
@import "sections/issues.scss"; @import "sections/issues.scss";
/**
* Styles related to projects
*/
@import "sections/projects.scss";
/** /**
* This scss file redefine chozen selectbox styles for * This scss file redefine chozen selectbox styles for
* project Branch/Tag select element * project Branch/Tag select element

View file

@ -0,0 +1,15 @@
.projects {
@extend .row;
.activities {
}
.side {
@extend .span4;
@extend .right;
.projects_box {
@extend .leftbar;
@extend .ui-box;
}
}
}

View file

@ -43,8 +43,8 @@ class CommitsController < ApplicationController
end end
def compare def compare
first = project.commit(params[:to]) first = project.commit(params[:to].try(:strip))
last = project.commit(params[:from]) last = project.commit(params[:from].try(:strip))
@diffs = [] @diffs = []
@commits = [] @commits = []

View file

@ -11,9 +11,9 @@ class ProjectsController < ApplicationController
before_filter :require_non_empty_project, :only => [:blob, :tree, :graph] before_filter :require_non_empty_project, :only => [:blob, :tree, :graph]
def index def index
@projects = current_user.projects @projects = current_user.projects.includes(:events).order("events.created_at DESC")
@projects = @projects.select(&:last_activity_date).sort_by(&:last_activity_date).reverse @projects = @projects.page(params[:page]).per(40)
@events = Event.where(:project_id => @projects.map(&:id)).recent.limit(20) @events = Event.where(:project_id => current_user.projects.map(&:id)).recent.limit(20)
end end
def new def new

View file

@ -1,6 +1,6 @@
- if @projects.any? - if @projects.any?
.row .projects
.span8 .activities.span8
- if current_user.require_ssh_key? - if current_user.require_ssh_key?
.alert.alert-error.padded .alert.alert-error.padded
%span %span
@ -14,24 +14,24 @@
- else - else
.padded .padded
%strong.cgray Projects activity will be displayed here %strong.cgray Projects activity will be displayed here
.span4.right .side
%div.leftbar.ui-box .projects_box
%h5 %h5
Projects Projects
%small %small
(#{@projects.count}) (#{@projects.total_count})
- if current_user.can_create_project? - if current_user.can_create_project?
%span.right %span.right
= link_to new_project_path, :class => "btn very_small info" do = link_to new_project_path, :class => "btn very_small info" do
New Project New Project
.content_list - @projects.each do |project|
- @projects.each do |project| = link_to project_path(project), :class => dom_class(project) do
= link_to project_path(project), :class => dom_class(project) do %h4
%h4 %span.ico.project
%span.ico.project = truncate(project.name, :length => 25)
= truncate(project.name, :length => 25) %span.right
%span.right &rarr;
&rarr; .bottom= paginate @projects, :theme => "gitlab"
- else - else
%h3 Nothing here %h3 Nothing here