Merge branch 'todo-issue-due-date' into 'master'
Todo issue due date ## What does this MR do? Adds the text 'Due today' or 'Due [DATE]' next to issues in todos. This does not add anyway to filter by due date - little steps. ## What are the relevant issue numbers? #18218 See merge request !6351
This commit is contained in:
commit
006cd7f7b2
|
@ -146,6 +146,7 @@ v 8.12.0
|
|||
- Increase ci_builds artifacts_size column to 8-byte integer to allow larger files
|
||||
- Add textarea autoresize after comment (ClemMakesApps)
|
||||
- Do not write SSH public key 'comments' to authorized_keys !6381
|
||||
- Add due date to issue todos
|
||||
- Refresh todos count cache when an Issue/MR is deleted
|
||||
- Fix branches page dropdown sort alignment (ClemMakesApps)
|
||||
- Hides merge request button on branches page is user doesn't have permissions
|
||||
|
|
|
@ -114,6 +114,26 @@ module TodosHelper
|
|||
selected_type ? selected_type[:text] : default_type
|
||||
end
|
||||
|
||||
def todo_due_date(todo)
|
||||
return unless todo.target.try(:due_date)
|
||||
|
||||
is_due_today = todo.target.due_date.today?
|
||||
is_overdue = todo.target.overdue?
|
||||
css_class =
|
||||
if is_due_today
|
||||
'text-warning'
|
||||
elsif is_overdue
|
||||
'text-danger'
|
||||
else
|
||||
''
|
||||
end
|
||||
|
||||
html = "· ".html_safe
|
||||
html << content_tag(:span, class: css_class) do
|
||||
"Due #{is_due_today ? "today" : todo.target.due_date.to_s(:medium)}"
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def show_todo_state?(todo)
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
(removed)
|
||||
|
||||
· #{time_ago_with_tooltip(todo.created_at)}
|
||||
= todo_due_date(todo)
|
||||
|
||||
.todo-body
|
||||
.todo-note
|
||||
|
|
|
@ -4,7 +4,7 @@ describe 'Dashboard Todos', feature: true do
|
|||
let(:user) { create(:user) }
|
||||
let(:author) { create(:user) }
|
||||
let(:project) { create(:project, visibility_level: Gitlab::VisibilityLevel::PUBLIC) }
|
||||
let(:issue) { create(:issue) }
|
||||
let(:issue) { create(:issue, due_date: Date.today) }
|
||||
|
||||
describe 'GET /dashboard/todos' do
|
||||
context 'User does not have todos' do
|
||||
|
@ -28,6 +28,12 @@ describe 'Dashboard Todos', feature: true do
|
|||
expect(page).to have_selector('.todos-list .todo', count: 1)
|
||||
end
|
||||
|
||||
it 'shows due date as today' do
|
||||
page.within first('.todo') do
|
||||
expect(page).to have_content 'Due today'
|
||||
end
|
||||
end
|
||||
|
||||
describe 'deleting the todo' do
|
||||
before do
|
||||
first('.done-todo').click
|
||||
|
|
Loading…
Reference in New Issue