better_delayed_job_web 1.3.5 → 1.3.11

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: e78049cb459bf7f327a41c30c73afe25b21ee9ad
4
- data.tar.gz: 8a9a0d0d50e9928f0cc9f135936dd2c5853bc0ea
3
+ metadata.gz: 6ebd0d58d88efa052fda53a9abfb5f3113388a30
4
+ data.tar.gz: efda9bc4d973940e9815ed93095013cce879cb77
5
5
  SHA512:
6
- metadata.gz: 15bd03012e2cf113129fe97d18b0236b772f1f48a5dd161704f4e7193652ebc90c98045fb3f05ccc916a6aa91bfcf44d96468891bcb04e8260d1e919a8ebc127
7
- data.tar.gz: 005a07adb26c8f733963cbde68498d6f38a407c79aa2e8890df58080bb20914a2226cc57226c8ccee50519badc13b58575bd2c148a10d9d2d055b59bd7842004
6
+ metadata.gz: 0c5012ad8a8b05837e210779669a4396f918f737fd152dbd5e2d765e9c74c7f92189c1c27c5c1f54596f8fc38d08e29923835a40c2cea7c87bc49a142a8f9ac0
7
+ data.tar.gz: dd4232c2ede7c922763adf1aa4e039582f67ce949a1e0a43ac6810e0ebbfb7f038de9fbfaa7bae0841cfe0c2af085c14f11b61569b47d9c208cbd604a8fbfb52
data/README.markdown CHANGED
@@ -15,7 +15,7 @@ Some features:
15
15
 
16
16
  The interface:
17
17
 
18
- ![Screen shot](http://dl.dropbox.com/u/1506097/Screenshots/delayed_job_web_1.png)
18
+ ![Screen shot](http://i.imgur.com/eji1Z8s.png)
19
19
 
20
20
  A beautiful Bootstrap based responsive interface.
21
21
 
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |gem|
2
2
  gem.name = "better_delayed_job_web"
3
- gem.version = "1.3.5"
3
+ gem.version = "1.3.11"
4
4
  gem.author = "Skcript"
5
5
  gem.email = "bello@skcript.com"
6
6
  gem.homepage = "https://github.com/skcript/better_delayed_job_web"
@@ -0,0 +1,256 @@
1
+ /*
2
+ * Implements a user-facing modal confirmation when link has a
3
+ * "data-confirm" attribute using bootstrap's modals. MIT license.
4
+ *
5
+ * - vjt@openssl.it Tue Jul 2 18:45:15 CEST 2013
6
+ */
7
+ (function ($) {
8
+
9
+ /**
10
+ * Builds the markup for a [Bootstrap modal](http://twitter.github.io/bootstrap/javascript.html#modals)
11
+ * for the given `element`. Uses the following `data-` parameters to
12
+ * customize it:
13
+ *
14
+ * * `data-confirm`: Contains the modal body text. HTML is allowed.
15
+ * Separate multiple paragraphs using \n\n.
16
+ * * `data-commit`: The 'confirm' button text. "Confirm" by default.
17
+ * * `data-cancel`: The 'cancel' button text. "Cancel" by default.
18
+ * * `data-verify`: Adds a text input in which the user has to input
19
+ * the text in this attribute value for the 'confirm'
20
+ * button to be clickable. Optional.
21
+ * * `data-verify-text`: Adds a label for the data-verify input. Optional
22
+ * * `data-focus`: Define focused input. Supported values are
23
+ * 'cancel' or 'commit', 'cancel' is default for
24
+ * data-method DELETE, 'commit' for all others.
25
+ *
26
+ * You can set global setting using `dataConfirmModal.setDefaults`, for example:
27
+ *
28
+ * dataConfirmModal.setDefaults({
29
+ * title: 'Confirm your action',
30
+ * commit: 'Continue',
31
+ * cancel: 'Cancel',
32
+ * fade: false,
33
+ * verifyClass: 'form-control',
34
+ * });
35
+ *
36
+ */
37
+
38
+ var defaults = {
39
+ title: 'Are you sure?',
40
+ commit: 'Confirm',
41
+ commitClass: 'btn-danger',
42
+ cancel: 'Cancel',
43
+ cancelClass: 'btn-default',
44
+ fade: true,
45
+ verifyClass: '',
46
+ elements: ['a[data-confirm]', 'button[data-confirm]', 'input[type=submit][data-confirm]'],
47
+ focus: 'commit'
48
+ };
49
+
50
+ var settings;
51
+
52
+ window.dataConfirmModal = {
53
+ setDefaults: function (newSettings) {
54
+ settings = $.extend(settings, newSettings);
55
+ },
56
+
57
+ restoreDefaults: function () {
58
+ settings = $.extend({}, defaults);
59
+ },
60
+
61
+ confirm: function (options) {
62
+ // Build an ephemeral modal
63
+ //
64
+ var modal = buildModal (options);
65
+
66
+ modal.modal('show');
67
+ modal.on('hidden.bs.modal', function () {
68
+ modal.remove();
69
+ });
70
+
71
+ modal.find('.commit').on('click', function () {
72
+ if (options.onConfirm && options.onConfirm.call)
73
+ options.onConfirm.call();
74
+
75
+ modal.modal('hide');
76
+ });
77
+
78
+ modal.find('.cancel').on('click', function () {
79
+ if (options.onCancel && options.onCancel.call)
80
+ options.onCancel.call();
81
+
82
+ modal.modal('hide');
83
+ });
84
+ }
85
+ };
86
+
87
+ dataConfirmModal.restoreDefaults();
88
+
89
+ var buildElementModal = function (element) {
90
+ var options = {
91
+ title: element.attr('title') || element.data('original-title'),
92
+ text: element.data('confirm'),
93
+ focus: element.data('focus'),
94
+ method: element.data('method'),
95
+ commit: element.data('commit'),
96
+ commitClass: element.data('commit-class'),
97
+ cancel: element.data('cancel'),
98
+ cancelClass: element.data('cancel-class'),
99
+ remote: element.data('remote'),
100
+ verify: element.data('verify'),
101
+ verifyRegexp: element.data('verify-regexp'),
102
+ verifyLabel: element.data('verify-text'),
103
+ verifyRegexpCaseInsensitive: element.data('verify-regexp-caseinsensitive')
104
+ };
105
+
106
+ var modal = buildModal (options);
107
+
108
+ modal.data('confirmed', false);
109
+ modal.find('.commit').on('click', function () {
110
+ modal.data('confirmed', true);
111
+ element.trigger('click');
112
+ modal.modal('hide');
113
+ });
114
+
115
+ return modal;
116
+ }
117
+
118
+ var buildModal = function (options) {
119
+ var id = 'confirm-modal-' + String(Math.random()).slice(2, -1);
120
+ var fade = settings.fade ? 'fade' : '';
121
+
122
+ var modal = $(
123
+ '<div id="'+id+'" class="modal '+fade+'" tabindex="-1" role="dialog" aria-labelledby="'+id+'Label" aria-hidden="true">' +
124
+ '<div class="modal-dialog">' +
125
+ '<div class="modal-content">' +
126
+ '<div class="modal-header">' +
127
+ '<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>' +
128
+ '<h4 id="'+id+'Label" class="modal-title"></h4> ' +
129
+ '</div>' +
130
+ '<div class="modal-body"></div>' +
131
+ '<div class="modal-footer">' +
132
+ '<button class="btn cancel" data-dismiss="modal" aria-hidden="true"></button>' +
133
+ '<button class="btn commit"></button>' +
134
+ '</div>'+
135
+ '</div>'+
136
+ '</div>'+
137
+ '</div>'
138
+ );
139
+
140
+ modal.find('.modal-title').text(options.title || settings.title);
141
+
142
+ var body = modal.find('.modal-body');
143
+
144
+ $.each((options.text||'').split(/\n{2}/), function (i, piece) {
145
+ body.append($('<p/>').html(piece));
146
+ });
147
+
148
+ var commit = modal.find('.commit');
149
+ commit.text(options.commit || settings.commit);
150
+ commit.addClass(options.commitClass || settings.commitClass);
151
+
152
+ var cancel = modal.find('.cancel');
153
+ cancel.text(options.cancel || settings.cancel);
154
+ cancel.addClass(options.cancelClass || settings.cancelClass);
155
+
156
+ if (options.remote) {
157
+ commit.attr('data-dismiss', 'modal');
158
+ }
159
+
160
+ if (options.verify || options.verifyRegexp) {
161
+ commit.prop('disabled', true);
162
+
163
+ var isMatch;
164
+ if (options.verifyRegexp) {
165
+ var caseInsensitive = options.verifyRegexpCaseInsensitive;
166
+ var re = new RegExp(regexp, caseInsensitive ? 'i' : '');
167
+
168
+ isMatch = function (input) { return input.match(re) };
169
+ } else {
170
+ isMatch = function (input) { return options.verify == input };
171
+ }
172
+
173
+ var verification = $('<input/>', {"type": 'text', "class": settings.verifyClass}).on('keyup', function () {
174
+ commit.prop('disabled', !isMatch($(this).val()));
175
+ });
176
+
177
+ modal.on('shown', function () {
178
+ verification.focus();
179
+ });
180
+
181
+ modal.on('hide', function () {
182
+ verification.val('').trigger('keyup');
183
+ });
184
+
185
+ if (options.verifyLabel)
186
+ body.append($('<p>', {text: options.verifyLabel}))
187
+
188
+ body.append(verification);
189
+ }
190
+
191
+ var focus_element;
192
+ if (options.focus) {
193
+ focus_element = options.focus;
194
+ } else if (options.method == 'delete') {
195
+ focus_element = 'cancel'
196
+ } else {
197
+ focus_element = settings.focus;
198
+ }
199
+ focus_element = modal.find('.' + focus_element);
200
+
201
+ modal.on('shown.bs.modal', function () {
202
+ focus_element.focus();
203
+ });
204
+
205
+ $('body').append(modal);
206
+
207
+ return modal;
208
+ };
209
+
210
+
211
+ /**
212
+ * Returns a modal already built for the given element or builds a new one,
213
+ * caching it into the element's `confirm-modal` data attribute.
214
+ */
215
+ var getModal = function (element) {
216
+ var modal = element.data('confirm-modal') || buildElementModal(element);
217
+
218
+ if (modal && !element.data('confirm-modal'))
219
+ element.data('confirm-modal', modal);
220
+
221
+ return modal;
222
+ };
223
+
224
+ $.fn.confirmModal = function () {
225
+ getModal($(this)).modal('show');
226
+
227
+ return this;
228
+ };
229
+
230
+ if ($.rails) {
231
+ /**
232
+ * Attaches to the Rails' UJS adapter 'confirm' event on links having a
233
+ * `data-confirm` attribute. Temporarily overrides the `$.rails.confirm`
234
+ * function with an anonymous one that returns the 'confirmed' status of
235
+ * the modal.
236
+ *
237
+ * A modal is considered 'confirmed' when an user has successfully clicked
238
+ * the 'confirm' button in it.
239
+ */
240
+ $(document).delegate(settings.elements.join(', '), 'confirm', function() {
241
+ var element = $(this), modal = getModal(element);
242
+ var confirmed = modal.data('confirmed');
243
+
244
+ if (!confirmed && !modal.is(':visible')) {
245
+ modal.modal('show');
246
+
247
+ var confirm = $.rails.confirm;
248
+ $.rails.confirm = function () { return modal.data('confirmed'); }
249
+ modal.on('hide', function () { $.rails.confirm = confirm; });
250
+ }
251
+
252
+ return confirmed;
253
+ });
254
+ }
255
+
256
+ })(jQuery);
@@ -56,3 +56,36 @@
56
56
  code {
57
57
  font-size: 80%;
58
58
  }
59
+
60
+ .job-actions {
61
+ text-align: center;
62
+ }
63
+
64
+ .more-job-actions {
65
+ float: right;
66
+ }
67
+
68
+ dt {
69
+ font-size: 24px;
70
+ margin-top: 11.5px;
71
+ margin-bottom: 11.5px;
72
+ font-family: inherit;
73
+ font-weight: 400!important;
74
+ line-height: 1.1;
75
+ color: #444444;
76
+ }
77
+
78
+ .failed-job {
79
+ margin: 0 auto;
80
+ width: 100%;
81
+ float: left;
82
+ }
83
+
84
+ .job-stat {
85
+ text-align: center;
86
+ }
87
+
88
+ .failed-job-actions {
89
+ float: left;
90
+ padding-right: 20px;
91
+ }
@@ -1,10 +1,12 @@
1
1
  <h2 class="sub-header">Enqueued</h2>
2
- <p class="text-info">
2
+ <p class="lead">
3
3
  The list below contains all jobs currently in the delayed_job queue.
4
4
  </p>
5
- <p class="sub">
5
+ <div class="job-stat">
6
+ <h4>
6
7
  <%= "Showing #{start} to #{start + per_page} of #{@all_jobs.count} enqueued jobs." %>
7
- </p>
8
+ </h4>
9
+ </div>
8
10
  <ul class="job">
9
11
  <% @jobs.each do |job| %>
10
12
  <%= partial :job, {:job => job} %>
@@ -1,24 +1,27 @@
1
1
  <h2 class="sub-header">Failed Jobs</h2>
2
- <p class="text-info">
2
+ <p class="lead">
3
3
  Here are the list of jobs that failed during execution.
4
4
  </p>
5
5
  <% if @jobs.any? %>
6
- <form action="<%= u('failed/clear') %>" method="POST">
7
- <%= csrf_token_tag %>
8
- <input type="submit" value="Clear Failed Jobs"></input>
9
- </form>
10
- <form action="<%= u('requeue/all') %>" method="POST">
11
- <%= csrf_token_tag %>
12
- <input type="submit" value="Retry Failed Jobs"></input>
13
- </form>
6
+ <div class="failed-job-actions">
7
+ <form action="<%= u('requeue/all') %>" method="POST">
8
+ <%= csrf_token_tag %>
9
+ <button type="submit" value="Retry Failed Jobs" class="btn btn-primary">Retry All Jobs</button>
10
+ </form>
11
+ </div>
12
+ <div class="failed-job-actions">
13
+ <form action="<%= u('failed/clear') %>" method="POST">
14
+ <%= csrf_token_tag %>
15
+ <button type="submit" value="Clear Failed Jobs" class="btn btn-warning">Clear All Jobs</button>
16
+ </form>
17
+ </div>
14
18
  <% end %>
15
- <p class="text-info">
16
- The list below contains all jobs that have a last_error message set.
17
- </p>
18
- <p class="sub">
19
+ <div class="job-stat">
20
+ <h4>
19
21
  <%= "Showing #{start} to #{start + per_page} of #{@all_jobs.count} failed jobs." %>
20
- </p>
21
- <ul class="failed job">
22
+ </h4>
23
+ </div>
24
+ <ul class="failed-job">
22
25
  <% @jobs.each do |job| %>
23
26
  <%= partial :job, {:job => job} %>
24
27
  <% end %>
@@ -1,25 +1,68 @@
1
1
  <li class="list-group-item">
2
- <dl>
3
- <dt>ID</dt>
4
- <dd>
5
- <a name="<%= job.id %>"></a>
2
+ <!-- New Table Interface -->
3
+ <table class="overview table table-striped table-hover">
4
+ <tbody><tr>
5
+ <th>Info</th>
6
+ <th>Details</th>
7
+ </tr>
8
+ <tr>
9
+ <td class="status">
10
+ ID
11
+ </td>
12
+ <td class="status">
6
13
  <a href="#<%= job.id %>"><%=h job.id %></a>
7
- <div class="controls">
8
- <form action="<%= u("requeue/#{job.id}") %>" method="post"><%= csrf_token_tag %><input type="submit" value="Retry"></input></form>
9
- or
10
- <form action="<%= u("remove/#{job.id}") %>" method="post"><%= csrf_token_tag %><input type="submit" value="Remove"></input></form>
11
- or
12
- <form action="<%= u("reload/#{job.id}") %>" method="post"><%= csrf_token_tag %><input type="submit" value="Reload"></input></form>
13
- </div>
14
- </dd>
15
- <dt>Priority</dt>
16
- <dd><%=h job.priority %></dd>
17
- <dt>Attempts</dt>
18
- <dd><%=h job.attempts %></dd>
19
- <% if job.respond_to?(:queue) && job.queue %>
20
- <dt>Queue</dt>
21
- <dd><%=h job.queue %></dd>
22
- <% end %>
14
+ </td>
15
+ </tr>
16
+ <tr>
17
+ <td class="status">
18
+ Priority
19
+ </td>
20
+ <td class="status">
21
+ <%=h job.priority %>
22
+ </td>
23
+ </tr>
24
+ <tr>
25
+ <td class="status">
26
+ Attempts
27
+ </td>
28
+ <td class="status">
29
+ <%=h job.attempts %>
30
+ </td>
31
+ </tr>
32
+ <% if job.respond_to?(:queue) && job.queue %>
33
+ <tr class="failure">
34
+ <td class="status">
35
+ <a href="/delayed_job/failed">Queue</a>
36
+ </td>
37
+ <td class="status danger">
38
+ <%=h job.queue %>
39
+ </td>
40
+ </tr>
41
+ <% end %>
42
+ </tbody>
43
+ </table>
44
+ <!-- End of New Table Interface -->
45
+ <hr>
46
+ <!-- Begin the amazing controls -->
47
+ <div class="controls">
48
+ <div class="col-md-4 job-actions">
49
+ <form action="<%= u("requeue/#{job.id}") %>" method="post"><%= csrf_token_tag %>
50
+ <button type="submit" value="Retry" class="btn btn-primary">Retry</button>
51
+ </form>
52
+ </div>
53
+ <div class="col-md-4 job-actions">
54
+ <form action="<%= u("remove/#{job.id}") %>" method="post"><%= csrf_token_tag %>
55
+ <button type="submit" value="Remove" class="btn btn-danger">Remove</button>
56
+ </form>
57
+ </div>
58
+ <div class="col-md-4 job-actions">
59
+ <form action="<%= u("reload/#{job.id}") %>" method="post"><%= csrf_token_tag %>
60
+ <button type="submit" value="Reload" class="btn btn-default">Reload</button>
61
+ </form>
62
+ </div>
63
+ </div>
64
+ <!-- End of the amazing controls -->
65
+ <dl>
23
66
  <dt>Handler</dt>
24
67
  <dd>
25
68
  <pre><%=h job.handler %></pre>
@@ -49,5 +49,6 @@
49
49
  <script src="<%= u("javascripts/application.js") %>" type="text/javascript"></script>
50
50
  <script src="<%= u("javascripts/bootstrap.min.js") %>" type="text/javascript"></script>
51
51
  <script src="<%= u("javascripts/material.js") %>" type="text/javascript"></script>
52
+ <script src="<%= u("javascripts/data-confirm-modal.js") %>" type="text/javascript"></script>
52
53
  </body>
53
54
  </html>
@@ -1,7 +1,7 @@
1
1
  <div class="col-xs-6">
2
2
  <h2 class="sub-header">Overview</h2>
3
3
  <div class="table-responsive">
4
- <p class="text-info">
4
+ <p class="lead">
5
5
  The list below shows an overview of the jobs in the delayed_job queue.
6
6
  </p>
7
7
  <table class="overview table table-striped table-hover">
@@ -48,7 +48,7 @@
48
48
  <div class="col-xs-6">
49
49
  <h2 class="sub-header">Statistics</h2>
50
50
  <div class="table-responsive">
51
- <p class="text-info">
51
+ <p class="lead">
52
52
  The list below shows an overview of the jobs in the delayed_job queue.
53
53
  </p>
54
54
  <table class="stats table table-striped table-hover">
@@ -1,19 +1,21 @@
1
1
  <h2 class="sub-header">Pending</h2>
2
- <p class="text-info">
2
+ <p class="lead">
3
3
  The list below shows an overview of the jobs that are pending.
4
4
  </p>
5
5
  <% if @jobs.any? %>
6
+ <div class="failed-job-actions">
6
7
  <form action="<%= u('requeue/all') %>" method="POST">
7
8
  <%= csrf_token_tag %>
8
- <input type="submit" value="Enqueue All Immediately"></input>
9
+ <button type="submit" value="Enqueue All Immediately" class="btn btn-primary">Enqueue All Immediately</button>
9
10
  </form>
11
+ </div>
10
12
  <% end %>
11
- <p class="sub">
12
- The list below contains jobs currently being processed.
13
- </p>
14
- <p class="sub">
13
+
14
+ <div class="job-stat">
15
+ <h4>
15
16
  <%= "Showing #{start} to #{start + per_page} of #{@all_jobs.count} pending jobs." %>
16
- </p>
17
+ </h4>
18
+ </div>
17
19
  <ul class="job">
18
20
  <% @jobs.each do |job| %>
19
21
  <%= partial :job, {:job => job} %>
@@ -1,13 +1,15 @@
1
1
  <h2 class="sub-header">Processing</h2>
2
- <p class="text-info">
2
+ <p class="lead">
3
3
  The list below shows an overview of the jobs that are currently being processed.
4
4
  </p>
5
5
  <p class="sub">
6
6
  The list below contains jobs currently being processed.
7
7
  </p>
8
- <p class="sub">
8
+ <div class="job-stat">
9
+ <h4>
9
10
  <%= "Showing #{start} to #{start + per_page} of #{@all_jobs.count} working jobs." %>
10
- </p>
11
+ </h4>
12
+ </div>
11
13
  <ul class="list-group">
12
14
  <% @jobs.each do |job| %>
13
15
  <%= partial :job, {:job => job} %>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: better_delayed_job_web
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.5
4
+ version: 1.3.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Skcript
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-02 00:00:00.000000000 Z
11
+ date: 2015-01-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sinatra
@@ -114,6 +114,7 @@ files:
114
114
  - lib/better_delayed_job_web/application/public/images/poll.png
115
115
  - lib/better_delayed_job_web/application/public/javascripts/application.js
116
116
  - lib/better_delayed_job_web/application/public/javascripts/bootstrap.min.js
117
+ - lib/better_delayed_job_web/application/public/javascripts/data-confirm-modal.js
117
118
  - lib/better_delayed_job_web/application/public/javascripts/jquery-1.11.2.min.js
118
119
  - lib/better_delayed_job_web/application/public/javascripts/jquery.relatize_date.js
119
120
  - lib/better_delayed_job_web/application/public/javascripts/material.js