Show last push widget on several project pages
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
This commit is contained in:
parent
a0b9fe1288
commit
f0e1da04f0
8 changed files with 29 additions and 4 deletions
|
@ -81,7 +81,6 @@ class ProjectsController < ApplicationController
|
|||
if @project.empty_repo?
|
||||
render 'projects/empty'
|
||||
else
|
||||
@last_push = current_user.recent_push(@project.id) if current_user
|
||||
render :show
|
||||
end
|
||||
else
|
||||
|
|
|
@ -266,4 +266,10 @@ module ProjectsHelper
|
|||
|
||||
namespace_project_new_blob_path(@project.namespace, @project, tree_join(ref), file_name: 'README.md')
|
||||
end
|
||||
|
||||
def last_push_event
|
||||
if current_user
|
||||
current_user.recent_push(@project.id)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
14
app/views/projects/_last_push.html.haml
Normal file
14
app/views/projects/_last_push.html.haml
Normal file
|
@ -0,0 +1,14 @@
|
|||
- if event = last_push_event
|
||||
- if show_last_push_widget?(event)
|
||||
.hidden-xs.center
|
||||
.slead
|
||||
%span You pushed to
|
||||
= link_to namespace_project_commits_path(event.project.namespace, event.project, event.ref_name) do
|
||||
%strong= event.ref_name
|
||||
branch
|
||||
#{time_ago_with_tooltip(event.created_at)}
|
||||
|
||||
%div
|
||||
= link_to new_mr_path_from_push_event(event), title: "New Merge Request", class: "btn btn-info btn-sm" do
|
||||
Create Merge Request
|
||||
%hr
|
|
@ -1,6 +1,5 @@
|
|||
= render 'projects/last_push'
|
||||
.hidden-xs
|
||||
= render "events/event_last_push", event: @last_push
|
||||
|
||||
- if current_user
|
||||
%ul.nav.nav-pills.event_filter.pull-right
|
||||
%li
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
- page_title @blob.path, @ref
|
||||
|
||||
= render 'projects/last_push'
|
||||
|
||||
%div.tree-ref-holder
|
||||
= render 'shared/ref_switcher', destination: 'blob', path: @path
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
- page_title "Merge Requests"
|
||||
= render 'projects/last_push'
|
||||
.append-bottom-10
|
||||
.pull-right
|
||||
= render 'shared/issuable/search_form', path: namespace_project_merge_requests_path(@project.namespace, @project)
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
= render 'shared/no_ssh'
|
||||
= render 'shared/no_password'
|
||||
|
||||
= render 'projects/last_push'
|
||||
= render "home_panel"
|
||||
|
||||
.project-stats
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
- if current_user
|
||||
= auto_discovery_link_tag(:atom, namespace_project_commits_url(@project.namespace, @project, @ref, format: :atom, private_token: current_user.private_token), title: "#{@project.name}:#{@ref} commits")
|
||||
|
||||
= render 'projects/last_push'
|
||||
|
||||
.tree-ref-holder
|
||||
= render 'shared/ref_switcher', destination: 'tree', path: @path
|
||||
|
||||
|
|
Loading…
Reference in a new issue