ama_layout 4.6.5 → 4.7.0

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: 91b1ac35bbe9737dcafa1dcb38c4ddd2dcfca2d2
4
- data.tar.gz: 811996ef18e6e327fb42f2e6662f0c14746c5cb4
3
+ metadata.gz: dc441eeefdc9b74536a646560060c03255c61d38
4
+ data.tar.gz: decf6e4a3e24f4aa58d20073a54f1d7fceedeacf
5
5
  SHA512:
6
- metadata.gz: 2ad8facfff99fc4583f28482cff487ba9a76660ee3ab480090e9a9ed2cea027b553f50e12387e3b4de9a523607260f51211bfdb02d44d81904bb6046ccdb20eb
7
- data.tar.gz: dc938bc1bc6b094ec3b85d9efeeae0d817f6f2a8ba5bfe20fc6345d4e3c9198d024ff72fa1e7b7e9ecf8a69058d4e1b9a7127a87d00cbc7dfd437dc3d5067dd6
6
+ metadata.gz: 15063153390ad691227ba856b18f1e426995923a715faeae6faf37940333aa44bf9d5c1213d80933fb2aa5046e0bf57ceabd14736c59d7b588a15d52748397b8
7
+ data.tar.gz: 16f16b62c93f55fe49d633b63fd0604f00271b7711ff98a7a7ebf5eaab686700de0fd3301a1fdb3202d7740ecace7c1d0faa62fddebac7f3993202099f3cbf71
@@ -18,10 +18,10 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_dependency "foundation-rails", "~> 6.2.3.0"
21
+ spec.add_dependency "foundation-rails", "~> 6.2.4.0"
22
22
  spec.add_dependency "rails", "~> 4.2"
23
23
  spec.add_dependency "sass-rails", "~> 5.0"
24
- spec.add_dependency "font-awesome-sass", "4.6.2"
24
+ spec.add_dependency "font-awesome-sass", "4.7.0"
25
25
  spec.add_dependency "draper", "~> 2.1"
26
26
  spec.add_dependency "browser", "~> 2.0"
27
27
  spec.add_dependency "breadcrumbs_on_rails", "~> 3.0.1"
@@ -4,3 +4,4 @@
4
4
  //= require ./foundation-equalizer-reflow
5
5
  //= require ./cookie.ready
6
6
  //= require ../mailcheck/index
7
+ //= require ../real_date_picker
@@ -0,0 +1,35 @@
1
+ class AMALayout.RealDatePicker
2
+ constructor: () ->
3
+ @setDefaultDays()
4
+ @addEvents()
5
+
6
+ setDefaultDays: () ->
7
+ @limitDaysInMonth $(dateContainer) for dateContainer in $('select.month').parents()
8
+
9
+ addEvents: () ->
10
+ $('select.month').on 'change', (event) =>
11
+ @limitDaysInMonth $(event.currentTarget).parent()
12
+
13
+ $('select.year').on 'change', (event) =>
14
+ @limitDaysInMonth $(event.currentTarget).parent()
15
+
16
+ limitDaysInMonth: (container) ->
17
+ year = container.find('.year').val()
18
+ month = container.find('.month').val()
19
+ daysInMonth = @daysInMonth(month, year)
20
+
21
+ if container.find('.day').val() > daysInMonth then @resetDay(container)
22
+
23
+ for day in [1..31]
24
+ option = container.find(".day option[value=#{day}]")
25
+ if day > daysInMonth then option.hide() else option.show()
26
+
27
+ daysInMonth: (month, year) ->
28
+ # JS months are 0-based, and day 0 is the last day of the previous month
29
+ new Date(year, month, 0).getDate()
30
+
31
+ resetDay: (container) ->
32
+ container.find('.day :nth-child(1)').prop('selected', true)
33
+
34
+ $(document).ready ->
35
+ new AMALayout.RealDatePicker()
@@ -1,3 +1,3 @@
1
1
  module AmaLayout
2
- VERSION = '4.6.5'
2
+ VERSION = '4.7.0'
3
3
  end
@@ -0,0 +1,72 @@
1
+ <div class="form-horizontal__input-wrapper">
2
+ <select id="birth_date_2i" name="birth_date(2i)" class="date optional month">
3
+ <option value="">Month</option>
4
+ <option value="1">January</option>
5
+ <option value="2">February</option>
6
+ <option value="3">March</option>
7
+ <option value="4">April</option>
8
+ <option value="5">May</option>
9
+ <option value="6">June</option>
10
+ <option value="7">July</option>
11
+ <option value="8">August</option>
12
+ <option value="9">September</option>
13
+ <option value="10">October</option>
14
+ <option value="11">November</option>
15
+ <option value="12">December</option>
16
+ </select>
17
+ <select id="birth_date_3i" name="birth_date(3i)" class="date optional day">
18
+ <option value="">Day</option>
19
+ <option value="1">1</option>
20
+ <option value="2">2</option>
21
+ <option value="3">3</option>
22
+ <option value="4">4</option>
23
+ <option value="5">5</option>
24
+ <option value="6">6</option>
25
+ <option value="7">7</option>
26
+ <option value="8">8</option>
27
+ <option value="9">9</option>
28
+ <option value="10">10</option>
29
+ <option value="11">11</option>
30
+ <option value="12">12</option>
31
+ <option value="13">13</option>
32
+ <option value="14">14</option>
33
+ <option value="15">15</option>
34
+ <option value="16">16</option>
35
+ <option value="17">17</option>
36
+ <option value="18">18</option>
37
+ <option value="19">19</option>
38
+ <option value="20">20</option>
39
+ <option value="21">21</option>
40
+ <option value="22">22</option>
41
+ <option value="23">23</option>
42
+ <option value="24">24</option>
43
+ <option value="25">25</option>
44
+ <option value="26">26</option>
45
+ <option value="27">27</option>
46
+ <option value="28">28</option>
47
+ <option value="29">29</option>
48
+ <option value="30">30</option>
49
+ <option value="31">31</option>
50
+ </select>
51
+ <select id="birth_date_1i" name="birth_date(1i)" class="date optional year">
52
+ <option value="">Year</option>
53
+ <option value="2000">2000</option>
54
+ <option value="1999">1999</option>
55
+ <option value="1998">1998</option>
56
+ <option value="1997">1997</option>
57
+ <option value="1996">1996</option>
58
+ <option value="1995">1995</option>
59
+ <option value="1994">1994</option>
60
+ <option value="1993">1993</option>
61
+ <option value="1992">1992</option>
62
+ <option value="1991">1991</option>
63
+ <option value="1990">1990</option>
64
+ <option value="1989">1989</option>
65
+ <option value="1988">1988</option>
66
+ <option value="1987">1987</option>
67
+ <option value="1986">1986</option>
68
+ <option value="1985">1985</option>
69
+ <option value="1984">1984</option>
70
+ <option value="1983">1983</option>
71
+ </select>
72
+ </div>
@@ -0,0 +1,42 @@
1
+ describe "AMALayout.RealDatePicker", ->
2
+ beforeEach ->
3
+ this.fixtures = fixture.load("real_date_picker.html", false)
4
+ jasmine.Ajax.install()
5
+ new AMALayout.RealDatePicker()
6
+
7
+ afterEach ->
8
+ jasmine.Ajax.uninstall()
9
+
10
+ describe "Initial state", ->
11
+ it "Displays 31 days", ->
12
+ available_days = $('select.day option')
13
+ expect(available_days.length).toBe 31 + 1
14
+
15
+ describe "Selecting a month with less than 31 days", ->
16
+ beforeEach ->
17
+ $('select.month').val(9)
18
+ $('select.month').trigger('change')
19
+
20
+ it "Displays 30 days", ->
21
+ available_days = $('select.day option').filter -> $(@).css("display") isnt "none"
22
+ expect(available_days.length).toBe 30 + 1
23
+
24
+ describe "Selecting February in a leap year", ->
25
+ beforeEach ->
26
+ $('select.year').val(2000)
27
+ $('select.month').val(2)
28
+ $('select.month').trigger('change')
29
+
30
+ it "Displays 29 days", ->
31
+ available_days = $('select.day option').filter -> $(@).css("display") isnt "none"
32
+ expect(available_days.length).toBe 29 + 1
33
+
34
+ describe "Changing month with an invalid day already selected", ->
35
+ beforeEach ->
36
+ $('select.day').val(31)
37
+
38
+ it "Resets day", ->
39
+ expect($('select.day option:selected').val()).toBe "31"
40
+ $('select.month').val(2)
41
+ $('select.month').trigger('change')
42
+ expect($('select.day option:selected').val()).toBe ""
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ama_layout
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.6.5
4
+ version: 4.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael van den Beuken
@@ -18,7 +18,7 @@ authors:
18
18
  autorequire:
19
19
  bindir: bin
20
20
  cert_chain: []
21
- date: 2016-11-25 00:00:00.000000000 Z
21
+ date: 2016-11-29 00:00:00.000000000 Z
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency
24
24
  name: foundation-rails
@@ -26,14 +26,14 @@ dependencies:
26
26
  requirements:
27
27
  - - "~>"
28
28
  - !ruby/object:Gem::Version
29
- version: 6.2.3.0
29
+ version: 6.2.4.0
30
30
  type: :runtime
31
31
  prerelease: false
32
32
  version_requirements: !ruby/object:Gem::Requirement
33
33
  requirements:
34
34
  - - "~>"
35
35
  - !ruby/object:Gem::Version
36
- version: 6.2.3.0
36
+ version: 6.2.4.0
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: rails
39
39
  requirement: !ruby/object:Gem::Requirement
@@ -68,14 +68,14 @@ dependencies:
68
68
  requirements:
69
69
  - - '='
70
70
  - !ruby/object:Gem::Version
71
- version: 4.6.2
71
+ version: 4.7.0
72
72
  type: :runtime
73
73
  prerelease: false
74
74
  version_requirements: !ruby/object:Gem::Requirement
75
75
  requirements:
76
76
  - - '='
77
77
  - !ruby/object:Gem::Version
78
- version: 4.6.2
78
+ version: 4.7.0
79
79
  - !ruby/object:Gem::Dependency
80
80
  name: draper
81
81
  requirement: !ruby/object:Gem::Requirement
@@ -278,6 +278,7 @@ files:
278
278
  - app/assets/javascripts/ama_layout/mobile/mobile_menu.coffee
279
279
  - app/assets/javascripts/ama_layout/mobile/ready.coffee
280
280
  - app/assets/javascripts/ama_layout/mobile/tablesaw.stackonly.js
281
+ - app/assets/javascripts/ama_layout/real_date_picker.coffee
281
282
  - app/assets/stylesheets/ama_layout/_settings.scss
282
283
  - app/assets/stylesheets/ama_layout/application.scss
283
284
  - app/assets/stylesheets/ama_layout/foundation_and_overrides.scss
@@ -376,6 +377,8 @@ files:
376
377
  - spec/ama_layout/decorators/navigation_decorator_spec.rb
377
378
  - spec/ama_layout/decorators/navigation_item_decorator_spec.rb
378
379
  - spec/ama_layout/fixtures/navigation.yml
380
+ - spec/ama_layout/fixtures/real_date_picker.html
381
+ - spec/ama_layout/javascripts/real_date_picker_spec.coffee
379
382
  - spec/ama_layout/moneris_spec.rb
380
383
  - spec/ama_layout/navigation_item_spec.rb
381
384
  - spec/ama_layout/navigation_spec.rb
@@ -413,7 +416,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
413
416
  version: '0'
414
417
  requirements: []
415
418
  rubyforge_project:
416
- rubygems_version: 2.4.5.1
419
+ rubygems_version: 2.5.1
417
420
  signing_key:
418
421
  specification_version: 4
419
422
  summary: ".ama.ab.ca site layouts"
@@ -424,6 +427,8 @@ test_files:
424
427
  - spec/ama_layout/decorators/navigation_decorator_spec.rb
425
428
  - spec/ama_layout/decorators/navigation_item_decorator_spec.rb
426
429
  - spec/ama_layout/fixtures/navigation.yml
430
+ - spec/ama_layout/fixtures/real_date_picker.html
431
+ - spec/ama_layout/javascripts/real_date_picker_spec.coffee
427
432
  - spec/ama_layout/moneris_spec.rb
428
433
  - spec/ama_layout/navigation_item_spec.rb
429
434
  - spec/ama_layout/navigation_spec.rb