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
77cf6620
Commit
77cf6620
authored
Jun 21, 2012
by
randx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pushed widget improved
parent
ed247b38
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
22 additions
and
16 deletions
+22
-16
app/helpers/application_helper.rb
app/helpers/application_helper.rb
+5
-0
app/roles/account.rb
app/roles/account.rb
+2
-2
app/roles/push_event.rb
app/roles/push_event.rb
+8
-0
app/views/events/_event_last_push.html.haml
app/views/events/_event_last_push.html.haml
+4
-5
app/views/projects/show.html.haml
app/views/projects/show.html.haml
+1
-7
features/step_definitions/dashboard_steps.rb
features/step_definitions/dashboard_steps.rb
+1
-1
spec/requests/last_push_widget_spec.rb
spec/requests/last_push_widget_spec.rb
+1
-1
No files found.
app/helpers/application_helper.rb
View file @
77cf6620
...
...
@@ -88,4 +88,9 @@ module ApplicationHelper
def
app_theme
Gitlab
::
Theme
.
css_class_by_id
(
current_user
.
try
(
:theme_id
))
end
def
show_last_push_widget?
(
event
)
event
&&
event
.
last_push_to_non_root?
&&
event
.
project
&&
event
.
project
.
merge_requests_enabled
end
end
app/roles/account.rb
View file @
77cf6620
...
...
@@ -48,8 +48,8 @@ module Account
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
)
# Get push events not earlier than
2
hours ago
events
=
recent_events
.
code_push
.
where
(
"created_at > ?"
,
Time
.
now
-
2
.
hours
)
events
=
events
.
where
(
:project_id
=>
project_id
)
if
project_id
# Take only latest one
...
...
app/roles/push_event.rb
View file @
77cf6620
...
...
@@ -9,6 +9,10 @@ module PushEvent
data
[
:ref
][
"refs/tags"
]
end
def
branch?
data
[
:ref
][
"refs/heads"
]
end
def
new_branch?
commit_from
=~
/^00000/
end
...
...
@@ -87,4 +91,8 @@ module PushEvent
def
push_with_commits?
md_ref?
&&
commits
.
any?
&&
parent_commit
&&
last_commit
end
def
last_push_to_non_root?
branch?
&&
project
.
default_branch
!=
branch_name
end
end
app/views/events/_event_last_push.html.haml
View file @
77cf6620
-
if
event
&&
event
.
branch_name
-
if
show_last_push_widget?
(
event
)
.event_lp
%div
=
image_tag
gravatar_icon
(
event
.
author_email
),
:class
=>
"avatar"
%span
Your
last push was
to
%span
Your
pushed
to
=
event
.
ref_type
=
link_to
project_commits_path
(
event
.
project
,
:ref
=>
event
.
ref_name
)
do
%strong
=
event
.
ref_name
...
...
@@ -12,6 +12,5 @@
=
time_ago_in_words
(
event
.
created_at
)
ago.
-
if
event
.
project
.
merge_requests_enabled
=
link_to
new_mr_path_from_push_event
(
event
),
:title
=>
"New Merge Request"
,
:class
=>
"btn small padded primary"
do
Create Merge Request
=
link_to
new_mr_path_from_push_event
(
event
),
:title
=>
"New Merge Request"
,
:class
=>
"btn small padded primary"
do
Create Merge Request
app/views/projects/show.html.haml
View file @
77cf6620
...
...
@@ -21,12 +21,6 @@
Issue
=
render
"events/event_last_push"
,
:event
=>
@last_push
-
unless
@events
.
blank?
%br
%h5
.cgray
%span
.ico.activities
Recent Activity
%hr
.content_list
=
render
@events
.content_list
=
render
@events
features/step_definitions/dashboard_steps.rb
View file @
77cf6620
...
...
@@ -42,7 +42,7 @@ Given /^project "(.*?)" has push event$/ do |arg1|
end
Then
/^I should see last push widget$/
do
page
.
should
have_content
"Your
last push was
to branch new_design"
page
.
should
have_content
"Your
pushed
to branch new_design"
page
.
should
have_link
"Create Merge Request"
end
...
...
spec/requests/last_push_widget_spec.rb
View file @
77cf6620
...
...
@@ -11,7 +11,7 @@ describe "Last Push widget" do
end
it
"should display last push widget with link to merge request page"
do
page
.
should
have_content
"Your
last push was
to branch new_design"
page
.
should
have_content
"Your
pushed
to branch new_design"
page
.
should
have_link
"Create Merge Request"
end
...
...
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