Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
heptapod
heptapod
Commits
aecb599bc15f
Commit
aecb599b
authored
Mar 01, 2012
by
Dmitriy Zaporozhets
Browse files
improved dashboard
parent
24fe2672545d
Changes
6
Hide whitespace changes
Inline
Side-by-side
app/assets/stylesheets/common.scss
View file @
aecb599b
...
...
@@ -615,6 +615,7 @@
margin
:auto
;
.wll
{
padding
:
5px
;
border
:none
;
&
:hover
{
background
:none
;
...
...
@@ -623,6 +624,19 @@
h4
{
color
:
#666
;
}
&
.event_feed
{
min-height
:
40px
;
border-bottom
:
1px
solid
#eee
;
.avatar
{
width
:
32px
;
}
ul
{
margin-left
:
50px
;
.avatar
{
width
:
24px
;
}
}
}
}
}
}
...
...
@@ -626,9 +640,3 @@
}
}
}
.event_feed
{
ul
{
margin-left
:
50px
;
}
}
app/controllers/dashboard_controller.rb
View file @
aecb599b
...
...
@@ -4,5 +4,5 @@
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
...
...
@@ -8,4 +8,4 @@
@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
...
...
@@ -10,6 +10,6 @@
@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
View file @
aecb599b
...
...
@@ -277,9 +277,9 @@
end
def
last_activity
updates
(
1
).
fir
st
events
.
la
st
rescue
nil
end
def
last_activity_date
...
...
@@ -281,9 +281,13 @@
rescue
nil
end
def
last_activity_date
last_activity
.
try
(
:created_at
)
if
events
.
last
events
.
last
.
created_at
else
updated_at
end
end
def
last_activity_date_cached
(
expire
=
1
.
hour
)
...
...
@@ -287,21 +291,7 @@
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
else
activity_date
=
last_activity_date
Rails
.
cache
.
write
(
activity_date_key
,
activity_date
||
"Never"
,
:expires_in
=>
expire
)
end
activity_date
last_activity_date
end
# Get project updates from cache
...
...
app/views/dashboard/_events_feed.html.haml
View file @
aecb599b
-
@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
View file @
aecb599b
...
...
@@ -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
View file @
aecb599b
.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
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment