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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
f2db188d
Commit
f2db188d
authored
Dec 14, 2012
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Processing with note events. reformated dashboard for more events to handle
parent
678e5355
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
73 additions
and
33 deletions
+73
-33
app/assets/stylesheets/sections/events.scss
app/assets/stylesheets/sections/events.scss
+6
-3
app/controllers/milestones_controller.rb
app/controllers/milestones_controller.rb
+2
-3
app/models/event.rb
app/models/event.rb
+9
-6
app/models/milestone.rb
app/models/milestone.rb
+1
-1
app/observers/activity_observer.rb
app/observers/activity_observer.rb
+17
-8
app/roles/note_event.rb
app/roles/note_event.rb
+21
-0
app/views/events/_event.html.haml
app/views/events/_event.html.haml
+6
-8
app/views/events/event/_note.html.haml
app/views/events/event/_note.html.haml
+11
-4
No files found.
app/assets/stylesheets/sections/events.scss
View file @
f2db188d
...
@@ -31,7 +31,6 @@
...
@@ -31,7 +31,6 @@
*
*
*/
*/
.event-item
{
.event-item
{
min-height
:
40px
;
border-bottom
:
1px
solid
#eee
;
border-bottom
:
1px
solid
#eee
;
.event-title
{
.event-title
{
color
:
#333
;
color
:
#333
;
...
@@ -50,14 +49,18 @@
...
@@ -50,14 +49,18 @@
}
}
}
}
.avatar
{
.avatar
{
width
:
32px
;
position
:
relative
;
top
:
-3px
;
}
}
.event_icon
{
.event_icon
{
position
:
relative
;
float
:
right
;
float
:
right
;
border
:
1px
solid
#EEE
;
border
:
1px
solid
#EEE
;
padding
:
5px
;
padding
:
5px
;
@include
border-radius
(
5px
);
@include
border-radius
(
5px
);
background
:
#F9F9F9
;
background
:
#F9F9F9
;
margin-left
:
10px
;
top
:
-6px
;
img
{
img
{
width
:
20px
;
width
:
20px
;
}
}
...
@@ -71,7 +74,7 @@
...
@@ -71,7 +74,7 @@
}
}
}
}
padding
:
1
5
px
5px
;
padding
:
1
6
px
5px
;
&
:last-child
{
border
:none
}
&
:last-child
{
border
:none
}
.wll
:hover
{
background
:none
}
.wll
:hover
{
background
:none
}
...
...
app/controllers/milestones_controller.rb
View file @
f2db188d
...
@@ -43,7 +43,7 @@ class MilestonesController < ProjectResourceController
...
@@ -43,7 +43,7 @@ class MilestonesController < ProjectResourceController
def
create
def
create
@milestone
=
@project
.
milestones
.
new
(
params
[
:milestone
])
@milestone
=
@project
.
milestones
.
new
(
params
[
:milestone
])
@milestone
.
author_id
=
current_user
.
id
@milestone
.
author_id
_of_changes
=
current_user
.
id
if
@milestone
.
save
if
@milestone
.
save
redirect_to
project_milestone_path
(
@project
,
@milestone
)
redirect_to
project_milestone_path
(
@project
,
@milestone
)
...
@@ -53,8 +53,7 @@ class MilestonesController < ProjectResourceController
...
@@ -53,8 +53,7 @@ class MilestonesController < ProjectResourceController
end
end
def
update
def
update
@milestone
.
author_id
=
current_user
.
id
@milestone
.
update_attributes
(
params
[
:milestone
].
merge
(
author_id_of_changes:
current_user
.
id
))
@milestone
.
update_attributes
(
params
[
:milestone
])
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
js
format
.
js
...
...
app/models/event.rb
View file @
f2db188d
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
#
#
class
Event
<
ActiveRecord
::
Base
class
Event
<
ActiveRecord
::
Base
include
NoteEvent
include
PushEvent
include
PushEvent
attr_accessible
:project
,
:action
,
:data
,
:author_id
,
:project_id
,
attr_accessible
:project
,
:action
,
:data
,
:author_id
,
:project_id
,
...
@@ -58,12 +59,14 @@ class Event < ActiveRecord::Base
...
@@ -58,12 +59,14 @@ class Event < ActiveRecord::Base
end
end
end
end
# Next events currently enabled for system
def
proper?
# - push
if
push?
# - new issue
true
# - merge request
elsif
membership_changed?
def
allowed?
true
push?
||
issue?
||
merge_request?
||
membership_changed?
||
note?
||
milestone?
else
(
issue?
||
merge_request?
||
note?
||
milestone?
)
&&
target
end
end
end
def
project_name
def
project_name
...
...
app/models/milestone.rb
View file @
f2db188d
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
class
Milestone
<
ActiveRecord
::
Base
class
Milestone
<
ActiveRecord
::
Base
attr_accessible
:title
,
:description
,
:due_date
,
:closed
attr_accessible
:title
,
:description
,
:due_date
,
:closed
attr_accessor
:author_id
attr_accessor
:author_id
,
:author_id_of_changes
belongs_to
:project
belongs_to
:project
has_many
:issues
has_many
:issues
...
...
app/observers/activity_observer.rb
View file @
f2db188d
...
@@ -2,17 +2,26 @@ class ActivityObserver < ActiveRecord::Observer
...
@@ -2,17 +2,26 @@ class ActivityObserver < ActiveRecord::Observer
observe
:issue
,
:merge_request
,
:note
,
:milestone
observe
:issue
,
:merge_request
,
:note
,
:milestone
def
after_create
(
record
)
def
after_create
(
record
)
Event
.
create
(
event_author_id
=
record
.
author_id
||
record
.
author_id_of_changes
project:
record
.
project
,
target_id:
record
.
id
,
# Skip status notes
target_type:
record
.
class
.
name
,
if
record
.
kind_of?
(
Note
)
&&
record
.
note
.
include?
(
"_Status changed to "
)
action:
Event
.
determine_action
(
record
),
return
true
author_id:
record
.
author_id
end
)
if
event_author_id
Event
.
create
(
project:
record
.
project
,
target_id:
record
.
id
,
target_type:
record
.
class
.
name
,
action:
Event
.
determine_action
(
record
),
author_id:
event_author_id
)
end
end
end
def
after_save
(
record
)
def
after_save
(
record
)
if
record
.
changed
.
include?
(
"closed"
)
if
record
.
changed
.
include?
(
"closed"
)
&&
record
.
author_id_of_changes
Event
.
create
(
Event
.
create
(
project:
record
.
project
,
project:
record
.
project
,
target_id:
record
.
id
,
target_id:
record
.
id
,
...
...
app/roles/note_event.rb
0 → 100644
View file @
f2db188d
module
NoteEvent
def
note_commit_id
target
.
noteable_id
end
def
note_short_commit_id
note_commit_id
[
0
..
8
]
end
def
note_commit?
target
.
noteable_type
==
"Commit"
end
def
note_target
target
.
noteable
end
def
note_target_id
target
.
noteable_id
end
end
app/views/events/_event.html.haml
View file @
f2db188d
-
if
event
.
allowed
?
-
if
event
.
proper
?
%div
.event-item
%div
.event-item
=
event_image
(
event
)
%span
.cgray.right
#{
time_ago_in_words
(
event
.
created_at
)
}
ago.
=
image_tag
gravatar_icon
(
event
.
author_email
),
class:
"avatar s24"
=
image_tag
gravatar_icon
(
event
.
author_email
),
class:
"avatar s24"
-
if
event
.
push?
-
if
event
.
push?
=
render
"events/event/push"
,
event:
event
=
render
"events/event/push"
,
event:
event
-
if
event
.
note?
.clearfix
-
elsif
event
.
note?
=
render
"events/event/note"
,
event:
event
=
render
"events/event/note"
,
event:
event
-
else
-
else
=
render
"events/event/common"
,
event:
event
=
render
"events/event/common"
,
event:
event
.clearfix
%span
.cgray.right
=
time_ago_in_words
(
event
.
created_at
)
ago.
.clearfix
app/views/events/event/_note.html.haml
View file @
f2db188d
.event-title
.event-title
%span
.author_name
=
link_to_author
event
%span
.author_name
=
link_to_author
event
%span
.event_label
commented on
#{
event
.
target
.
noteable_type_name
}
%span
.event_label
commented on
#{
event
.
target
.
noteable_type_name
}
-
if
event
.
target
and
event
.
target
.
noteable_id
-
if
event
.
target
and
event
.
note_target
=
link_to
[
event
.
project
,
event
.
target
.
noteable
]
do
-
if
event
.
note_commit?
%strong
=
truncate
event
.
target
.
noteable_id
=
link_to
event
.
note_short_commit_id
,
project_commit_path
(
event
.
project
,
event
.
note_commit_id
),
class:
"commit_short_id"
-
else
=
link_to
[
event
.
project
,
event
.
note_target
]
do
%strong
=
truncate
event
.
note_target_id
-
else
-
else
%strong
(deleted)
%strong
(deleted)
at
at
...
@@ -13,4 +17,7 @@
...
@@ -13,4 +17,7 @@
=
event
.
project_name
=
event
.
project_name
.event-body
.event-body
%p
.hint
=
truncate
event
.
target
.
note
,
length:
70
%span
.hint
%i
.icon-comment
=
truncate
event
.
target
.
note
,
length:
70
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