Commit bfdde96f authored by Simon Knox's avatar Simon Knox Committed by Douwe Maan

Resolve "Closed issue label in todo's styling is difficult to read"

parent f2b7da8a
/* eslint-disable func-names, space-before-function-paren, no-var, prefer-rest-params, wrap-iife, quotes, no-underscore-dangle, one-var, one-var-declaration-per-line, consistent-return, dot-notation, quote-props, comma-dangle, object-shorthand, max-len, prefer-arrow-callback */ /* eslint-disable func-names, space-before-function-paren, no-var, prefer-rest-params, wrap-iife, quotes, no-underscore-dangle, one-var, one-var-declaration-per-line, consistent-return, dot-notation, quote-props, comma-dangle, object-shorthand, max-len, prefer-arrow-callback */
import 'vendor/jquery.waitforimages'; import 'vendor/jquery.waitforimages';
import { __ } from '~/locale';
import TaskList from './task_list'; import TaskList from './task_list';
import MergeRequestTabs from './merge_request_tabs'; import MergeRequestTabs from './merge_request_tabs';
import IssuablesHelper from './helpers/issuables_helper'; import IssuablesHelper from './helpers/issuables_helper';
...@@ -110,12 +111,12 @@ MergeRequest.prototype.initCommitMessageListeners = function() { ...@@ -110,12 +111,12 @@ MergeRequest.prototype.initCommitMessageListeners = function() {
}); });
}; };
MergeRequest.updateStatusText = function(classToRemove, classToAdd, newStatusText) { MergeRequest.setStatusBoxToMerged = function() {
$('.detail-page-header .status-box') $('.detail-page-header .status-box')
.removeClass(classToRemove) .removeClass('status-box-open')
.addClass(classToAdd) .addClass('status-box-mr-merged')
.find('span') .find('span')
.text(newStatusText); .text(__('Merged'));
}; };
MergeRequest.decreaseCounter = function(by = 1) { MergeRequest.decreaseCounter = function(by = 1) {
......
...@@ -166,7 +166,7 @@ export default { ...@@ -166,7 +166,7 @@ export default {
// If state is merged we should update the widget and stop the polling // If state is merged we should update the widget and stop the polling
eventHub.$emit('MRWidgetUpdateRequested'); eventHub.$emit('MRWidgetUpdateRequested');
eventHub.$emit('FetchActionsContent'); eventHub.$emit('FetchActionsContent');
MergeRequest.updateStatusText('status-box-open', 'status-box-merged', 'Merged'); MergeRequest.setStatusBoxToMerged();
MergeRequest.hideCloseButton(); MergeRequest.hideCloseButton();
MergeRequest.decreaseCounter(); MergeRequest.decreaseCounter();
stopPolling(); stopPolling();
......
...@@ -24,15 +24,13 @@ ...@@ -24,15 +24,13 @@
font-size: $gl-font-size; font-size: $gl-font-size;
line-height: 25px; line-height: 25px;
&.status-box-closed,
&.status-box-mr-closed { &.status-box-mr-closed {
background-color: $gl-danger; background-color: $gl-danger;
} }
&.status-box-issue-closed { &.status-box-issue-closed,
background-color: $gl-primary; &.status-box-mr-merged {
}
&.status-box-merged {
background-color: $gl-primary; background-color: $gl-primary;
} }
......
...@@ -72,7 +72,7 @@ module IssuesHelper ...@@ -72,7 +72,7 @@ module IssuesHelper
if item.try(:expired?) if item.try(:expired?)
'status-box-expired' 'status-box-expired'
elsif item.try(:merged?) elsif item.try(:merged?)
'status-box-merged' 'status-box-mr-merged'
elsif item.closed? elsif item.closed?
'status-box-mr-closed' 'status-box-mr-closed'
elsif item.try(:upcoming?) elsif item.try(:upcoming?)
......
...@@ -54,8 +54,16 @@ module TodosHelper ...@@ -54,8 +54,16 @@ module TodosHelper
def todo_target_state_pill(todo) def todo_target_state_pill(todo)
return unless show_todo_state?(todo) return unless show_todo_state?(todo)
type =
case todo.target
when MergeRequest
'mr'
when Issue
'issue'
end
content_tag(:span, nil, class: 'target-status') do content_tag(:span, nil, class: 'target-status') do
content_tag(:span, nil, class: "status-box status-box-#{todo.target.state.dasherize}") do content_tag(:span, nil, class: "status-box status-box-#{type}-#{todo.target.state.dasherize}") do
todo.target.state.capitalize todo.target.state.capitalize
end end
end end
......
---
title: Fix closed text for issues on Todos page
merge_request:
author:
type: fixed
...@@ -404,7 +404,7 @@ describe('MRWidgetReadyToMerge', () => { ...@@ -404,7 +404,7 @@ describe('MRWidgetReadyToMerge', () => {
setTimeout(() => { setTimeout(() => {
const statusBox = document.querySelector('.status-box'); const statusBox = document.querySelector('.status-box');
expect(statusBox.classList.contains('status-box-merged')).toBeTruthy(); expect(statusBox.classList.contains('status-box-mr-merged')).toBeTruthy();
expect(statusBox.textContent).toContain('Merged'); expect(statusBox.textContent).toContain('Merged');
done(); done();
......
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