Skip to content
This repository was archived by the owner on Oct 19, 2022. It is now read-only.

Commit a588014

Browse files
author
Jared Deckard
authored
Merge pull request #17 from deckar01/15-vanilla
Drop jQuery Dependency
2 parents 40b1fdf + bce1c5e commit a588014

File tree

16 files changed

+354
-214
lines changed

16 files changed

+354
-214
lines changed

.travis.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
language: ruby
22
sudo: false
3-
install: ./script/bootstrap
3+
install:
4+
- rm -rf ~/.nvm && git clone https://github.com/creationix/nvm.git ~/.nvm && (cd ~/.nvm && git checkout `git describe --abbrev=0 --tags`) && source ~/.nvm/nvm.sh && nvm install $TRAVIS_NODE_VERSION
5+
- ./script/bootstrap
46
script: ./script/cibuild
57
rvm:
68
- 1.9.3
79
- 2.0
810
- 2.1
911
- 2.2
12+
env:
13+
- TRAVIS_NODE_VERSION="7"
1014
notifications:
1115
email: false

README.md

Lines changed: 48 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,19 @@
44

55
[travis]: https://travis-ci.org/deckar01/task_list
66

7-
This package provides various components necessary for integrating
8-
[Task Lists](https://github.com/blog/1375-task-lists-in-gfm-issues-pulls-comments)
9-
into your Markdown user content.
7+
This is a community fork of GitHub's archived [`task_list`][task_list] gem.
8+
9+
[task_list]: https://github.com/github-archive/task_list
10+
11+
```md
12+
- [x] Get
13+
- [x] More
14+
- [ ] Done
15+
```
16+
17+
> - [x] Get
18+
> - [x] More
19+
> - [ ] Done
1020
1121
## Components
1222

@@ -64,6 +74,10 @@ Rendered HTML (the `<ul>` element below) should be contained in a `js-task-list-
6474
Enable Task List updates with:
6575

6676
``` javascript
77+
// Vanilla JS API
78+
var container = document.querySelector('.js-task-list-container')
79+
new TaskList(container)
80+
// or jQuery API
6781
$('.js-task-list-container').taskList('enable')
6882
```
6983

@@ -87,12 +101,16 @@ And then execute:
87101

88102
$ bundle
89103

104+
### Frontend: NPM / Yarn
105+
106+
For the frontend components, add `deckar01-task_list` to your npm dependencies config.
107+
108+
This is the preferred method for including the frontend assets in your application.
109+
90110
### Frontend: Bower
91111

92112
For the frontend components, add `deckar01-task_list` to your Bower dependencies config.
93113

94-
This is the preferred method for including the frontend assets in your application. Alternatively, for Rails methods using `Sprockets`, see below.
95-
96114
### Frontend: Rails 3+ Railtie method
97115

98116
``` ruby
@@ -120,7 +138,31 @@ to manage building your asset bundles.
120138

121139
### Dependencies
122140

123-
At a high level, the Ruby components integrate with the [`html-pipeline`](https://github.com/jch/html-pipeline) library, and the frontend components depend on the jQuery library. The frontend components are written in CoffeeScript and need to be preprocessed for production use.
141+
- Ruby >= 2.1.0
142+
143+
At a high level, the Ruby components integrate with the [`html-pipeline`](https://github.com/jch/html-pipeline) library. The frontend components are vanilla JavaScript and include a thin jQuery wrapper that supports the original plugin interface. The frontend components are written in CoffeeScript and need to be preprocessed for production use.
144+
145+
[A polyfill for custom events](https://github.com/krambuhl/custom-event-polyfill) must be included to support IE10 and below.
146+
147+
### Upgrading
148+
149+
#### 1.x to 2.x
150+
151+
The event interface no longer passes data directly to the callbacks arguments
152+
list. Instead the CustomEvent API is used, which adds data to the
153+
`event.detail` object.
154+
155+
```js
156+
// 1.x interface
157+
el.on('tasklist:changed', function(event, index, checked) {
158+
console.log(index, checked)
159+
})
160+
161+
// 2.x interface
162+
el.on('tasklist:changed', function(event) {
163+
console.log(event.detail.index, event.detail.checked)
164+
})
165+
```
124166

125167
## Testing and Development
126168

0 commit comments

Comments
 (0)