timepiece 0.2.9 → 0.2.10

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: 2b0b951200ead8e2e6c26961beeae8ed6cf31eff
4
- data.tar.gz: 0f20489c5a775ddd33ba1a3b37bc8f856797e81b
3
+ metadata.gz: 6480f060e551a2440f4b5da6a0acbc53e30d410f
4
+ data.tar.gz: d41872ef5d130cb686f2707f3be8fe09806e0e83
5
5
  SHA512:
6
- metadata.gz: 22af1dc26d4385075153588aec13010a740706e8e54358b1c19a7906b1c3106cd7f631f504ce44256359142070effab206bfcd5a0e4d6084ede4c7aa98159cc0
7
- data.tar.gz: e7fdcf88cc8fdf602e485422021448fd175d73fbb4c6210764b9bf36edebc323eb8bef73c7ea51ff6849c154a91e0d51eb5353341a9abd1b0969cf744bb818ac
6
+ metadata.gz: edbdeaa73f7fadcbd22c53fc56516489fc209b4521bfcbfd21fd55ea02621dc6ad3b6329c80fdd79ee0d95a50adcce9af502eacadc5a772ed1610efa05acbb61
7
+ data.tar.gz: 5cdd6acfd951a3ee06470511f5437112069a3706bc579a50bddbde672f3c41f532e4306c0e575f71121a3d48f2579f2de190a044c050b01e2e6d3399ece65cf6
@@ -79,6 +79,31 @@ module TimepieceHelper
79
79
 
80
80
  seconds = seconds_diff
81
81
 
82
+ time = "<span class='timepiece-days'>#{days.to_s}</span>"\
83
+ "<span class='timepiece-separator tp-separator-days-hours'>:</span>"\
84
+ "<span class='timepiece-hours'>#{hours.to_s}</span>"\
85
+ "<span class='timepiece-separator tp-separator-hours-minutes'>:</span>"\
86
+ "<span class='timepiece-minutes'>#{minutes.to_s}</span>"\
87
+ "<span class='timepiece-separator tp-separator-minutes-seconds'>:</span>"\
88
+ "<span class='timepiece-seconds'>#{seconds.to_s}</span>"
89
+ # "<span class='timepiece-seconds'>#{seconds.to_s.rjust(2, '0')}</span>" # Note: rjust; it might be useful.
90
+
91
+ content_tag(:span, time.html_safe, class: 'timepiece-timer', 'data-days' => days, 'data-hours' => hours, 'data-minutes' => minutes, 'data-seconds' => seconds, 'id' => (id unless id.blank?))
92
+ end
93
+ def timer_in_words(time_since = Time.now, id: '')
94
+ seconds_diff = (Time.now - time_since).to_i
95
+
96
+ days = seconds_diff / 86400
97
+ seconds_diff -= days * 86400
98
+
99
+ hours = seconds_diff / 3600
100
+ seconds_diff -= hours * 3600
101
+
102
+ minutes = seconds_diff / 60
103
+ seconds_diff -= minutes * 60
104
+
105
+ seconds = seconds_diff
106
+
82
107
  time = "<span class='timepiece-days'>#{days.to_s}</span>"\
83
108
  "<span class='timepiece-descriptor tp-descriptor-days'> days </span>"\
84
109
  "<span class='timepiece-hours'>#{hours.to_s}</span>"\
@@ -106,6 +131,31 @@ module TimepieceHelper
106
131
 
107
132
  seconds = seconds_diff
108
133
 
134
+ time = "<span class='timepiece-days'>#{days.to_s}</span>"\
135
+ "<span class='timepiece-separator tp-separator-days-hours'>:</span>"\
136
+ "<span class='timepiece-hours'>#{hours.to_s}</span>"\
137
+ "<span class='timepiece-separator tp-separator-hours-minutes'>:</span>"\
138
+ "<span class='timepiece-minutes'>#{minutes.to_s}</span>"\
139
+ "<span class='timepiece-separator tp-separator-minutes-seconds'>:</span>"\
140
+ "<span class='timepiece-seconds'>#{seconds.to_s}</span>"
141
+ # "<span class='timepiece-seconds'>#{seconds.to_s.rjust(2, '0')}</span>" # Note: rjust; it might be useful.
142
+
143
+ content_tag(:span, time.html_safe, class: 'timepiece-countdown', 'data-days' => days, 'data-hours' => hours, 'data-minutes' => minutes, 'data-seconds' => seconds, 'id' => (id unless id.blank?))
144
+ end
145
+ def countdown_in_words(time_until = Time.new(2016), id: '')
146
+ seconds_diff = (time_until - Time.now).to_i
147
+
148
+ days = seconds_diff / 86400
149
+ seconds_diff -= days * 86400
150
+
151
+ hours = seconds_diff / 3600
152
+ seconds_diff -= hours * 3600
153
+
154
+ minutes = seconds_diff / 60
155
+ seconds_diff -= minutes * 60
156
+
157
+ seconds = seconds_diff
158
+
109
159
  time = "<span class='timepiece-days'>#{days.to_s}</span>"\
110
160
  "<span class='timepiece-descriptor tp-descriptor-days'> days </span>"\
111
161
  "<span class='timepiece-hours'>#{hours.to_s}</span>"\
@@ -1,3 +1,3 @@
1
1
  module Timepiece
2
- VERSION = "0.2.9"
2
+ VERSION = "0.2.10"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: timepiece
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.9
4
+ version: 0.2.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thom Bruce
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-17 00:00:00.000000000 Z
11
+ date: 2015-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jquery-rails
@@ -79,7 +79,7 @@ files:
79
79
  - test/integration/navigation_test.rb
80
80
  - test/test_helper.rb
81
81
  - test/timepiece_test.rb
82
- - vendor/assets/stylesheets/timepiece.css
82
+ - vendor/assets/stylesheets/timepiece.css.scss
83
83
  homepage: http://thombruce.com/timepiece
84
84
  licenses:
85
85
  - MIT