sortablelabel_js 0.1.0 → 0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4d5eb919c60f682748ab4554210be055e3202697
4
- data.tar.gz: a58c9408a6ede558daa1df9d7075a3db1a725a4d
3
+ metadata.gz: d1e965f81a78fe103dbb47a0f96fb54e217634e1
4
+ data.tar.gz: 436ae11a6c9e482451148bbabe1ebb403aa443f8
5
5
  SHA512:
6
- metadata.gz: 1f4ee538764347f6ef0ff9f3e56d3ea89c12aa5290113ff2a438eab4858422ce897765b111747b0a47d00808e53266654c66d62f434d9caa760b041bce15558e
7
- data.tar.gz: 49d7fa02fdfc09a6a1e1607d629968069c60c263eda198111853c251ed5748fc5b82dec07070c1dab023f13f03ac40382bee22c4d86da611f2b1c491f9b17161
6
+ metadata.gz: 084b86892fd4e3c5582a63d280315362007cf9dcfcad11f5b5c76d61544c2a84d70f1c9efec92ed204f9851571fe8c87adb6cf2698adbc77cd751514fbfe54ff
7
+ data.tar.gz: d980c15e26f12982a924c824ecc1849a40af5181251fa2f87c551180d30b7747e36e0186957f84cf515dd445151de8301f57d1c4e7473c2ebf944bc976718682
data/.gitignore CHANGED
@@ -1,2 +1,5 @@
1
+ /pkg
1
2
  /bower_components
2
- /node_modules
3
+ /node_modules
4
+ /coverage
5
+
data/README.md CHANGED
@@ -32,4 +32,19 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
32
32
 
33
33
  ## Contributing
34
34
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/sortablelabel-js.
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/ZYMoridae/sortablelabel-js.
36
+
37
+
38
+
39
+ ## How to run test
40
+
41
+ #### Step 1
42
+ Install dependencies lib
43
+ ```
44
+ npm run-script plugin
45
+ ```
46
+
47
+ #### Step 2
48
+ ```
49
+ npm test
50
+ ```
data/bower.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "sortlabel",
3
- "description": "",
3
+ "description": "Sortable label js dependencies",
4
4
  "main": "index.js",
5
5
  "authors": [
6
6
  "Joe <ashzhouyue@gmail.com>"
7
7
  ],
8
- "license": "ISC",
8
+ "license": "MIT",
9
9
  "homepage": "",
10
10
  "ignore": [
11
11
  "**/.*",
@@ -1,5 +1,5 @@
1
1
  module Sortablelabel
2
2
  module Js
3
- VERSION = "0.1.0"
3
+ VERSION = "0.2"
4
4
  end
5
5
  end
data/my.conf.js CHANGED
@@ -38,6 +38,7 @@ module.exports = function(config) {
38
38
  // preprocess matching files before serving them to the browser
39
39
  // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
40
40
  preprocessors: {
41
+ 'vendor/assets/javascripts/sortable_label.coffee': ['coverage'],
41
42
  'vendor/assets/javascripts/*.coffee': ['coffee']
42
43
  },
43
44
 
@@ -55,7 +56,7 @@ module.exports = function(config) {
55
56
  // test results reporter to use
56
57
  // possible values: 'dots', 'progress'
57
58
  // available reporters: https://npmjs.org/browse/keyword/karma-reporter
58
- reporters: ['progress'],
59
+ reporters: ['progress', 'coverage'],
59
60
 
60
61
 
61
62
  // web server port
@@ -86,6 +87,11 @@ module.exports = function(config) {
86
87
 
87
88
  // Concurrency level
88
89
  // how many browser should be started simultaneous
89
- concurrency: Infinity
90
+ concurrency: Infinity,
91
+
92
+ coverageReporter: {
93
+ type : 'html',
94
+ dir : 'coverage/'
95
+ }
90
96
  })
91
97
  }
@@ -1,18 +1,20 @@
1
1
  {
2
2
  "name": "sortlabel",
3
3
  "version": "1.0.0",
4
- "description": "",
4
+ "description": "Extension of jquery-sortable javascript library",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
- "test": "./node_modules/karma/bin/karma start my.conf.js"
7
+ "test": "./node_modules/karma/bin/karma start my.conf.js",
8
+ "dependency": "npm install | bower install"
8
9
  },
9
10
  "author": "",
10
- "license": "ISC",
11
+ "license": "MIT",
11
12
  "devDependencies": {
12
13
  "jasmine-core": "^2.7.0",
13
14
  "karma": "^1.7.0",
14
15
  "karma-chrome-launcher": "^2.2.0",
15
16
  "karma-coffee-preprocessor": "^1.0.1",
17
+ "karma-coverage": "^1.1.1",
16
18
  "karma-jasmine": "^1.1.0",
17
19
  "karma-jasmine-jquery": "^0.1.1"
18
20
  }
@@ -49,12 +49,12 @@ class @SortableLabel
49
49
  calInitStepLable: ->
50
50
  this.calLabel(this.options['removeField']+'[value=false]')
51
51
  if this.options['weekGroupLabelTarget']
52
- this.calWeekGroupLabel(this.options['weekGroupLabelTarget'])
52
+ this.calWeekGroupLabel(this.options['weekGroupLabelTarget'], true)
53
53
 
54
54
  calStepLable: ->
55
55
  this.calLabel(this.options['removeField']+'[value=false]')
56
56
  if this.options['weekGroupLabelTarget']
57
- this.calWeekGroupLabel(this.options['weekGroupLabelTarget'])
57
+ this.calWeekGroupLabel(this.options['weekGroupLabelTarget'], false)
58
58
 
59
59
  calLabel: (target) ->
60
60
  _this = this
@@ -84,21 +84,26 @@ class @SortableLabel
84
84
  )
85
85
  )
86
86
 
87
- calWeekGroupLabel: (target) ->
87
+ calWeekGroupLabel: (target, is_first) ->
88
88
  _this = this
89
89
  week_group_label_list = []
90
- $(@target.selector).each(->
90
+ $(@target).each(->
91
91
  $(this).find(target).each(->
92
- _index = _this.isIncludeWeekGroup($(this).text(), week_group_label_list)
92
+ tempLabel = ''
93
+ if is_first
94
+ tempLabel = $(this).text()
95
+ else
96
+ tempLabel = $(this).text().substr(0, $(this).text().lastIndexOf(' '))
97
+ _index = _this.isIncludeWeekGroup(tempLabel, week_group_label_list)
93
98
  if _index is -1
94
99
  week_group_label_list.push(
95
- name: $(this).text(),
100
+ name: tempLabel,
96
101
  count: 1
97
102
  )
98
- $(this).html("<i class='fa fa-trophy fa-fw small-opacity-30'></i>"+$(this).text()+" 1")
103
+ $(this).html("<i class='fa fa-trophy fa-fw small-opacity-30'></i>" + tempLabel + " 1")
99
104
  else if _index > -1
100
105
  week_group_label_list[_index].count += 1
101
- $(this).html("<i class='fa fa-trophy fa-fw small-opacity-30'></i>"+$(this).text()+" "+week_group_label_list[_index].count)
106
+ $(this).html("<i class='fa fa-trophy fa-fw small-opacity-30'></i>" + tempLabel + " " + week_group_label_list[_index].count)
102
107
  )
103
108
  )
104
109
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sortablelabel_js
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: '0.2'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe