rush_job 0.2.0 → 0.3.1

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: ada70c720203358ce0ed61959e120ac3b4e3b32ec4c7ad501fe112440b907f03
4
- data.tar.gz: 8b4d72d6b264eb13045c38c1ad84516f997f1a3132b0f28b6496bc256074a35b
3
+ metadata.gz: 62c92632ff547f79e44137da7c5d1fa32abebf73e193e415704b04bd981d6256
4
+ data.tar.gz: 2bb2cbb6fbd881c7c9419ffdb0b9bbe3ace33d3077f44ef3ee5ff1b4c08df6c3
5
5
  SHA512:
6
- metadata.gz: 831e166008796c689ac46afd00e03b8ddc5a14c37dda4e1ccf08cc84d422e463aa1b17044708e5e79a9dac7d2152a2f392e922830778adba4abec0aafca13825
7
- data.tar.gz: 82fc84d217653ee917b8043664690b68ec3b8c2be78ea770e3c58100007cc655ca86a538bbbb27972245b14f24ae820d1e6276b84a3f4d114db0f637f0cc664b
6
+ metadata.gz: 5ab20e3517d870afec5c08873854ed7191daae8efb8b462537d1f04545f2ce7b49ec57a0d3996ac2efa7246a5073e856b19d7420006708bd4d6dd2f369f4a9dd
7
+ data.tar.gz: 40421bf79367edd3e4ee1b4211adae3e9e918c69a76203cc2468c5779a6d19169b832d56cb9ce672cd8694b09f3f23df83e82aac6c5e5dd4c71bf59eac586925
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.1'
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.1'.freeze
3
3
  end