Properly set task-list class on single item task lists
This commit is contained in:
parent
09216e8bbd
commit
c3865bda02
|
@ -21,6 +21,7 @@ v 8.4.0 (unreleased)
|
|||
- Update version check images to use SVG
|
||||
- Validate README format before displaying
|
||||
- Enable Microsoft Azure OAuth2 support (Janis Meybohm)
|
||||
- Properly set task-list class on single item task lists
|
||||
|
||||
v 8.3.3 (unreleased)
|
||||
- Get "Merge when build succeeds" to work when commits were pushed to MR target branch while builds were running
|
||||
|
|
|
@ -12,13 +12,18 @@ module Banzai
|
|||
#
|
||||
# See https://github.com/github/task_list/pull/60
|
||||
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')
|
||||
super if node.children.any? { |c| c['class'] == 'task-list-item' }
|
||||
else
|
||||
super
|
||||
# Don't add class to all lists
|
||||
return
|
||||
elsif new_class_names.include?('task-list-item')
|
||||
add_css_class_without_fix(node.parent, 'task-list')
|
||||
end
|
||||
|
||||
add_css_class_without_fix(node, *new_class_names)
|
||||
end
|
||||
|
||||
alias_method_chain :add_css_class, :fix
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue