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
Jérome Perrin
gitlab-ce
Commits
e0d1fba1
Commit
e0d1fba1
authored
Jun 12, 2012
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Recent push event
parent
40af6e1a
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
70 additions
and
11 deletions
+70
-11
app/assets/stylesheets/common.scss
app/assets/stylesheets/common.scss
+13
-0
app/assets/stylesheets/themes/ui_modern.scss
app/assets/stylesheets/themes/ui_modern.scss
+5
-6
app/controllers/merge_requests_controller.rb
app/controllers/merge_requests_controller.rb
+1
-1
app/controllers/projects_controller.rb
app/controllers/projects_controller.rb
+3
-0
app/helpers/merge_requests_helper.rb
app/helpers/merge_requests_helper.rb
+11
-0
app/roles/account.rb
app/roles/account.rb
+9
-0
app/views/events/_event.html.haml
app/views/events/_event.html.haml
+9
-4
app/views/events/_event_last_push.html.haml
app/views/events/_event_last_push.html.haml
+16
-0
app/views/events/_event_push.html.haml
app/views/events/_event_push.html.haml
+1
-0
app/views/projects/index.html.haml
app/views/projects/index.html.haml
+1
-0
app/views/projects/show.html.haml
app/views/projects/show.html.haml
+1
-0
No files found.
app/assets/stylesheets/common.scss
View file @
e0d1fba1
...
@@ -733,3 +733,16 @@ li.note {
...
@@ -733,3 +733,16 @@ li.note {
.chzn-container-active
.chzn-single
{
.chzn-container-active
.chzn-single
{
background
:
#fff
;
background
:
#fff
;
}
}
/**
* Push event widget
*
*/
.event_lp
{
@extend
.alert-info
;
margin-bottom
:
15px
;
padding
:
8px
;
border-style
:
solid
;
border-width
:
1px
;
@include
border-radius
(
4px
);
}
app/assets/stylesheets/themes/ui_modern.scss
View file @
e0d1fba1
...
@@ -50,13 +50,12 @@
...
@@ -50,13 +50,12 @@
}
}
}
}
.alert
{
.alert-info
{
&
.alert-info
{
border-color
:
#FDA
;
border-color
:
#FDA
;
background
:
#FED
;
background
:
#FED
;
color
:
#D70
;
color
:
#D70
;
}
}
}
.progress
.bar
{
.progress
.bar
{
background
:
#D80
;
background
:
#D80
;
...
...
app/controllers/merge_requests_controller.rb
View file @
e0d1fba1
...
@@ -63,7 +63,7 @@ class MergeRequestsController < ApplicationController
...
@@ -63,7 +63,7 @@ class MergeRequestsController < ApplicationController
end
end
def
new
def
new
@merge_request
=
@project
.
merge_requests
.
new
@merge_request
=
@project
.
merge_requests
.
new
(
params
[
:merge_request
])
end
end
def
edit
def
edit
...
...
app/controllers/projects_controller.rb
View file @
e0d1fba1
...
@@ -15,6 +15,8 @@ class ProjectsController < ApplicationController
...
@@ -15,6 +15,8 @@ class ProjectsController < ApplicationController
@projects
=
@projects
.
page
(
params
[
:page
]).
per
(
40
)
@projects
=
@projects
.
page
(
params
[
:page
]).
per
(
40
)
@events
=
Event
.
where
(
:project_id
=>
current_user
.
projects
.
map
(
&
:id
)).
recent
.
limit
(
20
)
@events
=
Event
.
where
(
:project_id
=>
current_user
.
projects
.
map
(
&
:id
)).
recent
.
limit
(
20
)
@last_push
=
current_user
.
recent_push
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
html
format
.
html
format
.
atom
{
render
:layout
=>
false
}
format
.
atom
{
render
:layout
=>
false
}
...
@@ -69,6 +71,7 @@ class ProjectsController < ApplicationController
...
@@ -69,6 +71,7 @@ class ProjectsController < ApplicationController
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
html
do
format
.
html
do
if
@project
.
repo_exists?
&&
@project
.
has_commits?
if
@project
.
repo_exists?
&&
@project
.
has_commits?
@last_push
=
current_user
.
recent_push
(
@project
.
id
)
render
:show
render
:show
else
else
render
"projects/empty"
render
"projects/empty"
...
...
app/helpers/merge_requests_helper.rb
View file @
e0d1fba1
...
@@ -20,4 +20,15 @@ module MergeRequestsHelper
...
@@ -20,4 +20,15 @@ module MergeRequestsHelper
merge_request
.
author_name
merge_request
.
author_name
end
end
end
end
def
new_mr_path_from_push_event
(
event
)
new_project_merge_request_path
(
event
.
project
,
:merge_request
=>
{
:source_branch
=>
event
.
branch_name
,
:target_branch
=>
event
.
project
.
root_ref
,
:title
=>
event
.
branch_name
.
titleize
}
)
end
end
end
app/roles/account.rb
View file @
e0d1fba1
...
@@ -46,4 +46,13 @@ module Account
...
@@ -46,4 +46,13 @@ module Account
return
100
if
projects_limit
.
zero?
return
100
if
projects_limit
.
zero?
(
my_own_projects
.
count
.
to_f
/
projects_limit
)
*
100
(
my_own_projects
.
count
.
to_f
/
projects_limit
)
*
100
end
end
def
recent_push
project_id
=
nil
# Get push events not earlier than 6 hours ago
events
=
recent_events
.
code_push
.
where
(
"created_at > ?"
,
Time
.
now
-
6
.
hours
)
events
=
events
.
where
(
:project_id
=>
project_id
)
if
project_id
# Take only latest one
events
=
events
.
recent
.
limit
(
1
).
first
end
end
end
app/views/events/_event.html.haml
View file @
e0d1fba1
-
if
event
.
allowed?
-
if
event
.
allowed?
.event_feed
-
if
event
.
issue?
-
if
event
.
issue?
.event_feed
=
render
"events/event_issue"
,
:event
=>
event
=
render
"events/event_issue"
,
:event
=>
event
-
elsif
event
.
merge_request?
-
elsif
event
.
merge_request?
.event_feed
=
render
"events/event_merge_request"
,
:event
=>
event
=
render
"events/event_merge_request"
,
:event
=>
event
-
elsif
event
.
push?
-
elsif
event
.
push?
.event_feed
=
render
"events/event_push"
,
:event
=>
event
=
render
"events/event_push"
,
:event
=>
event
app/views/events/_event_last_push.html.haml
0 → 100644
View file @
e0d1fba1
-
if
event
&&
event
.
branch_name
&&
event
.
project
.
merge_requests_enabled
.event_lp
%div
=
image_tag
gravatar_icon
(
event
.
author_email
),
:class
=>
"avatar"
%span
Your last push was to
=
event
.
ref_type
=
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.
=
link_to
new_mr_path_from_push_event
(
event
),
:title
=>
"New Merge Request"
,
:class
=>
"btn small padded primary"
do
Merge Request
app/views/events/_event_push.html.haml
View file @
e0d1fba1
...
@@ -27,3 +27,4 @@
...
@@ -27,3 +27,4 @@
-
else
-
else
-
event
.
commits
.
each
do
|
commit
|
-
event
.
commits
.
each
do
|
commit
|
=
render
"events/commit"
,
:commit
=>
commit
,
:project
=>
project
=
render
"events/commit"
,
:commit
=>
commit
,
:project
=>
project
app/views/projects/index.html.haml
View file @
e0d1fba1
...
@@ -14,6 +14,7 @@
...
@@ -14,6 +14,7 @@
-
else
-
else
%h4
.nothing_here_message
Projects activity will be displayed here
%h4
.nothing_here_message
Projects activity will be displayed here
.side
.side
=
render
"events/event_last_push"
,
:event
=>
@last_push
.projects_box
.projects_box
%h5
%h5
Projects
Projects
...
...
app/views/projects/show.html.haml
View file @
e0d1fba1
...
@@ -24,6 +24,7 @@
...
@@ -24,6 +24,7 @@
=
link_to
new_project_issue_path
(
@project
),
:title
=>
"New Issue"
,
:class
=>
"btn small"
do
=
link_to
new_project_issue_path
(
@project
),
:title
=>
"New Issue"
,
:class
=>
"btn small"
do
Issue
Issue
=
render
"events/event_last_push"
,
:event
=>
@last_push
-
unless
@events
.
blank?
-
unless
@events
.
blank?
%br
%br
%h5
.cgray
%h5
.cgray
...
...
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