Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
c94159ab
Commit
c94159ab
authored
Mar 01, 2012
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improved dashboard
parent
219ac189
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
62 additions
and
49 deletions
+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
No files found.
app/assets/stylesheets/common.scss
View file @
c94159ab
...
@@ -615,6 +615,7 @@ p.time {
...
@@ -615,6 +615,7 @@ p.time {
margin
:auto
;
margin
:auto
;
.wll
{
.wll
{
padding
:
5px
;
border
:none
;
border
:none
;
&
:hover
{
&
:hover
{
background
:none
;
background
:none
;
...
@@ -623,12 +624,19 @@ p.time {
...
@@ -623,12 +624,19 @@ p.time {
h4
{
h4
{
color
:
#666
;
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
View file @
c94159ab
...
@@ -4,12 +4,12 @@ class DashboardController < ApplicationController
...
@@ -4,12 +4,12 @@ class DashboardController < ApplicationController
def
index
def
index
@projects
=
current_user
.
projects
.
all
@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
@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
)
@issues
=
@issues
.
includes
(
:author
,
:project
)
@events
=
Event
.
where
(
:project_id
=>
@projects
.
map
(
&
:id
)).
recent
.
limit
(
20
)
@events
=
Event
.
where
(
:project_id
=>
@projects
.
map
(
&
:id
)).
recent
.
limit
(
20
)
...
...
app/models/project.rb
View file @
c94159ab
...
@@ -277,31 +277,21 @@ class Project < ActiveRecord::Base
...
@@ -277,31 +277,21 @@ class Project < ActiveRecord::Base
end
end
def
last_activity
def
last_activity
updates
(
1
).
fir
st
events
.
la
st
rescue
rescue
nil
nil
end
end
def
last_activity_date
def
last_activity_date
last_activity
.
try
(
:created_at
)
if
events
.
last
end
events
.
last
.
created_at
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
else
activity_date
=
last_activity_date
updated_at
Rails
.
cache
.
write
(
activity_date_key
,
activity_date
||
"Never"
,
:expires_in
=>
expire
)
end
end
end
activity_date
def
last_activity_date_cached
(
expire
=
1
.
hour
)
last_activity_date
end
end
# Get project updates from cache
# Get project updates from cache
...
...
app/views/dashboard/_events_feed.html.haml
View file @
c94159ab
-
@events
.
each
do
|
event
|
=
render
@events
.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
app/views/dashboard/index.html.haml
View file @
c94159ab
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
%div
.dashboard_category
%div
.dashboard_category
%h3
%h3
Projects
=
link_to
"Projects"
,
"#projects"
,
:id
=>
"projects"
%small
%small
( most recent )
( most recent )
...
@@ -34,7 +34,8 @@
...
@@ -34,7 +34,8 @@
-
unless
@merge_requests
.
blank?
-
unless
@merge_requests
.
blank?
%div
.dashboard_category
%div
.dashboard_category
%h3
%h3
Merge Requests
=
link_to
"Merge Requests"
,
"#merge_requests"
,
:id
=>
"merge_requests"
%small
( authored or assigned to you )
%small
( authored or assigned to you )
%strong
.right
%strong
.right
=
link_to
dashboard_merge_requests_path
do
=
link_to
dashboard_merge_requests_path
do
...
@@ -46,7 +47,7 @@
...
@@ -46,7 +47,7 @@
-
unless
@issues
.
blank?
-
unless
@issues
.
blank?
%div
.dashboard_category
%div
.dashboard_category
%h3
%h3
Issues
=
link_to
"Issues"
,
"#issues"
,
:id
=>
"issues"
%small
( assigned to you )
%small
( assigned to you )
%strong
.right
%strong
.right
=
link_to
dashboard_merge_requests_path
do
=
link_to
dashboard_merge_requests_path
do
...
@@ -58,7 +59,7 @@
...
@@ -58,7 +59,7 @@
-
unless
@events
.
blank?
-
unless
@events
.
blank?
%div
.dashboard_category
%div
.dashboard_category
%h3
%h3
Activities
=
link_to
"Activities"
,
"#activities"
,
:id
=>
"activities"
%hr
%hr
.row
.row
...
...
app/views/events/_event.html.haml
0 → 100644
View file @
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
Write
Preview
Markdown
is supported
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