effective_bootstrap 0.3.6 → 0.3.7

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: 23f82a4fe7f56d25518f9e3a673d64fcc29d8962
4
- data.tar.gz: 2007f17827b4e9f6e8b1f3f5234f435ca4d340dd
3
+ metadata.gz: 3347c35569c67c69da8675ac9cb0c5e27bb6e819
4
+ data.tar.gz: c8e8b10ea9bcd6dc7ebbed4222efce44fad14e20
5
5
  SHA512:
6
- metadata.gz: a8d8b0b30434f080ceab96f7c5e9dab49643d05e261688a5bc561e486e7615e2aa06bbab1e8e291e19dcfa2e185b8b3a2aa0cc60ed0227f7858c8ce2f0380441
7
- data.tar.gz: 9194dbdce49197e2e11deb6df890cadd44327f870e1bd73c0b236d8762b495a097ca15de68622971728fec6c2090232bfcc352c01c907cbf65aac2a47ff94d07
6
+ metadata.gz: 693e87a79b8e10b1d188ac29fcdeeb162dc15577a8e99ac877f5d246e3fb11f29164d6ba98213582817dec4303abdbbd2cb71a95da09187d8e4649e3f63abb16
7
+ data.tar.gz: b7ba84a6226edb07a7ebb1c5f8ae2cfc82f3fab8f89644fab37f4c715d4e82eb6e5af542e2587f9c936a84db708621e58b564b8525af007f410cc9808b760ebe
@@ -5,6 +5,7 @@
5
5
  //= require ./effective_datetime/input
6
6
  //= require ./effective_date/input
7
7
  //= require ./effective_time/input
8
+ //= require ./effective_time_zone_select/input
8
9
 
9
10
  //= require ./effective_checks/input
10
11
  //= require ./effective_editor/input
@@ -0,0 +1,13 @@
1
+ (this.EffectiveBootstrap || {}).effective_time_zone_select = ($element, options) ->
2
+ unless $element.val().length > 0
3
+ try
4
+ offset = moment().format('Z')
5
+
6
+ zones = $element.find('option').filter -> $(this).text().includes(offset)
7
+ zone = zones.find (obj) -> $(obj).text().includes('Time') # Favor Mountain Time (US & Canada) over Arizona
8
+
9
+ guess = if zone.length > 0 then zone else zones.first()
10
+
11
+ $element.val(guess.val()) if guess.length > 0
12
+
13
+ $select = $element.select2(options)
@@ -0,0 +1 @@
1
+ //= require ./initialize
@@ -138,6 +138,11 @@ module Effective
138
138
  Effective::FormInputs::TimeField.new(name, options, builder: self).to_html { super(name, options) }
139
139
  end
140
140
 
141
+ def time_zone_select(name, options = {})
142
+ opts = options.merge(collection: Effective::FormInputs::TimeZoneSelect.time_zone_collection)
143
+ Effective::FormInputs::TimeZoneSelect.new(name, opts, builder: self).to_html
144
+ end
145
+
141
146
  def url_field(name, options = {})
142
147
  Effective::FormInputs::UrlField.new(name, options, builder: self).to_html { super(name, options) }
143
148
  end
@@ -0,0 +1,15 @@
1
+ module Effective
2
+ module FormInputs
3
+ class TimeZoneSelect < Select
4
+
5
+ def self.time_zone_collection
6
+ date = Time.zone.now
7
+
8
+ ActiveSupport::TimeZone.all.map do |tz|
9
+ ["(UTC #{date.in_time_zone(tz).strftime('%:z')}) #{tz.name}", tz.name]
10
+ end
11
+ end
12
+
13
+ end
14
+ end
15
+ end
@@ -1,3 +1,3 @@
1
1
  module EffectiveBootstrap
2
- VERSION = '0.3.6'.freeze
2
+ VERSION = '0.3.7'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_bootstrap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.6
4
+ version: 0.3.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-14 00:00:00.000000000 Z
11
+ date: 2019-01-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -405,6 +405,8 @@ files:
405
405
  - app/assets/javascripts/effective_select_or_text/input.js
406
406
  - app/assets/javascripts/effective_time/initialize.js.coffee
407
407
  - app/assets/javascripts/effective_time/input.js
408
+ - app/assets/javascripts/effective_time_zone_select/initialize.js.coffee
409
+ - app/assets/javascripts/effective_time_zone_select/input.js
408
410
  - app/assets/stylesheets/effective_bootstrap.scss
409
411
  - app/assets/stylesheets/effective_bootstrap/base.scss
410
412
  - app/assets/stylesheets/effective_bootstrap/forms.scss
@@ -460,6 +462,7 @@ files:
460
462
  - app/models/effective/form_inputs/text_area.rb
461
463
  - app/models/effective/form_inputs/text_field.rb
462
464
  - app/models/effective/form_inputs/time_field.rb
465
+ - app/models/effective/form_inputs/time_zone_select.rb
463
466
  - app/models/effective/form_inputs/url_field.rb
464
467
  - app/models/effective/form_logic.rb
465
468
  - app/models/effective/form_logics/hide_if.rb