deckar01-task_list 1.0.6 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fdfcf76a91d8eaab8ec42ad11c61cadf5563cd6b
4
- data.tar.gz: 71f6596cbe4bd8edfd4362c693ae8f54f257c647
3
+ metadata.gz: 16168d2e2bc478569084255a87377e170b782edf
4
+ data.tar.gz: 8ecf182028bd41b966ae878d4d0b0e8332706084
5
5
  SHA512:
6
- metadata.gz: cf328e7bc0d70b33a7124b15f4c0847b93a2eab368ff673872668b768276aa5b32cc65ff226d439fcbdbeeeb518f708a874447b740d88b709e1145262f458f40
7
- data.tar.gz: 41fb013dcdfc812ef969a358ed9e6918595c68c99243f4eabc89d90dc5c0282b5d666c712f4121ed00fd57b03cfc9058758124fa5abe5a0de4b53f7cdfcf7a82
6
+ metadata.gz: 2f6afc42d012bfbf6971d2c15c736581bdbb26a748c3f02ca07300a631b4ba0a7c83b8f17887a1d0a1dede20981ea1a7fba19bb1083dda41fb2a694c6d8198d9
7
+ data.tar.gz: 12882ad6c387d696def4c2e5e79c933ae60320d438f7af6f093bd6ffe5f43f56e6c265743d20e7a0d4fa064bfe4e59be597dbd492f1515b65b56e5c9daa9a548
data/.travis.yml CHANGED
@@ -1,11 +1,15 @@
1
1
  language: ruby
2
2
  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
4
6
  script: ./script/cibuild
5
7
  rvm:
6
8
  - 1.9.3
7
9
  - 2.0
8
10
  - 2.1
9
11
  - 2.2
12
+ env:
13
+ - TRAVIS_NODE_VERSION="7"
10
14
  notifications:
11
15
  email: false
data/README.md CHANGED
@@ -4,9 +4,19 @@
4
4
 
5
5
  [travis]: https://travis-ci.org/deckar01/task_list
6
6
 
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
10
20
 
11
21
  ## Components
12
22
 
@@ -64,6 +74,10 @@ Rendered HTML (the `<ul>` element below) should be contained in a `js-task-list-
64
74
  Enable Task List updates with:
65
75
 
66
76
  ``` javascript
77
+ // Vanilla JS API
78
+ var container = document.querySelector('.js-task-list-container')
79
+ new TaskList(container)
80
+ // or jQuery API
67
81
  $('.js-task-list-container').taskList('enable')
68
82
  ```
69
83
 
@@ -87,12 +101,16 @@ And then execute:
87
101
 
88
102
  $ bundle
89
103
 
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
+
90
110
  ### Frontend: Bower
91
111
 
92
112
  For the frontend components, add `deckar01-task_list` to your Bower dependencies config.
93
113
 
94
- This is the preferred method for including the frontend assets in your application. Alternatively, for Rails methods using `Sprockets`, see below.
95
-
96
114
  ### Frontend: Rails 3+ Railtie method
97
115
 
98
116
  ``` ruby
@@ -120,7 +138,31 @@ to manage building your asset bundles.
120
138
 
121
139
  ### Dependencies
122
140
 
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
+ ```
124
166
 
125
167
  ## Testing and Development
126
168
 
@@ -1,11 +1,6 @@
1
1
  # TaskList Behavior
2
2
  #
3
- #= provides tasklist:enabled
4
- #= provides tasklist:disabled
5
- #= provides tasklist:change
6
- #= provides tasklist:changed
7
- #
8
- #= require jquery
3
+ #= provides TaskList
9
4
  #
10
5
  # Enables Task List update behavior.
11
6
  #
@@ -39,8 +34,6 @@
39
34
  # TaskList updates trigger `tasklist:change` events. If the change is
40
35
  # successful, `tasklist:changed` is fired. The change can be canceled.
41
36
  #
42
- # jQuery is required.
43
- #
44
37
  # ### Methods
45
38
  #
46
39
  # `.taskList('enable')` or `.taskList()`
@@ -94,145 +87,176 @@
94
87
  # Task list checkboxes are rendered as disabled by default because rendered
95
88
  # user content is cached without regard for the viewer.
96
89
 
97
- incomplete = "[ ]"
98
- complete = "[x]"
99
-
100
- # Escapes the String for regular expression matching.
101
- escapePattern = (str) ->
102
- str.
103
- replace(/([\[\]])/g, "\\$1"). # escape square brackets
104
- replace(/\s/, "\\s"). # match all white space
105
- replace("x", "[xX]") # match all cases
106
-
107
- incompletePattern = ///
108
- #{escapePattern(incomplete)}
109
- ///
110
- completePattern = ///
111
- #{escapePattern(complete)}
112
- ///
113
-
114
- # Pattern used to identify all task list items.
115
- # Useful when you need iterate over all items.
116
- itemPattern = ///
117
- ^
118
- (?: # prefix, consisting of
119
- \s* # optional leading whitespace
120
- (?:>\s*)* # zero or more blockquotes
121
- (?:[-+*]|(?:\d+\.)) # list item indicator
122
- )
123
- \s* # optional whitespace prefix
124
- ( # checkbox
125
- #{escapePattern(complete)}|
126
- #{escapePattern(incomplete)}
127
- )
128
- \s+ # is followed by whitespace
129
- (?!
130
- \(.*?\) # is not part of a [foo](url) link
131
- )
132
- (?= # and is followed by zero or more links
133
- (?:\[.*?\]\s*(?:\[.*?\]|\(.*?\))\s*)*
134
- (?:[^\[]|$) # and either a non-link or the end of the string
135
- )
136
- ///
137
-
138
- # Used to skip checkbox markup inside of code fences.
139
- # http://rubular.com/r/TfCDNsy8x4
140
- startFencesPattern = /^`{3}.*$/
141
- endFencesPattern = /^`{3}$/
142
-
143
- # Used to filter out potential mismatches (items not in lists).
144
- # http://rubular.com/r/OInl6CiePy
145
- itemsInParasPattern = ///
146
- ^
147
- (
148
- #{escapePattern(complete)}|
149
- #{escapePattern(incomplete)}
150
- )
151
- .+
152
- $
153
- ///g
154
-
155
- # Given the source text, updates the appropriate task list item to match the
156
- # given checked value.
157
- #
158
- # Returns the updated String text.
159
- updateTaskListItem = (source, itemIndex, checked) ->
160
- clean = source.replace(/\r/g, '').replace(itemsInParasPattern, '').split("\n")
161
- index = 0
162
- inCodeBlock = false
163
- result = for line in source.split("\n")
164
- if inCodeBlock
165
- # Lines inside of a code block are ignored.
166
- if line.match(endFencesPattern)
167
- # Stop ignoring lines once the code block is closed.
168
- inCodeBlock = false
169
- else if line.match(startFencesPattern)
170
- # Start ignoring lines inside a code block.
171
- inCodeBlock = true
172
- else if line in clean && line.match(itemPattern)
173
- index += 1
174
- if index == itemIndex
175
- line =
176
- if checked
177
- line.replace(incompletePattern, complete)
178
- else
179
- line.replace(completePattern, incomplete)
180
- line
181
- result.join("\n")
182
-
183
- # Updates the $field value to reflect the state of $item.
184
- # Triggers the `tasklist:change` event before the value has changed, and fires
185
- # a `tasklist:changed` event once the value has changed.
186
- updateTaskList = ($item) ->
187
- $container = $item.closest '.js-task-list-container'
188
- $field = $container.find '.js-task-list-field'
189
- index = 1 + $container.find('.task-list-item-checkbox').index($item)
190
- checked = $item.prop 'checked'
191
-
192
- event = $.Event 'tasklist:change'
193
- $field.trigger event, [index, checked]
194
-
195
- unless event.isDefaultPrevented()
196
- $field.val updateTaskListItem($field.val(), index, checked)
197
- $field.trigger 'change'
198
- $field.trigger 'tasklist:changed', [index, checked]
199
-
200
- # When the task list item checkbox is updated, submit the change
201
- $(document).on 'change', '.task-list-item-checkbox', ->
202
- updateTaskList $(this)
203
-
204
- # Enables TaskList item changes.
205
- enableTaskList = ($container) ->
206
- if $container.find('.js-task-list-field').length > 0
207
- $container.
208
- find('.task-list-item').addClass('enabled').
209
- find('.task-list-item-checkbox').attr('disabled', null)
210
- $container.addClass('is-task-list-enabled').
211
- trigger 'tasklist:enabled'
212
-
213
- # Enables a collection of TaskList containers.
214
- enableTaskLists = ($containers) ->
215
- for container in $containers
216
- enableTaskList $(container)
217
-
218
- # Disable TaskList item changes.
219
- disableTaskList = ($container) ->
220
- $container.
221
- find('.task-list-item').removeClass('enabled').
222
- find('.task-list-item-checkbox').attr('disabled', 'disabled')
223
- $container.removeClass('is-task-list-enabled').
224
- trigger 'tasklist:disabled'
225
-
226
- # Disables a collection of TaskList containers.
227
- disableTaskLists = ($containers) ->
228
- for container in $containers
229
- disableTaskList $(container)
230
-
231
- $.fn.taskList = (method) ->
232
- $container = $(this).closest('.js-task-list-container')
233
-
234
- methods =
235
- enable: enableTaskLists
236
- disable: disableTaskLists
237
-
238
- methods[method || 'enable']($container)
90
+ NodeArray = (nodeList) -> Array.prototype.slice.apply(nodeList)
91
+
92
+ closest = (el, className) ->
93
+ while el && !el.classList.contains className
94
+ el = el.parentNode
95
+ el
96
+
97
+ createEvent = (eventName, detail) ->
98
+ if typeof Event == 'function'
99
+ event = new Event eventName, {bubbles: true, cancelable: true}
100
+ event.detail = detail
101
+ else
102
+ event = document.createEvent 'CustomEvent'
103
+ event.initCustomEvent eventName, true, true, detail
104
+ event
105
+
106
+ class TaskList
107
+ constructor: (@el) ->
108
+ @container = closest @el, 'js-task-list-container'
109
+ @field = @container.querySelector '.js-task-list-field'
110
+ # When the task list item checkbox is updated, submit the change
111
+ @container.addEventListener 'change', (event) =>
112
+ if event.target.classList.contains 'task-list-item-checkbox'
113
+ @updateTaskList(event.target)
114
+ @.enable()
115
+
116
+ enable: ->
117
+ if @container.querySelectorAll('.js-task-list-field').length > 0
118
+ NodeArray(@container.querySelectorAll('.task-list-item')).
119
+ forEach (item) ->
120
+ item.classList.add('enabled')
121
+ NodeArray(@container.querySelectorAll('.task-list-item-checkbox')).
122
+ forEach (checkbox) ->
123
+ checkbox.disabled = false
124
+ @container.classList.add 'is-task-list-enabled'
125
+ event = createEvent 'tasklist:enabled'
126
+ @container.dispatchEvent event
127
+
128
+ disable: ->
129
+ NodeArray(@container.querySelectorAll('.task-list-item')).
130
+ forEach (item) ->
131
+ item.classList.remove('enabled')
132
+ NodeArray(@container.querySelectorAll('.task-list-item-checkbox')).
133
+ forEach (checkbox) ->
134
+ checkbox.disabled = true
135
+ @container.classList.remove('is-task-list-enabled')
136
+ event = createEvent 'tasklist:disabled'
137
+ @container.dispatchEvent event
138
+
139
+ # Updates the field value to reflect the state of item.
140
+ # Triggers the `tasklist:change` event before the value has changed, and fires
141
+ # a `tasklist:changed` event once the value has changed.
142
+ updateTaskList: (item) ->
143
+ checkboxes = @container.querySelectorAll('.task-list-item-checkbox')
144
+ index = 1 + NodeArray(checkboxes).indexOf item
145
+
146
+ changeEvent = createEvent 'tasklist:change',
147
+ index: index
148
+ checked: item.checked
149
+ @field.dispatchEvent changeEvent
150
+
151
+ unless changeEvent.defaultPrevented
152
+ @field.value = TaskList.updateSource(@field.value, index, item.checked)
153
+ changeEvent = createEvent 'change'
154
+ @field.dispatchEvent changeEvent
155
+ changedEvent = createEvent 'tasklist:changed',
156
+ index: index
157
+ checked: item.checked
158
+ @field.dispatchEvent changedEvent
159
+
160
+ # Static interface
161
+
162
+ @incomplete: "[ ]"
163
+ @complete: "[x]"
164
+
165
+ # Escapes the String for regular expression matching.
166
+ @escapePattern: (str) ->
167
+ str.
168
+ replace(/([\[\]])/g, "\\$1"). # escape square brackets
169
+ replace(/\s/, "\\s"). # match all white space
170
+ replace("x", "[xX]") # match all cases
171
+
172
+ @incompletePattern: ///
173
+ #{@escapePattern(@incomplete)}
174
+ ///
175
+ @completePattern: ///
176
+ #{@escapePattern(@complete)}
177
+ ///
178
+
179
+ # Pattern used to identify all task list items.
180
+ # Useful when you need iterate over all items.
181
+ @itemPattern: ///
182
+ ^
183
+ (?: # prefix, consisting of
184
+ \s* # optional leading whitespace
185
+ (?:>\s*)* # zero or more blockquotes
186
+ (?:[-+*]|(?:\d+\.)) # list item indicator
187
+ )
188
+ \s* # optional whitespace prefix
189
+ ( # checkbox
190
+ #{@escapePattern(@complete)}|
191
+ #{@escapePattern(@incomplete)}
192
+ )
193
+ \s+ # is followed by whitespace
194
+ (?!
195
+ \(.*?\) # is not part of a [foo](url) link
196
+ )
197
+ (?= # and is followed by zero or more links
198
+ (?:\[.*?\]\s*(?:\[.*?\]|\(.*?\))\s*)*
199
+ (?:[^\[]|$) # and either a non-link or the end of the string
200
+ )
201
+ ///
202
+
203
+ # Used to skip checkbox markup inside of code fences.
204
+ # http://rubular.com/r/TfCDNsy8x4
205
+ @startFencesPattern: /^`{3}.*$/
206
+ @endFencesPattern: /^`{3}$/
207
+
208
+ # Used to filter out potential mismatches (items not in lists).
209
+ # http://rubular.com/r/OInl6CiePy
210
+ @itemsInParasPattern: ///
211
+ ^
212
+ (
213
+ #{@escapePattern(@complete)}|
214
+ #{@escapePattern(@incomplete)}
215
+ )
216
+ .+
217
+ $
218
+ ///g
219
+
220
+ # Given the source text, updates the appropriate task list item to match the
221
+ # given checked value.
222
+ #
223
+ # Returns the updated String text.
224
+ @updateSource: (source, itemIndex, checked) ->
225
+ clean = source.replace(/\r/g, '').
226
+ replace(@itemsInParasPattern, '').
227
+ split("\n")
228
+ index = 0
229
+ inCodeBlock = false
230
+ result = for line in source.split("\n")
231
+ if inCodeBlock
232
+ # Lines inside of a code block are ignored.
233
+ if line.match(@endFencesPattern)
234
+ # Stop ignoring lines once the code block is closed.
235
+ inCodeBlock = false
236
+ else if line.match(@startFencesPattern)
237
+ # Start ignoring lines inside a code block.
238
+ inCodeBlock = true
239
+ else if line in clean && line.match(@itemPattern)
240
+ index += 1
241
+ if index == itemIndex
242
+ line =
243
+ if checked
244
+ line.replace(@incompletePattern, @complete)
245
+ else
246
+ line.replace(@completePattern, @incomplete)
247
+ line
248
+ result.join("\n")
249
+
250
+ if typeof jQuery != 'undefined'
251
+ jQuery.fn.taskList = (method) ->
252
+ this.each (index, el) ->
253
+ taskList = jQuery(el).data('task-list')
254
+ if !taskList
255
+ taskList = new TaskList el
256
+ jQuery(el).data 'task-list', taskList
257
+ if !method || method == 'enable'
258
+ return
259
+
260
+ taskList[method || 'enable']()
261
+
262
+ module.exports = TaskList
data/bower.json CHANGED
@@ -1,13 +1,12 @@
1
1
  {
2
2
  "name": "deckar01-task_list",
3
- "version": "1.0.6",
3
+ "version": "2.0.0",
4
4
  "description": "Markdown TaskList components",
5
5
  "homepage": "https://github.com/deckar01/task_list",
6
- "dependencies": {
7
- "jquery": ">= 1.9.1"
8
- },
9
6
  "devDependencies": {
10
- "qunit": "^1.0.0"
7
+ "jquery": ">= 1.9.1",
8
+ "qunit": "^1.0.0",
9
+ "rails-behaviors": "^0.8.4"
11
10
  },
12
11
  "main": [
13
12
  "app/assets/javascripts/task_list.coffee",
data/dist/.gitignore ADDED
@@ -0,0 +1,2 @@
1
+ *.css
2
+ *.js
data/dist/.npmignore ADDED
File without changes
@@ -1,3 +1,3 @@
1
1
  class TaskList
2
- VERSION = [1, 0, 6].join('.')
2
+ VERSION = [2, 0, 0].join('.')
3
3
  end
data/package.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "deckar01-task_list",
3
+ "version": "2.0.0",
4
+ "description": "Markdown TaskList components",
5
+ "main": "dist/task_list.js",
6
+ "directories": {
7
+ "test": "test"
8
+ },
9
+ "files": [
10
+ "dist"
11
+ ],
12
+ "scripts": {
13
+ "test": "script/cibuild",
14
+ "qunit": "phantomjs test/run-qunit.coffee http://localhost:4018/test/index.html",
15
+ "lint": "coffeelint app/assets/javascripts/task_list.coffee",
16
+ "build:css": "node-sass -o dist/ app/assets/stylesheets/task_list.scss",
17
+ "build:js": "webpack",
18
+ "build": "npm run build:css && npm run build:js",
19
+ "prepublish": "npm run build"
20
+ },
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "git+https://github.com/deckar01/task_list.git"
24
+ },
25
+ "keywords": [
26
+ "task",
27
+ "list",
28
+ "markdown",
29
+ "ruby",
30
+ "check"
31
+ ],
32
+ "author": "Jared Deckard <jared.deckard@gmail.com>",
33
+ "license": "MIT",
34
+ "bugs": {
35
+ "url": "https://github.com/deckar01/task_list/issues"
36
+ },
37
+ "homepage": "https://github.com/deckar01/task_list#readme",
38
+ "devDependencies": {
39
+ "bower": "^1.8.0",
40
+ "coffee-loader": "^0.7.3",
41
+ "coffee-script": "^1.12.5",
42
+ "coffeelint": "^1.16.0",
43
+ "node-sass": "^4.5.2",
44
+ "phantomjs": "^1.9.19",
45
+ "webpack": "^2.5.1"
46
+ }
47
+ }
data/script/bootstrap CHANGED
@@ -5,9 +5,5 @@ if ! bundle check 1>/dev/null 2>&1; then
5
5
  bundle install --no-color --binstubs --path vendor/gems
6
6
  fi
7
7
 
8
- if ! npm list bower 2>&1 | grep 0.8.5 >/dev/null; then
9
- # npm install bower
10
- npm install git://github.com/twitter/bower.git
11
- fi
12
-
8
+ npm install
13
9
  bower install --no-color
data/script/cibuild CHANGED
@@ -2,5 +2,6 @@
2
2
  # Usage: script/cibuild
3
3
  # CI build script.
4
4
 
5
+ npm run lint
5
6
  ./script/testsuite 4018
6
7
  bundle exec rake test
data/script/testsuite CHANGED
@@ -3,15 +3,13 @@
3
3
  root = File.expand_path("../..", __FILE__)
4
4
  Dir.chdir root
5
5
 
6
- port = ARGV[0] || 4000
7
-
8
6
  pid = fork do
9
7
  $stderr.reopen "/dev/null" # silence WEBrick output
10
- exec 'bundle', 'exec', 'rackup', '-p', port.to_s
8
+ exec 'bundle', 'exec', 'rackup', '-p', '4018'
11
9
  end
12
10
  sleep 1
13
11
 
14
- status = system('phantomjs', "#{root}/test/run-qunit.coffee", "http://localhost:#{port}/test/index.html")
12
+ status = system('npm', 'run', 'qunit')
15
13
 
16
14
  Process.kill 'SIGINT', pid
17
15
  Process.wait pid
data/task_list.gemspec CHANGED
@@ -16,15 +16,18 @@ Gem::Specification.new do |gem|
16
16
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
17
17
  gem.require_paths = ["lib"]
18
18
 
19
- gem.add_dependency "rack", "~> 1.0"
20
- gem.add_dependency "activesupport", "~> 4.0"
19
+ gem.required_ruby_version = ">= 2.1.0"
20
+
21
+ gem.add_dependency "activesupport", "~> 4.0" if RUBY_VERSION < '2.2.2'
22
+ gem.add_dependency "nokogiri", "~> 1.6.0" if RUBY_VERSION < '2.1.0'
21
23
  gem.add_dependency "html-pipeline"
22
24
 
23
25
  gem.add_development_dependency "github-markdown"
24
26
  gem.add_development_dependency "rake"
25
27
  gem.add_development_dependency "coffee-script"
26
28
  gem.add_development_dependency "json"
27
- gem.add_development_dependency "rack"
29
+ gem.add_development_dependency "rack", "~> 1.0" if RUBY_VERSION < '2.2.2'
30
+ gem.add_development_dependency "rack" if RUBY_VERSION >= '2.2.2'
28
31
  gem.add_development_dependency "sprockets"
29
32
  gem.add_development_dependency "minitest", "~> 5.3.2"
30
33
  end
@@ -30,6 +30,9 @@
30
30
  logEvent(event)
31
31
  $(this).taskList()
32
32
  })
33
+ $(function() {
34
+ $('.js-task-list-container').taskList()
35
+ })
33
36
  </script>
34
37
 
35
38
  <style>
@@ -1,3 +1,4 @@
1
+ #= require jquery
1
2
  #= require task_list
2
3
 
3
4
  module "TaskList events",
@@ -1,3 +1,4 @@
1
+ #= require jquery
1
2
  #= require task_list
2
3
 
3
4
  module "TaskList updates",
@@ -255,9 +256,9 @@ module "TaskList updates",
255
256
  asyncTest "updates the source, marking the incomplete item as complete", ->
256
257
  expect 3
257
258
 
258
- @field.on 'tasklist:changed', (event, index, checked) =>
259
- ok checked
260
- equal index, @incompleteItem.expectedIndex
259
+ @field.on 'tasklist:changed', (event) =>
260
+ ok event.detail.checked
261
+ equal event.detail.index, @incompleteItem.expectedIndex
261
262
  equal @field.val(), @changes.toIncomplete
262
263
 
263
264
  setTimeout ->
@@ -269,9 +270,9 @@ asyncTest "updates the source, marking the incomplete item as complete", ->
269
270
  asyncTest "updates the source, marking the complete item as incomplete", ->
270
271
  expect 3
271
272
 
272
- @field.on 'tasklist:changed', (event, index, checked) =>
273
- ok !checked
274
- equal index, @completeItem.expectedIndex
273
+ @field.on 'tasklist:changed', (event) =>
274
+ ok !event.detail.checked
275
+ equal event.detail.index, @completeItem.expectedIndex
275
276
  equal @field.val(), @changes.toComplete
276
277
 
277
278
  setTimeout ->
@@ -284,9 +285,9 @@ asyncTest "updates the source, marking the complete item as incomplete", ->
284
285
  asyncTest "updates the source for items with non-breaking spaces", ->
285
286
  expect 3
286
287
 
287
- @field.on 'tasklist:changed', (event, index, checked) =>
288
- ok checked
289
- equal index, @incompleteNBSPItem.expectedIndex
288
+ @field.on 'tasklist:changed', (event) =>
289
+ ok event.detail.checked
290
+ equal event.detail.index, @incompleteNBSPItem.expectedIndex
290
291
  equal @field.val(), @changes.toIncompleteNBSP
291
292
 
292
293
  setTimeout ->
@@ -298,9 +299,9 @@ asyncTest "updates the source for items with non-breaking spaces", ->
298
299
  asyncTest "updates the source of a quoted item, marking the incomplete item as complete", ->
299
300
  expect 3
300
301
 
301
- @field.on 'tasklist:changed', (event, index, checked) =>
302
- ok checked
303
- equal index, @quotedIncompleteItem.expectedIndex
302
+ @field.on 'tasklist:changed', (event) =>
303
+ ok event.detail.checked
304
+ equal event.detail.index, @quotedIncompleteItem.expectedIndex
304
305
  equal @field.val(), @changes.toQuotedIncomplete
305
306
 
306
307
  setTimeout ->
@@ -312,9 +313,9 @@ asyncTest "updates the source of a quoted item, marking the incomplete item as c
312
313
  asyncTest "updates the source of a quoted item, marking the complete item as incomplete", ->
313
314
  expect 3
314
315
 
315
- @field.on 'tasklist:changed', (event, index, checked) =>
316
- ok !checked
317
- equal index, @quotedCompleteItem.expectedIndex
316
+ @field.on 'tasklist:changed', (event) =>
317
+ ok !event.detail.checked
318
+ equal event.detail.index, @quotedCompleteItem.expectedIndex
318
319
  equal @field.val(), @changes.toQuotedComplete
319
320
 
320
321
  setTimeout ->
@@ -326,9 +327,9 @@ asyncTest "updates the source of a quoted item, marking the complete item as inc
326
327
  asyncTest "updates the source of a quoted quoted item, marking the incomplete item as complete", ->
327
328
  expect 3
328
329
 
329
- @field.on 'tasklist:changed', (event, index, checked) =>
330
- ok checked
331
- equal index, @innerIncompleteItem.expectedIndex
330
+ @field.on 'tasklist:changed', (event) =>
331
+ ok event.detail.checked
332
+ equal event.detail.index, @innerIncompleteItem.expectedIndex
332
333
  equal @field.val(), @changes.toInnerIncomplete
333
334
 
334
335
  setTimeout ->
@@ -340,9 +341,9 @@ asyncTest "updates the source of a quoted quoted item, marking the incomplete it
340
341
  asyncTest "updates the source of a quoted quoted item, marking the complete item as incomplete", ->
341
342
  expect 3
342
343
 
343
- @field.on 'tasklist:changed', (event, index, checked) =>
344
- ok !checked
345
- equal index, @innerCompleteItem.expectedIndex
344
+ @field.on 'tasklist:changed', (event) =>
345
+ ok !event.detail.checked
346
+ equal event.detail.index, @innerCompleteItem.expectedIndex
346
347
  equal @field.val(), @changes.toInnerComplete
347
348
 
348
349
  setTimeout ->
@@ -354,9 +355,9 @@ asyncTest "updates the source of a quoted quoted item, marking the complete item
354
355
  asyncTest "updates the source of an ordered list item, marking the incomplete item as complete", ->
355
356
  expect 3
356
357
 
357
- @field.on 'tasklist:changed', (event, index, checked) =>
358
- ok checked
359
- equal index, @orderedIncompleteItem.expectedIndex
358
+ @field.on 'tasklist:changed', (event) =>
359
+ ok event.detail.checked
360
+ equal event.detail.index, @orderedIncompleteItem.expectedIndex
360
361
  equal @field.val(), @changes.toOrderedIncomplete
361
362
 
362
363
  setTimeout ->
@@ -368,9 +369,9 @@ asyncTest "updates the source of an ordered list item, marking the incomplete it
368
369
  asyncTest "updates the source of an ordered list item, marking the complete item as incomplete", ->
369
370
  expect 3
370
371
 
371
- @field.on 'tasklist:changed', (event, index, checked) =>
372
- ok !checked
373
- equal index, @orderedCompleteItem.expectedIndex
372
+ @field.on 'tasklist:changed', (event) =>
373
+ ok !event.detail.checked
374
+ equal event.detail.index, @orderedCompleteItem.expectedIndex
374
375
  equal @field.val(), @changes.toOrderedComplete
375
376
 
376
377
  setTimeout ->
@@ -430,9 +431,9 @@ asyncTest "update ignores items that look like Task List items but lack list pre
430
431
  $('#qunit-fixture').append(container)
431
432
  container.taskList()
432
433
 
433
- field.on 'tasklist:changed', (event, index, checked) =>
434
- ok checked
435
- equal index, item2.expectedIndex
434
+ field.on 'tasklist:changed', (event) =>
435
+ ok event.detail.checked
436
+ equal event.detail.index, item2.expectedIndex
436
437
  equal field.val(), changes
437
438
 
438
439
  setTimeout ->
@@ -496,9 +497,9 @@ asyncTest "update ignores items that look like Task List items but are links", -
496
497
  $('#qunit-fixture').append(container)
497
498
  container.taskList()
498
499
 
499
- field.on 'tasklist:changed', (event, index, checked) =>
500
- ok checked
501
- equal index, item2.expectedIndex
500
+ field.on 'tasklist:changed', (event) =>
501
+ ok event.detail.checked
502
+ equal event.detail.index, item2.expectedIndex
502
503
  equal field.val(), changes
503
504
 
504
505
  setTimeout ->
@@ -554,9 +555,9 @@ asyncTest "updates items followed by links", ->
554
555
  $('#qunit-fixture').append(container)
555
556
  container.taskList()
556
557
 
557
- field.on 'tasklist:changed', (event, index, checked) =>
558
- ok checked
559
- equal index, item2.expectedIndex
558
+ field.on 'tasklist:changed', (event) =>
559
+ ok event.detail.checked
560
+ equal event.detail.index, item2.expectedIndex
560
561
  equal field.val(), changes
561
562
 
562
563
  setTimeout ->
@@ -621,9 +622,9 @@ asyncTest "doesn't update items inside code blocks", ->
621
622
  $('#qunit-fixture').append(container)
622
623
  container.taskList()
623
624
 
624
- field.on 'tasklist:changed', (event, index, checked) =>
625
- ok checked
626
- equal index, item2.expectedIndex
625
+ field.on 'tasklist:changed', (event) =>
626
+ ok event.detail.checked
627
+ equal event.detail.index, item2.expectedIndex
627
628
  equal field.val(), changes
628
629
 
629
630
  setTimeout ->
data/webpack.config.js ADDED
@@ -0,0 +1,19 @@
1
+ module.exports = {
2
+ entry: './app/assets/javascripts/task_list.coffee',
3
+ output: {
4
+ filename: 'dist/task_list.js',
5
+ libraryTarget: 'umd',
6
+ library: 'TaskList',
7
+ },
8
+ module: {
9
+ loaders: [
10
+ {
11
+ test: /\.coffee$/,
12
+ loader: 'coffee-loader'
13
+ }
14
+ ]
15
+ },
16
+ resolve: {
17
+ extensions: ['.coffee', '.js']
18
+ }
19
+ }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deckar01-task_list
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jared Deckard
@@ -9,36 +9,8 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-10-12 00:00:00.000000000 Z
12
+ date: 2017-05-19 00:00:00.000000000 Z
13
13
  dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: rack
16
- requirement: !ruby/object:Gem::Requirement
17
- requirements:
18
- - - "~>"
19
- - !ruby/object:Gem::Version
20
- version: '1.0'
21
- type: :runtime
22
- prerelease: false
23
- version_requirements: !ruby/object:Gem::Requirement
24
- requirements:
25
- - - "~>"
26
- - !ruby/object:Gem::Version
27
- version: '1.0'
28
- - !ruby/object:Gem::Dependency
29
- name: activesupport
30
- requirement: !ruby/object:Gem::Requirement
31
- requirements:
32
- - - "~>"
33
- - !ruby/object:Gem::Version
34
- version: '4.0'
35
- type: :runtime
36
- prerelease: false
37
- version_requirements: !ruby/object:Gem::Requirement
38
- requirements:
39
- - - "~>"
40
- - !ruby/object:Gem::Version
41
- version: '4.0'
42
14
  - !ruby/object:Gem::Dependency
43
15
  name: html-pipeline
44
16
  requirement: !ruby/object:Gem::Requirement
@@ -168,11 +140,14 @@ files:
168
140
  - app/assets/stylesheets/task_list.scss
169
141
  - bower.json
170
142
  - config.ru
143
+ - dist/.gitignore
144
+ - dist/.npmignore
171
145
  - lib/task_list.rb
172
146
  - lib/task_list/filter.rb
173
147
  - lib/task_list/railtie.rb
174
148
  - lib/task_list/summary.rb
175
149
  - lib/task_list/version.rb
150
+ - package.json
176
151
  - script/bootstrap
177
152
  - script/cibuild
178
153
  - script/testsuite
@@ -189,6 +164,7 @@ files:
189
164
  - test/unit/test_updates.coffee
190
165
  - test/units.coffee
191
166
  - test/units.css
167
+ - webpack.config.js
192
168
  homepage:
193
169
  licenses: []
194
170
  metadata: {}
@@ -200,7 +176,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
200
176
  requirements:
201
177
  - - ">="
202
178
  - !ruby/object:Gem::Version
203
- version: '0'
179
+ version: 2.1.0
204
180
  required_rubygems_version: !ruby/object:Gem::Requirement
205
181
  requirements:
206
182
  - - ">="
@@ -208,7 +184,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
208
184
  version: '0'
209
185
  requirements: []
210
186
  rubyforge_project:
211
- rubygems_version: 2.6.6
187
+ rubygems_version: 2.5.2
212
188
  signing_key:
213
189
  specification_version: 4
214
190
  summary: Markdown TaskList components