Commit b1539116 authored by Robert Speicher's avatar Robert Speicher

Merge branch 'task-list-class' into 'master'

Properly set task-list class on single item task lists

Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/4193

See merge request !2330
parents 87000b25 79938744
...@@ -23,6 +23,7 @@ v 8.4.0 (unreleased) ...@@ -23,6 +23,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
- Add file finder feature in tree view (koreamic) - Add file finder feature in tree view (koreamic)
- Ajax filter by message for commits page - Ajax filter by message for commits page
......
...@@ -12,13 +12,18 @@ module Banzai ...@@ -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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment