browser-timezone-rails 0.2.00 → 1.0

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: d52f49e119bd49f775fb610e41f3135ef2982683
4
- data.tar.gz: e9f187515e203511f586447e25fc952ed0a7d020
3
+ metadata.gz: 40589a73cbc1b4387bcd606102119ff8f977b510
4
+ data.tar.gz: e8518f3d8c4b99aa25e3187b17e27552f1d28fe5
5
5
  SHA512:
6
- metadata.gz: 8443708e0d6369d00e39437304beac35b98dc48fe537f35e4e669c09898b2eeb3ce484b9d5440726456f358f64884078d5f696e0083e272e45e96d90b4dc7c0b
7
- data.tar.gz: cd49cbd75481db016b36433a64a71bc7f056a71a155cb1d492390e3ac39efe537c316eb17b39ddcac7cc94efd5a2131594bb39e8a0c745ab7a0ad3a0ef17b0ea
6
+ metadata.gz: ed8df349538e6d199e380dc979ca5820dabd5fe0a1045041cf7fffad21ca06f3794e6062db589ebbc45ecba8a75ff053c5dbf8176b096c9a4aaaa5bbcbbf1c4a
7
+ data.tar.gz: 1d1a59ff1d91d345168f6b93731896630512f0668a1a0b1dcc6873d7b51e2001cdc231580eaea64cfab40f2d4c477f4d7b57429be0a72e3f2b2d8efa68675c6d
data/README.md CHANGED
@@ -15,8 +15,7 @@ gem 'browser-timezone-rails'
15
15
 
16
16
  Make sure you have each of the following entries in your application.js:
17
17
  ```
18
- //= require jquery
19
- //= require jquery.cookie
18
+ //= require js.cookie
20
19
  //= require jstz
21
20
  //= require browser_timezone_rails/set_time_zone
22
21
  ```
@@ -0,0 +1,4 @@
1
+ (function() {
2
+ Cookies.set("browser.timezone", jstz.determine().name(), { expires: 365, path: '/' });
3
+ })();
4
+
@@ -1,22 +1,18 @@
1
1
  require "browser-timezone-rails/engine"
2
- require 'jquery-rails'
3
- require 'jquery-cookie-rails'
2
+ require 'js_cookie_rails'
4
3
  require 'jstz-rails'
5
4
 
6
5
  module BrowserTimezoneRails
7
6
  module TimezoneControllerSetup
8
7
  def self.included(base)
9
- base.send(:around_filter, :set_time_zone)
8
+ base.send(:prepend_around_action, :set_time_zone)
10
9
  end
11
10
 
12
11
  private
13
12
 
14
- def set_time_zone
15
- old_time_zone = Time.zone
16
- Time.zone = browser_timezone if browser_timezone.present?
17
- yield
18
- ensure
19
- Time.zone = old_time_zone
13
+ def set_time_zone(&action)
14
+ # Use existing methods to simplify filter
15
+ Time.use_zone(browser_timezone.presence || Time.zone, &action)
20
16
  end
21
17
 
22
18
  def browser_timezone
@@ -1,3 +1,3 @@
1
1
  module BrowserTimezoneRails
2
- VERSION = "0.2.00"
2
+ VERSION = "1.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: browser-timezone-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.00
4
+ version: '1.0'
5
5
  platform: ruby
6
6
  authors:
7
7
  - kbaum
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-17 00:00:00.000000000 Z
11
+ date: 2016-06-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -25,7 +25,7 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '3.1'
27
27
  - !ruby/object:Gem::Dependency
28
- name: jquery-rails
28
+ name: js_cookie_rails
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
@@ -39,21 +39,7 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: jquery-cookie-rails
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :runtime
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: jstz-rails
42
+ name: jstz-rails3-plus
57
43
  requirement: !ruby/object:Gem::Requirement
58
44
  requirements:
59
45
  - - ">="
@@ -132,7 +118,7 @@ files:
132
118
  - MIT-LICENSE
133
119
  - README.md
134
120
  - Rakefile
135
- - app/assets/javascripts/browser_timezone_rails/set_time_zone.js.coffee
121
+ - app/assets/javascripts/browser_timezone_rails/set_time_zone.js
136
122
  - app/controllers/browser_timezone_rails/application_controller.rb
137
123
  - config/routes.rb
138
124
  - lib/browser-timezone-rails.rb
@@ -157,7 +143,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
157
143
  version: '0'
158
144
  requirements: []
159
145
  rubyforge_project:
160
- rubygems_version: 2.4.3
146
+ rubygems_version: 2.4.8
161
147
  signing_key:
162
148
  specification_version: 4
163
149
  summary: Sets the browser timezone within rails
@@ -1,6 +0,0 @@
1
- window.BrowserTZone ||= {}
2
- BrowserTZone.setCookie = ->
3
- $.cookie "browser.timezone", jstz.determine().name(), { expires: 365, path: '/' }
4
-
5
- jQuery ->
6
- BrowserTZone.setCookie()