diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index be85521ffa5b5ad68586737c029312cffee54e7d..5474f9e97a6187974721f8ff880c9e4ec348330e 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -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 diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index 1bcd9a495278308ff3cfde5161a5462545f9468e..df1d630c89d783f05217d179f1067b80511f1138 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -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 diff --git a/app/views/projects/_last_push.html.haml b/app/views/projects/_last_push.html.haml new file mode 100644 index 0000000000000000000000000000000000000000..30622d8a91063d2c8360bdcba7f7809da5c40f00 --- /dev/null +++ b/app/views/projects/_last_push.html.haml @@ -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 diff --git a/app/views/projects/activity.html.haml b/app/views/projects/activity.html.haml index 25bd93cae87135c96666d5804e40a1988f816cef..b486cd4ded4e85f055f3508fa207121ce2bf928e 100644 --- a/app/views/projects/activity.html.haml +++ b/app/views/projects/activity.html.haml @@ -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 diff --git a/app/views/projects/blob/show.html.haml b/app/views/projects/blob/show.html.haml index a1d464bac59fcfb2d2bf40708f5ba65e3a52e874..bd2fc43633cbf391fe880e81ba23c7d93f2b8fd2 100644 --- a/app/views/projects/blob/show.html.haml +++ b/app/views/projects/blob/show.html.haml @@ -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 diff --git a/app/views/projects/merge_requests/index.html.haml b/app/views/projects/merge_requests/index.html.haml index e0bc1df97ee1f00dcc40bbdd3295de5ec3d1ba3f..72fbe2e27a7acbbfb0d3416df5e45dcea948e458 100644 --- a/app/views/projects/merge_requests/index.html.haml +++ b/app/views/projects/merge_requests/index.html.haml @@ -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) diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml index 17907a42e3c0891a56607cd95dd2920e93e844c7..d9cff805575bd04d41160b77481de885e5d1ab78 100644 --- a/app/views/projects/show.html.haml +++ b/app/views/projects/show.html.haml @@ -6,6 +6,7 @@ = render 'shared/no_ssh' = render 'shared/no_password' += render 'projects/last_push' = render "home_panel" .project-stats diff --git a/app/views/projects/tree/show.html.haml b/app/views/projects/tree/show.html.haml index 04590f65b27f7aa5ef5a12fd73db910c78593aed..c9e59428e7883aa221e812cf71bc8ad80591a460 100644 --- a/app/views/projects/tree/show.html.haml +++ b/app/views/projects/tree/show.html.haml @@ -2,7 +2,9 @@ = content_for :meta_tags do - 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