[#277] profile projects 1 ver.

This commit is contained in:
Alexander Machehin 2013-09-08 17:56:43 +06:00
parent 5340f6dfad
commit 7da70b5f12
15 changed files with 210 additions and 56 deletions

5
.gitignore vendored
View File

@ -20,4 +20,7 @@ crash.log
config/newrelic.yml
config/deploy/*.rb
config/deploy.rb
*.swo
.swo
.swn
.ruby-gemset
.ruby-version

Binary file not shown.

After

Width:  |  Height:  |  Size: 176 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@ -4,3 +4,4 @@
@import "design/common";
@import "design/custom";
@import "design/build_lists_monitoring";
@import "design/profile";

View File

@ -2105,37 +2105,3 @@ table tbody {
cursor: default;
}
}
.row {
.span3.profile {
.avatar {
float: left;
width: 81px;
height: 81px;
}
.base_info {
float: left;
width: 134px;
h3 {
margin: 0 0 0 10px;
}
p {
height: 35px;
margin-left: 10px;
}
a {
margin: 16px 0 0 10px;
}
}
p.first {
margin-top: 10px;
}
p.info {
max-width: 220px;
}
}
}
hr.profile_line {
margin-top: 20px;
}

View File

@ -0,0 +1,146 @@
.row {
.span3.profile {
.avatar {
float: left;
width: 81px;
height: 81px;
}
.base_info {
float: left;
width: 134px;
h3 {
margin: 0 0 0 10px;
}
p {
height: 35px;
margin-left: 10px;
}
a {
margin: 16px 0 0 10px;
}
}
p.first {
margin-top: 10px;
}
p.info {
max-width: 220px;
}
}
}
hr.profile_line {
margin-top: 20px;
margin: 20px 0 20px 0;
width: 870px;
}
.profile-content {
border: 5px solid #D4D4D4;
div.search {
//background: none repeat scroll 0 0 #FFFFFF;
border: 2px solid #D4D4D4;
float: left;
margin: 15px 10px;
width: 837px;
}
div.search div.pic {
background: url("/assets/search-button.png") repeat scroll 0 0 transparent;
float: left;
height: 22px;
width: 24px;
}
div.search div.field {
float: left;
margin: -1px 0 0;
}
div.search div.field input {
background: none repeat scroll 0 0 transparent;
border: medium none;
font-family: Arial;
font-size: 12px;
height: 18px;
padding: 2px 0 0;
width: 132px;
}
div.search div.field input.gray {
color: #CFCFCF;
}
div.search div.field input.black {
color: #333333;
}
table {
border: none;
border-collapse:collapse;
margin: 0 9px 10px 9px;
width: 844px;
th {
padding-left: 10px;
.project-link {
margin-top: 5px;
}
}
tr.odd {
}
tr.even {
background: #EDEDED;
}
.row-fluid {
max-height: 16px;
.span3 {
font-size: 10px;
font-weight: normal;
max-height: 16px;
min-height: 16px;
}
.span3.datetime_moment {
margin-right: 15px;
color: gray;
}
}
}
.span12.content {
background: url(/assets/bg_blue.png);
height: 30px;
margin-bottom: 0px;
nav {
ul {
list-style: none;
padding-left: 0;
margin: 4px 0 0 5px;
li {
text-decoration: none;
padding: 0 10px 6px 0;
a {
color: white;
font-weight: bold;
font-size: 14px;
padding: 0 10px 9px 10px;
}
a.active {
background: image-url("profile-hover.png") repeat-x scroll 0 100% transparent;
}
}
}
}
}
.span12.sub-menu {
height: 30px;
background: #EDEDED;
margin: 0;
box-shadow: none;
padding-left: 0px;
nav {
ul {
list-style: none;
padding: 0;
margin: 6px 0 0 5px;
a {
padding: 0 10px 9px 10px;
}
a.active {
background: image-url("profile-hover.png") repeat-x scroll 0 100% transparent;
}
}
}
}
}

View File

@ -11,7 +11,7 @@ class Groups::ProfileController < Groups::BaseController
def show
@projects = @group.projects.opened.search(params[:search]).recent
.paginate(:page => params[:page], :per_page => 25)
.paginate(:page => params[:page], :per_page => 24)
end
def new

View File

@ -4,6 +4,6 @@ class Users::ProfileController < Users::BaseController
def show
@projects = @user.projects.opened.search(params[:search]).recent
.paginate(:page => params[:page], :per_page => 25)
.paginate(:page => params[:page], :per_page => 24)
end
end

View File

@ -1,6 +1,5 @@
# -*- encoding : utf-8 -*-
module CommitHelper
def render_commit_stats(stats)
res = ["<table class='commit_stats'>"]
ind=0
@ -44,4 +43,14 @@ module CommitHelper
u = User.where(:email => email).first
u.present? ? link_to(name, user_path(u)) : mail_to(email, name)
end
def commits_pluralize(commits_count)
Russian.p(commits_count, *commits_pluralization_arr)
end
protected
def commits_pluralization_arr
pluralize ||= t('layout.commits.pluralize').map {|base, title| title.to_s}
end
end

View File

@ -15,6 +15,6 @@
= commit[1]
%br
- if defined? other_commits
-pluralize = t('layout.commits.pluralize').map {|base, title| title.to_s}
%br
=link_to t('notifications.bodies.more_commits', :count => other_commits_count, :commits => Russian.p(other_commits_count, *pluralize)), diff_path(project_owner, project_name, :diff => other_commits)
=link_to t('notifications.bodies.more_commits', :count => other_commits_count, :commits => commits_pluralize(other_commits_count)),
diff_path(project_owner, project_name, :diff => other_commits)

View File

@ -35,16 +35,23 @@
%hr.profile_line{:color => 'dfe8ef', :size => '3'}
.content
%h4= t("layout.projects.public_projects_list") + ":"
%p
=form_tag search_path, :id => 'filter_projects', :method => :get do
=tracker_search_field(:search, t('layout.find_project'))
%br
%p
- projects.each do |project|
= link_to project.name, project
%br
.row-fluid.profile-content
.span12.content
%nav
%ul
%li
= link_to t('layout.projects.list_header'), '#', :class => 'projects active'
.span12.sub-menu
%nav
%ul
%li= link_to t('layout.projects.public'), '#', :class => "public-projects #{@public ? 'active' : ''}"
%li= link_to t('layout.projects.private'), '#', :class => "private-projects #{!@public ? 'active' : ''}"
.search
.pic
.field= text_field_tag 'query', @query, :placeholder => t('layout.find_project')
%table.profile-table
%tbody= render 'shared/profile_projects', :projects => projects
%br
= will_paginate projects
%br

View File

@ -0,0 +1,11 @@
- pr_groups = projects.in_groups(2)
- pr_groups[0].each_with_index do |project, ind|
%tr{:class => ind.odd? ? 'odd' : 'even'}
- [project, pr_groups[1][ind]].each do |project|
%th
- if project.present?
.project-link= link_to project.name, project
.row-fluid
= datetime_moment project.updated_at, :class => :span3
- commits_count = project.total_commits_count
.span3= "#{commits_count > 10000 ? '10000+' : commits_count} #{commits_pluralize(commits_count)}"

View File

@ -71,6 +71,9 @@ en:
current_commit: Current commit
files_in_project: Files in
public: Public
private: Private
flash:
project:
saved: Project saved

View File

@ -71,6 +71,9 @@ ru:
cloning: Клонирование этого репозитория
remote: Добавление этого репозитория как удаленного к существующему локальному репозиторию
public: Публичные
private: Приватные
flash:
project:
saved: Проект успешно сохранен

View File

@ -115,6 +115,11 @@ module Modules
repo.branches.count == 0
end
def total_commits_count
return 0 if is_empty?
%x(cd #{path} && git rev-list --all | wc -l).to_i
end
protected
def build_path(dir)