Move conditional to a method

This commit is contained in:
Alfredo Sumaran
2016-05-25 08:15:20 -04:00
committed by Jacob Schatz
parent 7586807fc3
commit 2c8000e302
2 changed files with 5 additions and 1 deletions
+4
View File
@@ -46,6 +46,10 @@ module TodosHelper
end
end
def show_todo_state?(todo)
(todo.target.is_a?(MergeRequest) || todo.target.is_a?(Issue)) && ['closed', 'merged'].include?(todo.target.state)
end
def todos_filter_params
{
state: params[:state],
+1 -1
View File
@@ -3,7 +3,7 @@
= image_tag avatar_icon(todo.author_email, 40), class: 'avatar s40', alt:''
.todo-title.title
- unless todo.build_failed?
- if (todo.target.is_a?(MergeRequest) || todo.target.is_a?(Issue)) && ['closed', 'merged'].include?(todo.target.state)
- if show_todo_state?(todo)
%span.target-status
= todo_target_state_pill(todo)