delayed_job_web 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of delayed_job_web might be problematic. Click here for more details.
- data/VERSION +1 -1
- data/delayed_job_web.gemspec +2 -1
- data/lib/delayed_job_web/application/public/javascripts/application.js +29 -0
- data/lib/delayed_job_web/application/public/javascripts/jquery.relatize_date.js +94 -0
- data/lib/delayed_job_web/application/views/enqueued.haml +0 -1
- data/lib/delayed_job_web/application/views/failed.haml +0 -1
- data/lib/delayed_job_web/application/views/job.haml +6 -6
- data/lib/delayed_job_web/application/views/layout.haml +1 -0
- data/lib/delayed_job_web/application/views/pending.haml +0 -1
- data/lib/delayed_job_web/application/views/working.haml +0 -1
- metadata +3 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.2
|
data/delayed_job_web.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{delayed_job_web}
|
8
|
-
s.version = "1.0.
|
8
|
+
s.version = "1.0.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Erick Schmitt"]
|
@@ -32,6 +32,7 @@ Gem::Specification.new do |s|
|
|
32
32
|
"lib/delayed_job_web/application/public/images/poll.png",
|
33
33
|
"lib/delayed_job_web/application/public/javascripts/application.js",
|
34
34
|
"lib/delayed_job_web/application/public/javascripts/jquery-1.7.1.min.js",
|
35
|
+
"lib/delayed_job_web/application/public/javascripts/jquery.relatize_date.js",
|
35
36
|
"lib/delayed_job_web/application/public/stylesheets/reset.css",
|
36
37
|
"lib/delayed_job_web/application/public/stylesheets/style.css",
|
37
38
|
"lib/delayed_job_web/application/views/enqueued.haml",
|
@@ -1,6 +1,35 @@
|
|
1
1
|
$(function() {
|
2
2
|
var poll_interval = 3;
|
3
3
|
|
4
|
+
var relatizer = function(){
|
5
|
+
var dt = $(this).text(), relatized = $.relatizeDate(this)
|
6
|
+
if ($(this).parents("a").length > 0 || $(this).is("a")) {
|
7
|
+
$(this).relatizeDate()
|
8
|
+
if (!$(this).attr('title')) {
|
9
|
+
$(this).attr('title', dt)
|
10
|
+
}
|
11
|
+
} else {
|
12
|
+
$(this)
|
13
|
+
.text('')
|
14
|
+
.append( $('<a href="#" class="toggle_format" title="' + dt + '" />')
|
15
|
+
.append('<span class="date_time">' + dt +
|
16
|
+
'</span><span class="relatized_time">' +
|
17
|
+
relatized + '</span>') )
|
18
|
+
}
|
19
|
+
};
|
20
|
+
|
21
|
+
$('.time').each(relatizer);
|
22
|
+
|
23
|
+
$('.time a.toggle_format .date_time').hide();
|
24
|
+
|
25
|
+
var format_toggler = function(){
|
26
|
+
$('.time a.toggle_format span').toggle();
|
27
|
+
$(this).attr('title', $('span:hidden',this).text());
|
28
|
+
return false;
|
29
|
+
};
|
30
|
+
|
31
|
+
$('.time a.toggle_format').click(format_toggler);
|
32
|
+
|
4
33
|
$('ul li.job').hover(function() {
|
5
34
|
$(this).addClass('hover');
|
6
35
|
}, function() {
|
@@ -0,0 +1,94 @@
|
|
1
|
+
// All credit goes to Rick Olson.
|
2
|
+
(function($) {
|
3
|
+
$.fn.relatizeDate = function() {
|
4
|
+
return $(this).each(function() {
|
5
|
+
$(this).text( $.relatizeDate(this) )
|
6
|
+
})
|
7
|
+
}
|
8
|
+
|
9
|
+
$.relatizeDate = function(element) {
|
10
|
+
return $.relatizeDate.timeAgoInWords( new Date($(element).text()) )
|
11
|
+
}
|
12
|
+
|
13
|
+
// shortcut
|
14
|
+
$r = $.relatizeDate
|
15
|
+
|
16
|
+
$.extend($.relatizeDate, {
|
17
|
+
shortDays: [ 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat' ],
|
18
|
+
days: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
|
19
|
+
shortMonths: [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ],
|
20
|
+
months: [ 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' ],
|
21
|
+
|
22
|
+
/**
|
23
|
+
* Given a formatted string, replace the necessary items and return.
|
24
|
+
* Example: Time.now().strftime("%B %d, %Y") => February 11, 2008
|
25
|
+
* @param {String} format The formatted string used to format the results
|
26
|
+
*/
|
27
|
+
strftime: function(date, format) {
|
28
|
+
var day = date.getDay(), month = date.getMonth();
|
29
|
+
var hours = date.getHours(), minutes = date.getMinutes();
|
30
|
+
|
31
|
+
var pad = function(num) {
|
32
|
+
var string = num.toString(10);
|
33
|
+
return new Array((2 - string.length) + 1).join('0') + string
|
34
|
+
};
|
35
|
+
|
36
|
+
return format.replace(/\%([aAbBcdHImMpSwyY])/g, function(part) {
|
37
|
+
switch(part[1]) {
|
38
|
+
case 'a': return $r.shortDays[day]; break;
|
39
|
+
case 'A': return $r.days[day]; break;
|
40
|
+
case 'b': return $r.shortMonths[month]; break;
|
41
|
+
case 'B': return $r.months[month]; break;
|
42
|
+
case 'c': return date.toString(); break;
|
43
|
+
case 'd': return pad(date.getDate()); break;
|
44
|
+
case 'H': return pad(hours); break;
|
45
|
+
case 'I': return pad((hours + 12) % 12); break;
|
46
|
+
case 'm': return pad(month + 1); break;
|
47
|
+
case 'M': return pad(minutes); break;
|
48
|
+
case 'p': return hours > 12 ? 'PM' : 'AM'; break;
|
49
|
+
case 'S': return pad(date.getSeconds()); break;
|
50
|
+
case 'w': return day; break;
|
51
|
+
case 'y': return pad(date.getFullYear() % 100); break;
|
52
|
+
case 'Y': return date.getFullYear().toString(); break;
|
53
|
+
}
|
54
|
+
})
|
55
|
+
},
|
56
|
+
|
57
|
+
timeAgoInWords: function(targetDate, includeTime) {
|
58
|
+
return $r.distanceOfTimeInWords(targetDate, new Date(), includeTime);
|
59
|
+
},
|
60
|
+
|
61
|
+
/**
|
62
|
+
* Return the distance of time in words between two Date's
|
63
|
+
* Example: '5 days ago', 'about an hour ago'
|
64
|
+
* @param {Date} fromTime The start date to use in the calculation
|
65
|
+
* @param {Date} toTime The end date to use in the calculation
|
66
|
+
* @param {Boolean} Include the time in the output
|
67
|
+
*/
|
68
|
+
distanceOfTimeInWords: function(fromTime, toTime, includeTime) {
|
69
|
+
var delta = parseInt((toTime.getTime() - fromTime.getTime()) / 1000);
|
70
|
+
if (delta < 60) {
|
71
|
+
return 'less than a minute ago';
|
72
|
+
} else if (delta < 120) {
|
73
|
+
return 'about a minute ago';
|
74
|
+
} else if (delta < (45*60)) {
|
75
|
+
return (parseInt(delta / 60)).toString() + ' minutes ago';
|
76
|
+
} else if (delta < (120*60)) {
|
77
|
+
return 'about an hour ago';
|
78
|
+
} else if (delta < (24*60*60)) {
|
79
|
+
return 'about ' + (parseInt(delta / 3600)).toString() + ' hours ago';
|
80
|
+
} else if (delta < (48*60*60)) {
|
81
|
+
return '1 day ago';
|
82
|
+
} else {
|
83
|
+
var days = (parseInt(delta / 86400)).toString();
|
84
|
+
if (days > 5) {
|
85
|
+
var fmt = '%B %d, %Y'
|
86
|
+
if (includeTime) fmt += ' %I:%M %p'
|
87
|
+
return $r.strftime(fromTime, fmt);
|
88
|
+
} else {
|
89
|
+
return days + " days ago"
|
90
|
+
}
|
91
|
+
}
|
92
|
+
}
|
93
|
+
})
|
94
|
+
})(jQuery);
|
@@ -23,15 +23,15 @@
|
|
23
23
|
= job.last_error
|
24
24
|
- if job.run_at
|
25
25
|
%dt Run At
|
26
|
-
%dd= job.run_at
|
26
|
+
%dd.time= job.run_at
|
27
27
|
- if job.locked_at
|
28
28
|
%dt Locked At
|
29
|
-
%dd= job.locked_at
|
30
|
-
- if job.
|
29
|
+
%dd.time= job.locked_at
|
30
|
+
- if job.locked_by
|
31
31
|
%dt Locked By
|
32
32
|
%dd= job.locked_by
|
33
|
-
-if job.failed_at
|
33
|
+
- if job.failed_at
|
34
34
|
%dt Failed At
|
35
|
-
%dd= job.failed_at
|
35
|
+
%dd.time= job.failed_at
|
36
36
|
%dt Created At
|
37
|
-
%dd= job.created_at
|
37
|
+
%dd.time= job.created_at
|
@@ -19,4 +19,5 @@
|
|
19
19
|
&
|
20
20
|
%a{:href => 'https://github.com/ejschmitt/delayed_job_web'} delayed_job_web
|
21
21
|
%script{:type => "text/javascript", :src => u("javascripts/jquery-1.7.1.min.js")}
|
22
|
+
%script{:type => "text/javascript", :src => u("javascripts/jquery.relatize_date.js")}
|
22
23
|
%script{:type => "text/javascript", :src => u("javascripts/application.js")}
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: delayed_job_web
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 1.0.
|
5
|
+
version: 1.0.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Erick Schmitt
|
@@ -135,6 +135,7 @@ files:
|
|
135
135
|
- lib/delayed_job_web/application/public/images/poll.png
|
136
136
|
- lib/delayed_job_web/application/public/javascripts/application.js
|
137
137
|
- lib/delayed_job_web/application/public/javascripts/jquery-1.7.1.min.js
|
138
|
+
- lib/delayed_job_web/application/public/javascripts/jquery.relatize_date.js
|
138
139
|
- lib/delayed_job_web/application/public/stylesheets/reset.css
|
139
140
|
- lib/delayed_job_web/application/public/stylesheets/style.css
|
140
141
|
- lib/delayed_job_web/application/views/enqueued.haml
|
@@ -163,7 +164,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
163
164
|
requirements:
|
164
165
|
- - ">="
|
165
166
|
- !ruby/object:Gem::Version
|
166
|
-
hash: -
|
167
|
+
hash: -1684287865726047204
|
167
168
|
segments:
|
168
169
|
- 0
|
169
170
|
version: "0"
|