epi_js 0.0.22 → 1

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: bc857a298975eee6bc9d4d434d705b7e4e3a2e79
4
- data.tar.gz: ca18662bf2e10f370660b61d527a80442dab5ede
3
+ metadata.gz: 75f3e48a268cbd242ebb2cb41163f49524b1d9d0
4
+ data.tar.gz: c5fcfdf8cbb15cf659cb8cfdc910b984340e5126
5
5
  SHA512:
6
- metadata.gz: c715d378e65f514b37093f7e83300cf30850284db1f8a233f2e26381d9338554a951cdf219de6e94f3a951ea8d2ef50e3f1a690cf05fa543ff9dde8e081feed2
7
- data.tar.gz: cd59faeed5a3071313c8c860a8082abe4ba8a2963f8f2e86166b0b56ca54b6698775d8d6400396592ec4af93bcb0ce1ec9826408e4af0993b2aa3b0a3976aaa4
6
+ metadata.gz: 637e467d67afbb5384f499db1f29d1f2cd7632dc369a2867aaca19f0a978a5506f05a4f77852114d06ebb6397f0d7bebdd0fe15b0c88f32e75c5387299d62e27
7
+ data.tar.gz: fd134440f734723c41390aba7f5fbb78adb8d17bebb78a56552f19f8fdafca6ca100e3df30d15d5ead1a543edea0ee51cca2b20666729fe22099b7e633e74404
data/epi_js.gemspec CHANGED
@@ -6,11 +6,11 @@ require 'epi_js/version'
6
6
  Gem::Specification.new do |gem|
7
7
  gem.name = "epi_js"
8
8
  gem.version = EpiJs::VERSION
9
- gem.authors = ["Shuo Chen"]
9
+ gem.authors = ["Shuo Chen", "Ryan Bibby"]
10
10
  gem.email = ["s.chen@epigenesys.co.uk"]
11
11
  gem.description = %q{jQuery scripts used in various projects}
12
12
  gem.summary = %q{jQuery scripts used in various projects}
13
- gem.homepage = ""
13
+ gem.homepage = "https://github.com/epigenesys/epi-js"
14
14
 
15
15
  gem.files = `git ls-files`.split($/)
16
16
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
@@ -1,3 +1,3 @@
1
1
  module EpiJs
2
- VERSION = "0.0.22"
2
+ VERSION = "1"
3
3
  end
@@ -0,0 +1,46 @@
1
+ (($) ->
2
+ 'use strict'
3
+ class TableFilter
4
+ constructor: (element) ->
5
+ @element = element
6
+ @target = $(@element.data('table-filter-target'))
7
+ @allRows = $('tbody tr:not(.tr-no-record)', @target)
8
+ colspan = if @target.data('no-record-span')?
9
+ @target.data('no-record-span')
10
+ else
11
+ $('thead th', @target).size()
12
+
13
+ message = if @target.data('no-record')?
14
+ @target.data('no-record')
15
+ else
16
+ 'No records found'
17
+
18
+ @noRecordRow = $("<tr class='tr-no-record'><td colspan=#{colspan}>#{message}</td></tr>")
19
+ filter: ->
20
+ $('.tr-no-record', @target).remove()
21
+ keyword = @element.val().toLowerCase()
22
+
23
+ $toShow = if keyword is ''
24
+ @allRows
25
+ else
26
+ @allRows.filter ->
27
+ trText = $(this).clone().find('.btn').remove().end().text().toLowerCase()
28
+ trText.indexOf(keyword) > -1
29
+
30
+ $toShow.show()
31
+ @allRows.not($toShow).hide()
32
+
33
+ if $toShow.size() is 0
34
+ $('tbody', @target).append(@noRecordRow)
35
+
36
+ $.fn.tableFilter = ->
37
+ @each ->
38
+ data = $(this).data('table-filter')
39
+ unless data?
40
+ $(this).data('table-filter', data = new TableFilter($(this)) )
41
+ data.filter()
42
+
43
+ $ ->
44
+ $(document).on 'keyup', '[data-table-filter-target]', (e) ->
45
+ $(this).tableFilter()
46
+ ) jQuery
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: epi_js
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.22
4
+ version: '1'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shuo Chen
8
+ - Ryan Bibby
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2016-04-04 00:00:00.000000000 Z
12
+ date: 2016-04-05 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: railties
@@ -115,11 +116,12 @@ files:
115
116
  - vendor/assets/javascripts/flash_message.coffee
116
117
  - vendor/assets/javascripts/option_filter.coffee
117
118
  - vendor/assets/javascripts/responsive_table.coffee
119
+ - vendor/assets/javascripts/table_filter.coffee
118
120
  - vendor/assets/javascripts/visibility_map.coffee
119
121
  - vendor/assets/stylesheets/epi_utilities.sass
120
122
  - vendor/assets/stylesheets/flash_message.sass
121
123
  - vendor/assets/stylesheets/responsive_table.sass
122
- homepage: ''
124
+ homepage: https://github.com/epigenesys/epi-js
123
125
  licenses: []
124
126
  metadata: {}
125
127
  post_install_message:
@@ -138,7 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
138
140
  version: '0'
139
141
  requirements: []
140
142
  rubyforge_project:
141
- rubygems_version: 2.4.8
143
+ rubygems_version: 2.4.5.1
142
144
  signing_key:
143
145
  specification_version: 4
144
146
  summary: jQuery scripts used in various projects