Properly set task-list class on single item task lists

This commit is contained in:
Douwe Maan 2016-01-07 14:04:01 +01:00
parent 09216e8bbd
commit c3865bda02
2 changed files with 10 additions and 4 deletions

View file

@ -21,6 +21,7 @@ v 8.4.0 (unreleased)
- Update version check images to use SVG - Update version check images to use SVG
- Validate README format before displaying - Validate README format before displaying
- Enable Microsoft Azure OAuth2 support (Janis Meybohm) - Enable Microsoft Azure OAuth2 support (Janis Meybohm)
- Properly set task-list class on single item task lists
v 8.3.3 (unreleased) v 8.3.3 (unreleased)
- Get "Merge when build succeeds" to work when commits were pushed to MR target branch while builds were running - Get "Merge when build succeeds" to work when commits were pushed to MR target branch while builds were running

View file

@ -12,13 +12,18 @@ module Banzai
# #
# See https://github.com/github/task_list/pull/60 # See https://github.com/github/task_list/pull/60
class TaskListFilter < TaskList::Filter class TaskListFilter < TaskList::Filter
def add_css_class(node, *new_class_names) def add_css_class_with_fix(node, *new_class_names)
if new_class_names.include?('task-list') if new_class_names.include?('task-list')
super if node.children.any? { |c| c['class'] == 'task-list-item' } # Don't add class to all lists
else return
super elsif new_class_names.include?('task-list-item')
add_css_class_without_fix(node.parent, 'task-list')
end end
add_css_class_without_fix(node, *new_class_names)
end end
alias_method_chain :add_css_class, :fix
end end
end end
end end