time_machine 0.0.1 → 0.0.2

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.
data/README.rdoc CHANGED
@@ -1,12 +1,13 @@
1
1
  = TimeMachine
2
2
 
3
- This plugin lets you easily change Time.now.
3
+ This rails plugin lets you easily change the current date.
4
+ Useful to see how the app looks and behaves when time changes.
4
5
 
5
6
  == Installation
6
7
 
7
8
  Add gem 'time_machine' to your development group and add this in a view file (ie application layout):
8
9
 
9
- <%= time_machine %>
10
+ <%= time_machine if Rails.env.development? %>
10
11
 
11
12
  Reload, and you'll see a small box in the upper left corner of your app. Use this to travel in time and see how your app behaves/looks like when time changes.
12
13
 
@@ -1,9 +1,20 @@
1
1
  jQuery ->
2
+ redirect = (date) -> window.location.href = "/time_machine/#{date}"
3
+
2
4
  # initialize date picker
3
5
  $('#time-machine-date').Zebra_DatePicker
4
6
  always_show_clear: false
5
7
  lang_clear_date: ''
6
- onSelect: (date) -> window.location.href = "/time_machine/#{date}"
8
+ readonly_element: false
9
+ onSelect: (date) -> redirect date
10
+
11
+ $(document).on 'keydown', '#time-machine-date', (ev) ->
12
+ if ev.keyCode == 13
13
+ date = $('#time-machine-date').val()
14
+ redirect date if ev.keyCode == 13 && date.trim().length > 0
15
+ false
16
+
17
+ $(document).on 'mouseup', '#time-machine-date', (ev) -> $(@).select()
7
18
 
8
19
  # toggle expanded/collapsed satte
9
20
  $(document).on 'click', '#time-machine a.toggle', ->
@@ -20,7 +20,7 @@ body
20
20
  padding: 6px 8px
21
21
  font-family: geneva
22
22
  box-shadow: #999 0px 3px 15px
23
- width: 150px
23
+ width: 153px
24
24
  border:
25
25
  bottom: 1px solid #ccc
26
26
  right: 1px solid #ccc
@@ -32,6 +32,9 @@ body
32
32
  float: right
33
33
  a.reset
34
34
  float: right
35
+ button
36
+ top: 0px !important
37
+ left: 5px !important
35
38
 
36
39
  &.top-right
37
40
  right: 0
@@ -44,6 +47,9 @@ body
44
47
  float: right
45
48
  input
46
49
  float: right
50
+ button
51
+ top: 21px !important
52
+ left: 7px !important
47
53
 
48
54
  &.light
49
55
  background: #fff
@@ -59,21 +65,21 @@ body
59
65
 
60
66
  &.collapsed
61
67
  width: 15px
62
- a.reset, input, h6
68
+ a.reset, input, h6, button
63
69
  display: none
64
70
  a.toggle
65
71
  font-size: 18px
66
72
  font-weight: bold
67
73
 
68
74
  button
69
- display: none
75
+ position: relative
70
76
 
71
77
  a.reset, a.toggle
72
78
  text-decoration: none
73
79
  font-size: 10px
74
80
 
75
81
  a.reset
76
- margin-top: 7px
82
+ margin-top: 4px
77
83
 
78
84
  a.toggle
79
85
  position: relative
@@ -91,6 +97,7 @@ body
91
97
  border: none
92
98
  padding: 3px
93
99
  cursor: pointer !important
100
+ line-height: 1em
94
101
 
95
102
  h6
96
103
  padding: 0
@@ -7,7 +7,7 @@ module TimeMachine
7
7
  end
8
8
 
9
9
  def travel
10
- date = Date.parse params[:date]
10
+ date = Chronic.parse params[:date]
11
11
  Timecop.travel date
12
12
  redirect_to params[:redirect] || :back
13
13
  end
@@ -1,8 +1,8 @@
1
1
  <div class="<%= options[:classes] %>" style="position: absolute; top: 0; left: -100000; display: none" id="time-machine" >
2
2
  <%= link_to "¤", "#", class: 'toggle' %>
3
3
  <h6>Timemachine</h6>
4
- <input value="<%= Time.now.strftime('%Y-%m-%d') %>" type="text" readonly="readonly" id="time-machine-date"/>
5
- <%= link_to "reset", "/time_machine/reset", class: 'reset' %>
4
+ <input value="<%= Time.now.strftime('%Y-%m-%d') %>" type="text" id="time-machine-date"/>
5
+ <%= link_to image_tag("time_machine/reset.png"), "/time_machine/reset", class: 'reset' %>
6
6
  </div>
7
7
 
8
8
  <script type="text/javascript">
data/lib/time_machine.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require "time_machine/engine"
2
2
  require "timecop"
3
+ require "chronic"
3
4
 
4
5
  module TimeMachine
5
6
  end
@@ -1,3 +1,3 @@
1
1
  module TimeMachine
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: time_machine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-30 00:00:00.000000000 Z
12
+ date: 2012-08-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -59,6 +59,22 @@ dependencies:
59
59
  - - ! '>='
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: chronic
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :runtime
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
62
78
  description: Development tool for changing Time.now in your rails app
63
79
  email:
64
80
  - gudleik@gmail.com
@@ -68,12 +84,12 @@ extra_rdoc_files: []
68
84
  files:
69
85
  - app/assets/images/time_machine/calendar-disabled.png
70
86
  - app/assets/images/time_machine/calendar.png
71
- - app/assets/images/time_machine/metallic/calendar.png
72
87
  - app/assets/images/time_machine/metallic/default-date.png
73
88
  - app/assets/images/time_machine/metallic/disabled-date.png
74
89
  - app/assets/images/time_machine/metallic/header.png
75
90
  - app/assets/images/time_machine/metallic/selected-date.png
76
91
  - app/assets/images/time_machine/metallic/titles.png
92
+ - app/assets/images/time_machine/reset.png
77
93
  - app/assets/javascripts/time_machine/application.js
78
94
  - app/assets/javascripts/time_machine/datepicker.coffee
79
95
  - app/assets/javascripts/time_machine/zebra_datepicker.js
@@ -104,7 +120,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
104
120
  version: '0'
105
121
  segments:
106
122
  - 0
107
- hash: -4077653272273999823
123
+ hash: 2651298203015124916
108
124
  required_rubygems_version: !ruby/object:Gem::Requirement
109
125
  none: false
110
126
  requirements:
@@ -113,10 +129,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
113
129
  version: '0'
114
130
  segments:
115
131
  - 0
116
- hash: -4077653272273999823
132
+ hash: 2651298203015124916
117
133
  requirements: []
118
134
  rubyforge_project:
119
- rubygems_version: 1.8.23
135
+ rubygems_version: 1.8.24
120
136
  signing_key:
121
137
  specification_version: 3
122
138
  summary: Provides timetravelling in your rails app