Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
c4c80899
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
c4c80899
编写于
1月 29, 2015
作者:
D
Dmitriy Zaporozhets
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of dev.gitlab.org:gitlab/gitlabhq
上级
7a5784ec
95ec0442
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
47 addition
and
15 deletion
+47
-15
app/assets/stylesheets/generic/avatar.scss
app/assets/stylesheets/generic/avatar.scss
+4
-0
app/controllers/users_controller.rb
app/controllers/users_controller.rb
+3
-6
app/models/project_contributions.rb
app/models/project_contributions.rb
+23
-0
app/views/groups/show.html.haml
app/views/groups/show.html.haml
+1
-1
app/views/users/calendar.html.haml
app/views/users/calendar.html.haml
+1
-1
app/views/users/show.html.haml
app/views/users/show.html.haml
+3
-3
lib/gitlab/commits_calendar.rb
lib/gitlab/commits_calendar.rb
+12
-4
未找到文件。
app/assets/stylesheets/generic/avatar.scss
浏览文件 @
c4c80899
...
...
@@ -15,6 +15,10 @@
&
.s24
{
margin-right
:
4px
;
}
}
&
.avatar-tile
{
@include
border-radius
(
0px
);
}
&
.s16
{
width
:
16px
;
height
:
16px
;
margin-right
:
6px
;
}
&
.s24
{
width
:
24px
;
height
:
24px
;
margin-right
:
8px
;
}
&
.s26
{
width
:
26px
;
height
:
26px
;
margin-right
:
8px
;
}
...
...
app/controllers/users_controller.rb
浏览文件 @
c4c80899
...
...
@@ -28,13 +28,10 @@ class UsersController < ApplicationController
def
calendar
visible_projects
=
ProjectsFinder
.
new
.
execute
(
current_user
)
# Get user repositories and collect timestamps for commits
user_repositories
=
visible_projects
.
map
(
&
:repository
)
calendar
=
Gitlab
::
CommitsCalendar
.
new
(
user_repositories
,
@user
)
calendar
=
Gitlab
::
CommitsCalendar
.
new
(
visible_projects
,
@user
)
@timestamps
=
calendar
.
timestamps
@starting_year
=
(
Time
.
now
-
1
.
year
).
strftime
(
"%Y"
)
@starting_month
=
Date
.
today
.
strftime
(
"%m"
).
to_i
@starting_year
=
calendar
.
starting_year
@starting_month
=
calendar
.
starting_month
render
'calendar'
,
layout:
false
end
...
...
app/models/project_contributions.rb
0 → 100644
浏览文件 @
c4c80899
class
ProjectContributions
attr_reader
:project
,
:user
def
initialize
(
project
,
user
)
@project
,
@user
=
project
,
user
end
def
commits_log
repository
=
project
.
repository
if
!
repository
.
exists?
||
repository
.
empty?
return
{}
end
Rails
.
cache
.
fetch
(
cache_key
)
do
repository
.
commits_per_day_for_user
(
user
)
end
end
def
cache_key
"
#{
Date
.
today
.
to_s
}
-commits-log-
#{
project
.
id
}
-
#{
user
.
email
}
"
end
end
app/views/groups/show.html.haml
浏览文件 @
c4c80899
.dashboard
%div
=
image_tag
group_icon
(
@group
.
path
),
class:
"avatar s90"
=
image_tag
group_icon
(
@group
.
path
),
class:
"avatar
avatar-tile
s90"
.clearfix
%h2
=
@group
.
name
...
...
app/views/users/calendar.html.haml
浏览文件 @
c4c80899
%h4
Calendar
:
%h4
Calendar
#cal-heatmap
.calendar
:javascript
new
calendar
(
...
...
app/views/users/show.html.haml
浏览文件 @
c4c80899
.row
.col-md-8
%h3
.page-title
=
image_tag
avatar_icon
(
@user
.
email
,
90
),
class:
"avatar s90"
,
alt:
''
=
image_tag
avatar_icon
(
@user
.
email
,
90
),
class:
"avatar
avatar-tile
s90"
,
alt:
''
=
@user
.
name
-
if
@user
==
current_user
.pull-right
...
...
@@ -15,7 +15,7 @@
.clearfix
-
if
@groups
.
any?
%h4
Groups
:
%h4
Groups
=
render
'groups'
,
groups:
@groups
%hr
...
...
@@ -24,7 +24,7 @@
%i
.fa.fa-spinner.fa-spin
%hr
%h4
User Activity
:
User Activity
-
if
current_user
%span
.rss-icon.pull-right
...
...
lib/gitlab/commits_calendar.rb
浏览文件 @
c4c80899
...
...
@@ -2,15 +2,15 @@ module Gitlab
class
CommitsCalendar
attr_reader
:timestamps
def
initialize
(
repositorie
s
,
user
)
def
initialize
(
project
s
,
user
)
@timestamps
=
{}
date_timestamps
=
[]
repositories
.
select
(
&
:exists?
).
reject
(
&
:empty?
).
each
do
|
raw_repository
|
commits_log
=
raw_repository
.
commits_per_day_for_user
(
user
)
date_timestamps
<<
commits_log
projects
.
reject
(
&
:forked?
).
each
do
|
project
|
date_timestamps
<<
ProjectContributions
.
new
(
project
,
user
).
commits_log
end
# Sumarrize commits from all projects per days
date_timestamps
=
date_timestamps
.
inject
do
|
collection
,
date
|
collection
.
merge
(
date
)
{
|
k
,
old_v
,
new_v
|
old_v
+
new_v
}
end
...
...
@@ -21,5 +21,13 @@ module Gitlab
@timestamps
[
timestamp
]
=
commits
if
timestamp
end
end
def
starting_year
(
Time
.
now
-
1
.
year
).
strftime
(
"%Y"
)
end
def
starting_month
Date
.
today
.
strftime
(
"%m"
).
to_i
end
end
end
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录