epi_js 1.0.9 → 1.0.16

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
- SHA1:
3
- metadata.gz: 6a3f46b4a617bb177e498058a8353743a735a935
4
- data.tar.gz: a5d11d7473856a4ddefb743a3cbaf39973a85da4
2
+ SHA256:
3
+ metadata.gz: 6c486786ad5dea7f11879922068d37e7d5c60d53e650607e22d7c1396276fd3b
4
+ data.tar.gz: 871d7607dfcefbe9e656f07069642168dc40174b24f15be337eca7ad36bfbe0d
5
5
  SHA512:
6
- metadata.gz: d304a8d18a8f80e6ed4d1e3229a4c2b42e74e3e5aad4aa01753e84ca077e50a29c8cd990e481e1dc2aa77a584623f26d0f56deb97867a6c90376a30b99404e17
7
- data.tar.gz: 2ba79c94751e203407ae57c0f2bfd97db58b85de8445f70269416d8ab6f3b8603b6959e871437aece316788b2ff881257af33619c9257fc509af77741c4518b2
6
+ metadata.gz: 41cd5c5ece8f4b3a999802ca514cae84a5a3e82378e0669f62823d904bd21e7f572b9b8d30404d9cd17a6934b5977c7ea2b116add6ba5ab2d70033874a02d7a2
7
+ data.tar.gz: b130335367d7aba8fa2421cd641a09660dd0e6314ff94d7f04bdc56edfda85525c62e01513a6c14d450d557fdf4913b84d06b51449cee89931e158998fc81a50
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # EpiJS
1
+ # epiJS
2
2
 
3
3
  Some jQuery based scripts, including:
4
4
 
@@ -6,8 +6,8 @@ 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", "Ryan Bibby"]
10
- gem.email = ["s.chen@epigenesys.co.uk"]
9
+ gem.authors = ["Shuo Chen", "Ryan Bibby", "James Gregory-Monk"]
10
+ gem.email = ["shuo.chen@epigenesys.org.uk", "james.gregory@epigenesys.org.uk"]
11
11
  gem.description = %q{jQuery scripts used in various projects}
12
12
  gem.summary = %q{jQuery scripts used in various projects}
13
13
  gem.homepage = "https://github.com/epigenesys/epi-js"
@@ -16,12 +16,11 @@ Gem::Specification.new do |gem|
16
16
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
17
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
18
  gem.require_paths = ["lib"]
19
-
20
-
19
+
20
+
21
21
  gem.add_dependency 'railties', '>= 3.0'
22
22
  gem.add_dependency 'coffee-rails', '>= 3.2'
23
23
  gem.add_dependency 'sass-rails', '>= 3.2'
24
- gem.add_dependency 'bootstrap-sass'
25
24
 
26
25
  gem.add_development_dependency 'bundler', '>= 1.0'
27
26
  gem.add_development_dependency 'rails', '>= 3.0'
@@ -1,3 +1,3 @@
1
1
  module EpiJs
2
- VERSION = "1.0.9"
2
+ VERSION = "1.0.16"
3
3
  end
@@ -2,7 +2,7 @@
2
2
  'use strict'
3
3
  $.ajaxModal = (url, params) ->
4
4
  $.get url, params, (data) ->
5
- $modal = if $('#modalWindow').length > 0
5
+ $modal = if $('#modalWindow').length > 0
6
6
  $('#modalWindow')
7
7
  else
8
8
  $('<div id="modalWindow" class="modal fade" tabindex="-1" role="dialog"></div>')
@@ -30,7 +30,8 @@
30
30
  $(document).trigger('ajax-modal-shown')
31
31
 
32
32
  $ ->
33
- $(document.body).on 'click', 'a.ajax-modal, a[data-toggle="ajax-modal"]', (e) ->
33
+ $(document.body).on 'click', 'a.ajax-modal, [data-toggle="ajax-modal"]', (e) ->
34
34
  e.preventDefault()
35
- $.ajaxModal $(@).attr('href'), $(@).data('params')
35
+ url = $(@).data('url') ? $(@).attr('href')
36
+ $.ajaxModal url, $(@).data('params')
36
37
  ) jQuery
@@ -24,5 +24,9 @@
24
24
 
25
25
  if $('.flash-messages .alert').length > 0
26
26
  $('.flash-messages .alert').addClass('in')
27
- setTimeout("$('.flash-messages .alert').alert('close');", 6000)
27
+ setTimeout(
28
+ ->
29
+ $('.flash-messages .alert').alert('close')
30
+ , 6000
31
+ )
28
32
  ) jQuery
@@ -4,7 +4,7 @@
4
4
  constructor: (element) ->
5
5
  @element = element
6
6
  @target = $(@element.data('table-filter-target'))
7
- @allRows = $('tbody tr:not(.tr-no-record)', @target)
7
+
8
8
  colspan = if @target.data('no-record-span')?
9
9
  @target.data('no-record-span')
10
10
  else
@@ -18,21 +18,24 @@
18
18
  @noRecordRow = $("<tr class='tr-no-record'><td colspan=#{colspan}>#{message}</td></tr>")
19
19
  filter: ->
20
20
  $('.tr-no-record', @target).remove()
21
+ allRows = @allRows()
21
22
  keyword = @element.val().toLowerCase()
22
23
 
23
24
  $toShow = if keyword is ''
24
- @allRows
25
+ allRows
25
26
  else
26
- @allRows.filter ->
27
+ allRows.filter ->
27
28
  trText = $(this).clone().find('.btn').remove().end().text().toLowerCase()
28
29
  trText.indexOf(keyword) > -1
29
30
 
30
31
  $toShow.show()
31
- @allRows.not($toShow).hide()
32
+ allRows.not($toShow).hide()
32
33
 
33
34
  if $toShow.length is 0
34
35
  $('tbody', @target).append(@noRecordRow)
35
36
 
37
+ allRows: ->
38
+ $('tbody tr:not(.tr-no-record)', @target)
36
39
  $.fn.tableFilter = ->
37
40
  @each ->
38
41
  data = $(this).data('table-filter')
@@ -1,5 +1,5 @@
1
1
  (($) ->
2
- 'use strict'
2
+ 'use strict'
3
3
  class GenericVisibilityChecker
4
4
  constructor: (element) ->
5
5
  @element = element
@@ -7,17 +7,17 @@
7
7
  @action = @element.data('visibility-map-action') ? 'show'
8
8
  @map = @element.data('visibility-map')
9
9
  @allFields = $($.unique $.map @map, (val) => $(val, @scope).get())
10
-
10
+
11
11
  check: ->
12
12
  fieldsForValue = $ $.unique $.map @getValue(), (value) => $(@map[value], @scope).get()
13
-
13
+
14
14
  if @action is 'show'
15
15
  toShow = fieldsForValue
16
16
  toHide = @allFields.not(fieldsForValue)
17
17
  else
18
18
  toHide = fieldsForValue
19
19
  toShow = @allFields.not(fieldsForValue)
20
-
20
+
21
21
  toShow.show()
22
22
  toShow.trigger('visibility.show')
23
23
 
@@ -27,33 +27,37 @@
27
27
  hideAll: ->
28
28
  @allFields.hide()
29
29
  @allFields.trigger('visibility.hide')
30
-
30
+
31
+ showAll: ->
32
+ @allFields.show()
33
+ @allFields.trigger('visibility.show')
34
+
31
35
  getValue: ->
32
36
  $.makeArray(@element.val())
33
-
37
+
34
38
  class CheckboxVisibilityChecker extends GenericVisibilityChecker
35
39
  getValue: ->
36
40
  $.map $("input[type='checkbox'][name='#{@element.attr('name')}']:checked"), (inputElement) ->
37
41
  $(inputElement).val()
38
-
42
+
39
43
  $.fn.setVisibility = (action) ->
40
44
  @each ->
41
45
  data = $(this).data('visibility-checker')
42
46
  unless data?
43
- checkerClass = if $(this).is("input[type='checkbox']") then CheckboxVisibilityChecker else GenericVisibilityChecker
47
+ checkerClass = if $(this).is("input[type='checkbox']") then CheckboxVisibilityChecker else GenericVisibilityChecker
44
48
  $(this).data('visibility-checker', data = new checkerClass $(this))
45
49
  action ?= 'check'
46
50
  data[action]()
47
-
51
+
48
52
  $ ->
49
- $('input[data-visibility-map]:checked, select[data-visibility-map]').setVisibility()
50
-
51
53
  $(document.body).on('visibility.show', (e) ->
52
54
  $(':input:not([data-visibility-map-no-auto-enable])', $(e.target)).prop('disabled', false)
53
55
  ).on('visibility.hide', (e) ->
54
56
  $(':input', $(e.target)).prop('disabled', true)
55
57
  )
56
-
58
+
59
+ $('input[data-visibility-map]:checked, select[data-visibility-map]').setVisibility()
60
+
57
61
  $(document.body).on 'change', '[data-visibility-map]', (e) ->
58
62
  $(this).setVisibility()
59
- ) jQuery
63
+ ) jQuery
metadata CHANGED
@@ -1,15 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: epi_js
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.9
4
+ version: 1.0.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shuo Chen
8
8
  - Ryan Bibby
9
+ - James Gregory-Monk
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
- date: 2018-01-10 00:00:00.000000000 Z
13
+ date: 2020-10-02 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: railties
@@ -53,20 +54,6 @@ dependencies:
53
54
  - - ">="
54
55
  - !ruby/object:Gem::Version
55
56
  version: '3.2'
56
- - !ruby/object:Gem::Dependency
57
- name: bootstrap-sass
58
- requirement: !ruby/object:Gem::Requirement
59
- requirements:
60
- - - ">="
61
- - !ruby/object:Gem::Version
62
- version: '0'
63
- type: :runtime
64
- prerelease: false
65
- version_requirements: !ruby/object:Gem::Requirement
66
- requirements:
67
- - - ">="
68
- - !ruby/object:Gem::Version
69
- version: '0'
70
57
  - !ruby/object:Gem::Dependency
71
58
  name: bundler
72
59
  requirement: !ruby/object:Gem::Requirement
@@ -97,7 +84,8 @@ dependencies:
97
84
  version: '3.0'
98
85
  description: jQuery scripts used in various projects
99
86
  email:
100
- - s.chen@epigenesys.co.uk
87
+ - shuo.chen@epigenesys.org.uk
88
+ - james.gregory@epigenesys.org.uk
101
89
  executables: []
102
90
  extensions: []
103
91
  extra_rdoc_files: []
@@ -139,8 +127,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
139
127
  - !ruby/object:Gem::Version
140
128
  version: '0'
141
129
  requirements: []
142
- rubyforge_project:
143
- rubygems_version: 2.6.13
130
+ rubygems_version: 3.0.3
144
131
  signing_key:
145
132
  specification_version: 4
146
133
  summary: jQuery scripts used in various projects