diff options
author | Andre Guedes <andrebsguedes@gmail.com> | 2016-09-21 09:46:13 -0300 |
---|---|---|
committer | Andre Guedes <andrebsguedes@gmail.com> | 2016-09-30 07:08:25 -0300 |
commit | 5dbf1f487188e73bc5eb556c7b955088ff4676e5 (patch) | |
tree | a698a5e13c1b74d8126258d933b2f9496a72bd00 /lib/banzai | |
parent | f80e7683237a4aca01ff3d0c729c4933dde8753c (diff) | |
download | gitlab-ce-5dbf1f487188e73bc5eb556c7b955088ff4676e5.tar.gz |
Use `Module#prepend` instead of `alias_method_chain`
Diffstat (limited to 'lib/banzai')
-rw-r--r-- | lib/banzai/filter/task_list_filter.rb | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/banzai/filter/task_list_filter.rb b/lib/banzai/filter/task_list_filter.rb index 66608c9859c..4efbcaf5c7f 100644 --- a/lib/banzai/filter/task_list_filter.rb +++ b/lib/banzai/filter/task_list_filter.rb @@ -10,19 +10,21 @@ module Banzai # task_list gem. # # See https://github.com/github/task_list/pull/60 - class TaskListFilter < TaskList::Filter - def add_css_class_with_fix(node, *new_class_names) + module ClassNamesFilter + def add_css_class(node, *new_class_names) if new_class_names.include?('task-list') # 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') + super(node.parent, 'task-list') end - add_css_class_without_fix(node, *new_class_names) + super(node, *new_class_names) end + end - alias_method_chain :add_css_class, :fix + class TaskListFilter < TaskList::Filter + prepend ClassNamesFilter end end end |