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 +4 -4
- data/app/assets/javascripts/effective_bootstrap.js +1 -0
- data/app/assets/javascripts/effective_time_zone_select/initialize.js.coffee +13 -0
- data/app/assets/javascripts/effective_time_zone_select/input.js +1 -0
- data/app/models/effective/form_builder.rb +5 -0
- data/app/models/effective/form_inputs/time_zone_select.rb +15 -0
- data/lib/effective_bootstrap/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3347c35569c67c69da8675ac9cb0c5e27bb6e819
|
4
|
+
data.tar.gz: c8e8b10ea9bcd6dc7ebbed4222efce44fad14e20
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 693e87a79b8e10b1d188ac29fcdeeb162dc15577a8e99ac877f5d246e3fb11f29164d6ba98213582817dec4303abdbbd2cb71a95da09187d8e4649e3f63abb16
|
7
|
+
data.tar.gz: b7ba84a6226edb07a7ebb1c5f8ae2cfc82f3fab8f89644fab37f4c715d4e82eb6e5af542e2587f9c936a84db708621e58b564b8525af007f410cc9808b760ebe
|
@@ -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
|
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.
|
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:
|
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
|