diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-07-09 14:25:05 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-07-09 14:25:05 +0300 |
commit | 5309dad4599310a50883366c9cdf866465a89f11 (patch) | |
tree | 6f99a4344cc56e5b1359c3909ec440018763b49d | |
parent | 11e43cddbc22e9402e1f3f0f79172cebd741983f (diff) | |
parent | e9ab09c6b59421c32913e4b92ee061b91de30231 (diff) |
Merge branch 'last-push-widget' into 'master'
Last push widget
Continue of !938. Screenshots are at https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/938#note_1594727
See merge request !946
-rw-r--r-- | app/controllers/projects_controller.rb | 1 | ||||
-rw-r--r-- | app/helpers/projects_helper.rb | 6 | ||||
-rw-r--r-- | app/views/projects/_last_push.html.haml | 14 | ||||
-rw-r--r-- | app/views/projects/activity.html.haml | 3 | ||||
-rw-r--r-- | app/views/projects/blob/show.html.haml | 3 | ||||
-rw-r--r-- | app/views/projects/merge_requests/index.html.haml | 1 | ||||
-rw-r--r-- | app/views/projects/show.html.haml | 1 | ||||
-rw-r--r-- | app/views/projects/tree/show.html.haml | 4 |
8 files changed, 29 insertions, 4 deletions
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index be85521ffa5..5474f9e97a6 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 1bcd9a49527..df1d630c89d 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 00000000000..30622d8a910 --- /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 25bd93cae87..b486cd4ded4 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 a1d464bac59..bd2fc43633c 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 e0bc1df97ee..72fbe2e27a7 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 17907a42e3c..d9cff805575 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 04590f65b27..c9e59428e78 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 |