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
Tatuya Kamada
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
Show 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 {
...
@@ -67,6 +67,12 @@ a:focus {
}
}
}
}
.event_label
{
background
:
#FCEEC1
;
padding
:
0
2px
;
font-family
:
monospace
;
}
.tabs
>
li
>
a
,
.pills
>
li
>
a
{
.tabs
>
li
>
a
,
.pills
>
li
>
a
{
color
:
$style_color
;
color
:
$style_color
;
}
}
...
@@ -126,6 +132,9 @@ a:focus {
...
@@ -126,6 +132,9 @@ a:focus {
.ipadded
{
.ipadded
{
padding
:
20px
!
important
;
padding
:
20px
!
important
;
}
}
.lborder
{
border-left
:
1px
solid
#eee
;
}
.no-borders
{
.no-borders
{
border
:none
;
border
:none
;
}
}
...
@@ -872,10 +881,9 @@ p.time {
...
@@ -872,10 +881,9 @@ p.time {
border
:none
;
border
:none
;
padding
:
0px
5px
;
padding
:
0px
5px
;
.project_link
{
color
:
#888
;
&
:hover
{
&
:hover
{
background
:
$hover
;
//border-left:4px solid $styled_border_color;
h4
{
color
:
#111
;
color
:
#111
;
.ico.project
{
.ico.project
{
background-position
:
-209px
-21px
;
background-position
:
-209px
-21px
;
...
@@ -1077,7 +1085,6 @@ p.time {
...
@@ -1077,7 +1085,6 @@ p.time {
}
}
.arrow
{
.arrow
{
float
:
right
;
background
:
#E3E5EA
;
background
:
#E3E5EA
;
padding
:
5px
;
padding
:
5px
;
margin-top
:
5px
;
margin-top
:
5px
;
...
...
app/models/event.rb
View file @
00dc34e1
...
@@ -9,6 +9,8 @@ class Event < ActiveRecord::Base
...
@@ -9,6 +9,8 @@ class Event < ActiveRecord::Base
Commented
=
6
Commented
=
6
Merged
=
7
Merged
=
7
does
"event/push"
belongs_to
:project
belongs_to
:project
belongs_to
:target
,
:polymorphic
=>
true
belongs_to
:target
,
:polymorphic
=>
true
...
@@ -30,14 +32,17 @@ class Event < ActiveRecord::Base
...
@@ -30,14 +32,17 @@ class Event < ActiveRecord::Base
# - new issue
# - new issue
# - merge request
# - merge request
def
allowed?
def
allowed?
push?
||
new_issue?
||
new_merge_request?
||
push?
||
issue?
||
merge_request?
changed_merge_request?
||
changed_issue?
end
end
def
push?
def
push?
action
==
self
.
class
::
Pushed
action
==
self
.
class
::
Pushed
end
end
def
merged?
action
==
self
.
class
::
Merged
end
def
closed?
def
closed?
action
==
self
.
class
::
Closed
action
==
self
.
class
::
Closed
end
end
...
@@ -46,28 +51,12 @@ class Event < ActiveRecord::Base
...
@@ -46,28 +51,12 @@ class Event < ActiveRecord::Base
action
==
self
.
class
::
Reopened
action
==
self
.
class
::
Reopened
end
end
def
new_tag?
def
issue?
data
[
:ref
][
"refs/tags"
]
target_type
==
"Issue"
end
def
new_branch?
data
[
:before
]
=~
/^00000/
end
def
commit_from
data
[
:before
]
end
def
commit_to
data
[
:after
]
end
def
branch_name
@branch_name
||=
data
[
:ref
].
gsub
(
"refs/heads/"
,
""
)
end
end
def
tag_name
def
merge_request?
@tag_name
||=
data
[
:ref
].
gsub
(
"refs/tags/"
,
""
)
target_type
==
"MergeRequest"
end
end
def
new_issue?
def
new_issue?
...
@@ -102,9 +91,13 @@ class Event < ActiveRecord::Base
...
@@ -102,9 +91,13 @@ class Event < ActiveRecord::Base
@author
||=
User
.
find
(
author_id
)
@author
||=
User
.
find
(
author_id
)
end
end
def
commits
def
action_name
@commits
||=
data
[
:commits
].
map
do
|
commit
|
if
closed?
project
.
commit
(
commit
[
:id
])
"closed"
elsif
merged?
"merged"
else
"opened"
end
end
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
|
-
projects
.
first
(
5
).
each
do
|
project
|
%div
.dash_project_item
%div
.dash_project_item
=
link_to
project
do
%h4
%h4
=
link_to
project
,
:class
=>
"project_link"
do
%span
.ico.project
%span
.ico.project
=
truncate
project
.
name
,
:length
=>
30
=
truncate
project
.
name
,
:length
=>
24
%small
%small
last activity at
last activity at
=
project
.
last_activity_date
.
stamp
(
"Aug 25, 2011"
)
=
project
.
last_activity_date
.
stamp
(
"Aug 25, 2011"
)
%span
.right.arrow
→
.right
%small
%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 @@
...
@@ -21,8 +21,8 @@
.dashboard_block
.dashboard_block
.row
.row
.span4.right
.span4.right
%div
.
borders
.ipadded
%div
.
lborder
.ipadded
%h
1
%h
3
=
pluralize
current_user
.
projects
.
count
,
"project"
,
"projects"
=
pluralize
current_user
.
projects
.
count
,
"project"
,
"projects"
-
if
current_user
.
can_create_project?
-
if
current_user
.
can_create_project?
%hr
%hr
...
...
app/views/events/_event.html.haml
View file @
00dc34e1
-
if
event
.
allowed?
-
if
event
.
allowed?
.event_feed
.event_feed
-
if
event
.
new_issue?
-
if
event
.
issue?
=
render
"events/event_new_issue"
,
:event
=>
event
=
render
"events/event_issue"
,
:event
=>
event
-
elsif
event
.
new_merge_request?
-
elsif
event
.
merge_request?
=
render
"events/event_new_merge_request"
,
:event
=>
event
=
render
"events/event_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
-
elsif
event
.
push?
-
elsif
event
.
push?
=
render
"events/event_push"
,
:event
=>
event
=
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"
=
image_tag
gravatar_icon
(
event
.
author_email
),
:class
=>
"avatar"
%strong
#{
event
.
author_name
}
%strong
#{
event
.
author_name
}
%span
.
label.success
created
%span
.
event_label
=
event
.
action_name
new
issue
issue
=
link_to
project_issue_path
(
event
.
project
,
event
.
issue
)
do
=
link_to
project_issue_path
(
event
.
project
,
event
.
issue
)
do
%strong
=
truncate
event
.
issue_title
%strong
=
truncate
event
.
issue_title
at
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"
=
image_tag
gravatar_icon
(
event
.
author_email
),
:class
=>
"avatar"
%strong
#{
event
.
author_name
}
%strong
#{
event
.
author_name
}
%span
.
label.success
requested
%span
.
event_label
=
event
.
action_name
merge
merge
request
=
link_to
project_merge_request_path
(
event
.
project
,
event
.
merge_request
)
do
=
link_to
project_merge_request_path
(
event
.
project
,
event
.
merge_request
)
do
%strong
=
truncate
event
.
merge_request_title
%strong
=
truncate
event
.
merge_request_title
at
at
...
@@ -10,7 +10,7 @@ at
...
@@ -10,7 +10,7 @@ at
=
time_ago_in_words
(
event
.
created_at
)
=
time_ago_in_words
(
event
.
created_at
)
ago.
ago.
%br
%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"
=
image_tag
gravatar_icon
(
event
.
author_email
),
:class
=>
"avatar"
%strong
#{
event
.
author_name
}
%strong
#{
event
.
author_name
}
%span
.label.pushed
pushed
%span
.event_label
=
event
.
push_action_name
new
=
link_to
project_commits_path
(
event
.
project
,
:ref
=>
event
.
ref_name
)
do
-
if
event
.
new_tag?
%strong
=
event
.
ref_name
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
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
at
%strong
=
link_to
event
.
project
.
name
,
event
.
project
%strong
=
link_to
event
.
project
.
name
,
event
.
project
%span
.cgray
%span
.cgray
=
time_ago_in_words
(
event
.
created_at
)
=
time_ago_in_words
(
event
.
created_at
)
ago.
ago.
-
if
event
.
md_ref?
-
if
event
.
commits
.
count
>
1
-
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
=
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
]
}
%strong
#{
event
.
commits
.
first
.
commit
.
id
[
0
..
7
]
}
...
#{
event
.
commits
.
last
.
id
[
0
..
7
]
}
...
...
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