diff options
author | Douwe Maan <douwe@gitlab.com> | 2016-01-07 14:04:01 +0100 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2016-01-07 15:52:34 +0100 |
commit | c3865bda0257506e3e9ba8352913eb288f0e3e34 (patch) | |
tree | 8f04f0c2a5f9b93ded6cc2dc7a5839560bd33e56 | |
parent | 09216e8bbdd82e46705888aba13405a2fd191100 (diff) | |
download | gitlab-ce-c3865bda0257506e3e9ba8352913eb288f0e3e34.tar.gz |
Properly set task-list class on single item task lists
-rw-r--r-- | CHANGELOG | 1 | ||||
-rw-r--r-- | lib/banzai/filter/task_list_filter.rb | 13 |
2 files changed, 10 insertions, 4 deletions
diff --git a/CHANGELOG b/CHANGELOG index 22fb91baaf0..c034344e7f9 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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 diff --git a/lib/banzai/filter/task_list_filter.rb b/lib/banzai/filter/task_list_filter.rb index bdf7c2ebdfc..d0ce13003a5 100644 --- a/lib/banzai/filter/task_list_filter.rb +++ b/lib/banzai/filter/task_list_filter.rb @@ -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 |