Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
c94159ab
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 搜索 >>
提交
c94159ab
编写于
3月 01, 2012
作者:
D
Dmitriy Zaporozhets
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
improved dashboard
上级
219ac189
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
62 addition
and
49 deletion
+62
-49
app/assets/stylesheets/common.scss
app/assets/stylesheets/common.scss
+14
-6
app/controllers/dashboard_controller.rb
app/controllers/dashboard_controller.rb
+3
-3
app/models/project.rb
app/models/project.rb
+7
-17
app/views/dashboard/_events_feed.html.haml
app/views/dashboard/_events_feed.html.haml
+2
-19
app/views/dashboard/index.html.haml
app/views/dashboard/index.html.haml
+5
-4
app/views/events/_event.html.haml
app/views/events/_event.html.haml
+31
-0
未找到文件。
app/assets/stylesheets/common.scss
浏览文件 @
c94159ab
...
...
@@ -615,6 +615,7 @@ p.time {
margin
:auto
;
.wll
{
padding
:
5px
;
border
:none
;
&
:hover
{
background
:none
;
...
...
@@ -623,12 +624,19 @@ p.time {
h4
{
color
:
#666
;
}
&
.event_feed
{
min-height
:
40px
;
border-bottom
:
1px
solid
#eee
;
.avatar
{
width
:
32px
;
}
ul
{
margin-left
:
50px
;
.avatar
{
width
:
24px
;
}
}
}
}
}
}
.event_feed
{
ul
{
margin-left
:
50px
;
}
}
app/controllers/dashboard_controller.rb
浏览文件 @
c94159ab
...
...
@@ -4,12 +4,12 @@ class DashboardController < ApplicationController
def
index
@projects
=
current_user
.
projects
.
all
@active_projects
=
@projects
.
select
(
&
:
repo_exists?
).
select
(
&
:last_activity_date_cached
).
sort_by
(
&
:last_activity_date_cached
).
reverse
@active_projects
=
@projects
.
select
(
&
:
last_activity_date
).
sort_by
(
&
:last_activity_date
).
reverse
@merge_requests
=
MergeRequest
.
where
(
"author_id = :id or assignee_id = :id"
,
:id
=>
current_user
.
id
).
opened
.
order
(
"created_at DESC"
).
limit
(
10
)
@merge_requests
=
MergeRequest
.
where
(
"author_id = :id or assignee_id = :id"
,
:id
=>
current_user
.
id
).
opened
.
order
(
"created_at DESC"
).
limit
(
5
)
@user
=
current_user
@issues
=
current_user
.
assigned_issues
.
opened
.
order
(
"created_at DESC"
).
limit
(
10
)
@issues
=
current_user
.
assigned_issues
.
opened
.
order
(
"created_at DESC"
).
limit
(
5
)
@issues
=
@issues
.
includes
(
:author
,
:project
)
@events
=
Event
.
where
(
:project_id
=>
@projects
.
map
(
&
:id
)).
recent
.
limit
(
20
)
...
...
app/models/project.rb
浏览文件 @
c94159ab
...
...
@@ -277,31 +277,21 @@ class Project < ActiveRecord::Base
end
def
last_activity
updates
(
1
).
fir
st
events
.
la
st
rescue
nil
end
def
last_activity_date
last_activity
.
try
(
:created_at
)
end
def
last_activity_date_cached
(
expire
=
1
.
hour
)
activity_date_key
=
"project_
#{
id
}
_activity_date"
cached_activities
=
Rails
.
cache
.
read
(
activity_date_key
)
if
cached_activities
activity_date
=
if
cached_activities
==
"Never"
nil
else
cached_activities
end
if
events
.
last
events
.
last
.
created_at
else
activity_date
=
last_activity_date
Rails
.
cache
.
write
(
activity_date_key
,
activity_date
||
"Never"
,
:expires_in
=>
expire
)
updated_at
end
end
activity_date
def
last_activity_date_cached
(
expire
=
1
.
hour
)
last_activity_date
end
# Get project updates from cache
...
...
app/views/dashboard/_events_feed.html.haml
浏览文件 @
c94159ab
-
@events
.
each
do
|
event
|
.wll.event_feed
-
if
event
.
push?
-
if
event
.
new_branch?
User pushed new branch
-
else
=
image_tag
gravatar_icon
(
event
.
pusher_email
),
:class
=>
"avatar"
#{
event
.
pusher_name
}
pushed to
=
link_to
project_commits_path
(
event
.
project
,
:ref
=>
event
.
branch_name
)
do
%strong
=
event
.
branch_name
%span
.cgray
=
time_ago_in_words
(
event
.
created_at
)
ago.
-
if
event
.
commits
.
count
>
1
=
link_to
compare_project_commits_path
(
event
.
project
,
:from
=>
event
.
commits
.
first
.
prev_commit_id
,
:to
=>
event
.
commits
.
last
.
id
)
do
Compare
#{
event
.
commits
.
first
.
commit
.
id
[
0
..
8
]
}
...
#{
event
.
commits
.
last
.
id
[
0
..
8
]
}
-
@project
=
event
.
project
%ul
.unstyled
=
render
event
.
commits
=
render
@events
app/views/dashboard/index.html.haml
浏览文件 @
c94159ab
...
...
@@ -8,7 +8,7 @@
%div
.dashboard_category
%h3
Projects
=
link_to
"Projects"
,
"#projects"
,
:id
=>
"projects"
%small
( most recent )
...
...
@@ -34,7 +34,8 @@
-
unless
@merge_requests
.
blank?
%div
.dashboard_category
%h3
Merge Requests
=
link_to
"Merge Requests"
,
"#merge_requests"
,
:id
=>
"merge_requests"
%small
( authored or assigned to you )
%strong
.right
=
link_to
dashboard_merge_requests_path
do
...
...
@@ -46,7 +47,7 @@
-
unless
@issues
.
blank?
%div
.dashboard_category
%h3
Issues
=
link_to
"Issues"
,
"#issues"
,
:id
=>
"issues"
%small
( assigned to you )
%strong
.right
=
link_to
dashboard_merge_requests_path
do
...
...
@@ -58,7 +59,7 @@
-
unless
@events
.
blank?
%div
.dashboard_category
%h3
Activities
=
link_to
"Activities"
,
"#activities"
,
:id
=>
"activities"
%hr
.row
...
...
app/views/events/_event.html.haml
0 → 100644
浏览文件 @
c94159ab
.wll.event_feed
-
if
event
.
push?
-
if
event
.
new_branch?
=
image_tag
gravatar_icon
(
event
.
pusher_email
),
:class
=>
"avatar"
%strong
#{
event
.
pusher_name
}
pushed new branch
=
link_to
project_commits_path
(
event
.
project
,
:ref
=>
event
.
branch_name
)
do
%strong
=
event
.
branch_name
at
%strong
=
link_to
event
.
project
.
name
,
event
.
project
%span
.cgray
=
time_ago_in_words
(
event
.
created_at
)
ago.
-
else
=
image_tag
gravatar_icon
(
event
.
pusher_email
),
:class
=>
"avatar"
%strong
#{
event
.
pusher_name
}
pushed to
=
link_to
project_commits_path
(
event
.
project
,
:ref
=>
event
.
branch_name
)
do
%strong
=
event
.
branch_name
at
%strong
=
link_to
event
.
project
.
name
,
event
.
project
%span
.cgray
=
time_ago_in_words
(
event
.
created_at
)
ago.
-
if
event
.
commits
.
count
>
1
=
link_to
compare_project_commits_path
(
event
.
project
,
:from
=>
event
.
commits
.
first
.
prev_commit_id
,
:to
=>
event
.
commits
.
last
.
id
)
do
Compare
#{
event
.
commits
.
first
.
commit
.
id
[
0
..
8
]
}
...
#{
event
.
commits
.
last
.
id
[
0
..
8
]
}
-
@project
=
event
.
project
%ul
.unstyled
=
render
event
.
commits
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录