diff --git a/CHANGELOG b/CHANGELOG index d2110c12567..793ecb5e59b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -8,6 +8,7 @@ v 7.12.0 (unreleased) - Fix resolving of relative links to repository files in AsciiDoc documents. (Jakub Jirutka) - Use the user list from the target project in a merge request (Stan Hu) - Consistently refer to MRs as either Accepted or Rejected. + - Add Accepted and Rejected tabs to MR lists. v 7.11.2 - no changes diff --git a/app/finders/issuable_finder.rb b/app/finders/issuable_finder.rb index b8f367c6339..e658e141159 100644 --- a/app/finders/issuable_finder.rb +++ b/app/finders/issuable_finder.rb @@ -75,6 +75,10 @@ class IssuableFinder case params[:state] when 'closed' items.closed + when 'rejected' + items.respond_to?(:rejected) ? items.rejected : items.closed + when 'merged' + items.respond_to?(:merged) ? items.merged : items.closed when 'all' items when 'opened' diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index bcd400b7e7b..89dcdf57798 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -330,7 +330,12 @@ module ApplicationHelper end def state_filters_text_for(entity, project) - entity_title = entity.to_s.humanize + titles = { + opened: "Open", + merged: "Accepted" + } + + entity_title = titles[entity] || entity.to_s.humanize count = if project.nil? diff --git a/app/views/dashboard/issues.html.haml b/app/views/dashboard/issues.html.haml index dfdf0d68c8f..0dd2edbb1bc 100644 --- a/app/views/dashboard/issues.html.haml +++ b/app/views/dashboard/issues.html.haml @@ -17,5 +17,5 @@ = link_to issues_dashboard_url(format: :atom, private_token: current_user.private_token), class: 'btn' do %i.fa.fa-rss - = render 'shared/issuable_filter' + = render 'shared/issuable_filter', type: :issues = render 'shared/issues' diff --git a/app/views/dashboard/merge_requests.html.haml b/app/views/dashboard/merge_requests.html.haml index a7e1b08a0a4..61d2fbe538c 100644 --- a/app/views/dashboard/merge_requests.html.haml +++ b/app/views/dashboard/merge_requests.html.haml @@ -7,5 +7,5 @@ List all merge requests from all projects you have access to. %hr .append-bottom-20 - = render 'shared/issuable_filter' + = render 'shared/issuable_filter', type: :merge_requests = render 'shared/merge_requests' diff --git a/app/views/groups/issues.html.haml b/app/views/groups/issues.html.haml index 6a3da6adacf..e0756e909be 100644 --- a/app/views/groups/issues.html.haml +++ b/app/views/groups/issues.html.haml @@ -21,5 +21,5 @@ = link_to issues_group_url(@group, format: :atom, private_token: current_user.private_token), class: 'btn' do %i.fa.fa-rss - = render 'shared/issuable_filter' + = render 'shared/issuable_filter', type: :issues = render 'shared/issues' diff --git a/app/views/groups/merge_requests.html.haml b/app/views/groups/merge_requests.html.haml index 268f33d5761..3d9e857cc52 100644 --- a/app/views/groups/merge_requests.html.haml +++ b/app/views/groups/merge_requests.html.haml @@ -10,5 +10,5 @@ To see all merge requests you should visit #{link_to 'dashboard', merge_requests_dashboard_path} page. %hr .append-bottom-20 - = render 'shared/issuable_filter' + = render 'shared/issuable_filter', type: :merge_requests = render 'shared/merge_requests' diff --git a/app/views/projects/issues/index.html.haml b/app/views/projects/issues/index.html.haml index 709ea1f7897..a378b37f4a8 100644 --- a/app/views/projects/issues/index.html.haml +++ b/app/views/projects/issues/index.html.haml @@ -18,7 +18,7 @@ %i.fa.fa-plus New Issue - = render 'shared/issuable_filter' + = render 'shared/issuable_filter', type: :issues .issues-holder = render "issues" diff --git a/app/views/projects/merge_requests/index.html.haml b/app/views/projects/merge_requests/index.html.haml index ab845a7e719..841d1e1cfe9 100644 --- a/app/views/projects/merge_requests/index.html.haml +++ b/app/views/projects/merge_requests/index.html.haml @@ -7,6 +7,6 @@ = link_to new_namespace_project_merge_request_path(@project.namespace, @project), class: "btn btn-new pull-left", title: "New Merge Request" do %i.fa.fa-plus New Merge Request - = render 'shared/issuable_filter' + = render 'shared/issuable_filter', type: :merge_requests .merge-requests-holder = render 'merge_requests' diff --git a/app/views/shared/_issuable_filter.html.haml b/app/views/shared/_issuable_filter.html.haml index 4ab9421f013..a5187fa4ea7 100644 --- a/app/views/shared/_issuable_filter.html.haml +++ b/app/views/shared/_issuable_filter.html.haml @@ -3,15 +3,28 @@ %ul.nav.nav-tabs %li{class: ("active" if params[:state] == 'opened')} = link_to page_filter_path(state: 'opened') do - %i.fa.fa-exclamation-circle + = icon('exclamation-circle') #{state_filters_text_for(:opened, @project)} - %li{class: ("active" if params[:state] == 'closed')} - = link_to page_filter_path(state: 'closed') do - %i.fa.fa-check-circle - #{state_filters_text_for(:closed, @project)} + + - if defined?(type) && type == :merge_requests + %li{class: ("active" if params[:state] == 'merged')} + = link_to page_filter_path(state: 'merged') do + = icon('check-circle') + #{state_filters_text_for(:merged, @project)} + + %li{class: ("active" if params[:state] == 'rejected')} + = link_to page_filter_path(state: 'rejected') do + = icon('ban') + #{state_filters_text_for(:rejected, @project)} + - else + %li{class: ("active" if params[:state] == 'closed')} + = link_to page_filter_path(state: 'closed') do + = icon('check-circle') + #{state_filters_text_for(:closed, @project)} + %li{class: ("active" if params[:state] == 'all')} = link_to page_filter_path(state: 'all') do - %i.fa.fa-compass + = icon('compass') #{state_filters_text_for(:all, @project)} .issues-details-filters