Commit 9eec0d54 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'accepted-rejected-mrs' into 'master'

Add Accepted and Rejected tabs to MR lists.

Before, MRs were referred to as Merged or Closed, but the Merge button on the MR page read "Accept Merge Request", the activity feed even read "X accepted merge request Y", and the Closed tab on the MR index included both Merged _and_ Closed MRs. I've changed every occurrence to consistently refer to MRs as either Accepted or Rejected, which is less technical and more clearly two opposites.

![Screen_Shot_2015-05-25_at_17.02.31](https://gitlab.com/gitlab-org/gitlab-ce/uploads/b0bf43aa1b5b9898a1c6b204dbcf669a/Screen_Shot_2015-05-25_at_17.02.31.png)

![Screen_Shot_2015-05-25_at_17.02.47](https://gitlab.com/gitlab-org/gitlab-ce/uploads/2ac05b1e1dba3b2d1692bd9242078f3a/Screen_Shot_2015-05-25_at_17.02.47.png)

![Screen_Shot_2015-05-25_at_17.03.03](https://gitlab.com/gitlab-org/gitlab-ce/uploads/4c0f0fa869c9130a6af18d80a1c6ebed/Screen_Shot_2015-05-25_at_17.03.03.png)

Addresses internal issue https://dev.gitlab.org/gitlab/gitlabhq/issues/2201.

See merge request !702
parents 701c2e9a 7df45882
......@@ -17,6 +17,8 @@ v 7.12.0 (unreleased)
- Add validation to wiki page creation (only [a-zA-Z0-9/_-] are allowed) (Jeroen van Baarsen)
- Fix new/empty milestones showing 100% completion value (Jonah Bishop)
- Add a note when an Issue or Merge Request's title changes
- Consistently refer to MRs as either Accepted or Rejected.
- Add Accepted and Rejected tabs to MR lists.
v 7.11.2
- no changes
......
......@@ -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'
......
......@@ -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?
......
......@@ -134,7 +134,7 @@ class MergeRequest < ActiveRecord::Base
# Closed scope for merge request should return
# both merged and closed mr's
scope :closed, -> { with_states(:closed, :merged) }
scope :declined, -> { with_states(:closed) }
scope :rejected, -> { with_states(:closed) }
def self.reference_prefix
'!'
......
......@@ -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'
......@@ -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'
......@@ -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'
......@@ -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'
......@@ -18,7 +18,7 @@
%i.fa.fa-plus
New Issue
= render 'shared/issuable_filter'
= render 'shared/issuable_filter', type: :issues
.issues-holder
= render "issues"
......@@ -9,11 +9,11 @@
- if merge_request.merged?
%span
%i.fa.fa-check
MERGED
ACCEPTED
- elsif merge_request.closed?
%span
%i.fa.fa-close
CLOSED
%i.fa.fa-ban
REJECTED
- else
%span.hidden-xs.hidden-sm
%span.label-branch<
......
......@@ -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'
%h4.page-title
.issue-box{ class: issue_box_class(@merge_request) }
- if @merge_request.merged?
Merged
Accepted
- elsif @merge_request.closed?
Closed
Rejected
- else
Open
= "Merge Request ##{@merge_request.iid}"
......
......@@ -11,7 +11,7 @@
- if @merge_request.closed?
%h4
Closed
Rejected
- if @merge_request.closed_event
by #{link_to_member(@project, @merge_request.closed_event.author, avatar: false)}
#{time_ago_with_tooltip(@merge_request.closed_event.created_at)}
......@@ -19,7 +19,7 @@
- if @merge_request.merged?
%h4
Merged
Accepted
- if @merge_request.merge_event
by #{link_to_member(@project, @merge_request.merge_event.author, avatar: false)}
#{time_ago_with_tooltip(@merge_request.merge_event.created_at)}
......
......@@ -86,10 +86,10 @@
.col-md-3
= render('merge_requests', title: 'Waiting for merge (open and assigned)', merge_requests: @merge_requests.opened.assigned, id: 'ongoing')
.col-md-3
= render('merge_requests', title: 'Declined (closed)', merge_requests: @merge_requests.declined, id: 'closed')
= render('merge_requests', title: 'Rejected (closed)', merge_requests: @merge_requests.rejected, id: 'closed')
.col-md-3
.panel.panel-primary
.panel-heading Merged
.panel-heading Accepted
%ul.well-list
- @merge_requests.merged.each do |merge_request|
= render 'merge_request', merge_request: merge_request
......
......@@ -11,6 +11,6 @@
#{merge_request.project.name_with_namespace}
.pull-right
- if merge_request.merged?
%span.label.label-primary Merged
%span.label.label-primary Accepted
- elsif merge_request.closed?
%span.label.label-danger Closed
%span.label.label-danger Rejected
......@@ -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)}
- 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
%i.fa.fa-check-circle
= 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
......
......@@ -10,8 +10,8 @@ Feature: Project Merge Requests
Then I should see "Bug NS-04" in merge requests
And I should not see "Feature NS-03" in merge requests
Scenario: I should see closed merge requests
Given I click link "Closed"
Scenario: I should see rejected merge requests
Given I click link "Rejected"
Then I should see "Feature NS-03" in merge requests
And I should not see "Bug NS-04" in merge requests
......
......@@ -19,8 +19,8 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
click_link "All"
end
step 'I click link "Closed"' do
click_link "Closed"
step 'I click link "Rejected"' do
click_link "Rejected"
end
step 'I should see merge request "Wiki Feature"' do
......@@ -32,7 +32,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
step 'I should see closed merge request "Bug NS-04"' do
merge_request = MergeRequest.find_by!(title: "Bug NS-04")
merge_request.closed?.should be_true
page.should have_content "Closed by"
page.should have_content "Rejected by"
end
step 'I should see merge request "Bug NS-04"' do
......@@ -202,7 +202,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
step 'I should see merged request' do
within '.issue-box' do
page.should have_content "Merged"
page.should have_content "Accepted"
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment