clockpunch 0.1.8 → 0.1.9
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/clockpunch.js +20 -23
- data/lib/clockpunch/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f8af745a5db71ec5794300aa7317a7aab6fcf8c5
|
4
|
+
data.tar.gz: 9c7d5d57657621ba13eccbb27c666803bae24f52
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b8c3f1b0a38d675ccd5739c95b66d14a8f64c2844ecb847e12c90924c87eaaef428c55e70a039427e4cdda1519a943beb7e024ce26374e85df88340e8a15ce80
|
7
|
+
data.tar.gz: 31230f9e7ca0bf3fdd22c9440713724f2abdb109100753c9085d4fe5c06ffc3fda3928e37de567489f0edfd031c402f478fdfef73718a31f7387b9752476ca3f
|
@@ -1,10 +1,9 @@
|
|
1
|
-
// Generated by CoffeeScript 1.
|
1
|
+
// Generated by CoffeeScript 1.10.0
|
2
2
|
|
3
3
|
/*
|
4
|
-
Clockpunch 0.1.
|
4
|
+
Clockpunch 0.1.9
|
5
5
|
https://github.com/tablexi/clockpunch
|
6
|
-
*/
|
7
|
-
|
6
|
+
*/
|
8
7
|
|
9
8
|
(function() {
|
10
9
|
var $, TimeParsingInput;
|
@@ -26,12 +25,14 @@ https://github.com/tablexi/clockpunch
|
|
26
25
|
}
|
27
26
|
|
28
27
|
TimeParsingInput = (function() {
|
29
|
-
|
30
28
|
function TimeParsingInput(elem, format) {
|
31
29
|
if (format == null) {
|
32
30
|
format = 'default';
|
33
31
|
}
|
34
32
|
this.$elem = $(elem);
|
33
|
+
if (this.$elem.hasClass('clockpunch-applied')) {
|
34
|
+
return;
|
35
|
+
}
|
35
36
|
this.$elem.data('timeparser', this);
|
36
37
|
this.parser = new TimeParser(format);
|
37
38
|
if (this.$elem.is('input')) {
|
@@ -53,9 +54,6 @@ https://github.com/tablexi/clockpunch
|
|
53
54
|
TimeParsingInput.prototype.configure_input = function(format) {
|
54
55
|
var self;
|
55
56
|
self = this;
|
56
|
-
if (this.$elem.hasClass('clockpunch-applied')) {
|
57
|
-
return;
|
58
|
-
}
|
59
57
|
this.create_hidden_field(format);
|
60
58
|
this.ensure_elem_is_text();
|
61
59
|
this.$elem.change(function() {
|
@@ -75,7 +73,7 @@ https://github.com/tablexi/clockpunch
|
|
75
73
|
field_name = this.$elem.attr('name');
|
76
74
|
this.$hidden_field = $("<input type=\"hidden\" />").attr('name', field_name);
|
77
75
|
this.$elem.after(this.$hidden_field);
|
78
|
-
return this.$elem.attr('name',
|
76
|
+
return this.$elem.attr('name', field_name + "_display");
|
79
77
|
};
|
80
78
|
|
81
79
|
TimeParsingInput.prototype.ensure_elem_is_text = function() {
|
@@ -116,7 +114,6 @@ https://github.com/tablexi/clockpunch
|
|
116
114
|
})();
|
117
115
|
|
118
116
|
window.TimeParser = (function() {
|
119
|
-
|
120
117
|
function TimeParser(time_format) {
|
121
118
|
if (time_format == null) {
|
122
119
|
time_format = null;
|
@@ -124,10 +121,10 @@ https://github.com/tablexi/clockpunch
|
|
124
121
|
this.time_format = this.get_format_mapping(time_format);
|
125
122
|
}
|
126
123
|
|
127
|
-
/*
|
128
|
-
# Class Methods
|
129
|
-
*/
|
130
124
|
|
125
|
+
/*
|
126
|
+
* Class Methods
|
127
|
+
*/
|
131
128
|
|
132
129
|
TimeParser.set_default_format = function(string) {
|
133
130
|
return this.default_format = string;
|
@@ -156,10 +153,10 @@ https://github.com/tablexi/clockpunch
|
|
156
153
|
}
|
157
154
|
};
|
158
155
|
|
159
|
-
/*
|
160
|
-
# Instance methods
|
161
|
-
*/
|
162
156
|
|
157
|
+
/*
|
158
|
+
* Instance methods
|
159
|
+
*/
|
163
160
|
|
164
161
|
TimeParser.prototype.to_minutes = function(string) {
|
165
162
|
var result;
|
@@ -191,10 +188,10 @@ https://github.com/tablexi/clockpunch
|
|
191
188
|
return this.from_minutes(this.to_minutes(string));
|
192
189
|
};
|
193
190
|
|
194
|
-
/*
|
195
|
-
# PRIVATE
|
196
|
-
*/
|
197
191
|
|
192
|
+
/*
|
193
|
+
* PRIVATE
|
194
|
+
*/
|
198
195
|
|
199
196
|
TimeParser.prototype.read_format = function(regex, string, clean_function) {
|
200
197
|
var cleaned_string, matches;
|
@@ -254,7 +251,7 @@ https://github.com/tablexi/clockpunch
|
|
254
251
|
if (hours > 0) {
|
255
252
|
return formats['hm'].call(this, hours, minutes);
|
256
253
|
} else {
|
257
|
-
return
|
254
|
+
return minutes + "m";
|
258
255
|
}
|
259
256
|
},
|
260
257
|
minutes: function(hours, minutes) {
|
@@ -280,10 +277,10 @@ https://github.com/tablexi/clockpunch
|
|
280
277
|
var output;
|
281
278
|
output = [];
|
282
279
|
if (hours > 0) {
|
283
|
-
output.push(
|
280
|
+
output.push(hours + " " + (this.pluralize(hours, 'hour')));
|
284
281
|
}
|
285
282
|
if (minutes > 0 || (minutes === 0 && hours === 0)) {
|
286
|
-
output.push(
|
283
|
+
output.push(minutes + " " + (this.pluralize(minutes, 'minute')));
|
287
284
|
}
|
288
285
|
return output.join(" ");
|
289
286
|
};
|
@@ -292,7 +289,7 @@ https://github.com/tablexi/clockpunch
|
|
292
289
|
if (count === 1) {
|
293
290
|
return string;
|
294
291
|
} else {
|
295
|
-
return
|
292
|
+
return string + "s";
|
296
293
|
}
|
297
294
|
};
|
298
295
|
|
data/lib/clockpunch/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clockpunch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Hanggi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sass
|
@@ -123,3 +123,4 @@ signing_key:
|
|
123
123
|
specification_version: 4
|
124
124
|
summary: Calculate durations from text input
|
125
125
|
test_files: []
|
126
|
+
has_rdoc:
|