Commit c4a061a2 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch '22466-task-list-fork' into 'master'

Resolve "Task List Checkbox Alignment"

## What does this MR do?

Replace the unmaintained `task_list` gem with the `deckar01-task_list` fork

## Are there points in the code the reviewer needs to double check?

 - I had to pin some dependencies in the fork to support `ruby < 2.2`, which added new version restrictions for 2 existing modules.
 - I triggered a build after I removed the patch to show the test passed with the new gem, then I removed the test, because this behavior is tested in the gem's repo now.

## Why was this MR needed?

 - The `task_list` patch was added with a comment that said it should be removed when merged upstream, but the repo got archived, so an upstream patch requires a fork.
 - #22470 can't be patched without warnings due to the way `task_list` uses Ruby constants.
 - There are additional outstanding `task_list` bugs that can be fixed once we switch to a fork.

## What are the relevant issue numbers?

 - #22466 
 - #22470
 - !6487

See merge request !6625
parents dfb9cab8 4a23d7f4
......@@ -99,17 +99,17 @@ gem 'unf', '~> 0.1.4'
gem 'seed-fu', '~> 2.3.5'
# Markdown and HTML processing
gem 'html-pipeline', '~> 1.11.0'
gem 'task_list', '~> 1.0.2', require: 'task_list/railtie'
gem 'github-markup', '~> 1.4'
gem 'redcarpet', '~> 3.3.3'
gem 'RedCloth', '~> 4.3.2'
gem 'rdoc', '~>3.6'
gem 'org-ruby', '~> 0.9.12'
gem 'creole', '~> 0.5.0'
gem 'wikicloth', '0.8.1'
gem 'asciidoctor', '~> 1.5.2'
gem 'rouge', '~> 2.0'
gem 'html-pipeline', '~> 1.11.0'
gem 'deckar01-task_list', '1.0.5', require: 'task_list/railtie'
gem 'github-markup', '~> 1.4'
gem 'redcarpet', '~> 3.3.3'
gem 'RedCloth', '~> 4.3.2'
gem 'rdoc', '~>3.6'
gem 'org-ruby', '~> 0.9.12'
gem 'creole', '~> 0.5.0'
gem 'wikicloth', '0.8.1'
gem 'asciidoctor', '~> 1.5.2'
gem 'rouge', '~> 2.0'
# See https://groups.google.com/forum/#!topic/ruby-security-ann/aSbgDiwb24s
# and https://groups.google.com/forum/#!topic/ruby-security-ann/Dy7YiKb_pMM
......
......@@ -157,6 +157,10 @@ GEM
database_cleaner (1.5.3)
debug_inspector (0.0.2)
debugger-ruby_core_source (1.3.8)
deckar01-task_list (1.0.5)
activesupport (~> 4.0)
html-pipeline
rack (~> 1.0)
default_value_for (3.0.2)
activerecord (>= 3.2.0, < 5.1)
descendants_tracker (0.0.4)
......@@ -725,8 +729,6 @@ GEM
ffi
sysexits (1.2.0)
systemu (2.6.5)
task_list (1.0.2)
html-pipeline
teaspoon (1.1.5)
railties (>= 3.2.5, < 6)
teaspoon-jasmine (2.2.0)
......@@ -831,6 +833,7 @@ DEPENDENCIES
creole (~> 0.5.0)
d3_rails (~> 3.5.0)
database_cleaner (~> 1.5.0)
deckar01-task_list (= 1.0.5)
default_value_for (~> 3.0.0)
devise (~> 4.2)
devise-two-factor (~> 3.0.0)
......@@ -963,7 +966,6 @@ DEPENDENCIES
sprockets-es6 (~> 0.9.2)
state_machines-activerecord (~> 0.4.0)
sys-filesystem (~> 1.1.6)
task_list (~> 1.0.2)
teaspoon (~> 1.1.0)
teaspoon-jasmine (~> 2.2.0)
test_after_commit (~> 0.4.2)
......
......@@ -2,29 +2,7 @@ require 'task_list/filter'
module Banzai
module Filter
# Work around a bug in the default TaskList::Filter that adds a `task-list`
# class to every list element, regardless of whether or not it contains a
# task list.
#
# This is a (hopefully) temporary fix, pending a new release of the
# task_list gem.
#
# See https://github.com/github/task_list/pull/60
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')
super(node.parent, 'task-list')
end
super(node, *new_class_names)
end
end
class TaskListFilter < TaskList::Filter
prepend ClassNamesFilter
end
end
end
require 'spec_helper'
describe Banzai::Filter::TaskListFilter, lib: true do
include FilterSpecHelper
it 'does not apply `task-list` class to non-task lists' do
exp = act = %(<ul><li>Item</li></ul>)
expect(filter(act).to_html).to eq exp
end
it 'applies `task-list` to single-item task lists' do
act = filter('<ul><li>[ ] Task 1</li></ul>')
expect(act.to_html).to start_with '<ul class="task-list">'
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