rush_job 0.2.0 → 0.3.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ada70c720203358ce0ed61959e120ac3b4e3b32ec4c7ad501fe112440b907f03
4
- data.tar.gz: 8b4d72d6b264eb13045c38c1ad84516f997f1a3132b0f28b6496bc256074a35b
3
+ metadata.gz: 0a80fc522578d00f9313b67a63c0b2d8e8473ea03569ec8c83eb59894d3a8405
4
+ data.tar.gz: b53eb38eea3005a117a92aaa0332cf5f95ae307baaf5639f17bd527de91ec5f7
5
5
  SHA512:
6
- metadata.gz: 831e166008796c689ac46afd00e03b8ddc5a14c37dda4e1ccf08cc84d422e463aa1b17044708e5e79a9dac7d2152a2f392e922830778adba4abec0aafca13825
7
- data.tar.gz: 82fc84d217653ee917b8043664690b68ec3b8c2be78ea770e3c58100007cc655ca86a538bbbb27972245b14f24ae820d1e6276b84a3f4d114db0f637f0cc664b
6
+ metadata.gz: 0d57ebaf610a4340cc24ebb69583d1fea64a56a945c7a4a2486d37d4e4fd1969809def22f63f85408e338c9d7e8013ea6e8b22e6c32d17f4404a70ffcc4e9128
7
+ data.tar.gz: 3ebd1910a18c140cc608b4b28cc3b8489ff261498d9450a8ff5ec99b6fc961d835c60521f76da4f12f5a39bdacc368a2b590469d653dbc921601dd71b63e8356
data/README.md CHANGED
@@ -2,7 +2,8 @@
2
2
  User interface for Delayed Job (https://github.com/collectiveidea/delayed_job) in Ruby on Rails
3
3
 
4
4
  ### Note
5
- This has only been tested with SQLite and Postgresql.
5
+ - This has only been tested with SQLite and Postgresql.
6
+ - This app uses cookies to store the dark mode selection.
6
7
 
7
8
  ## Usage
8
9
  You will need Delayed Job, `delayed_job`, and Delayed Job ActiveRecord, `delayed_job_active_record`, installed in a Ruby on Rails application for this gem to work properly.
@@ -13,7 +14,7 @@ Navigate to the `/rush_job` route in your application to see the Delayed Jobs. L
13
14
  Add this line to your Ruby on Rails application's Gemfile:
14
15
 
15
16
  ```ruby
16
- gem "rush_job", '~> 0.1'
17
+ gem 'rush_job', '~> 0.3.0'
17
18
  ```
18
19
 
19
20
  And then execute:
@@ -1,5 +1,4 @@
1
1
  //= link_directory ../stylesheets/rush_job .scss
2
2
  //= link_directory ../../../vendor/stylesheets/rush_job .css
3
3
  //= link_tree ../javascript/rush_job .js
4
- //= link_directory ../../../vendor/javascript/rush_job .js
5
4
  //= link_directory ../images/rush_job .svg
@@ -1,3 +1,3 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-down" viewBox="0 0 16 16">
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="rgb(0, 0, 0)" class="bi bi-arrow-down" viewBox="0 0 16 16">
2
2
  <path fill-rule="evenodd" d="M8 1a.5.5 0 0 1 .5.5v11.793l3.146-3.147a.5.5 0 0 1 .708.708l-4 4a.5.5 0 0 1-.708 0l-4-4a.5.5 0 0 1 .708-.708L7.5 13.293V1.5A.5.5 0 0 1 8 1z"/>
3
3
  </svg>
@@ -0,0 +1,3 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="rgb(255, 255, 255)" class="bi bi-arrow-down" viewBox="0 0 16 16">
2
+ <path fill-rule="evenodd" d="M8 1a.5.5 0 0 1 .5.5v11.793l3.146-3.147a.5.5 0 0 1 .708.708l-4 4a.5.5 0 0 1-.708 0l-4-4a.5.5 0 0 1 .708-.708L7.5 13.293V1.5A.5.5 0 0 1 8 1z"/>
3
+ </svg>
@@ -1,3 +1,3 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-up" viewBox="0 0 16 16">
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="rgb(0, 0, 0)" class="bi bi-arrow-up" viewBox="0 0 16 16">
2
2
  <path fill-rule="evenodd" d="M8 15a.5.5 0 0 0 .5-.5V2.707l3.146 3.147a.5.5 0 0 0 .708-.708l-4-4a.5.5 0 0 0-.708 0l-4 4a.5.5 0 1 0 .708.708L7.5 2.707V14.5a.5.5 0 0 0 .5.5z"/>
3
3
  </svg>
@@ -0,0 +1,3 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="rgb(255, 255, 255)" class="bi bi-arrow-up" viewBox="0 0 16 16">
2
+ <path fill-rule="evenodd" d="M8 15a.5.5 0 0 0 .5-.5V2.707l3.146 3.147a.5.5 0 0 0 .708-.708l-4-4a.5.5 0 0 0-.708 0l-4 4a.5.5 0 1 0 .708.708L7.5 2.707V14.5a.5.5 0 0 0 .5.5z"/>
3
+ </svg>
@@ -12,4 +12,6 @@
12
12
  *
13
13
  */
14
14
  @import "../../../vendor/stylesheets/rush_job/bootstrap";
15
+ @import "themes/dark";
16
+ @import "themes/light";
15
17
  @import "pages/index";
@@ -20,4 +20,16 @@
20
20
  margin-left: 5%;
21
21
  margin-right: 5%;
22
22
  float: right;
23
+ }
24
+
25
+ .page-link.disabled, .disabled > .page-link {
26
+ color: rgb(68, 110, 155);
27
+ }
28
+
29
+ .page-item:first-child .page-link {
30
+ color: rgb(68, 110, 155);
31
+ }
32
+
33
+ .page-item:last-child .page-link {
34
+ color: rgb(68, 110, 155);
23
35
  }
@@ -0,0 +1,3 @@
1
+ .background-color-dark {
2
+ background-color: #000;
3
+ }
@@ -0,0 +1,3 @@
1
+ .background-color-light {
2
+ background-color: #fff;
3
+ }
@@ -0,0 +1,13 @@
1
+ module RushJob
2
+ class ThemesController < ApplicationController
3
+ def update
4
+ cookies.permanent[:rush_job_theme] = if cookies[:rush_job_theme] == 'dark'
5
+ 'light'
6
+ else
7
+ 'dark'
8
+ end
9
+
10
+ redirect_to root_path
11
+ end
12
+ end
13
+ end
@@ -1,4 +1,11 @@
1
1
  module RushJob
2
2
  module ApplicationHelper
3
+ def current_theme
4
+ cookies[:rush_job_theme] == 'dark' ? 'dark' : 'light'
5
+ end
6
+
7
+ def invert_theme
8
+ cookies[:rush_job_theme] == 'dark' ? 'light' : 'dark'
9
+ end
3
10
  end
4
11
  end
@@ -1,20 +1,21 @@
1
1
  module RushJob
2
2
  module RushJobsHelper
3
+ include ApplicationHelper
3
4
  include SortHelper
4
5
  include Pagy::Frontend
5
6
 
6
7
  def sortable(column)
7
8
  direction = column == sort_column && sort_direction == 'asc' ? 'desc' : 'asc'
8
- link_to t(column), rush_job.root_path({ sort: column, direction: })
9
+ link_to t(column), rush_job.root_path({ sort: column, direction: }), class: "link-#{invert_theme}"
9
10
  end
10
11
 
11
12
  def sort_arrow(column)
12
13
  return unless column == sort_column
13
14
 
14
15
  if sort_direction == 'desc'
15
- image_tag('rush_job/arrow-down.svg', id: 'rush-job-down-arrow', alt: 'down arrow')
16
+ image_tag("rush_job/arrow-down-#{invert_theme}.svg", id: 'rush-job-down-arrow', alt: 'down arrow')
16
17
  else
17
- image_tag('rush_job/arrow-up.svg', id: 'rush-job-up-arrow', alt: 'up arrow')
18
+ image_tag("rush_job/arrow-up-#{invert_theme}.svg", id: 'rush-job-up-arrow', alt: 'up arrow')
18
19
  end
19
20
  end
20
21
  end
@@ -10,7 +10,7 @@
10
10
 
11
11
  <%= stylesheet_link_tag "rush_job/application", media: "all" %>
12
12
  </head>
13
- <body>
13
+ <body class="background-color-<%= current_theme %>">
14
14
 
15
15
  <%= yield %>
16
16
 
@@ -1,12 +1,12 @@
1
- <div class="header-container">
1
+ <div class="header-container" role="heading" aria-level="1">
2
2
  <div class="container text-center">
3
3
  <div class="row align-items-center">
4
- <div class="col-6">
4
+ <div class="col-6" role="banner">
5
5
  <h2 class="delayed_title">
6
6
  <%= t :delayed_title %>
7
7
  </h2>
8
8
  </div>
9
- <div class="col-6">
9
+ <div class="col-3">
10
10
  <button
11
11
  type="button"
12
12
  class="btn btn-primary"
@@ -14,15 +14,21 @@
14
14
  <%= t :reload %>
15
15
  </button>
16
16
  </div>
17
+ <div class="col-3">
18
+ <%= form_with url: theme_path, method: 'patch' do |form| %>
19
+ <%= form.button "#{invert_theme.titleize} Mode", class: "btn btn-#{invert_theme}" %>
20
+ <% end %>
21
+ </div>
17
22
  </div>
18
23
  </div>
19
24
  </div>
20
25
 
21
- <div class="jobs-container">
26
+ <div class="jobs-container" role="main">
22
27
  <div class="table-responsive">
23
28
  <table class="table
24
29
  table-bordered
25
- table-striped">
30
+ table-striped
31
+ table-<%= current_theme %>">
26
32
  <thead>
27
33
  <tr>
28
34
  <th><%= sortable 'id' %><%= sort_arrow 'id' %></th>
data/config/importmap.rb CHANGED
@@ -1,2 +1,3 @@
1
1
  pin 'rush_job/application', preload: true
2
- pin 'bootstrap', to: 'rush_job/bootstrap.bundle.min.js', preload: true
2
+ pin 'bootstrap', to: 'https://ga.jspm.io/npm:bootstrap@5.3.1/dist/js/bootstrap.esm.js'
3
+ pin '@popperjs/core', to: 'https://ga.jspm.io/npm:@popperjs/core@2.11.8/lib/index.js'
data/config/routes.rb CHANGED
@@ -1,3 +1,4 @@
1
1
  RushJob::Engine.routes.draw do
2
2
  root 'rush_jobs#index'
3
+ patch '/theme', to: 'themes#update'
3
4
  end
@@ -17,9 +17,10 @@ module RushJob
17
17
  rush_job/application.css
18
18
  rush_job/application.scss
19
19
  rush_job/application.js
20
- rush_job/arrow-up.svg
21
- rush_job/arrow-down.svg
22
- rush_job/bootstrap.bundle.min.js
20
+ rush_job/arrow-up-light.svg
21
+ rush_job/arrow-up-dark.svg
22
+ rush_job/arrow-down-light.svg
23
+ rush_job/arrow-down-dark.svg
23
24
  rush_job_manifest.js
24
25
  ]
25
26
  end
@@ -1,3 +1,3 @@
1
1
  module RushJob
2
- VERSION = '0.2.0'.freeze
2
+ VERSION = '0.3.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rush_job
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - JavaKoala
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-07-25 00:00:00.000000000 Z
11
+ date: 2023-07-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionview
@@ -287,13 +287,18 @@ files:
287
287
  - README.md
288
288
  - Rakefile
289
289
  - app/assets/config/rush_job_manifest.js
290
- - app/assets/images/rush_job/arrow-down.svg
291
- - app/assets/images/rush_job/arrow-up.svg
290
+ - app/assets/images/rush_job/arrow-down-dark.svg
291
+ - app/assets/images/rush_job/arrow-down-light.svg
292
+ - app/assets/images/rush_job/arrow-up-dark.svg
293
+ - app/assets/images/rush_job/arrow-up-light.svg
292
294
  - app/assets/javascript/rush_job/application.js
293
295
  - app/assets/stylesheets/rush_job/application.scss
294
296
  - app/assets/stylesheets/rush_job/pages/_index.scss
297
+ - app/assets/stylesheets/rush_job/themes/_dark.scss
298
+ - app/assets/stylesheets/rush_job/themes/_light.scss
295
299
  - app/controllers/rush_job/application_controller.rb
296
300
  - app/controllers/rush_job/rush_jobs_controller.rb
301
+ - app/controllers/rush_job/themes_controller.rb
297
302
  - app/helpers/rush_job/application_helper.rb
298
303
  - app/helpers/rush_job/rush_jobs_helper.rb
299
304
  - app/helpers/rush_job/sort_helper.rb