rush_job 0.1.0 → 0.3.0

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
  SHA256:
3
- metadata.gz: 100ed627f08ab8045f14e2aa96185c60ff877d78452f73a259de21e612ab67bc
4
- data.tar.gz: b1d4ad45fd475b170fc8ab881a7b7ae91938b5e9f29dac883e0deabd2a00d24b
3
+ metadata.gz: 0a80fc522578d00f9313b67a63c0b2d8e8473ea03569ec8c83eb59894d3a8405
4
+ data.tar.gz: b53eb38eea3005a117a92aaa0332cf5f95ae307baaf5639f17bd527de91ec5f7
5
5
  SHA512:
6
- metadata.gz: 579b4b83fc3e00d7c1979e4c36d6db3a99b9f54ae34bff8b31914288b64d8a93ac39eec8673b54dbdc0a3124a3db43582215ec6048fb7c22c9b3c56ed11288ca
7
- data.tar.gz: f01cf38565a8cb450ba693bce3301826b33961b5f3c9b730738c07151bd1eb4ca8764c18b916921d2c4a46f074feb2e3183f7c9006746a877f28ad5db95dd1fd
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,3 +1,4 @@
1
1
  //= link_directory ../stylesheets/rush_job .scss
2
+ //= link_directory ../../../vendor/stylesheets/rush_job .css
2
3
  //= link_tree ../javascript/rush_job .js
3
- //= link_directory ../images/rush_job .svg
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>
@@ -1 +1 @@
1
- import "bootstrap"
1
+ import "bootstrap"
@@ -11,5 +11,7 @@
11
11
  * It is generally better to create a new file per style scope.
12
12
  *
13
13
  */
14
- @import "bootstrap";
15
- @import "pages/index";
14
+ @import "../../../vendor/stylesheets/rush_job/bootstrap";
15
+ @import "themes/dark";
16
+ @import "themes/light";
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: 'bootstrap.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
@@ -1,8 +1,8 @@
1
1
  module RushJob
2
2
  require 'importmap-rails'
3
- require 'bootstrap'
4
3
  require 'pagy'
5
4
  require 'pagy/extras/bootstrap'
5
+ require 'sassc-rails'
6
6
 
7
7
  class Engine < ::Rails::Engine
8
8
  isolate_namespace RushJob
@@ -17,8 +17,11 @@ 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-light.svg
21
+ rush_job/arrow-up-dark.svg
22
+ rush_job/arrow-down-light.svg
23
+ rush_job/arrow-down-dark.svg
20
24
  rush_job_manifest.js
21
- bootstrap.min.js
22
25
  ]
23
26
  end
24
27
  end
@@ -1,3 +1,3 @@
1
1
  module RushJob
2
- VERSION = '0.1.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.1.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-21 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
@@ -53,47 +53,47 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '7.0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: bootstrap
56
+ name: importmap-rails
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '5.2'
61
+ version: '1.2'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '5.2'
68
+ version: '1.2'
69
69
  - !ruby/object:Gem::Dependency
70
- name: importmap-rails
70
+ name: pagy
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '1.2'
75
+ version: '6.0'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '1.2'
82
+ version: '6.0'
83
83
  - !ruby/object:Gem::Dependency
84
- name: pagy
84
+ name: sassc-rails
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '6.0'
89
+ version: '2.1'
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '6.0'
96
+ version: '2.1'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: delayed_job
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -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