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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kazuhiko Shiozaki
gitlab-ce
Commits
00dc34e1
Commit
00dc34e1
authored
Apr 02, 2012
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Events improved & refactored. Dashboard pollished
parent
3ac9c3ad
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
139 additions
and
126 deletions
+139
-126
app/assets/stylesheets/common.scss
app/assets/stylesheets/common.scss
+12
-5
app/models/event.rb
app/models/event.rb
+19
-26
app/models/event/push_trait.rb
app/models/event/push_trait.rb
+67
-0
app/views/dashboard/_projects_feed.html.haml
app/views/dashboard/_projects_feed.html.haml
+9
-7
app/views/dashboard/index.html.haml
app/views/dashboard/index.html.haml
+2
-2
app/views/events/_event.html.haml
app/views/events/_event.html.haml
+4
-8
app/views/events/_event_changed_issue.html.haml
app/views/events/_event_changed_issue.html.haml
+0
-15
app/views/events/_event_changed_merge_request.html.haml
app/views/events/_event_changed_merge_request.html.haml
+0
-20
app/views/events/_event_issue.html.haml
app/views/events/_event_issue.html.haml
+2
-2
app/views/events/_event_merge_request.html.haml
app/views/events/_event_merge_request.html.haml
+4
-4
app/views/events/_event_push.html.haml
app/views/events/_event_push.html.haml
+20
-37
No files found.
app/assets/stylesheets/common.scss
View file @
00dc34e1
...
...
@@ -67,6 +67,12 @@ a:focus {
}
}
.event_label
{
background
:
#FCEEC1
;
padding
:
0
2px
;
font-family
:
monospace
;
}
.tabs
>
li
>
a
,
.pills
>
li
>
a
{
color
:
$style_color
;
}
...
...
@@ -126,6 +132,9 @@ a:focus {
.ipadded
{
padding
:
20px
!
important
;
}
.lborder
{
border-left
:
1px
solid
#eee
;
}
.no-borders
{
border
:none
;
}
...
...
@@ -872,10 +881,9 @@ p.time {
border
:none
;
padding
:
0px
5px
;
&
:hover
{
background
:
$hover
;
//border-left:4px solid $styled_border_color;
h4
{
.project_link
{
color
:
#888
;
&
:hover
{
color
:
#111
;
.ico.project
{
background-position
:
-209px
-21px
;
...
...
@@ -1077,7 +1085,6 @@ p.time {
}
.arrow
{
float
:
right
;
background
:
#E3E5EA
;
padding
:
5px
;
margin-top
:
5px
;
...
...
app/models/event.rb
View file @
00dc34e1
...
...
@@ -9,6 +9,8 @@ class Event < ActiveRecord::Base
Commented
=
6
Merged
=
7
does
"event/push"
belongs_to
:project
belongs_to
:target
,
:polymorphic
=>
true
...
...
@@ -30,14 +32,17 @@ class Event < ActiveRecord::Base
# - new issue
# - merge request
def
allowed?
push?
||
new_issue?
||
new_merge_request?
||
changed_merge_request?
||
changed_issue?
push?
||
issue?
||
merge_request?
end
def
push?
action
==
self
.
class
::
Pushed
end
def
merged?
action
==
self
.
class
::
Merged
end
def
closed?
action
==
self
.
class
::
Closed
end
...
...
@@ -46,28 +51,12 @@ class Event < ActiveRecord::Base
action
==
self
.
class
::
Reopened
end
def
new_tag?
data
[
:ref
][
"refs/tags"
]
end
def
new_branch?
data
[
:before
]
=~
/^00000/
end
def
commit_from
data
[
:before
]
end
def
commit_to
data
[
:after
]
def
issue?
target_type
==
"Issue"
end
def
branch_name
@branch_name
||=
data
[
:ref
].
gsub
(
"refs/heads/"
,
""
)
end
def
tag_name
@tag_name
||=
data
[
:ref
].
gsub
(
"refs/tags/"
,
""
)
def
merge_request?
target_type
==
"MergeRequest"
end
def
new_issue?
...
...
@@ -101,10 +90,14 @@ class Event < ActiveRecord::Base
def
author
@author
||=
User
.
find
(
author_id
)
end
def
commits
@commits
||=
data
[
:commits
].
map
do
|
commit
|
project
.
commit
(
commit
[
:id
])
def
action_name
if
closed?
"closed"
elsif
merged?
"merged"
else
"opened"
end
end
...
...
app/models/event/push_trait.rb
0 → 100644
View file @
00dc34e1
module
Event::PushTrait
as_trait
do
def
tag?
data
[
:ref
][
"refs/tags"
]
end
def
new_branch?
data
[
:before
]
=~
/^00000/
end
def
new_ref?
data
[
:before
]
=~
/^00000/
end
def
rm_ref?
data
[
:after
]
=~
/^00000/
end
def
md_ref?
!
(
rm_ref?
||
new_ref?
)
end
def
commit_from
data
[
:before
]
end
def
commit_to
data
[
:after
]
end
def
ref_name
if
tag?
tag_name
else
branch_name
end
end
def
branch_name
@branch_name
||=
data
[
:ref
].
gsub
(
"refs/heads/"
,
""
)
end
def
tag_name
@tag_name
||=
data
[
:ref
].
gsub
(
"refs/tags/"
,
""
)
end
def
commits
@commits
||=
data
[
:commits
].
map
do
|
commit
|
project
.
commit
(
commit
[
:id
])
end
end
def
ref_type
tag?
?
"tag"
:
"branch"
end
def
push_action_name
if
new_ref?
"pushed new"
elsif
rm_ref?
"removed
#{
ref_type
}
"
else
"pushed to"
end
end
end
end
app/views/dashboard/_projects_feed.html.haml
View file @
00dc34e1
-
projects
.
first
(
5
).
each
do
|
project
|
%div
.dash_project_item
=
link_to
project
do
%h4
%h4
=
link_to
project
,
:class
=>
"project_link"
do
%span
.ico.project
=
truncate
project
.
name
,
:length
=>
30
=
truncate
project
.
name
,
:length
=>
24
%small
last activity at
=
project
.
last_activity_date
.
stamp
(
"Aug 25, 2011"
)
.right
%small
last activity at
=
project
.
last_activity_date
.
stamp
(
"Aug 25, 2011"
)
%span
.right.arrow
→
%strong
=
link_to
"Browse Code »"
,
tree_project_ref_path
(
project
,
project
.
root_ref
),
:class
=>
"vlink"
app/views/dashboard/index.html.haml
View file @
00dc34e1
...
...
@@ -21,8 +21,8 @@
.dashboard_block
.row
.span4.right
%div
.
borders
.ipadded
%h
1
%div
.
lborder
.ipadded
%h
3
=
pluralize
current_user
.
projects
.
count
,
"project"
,
"projects"
-
if
current_user
.
can_create_project?
%hr
...
...
app/views/events/_event.html.haml
View file @
00dc34e1
-
if
event
.
allowed?
.event_feed
-
if
event
.
new_issue?
=
render
"events/event_new_issue"
,
:event
=>
event
-
elsif
event
.
new_merge_request?
=
render
"events/event_new_merge_request"
,
:event
=>
event
-
elsif
event
.
changed_merge_request?
=
render
"events/event_changed_merge_request"
,
:event
=>
event
-
elsif
event
.
changed_issue?
=
render
"events/event_changed_issue"
,
:event
=>
event
-
if
event
.
issue?
=
render
"events/event_issue"
,
:event
=>
event
-
elsif
event
.
merge_request?
=
render
"events/event_merge_request"
,
:event
=>
event
-
elsif
event
.
push?
=
render
"events/event_push"
,
:event
=>
event
app/views/events/_event_changed_issue.html.haml
deleted
100644 → 0
View file @
3ac9c3ad
=
image_tag
gravatar_icon
(
event
.
author_email
),
:class
=>
"avatar"
%strong
#{
event
.
author_name
}
%span
.label.important
-
if
event
.
closed?
closed
-
else
reopened
issue
=
link_to
project_issue_path
(
event
.
project
,
event
.
issue
)
do
%strong
=
truncate
event
.
issue_title
at
%strong
=
link_to
event
.
project
.
name
,
event
.
project
%span
.cgray
=
time_ago_in_words
(
event
.
created_at
)
ago.
app/views/events/_event_changed_merge_request.html.haml
deleted
100644 → 0
View file @
3ac9c3ad
=
image_tag
gravatar_icon
(
event
.
author_email
),
:class
=>
"avatar"
%strong
#{
event
.
author_name
}
%span
.label.important
-
if
event
.
closed?
closed
-
else
reopened
merge request
=
link_to
project_merge_request_path
(
event
.
project
,
event
.
merge_request
)
do
%strong
=
truncate
event
.
merge_request_title
at
%strong
=
link_to
event
.
project
.
name
,
event
.
project
%span
.cgray
=
time_ago_in_words
(
event
.
created_at
)
ago.
%br
%span
.label
=
event
.
merge_request
.
source_branch
→
%span
.label
=
event
.
merge_request
.
target_branch
app/views/events/_event_
new_
issue.html.haml
→
app/views/events/_event_issue.html.haml
View file @
00dc34e1
=
image_tag
gravatar_icon
(
event
.
author_email
),
:class
=>
"avatar"
%strong
#{
event
.
author_name
}
%span
.
label.success
created
new
issue
%span
.
event_label
=
event
.
action_name
issue
=
link_to
project_issue_path
(
event
.
project
,
event
.
issue
)
do
%strong
=
truncate
event
.
issue_title
at
...
...
app/views/events/_event_
new_
merge_request.html.haml
→
app/views/events/_event_merge_request.html.haml
View file @
00dc34e1
=
image_tag
gravatar_icon
(
event
.
author_email
),
:class
=>
"avatar"
%strong
#{
event
.
author_name
}
%span
.
label.success
requested
merge
%span
.
event_label
=
event
.
action_name
merge
request
=
link_to
project_merge_request_path
(
event
.
project
,
event
.
merge_request
)
do
%strong
=
truncate
event
.
merge_request_title
at
...
...
@@ -10,7 +10,7 @@ at
=
time_ago_in_words
(
event
.
created_at
)
ago.
%br
%span
.label
=
event
.
merge_request
.
source_branch
%span
=
event
.
merge_request
.
source_branch
→
%span
.label
=
event
.
merge_request
.
target_branch
%span
=
event
.
merge_request
.
target_branch
app/views/events/_event_push.html.haml
View file @
00dc34e1
-
if
event
.
new_branch?
||
event
.
new_tag?
%div
=
image_tag
gravatar_icon
(
event
.
author_email
),
:class
=>
"avatar"
%strong
#{
event
.
author_name
}
%span
.label.pushed
pushed
new
-
if
event
.
new_tag?
tag
=
link_to
project_commits_path
(
event
.
project
,
:ref
=>
event
.
tag_name
)
do
%strong
=
event
.
tag_name
-
else
branch
=
link_to
project_commits_path
(
event
.
project
,
:ref
=>
event
.
branch_name
)
do
%strong
=
event
.
branch_name
%span
.event_label
=
event
.
push_action_name
=
link_to
project_commits_path
(
event
.
project
,
:ref
=>
event
.
ref_name
)
do
%strong
=
event
.
ref_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
.
author_email
),
:class
=>
"avatar"
%strong
#{
event
.
author_name
}
%span
.label.pushed
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
%strong
#{
event
.
commits
.
first
.
commit
.
id
[
0
..
7
]
}
...
#{
event
.
commits
.
last
.
id
[
0
..
7
]
}
-
project
=
event
.
project
%ul
.unstyled.event_commits
-
if
event
.
commits
.
size
>
3
-
event
.
commits
[
0
...
2
].
each
do
|
commit
|
=
render
"events/commit"
,
:commit
=>
commit
,
:project
=>
project
%li
%br
\... and
#{
event
.
commits
.
size
-
2
}
more commits
-
else
-
event
.
commits
.
each
do
|
commit
|
=
render
"events/commit"
,
:commit
=>
commit
,
:project
=>
project
-
if
event
.
md_ref?
-
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
%strong
#{
event
.
commits
.
first
.
commit
.
id
[
0
..
7
]
}
...
#{
event
.
commits
.
last
.
id
[
0
..
7
]
}
-
project
=
event
.
project
%ul
.unstyled.event_commits
-
if
event
.
commits
.
size
>
3
-
event
.
commits
[
0
...
2
].
each
do
|
commit
|
=
render
"events/commit"
,
:commit
=>
commit
,
:project
=>
project
%li
%br
\... and
#{
event
.
commits
.
size
-
2
}
more commits
-
else
-
event
.
commits
.
each
do
|
commit
|
=
render
"events/commit"
,
:commit
=>
commit
,
:project
=>
project
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