This is a community fork of GitHub's archived
- [x] Get- [x] More- [ ] Done
The Task List feature is made of several different components:
- Markdown Ruby Filter
- Summary Ruby Model: summarizes task list items
- CSS: styles Markdown task list items
Usage & Integration
The backend components are designed for rendering the Task List item checkboxes, and the frontend components handle updating the Markdown source (embedded in the markup).
Backend: Markdown pipeline filter
Rendering Task List item checkboxes from source Markdown depends on the
TaskList::Filter, designed to integrate with the
html-pipeline gem. For example:
pipeline = HTML::Pipeline.new [HTML::Pipeline::MarkdownFilter,TaskList::Filter]pipeline.call "- [ ] task list item"
Frontend: Markdown Updates
Rendered HTML (the
<ul> element below) should be contained in a
js-task-list-container container element and include a sibling
textarea.js-task-list-field element that is updated when checkboxes are changed.
- [ ] text
text- [ ] text
Enable Task List updates with:
// Vanilla JS APIvar container = documentcontainer// or jQuery API
NOTE: Updates are not persisted to the server automatically. Persistence is the responsibility of the integrating application, accomplished by hooking into the
Read through the documented behaviors and samples in the source for more detail, including documented events.
Task Lists are packaged as both a RubyGem with both backend and frontend behavior, and a Bower package with just the frontend behavior.
For the backend Ruby components, add this line to your application's Gemfile:
And then execute:
Frontend: NPM / Yarn
For the frontend components, add
deckar01-task_list to your npm dependencies config.
This is the preferred method for including the frontend assets in your application.
For the frontend components, add
deckar01-task_list to your Bower dependencies config.
Frontend: Rails 3+ Railtie method
Frontend: Rails 2.3 Manual method
Wherever you have your Sprockets setup:
Sprockets::Environment.new(Rails.root) do |env|# Load TaskList assetsTaskList.asset_paths.each do |path|env.append_path pathendend
If you're not using Sprockets, you're on your own but it's pretty straight
TaskList.asset_paths which you can use
to manage building your asset bundles.
- Ruby >= 2.1.0
At a high level, the Ruby components integrate with the
A polyfill for custom events must be included to support IE10 and below.
The markdown parser used on the front end produces false positives when looking for checkboxes
in some complex nesting situations. To combat this issue, you can enable the
in your markdown parser. This will avoid parsing the markdown on the front end, because the line
numbers will be provided as attributes on the HTML elements.
task_list checks for the source
position attribute and falls back to manually parsing the markown when needed.
1.x to 2.x
The event interface no longer passes data directly to the callbacks arguments
list. Instead the CustomEvent API is used, which adds data to the
// 1.x interfaceel// 2.x interfaceel
Testing and Development
Ruby unit tests can be run with
Functional tests are useful for manual testing in the browser. To run, install
the necessary components with
script/bootstrap then run the server:
rackup -p 4011