diff --git a/Gemfile b/Gemfile index b7a9183..7b5e2ea 100644 --- a/Gemfile +++ b/Gemfile @@ -1,36 +1,36 @@ -source "https://rubygems.org" +source 'https://rubygems.org' -ruby "3.3.4" +ruby '3.3.4' # Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main" -gem "rails", "~> 7.1.3", ">= 7.1.3.4" +gem 'rails', '~> 7.1.3', '>= 7.1.3.4' # The original asset pipeline for Rails [https://github.com/rails/sprockets-rails] -gem "sprockets-rails" +gem 'sprockets-rails' # Use sqlite3 as the database for Active Record -gem "sqlite3", "~> 1.4" +gem 'sqlite3', '~> 1.4' # Use the Puma web server [https://github.com/puma/puma] -gem "puma", ">= 5.0" +gem 'puma', '>= 5.0' # Use JavaScript with ESM import maps [https://github.com/rails/importmap-rails] -gem "importmap-rails" +gem 'importmap-rails' # Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev] -gem "turbo-rails" +gem 'turbo-rails' # Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev] -gem "stimulus-rails" +gem 'stimulus-rails' # Use Tailwind CSS [https://github.com/rails/tailwindcss-rails] -gem "tailwindcss-rails" +gem 'tailwindcss-rails' # Build JSON APIs with ease [https://github.com/rails/jbuilder] -gem "jbuilder" +gem 'jbuilder' # Use Redis adapter to run Action Cable in production -# gem "redis", ">= 4.0.1" +gem 'redis', '>= 4.0.1' # Use Kredis to get higher-level data types in Redis [https://github.com/rails/kredis] # gem "kredis" @@ -39,22 +39,22 @@ gem "jbuilder" # gem "bcrypt", "~> 3.1.7" # Windows does not include zoneinfo files, so bundle the tzinfo-data gem -gem "tzinfo-data", platforms: %i[ windows jruby ] +gem 'tzinfo-data', platforms: %i[windows jruby] # Reduces boot times through caching; required in config/boot.rb -gem "bootsnap", require: false +gem 'bootsnap', require: false # Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images] # gem "image_processing", "~> 1.2" group :development, :test do # See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem - gem "debug", platforms: %i[ mri windows ] + gem 'debug', platforms: %i[mri windows] end group :development do # Use console on exceptions pages [https://github.com/rails/web-console] - gem "web-console" + gem 'web-console' # Add speed badges [https://github.com/MiniProfiler/rack-mini-profiler] # gem "rack-mini-profiler" @@ -65,8 +65,8 @@ end group :test do # Use system testing [https://guides.rubyonrails.org/testing.html#system-testing] - gem "capybara" - gem "selenium-webdriver" + gem 'capybara' + gem 'selenium-webdriver' end -gem "faker", "~> 3.4" +gem 'faker', '~> 3.4' diff --git a/Gemfile.lock b/Gemfile.lock index bbaeb9d..e3bfff1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -201,6 +201,10 @@ GEM rake (13.2.1) rdoc (6.7.0) psych (>= 4.0.0) + redis (5.2.0) + redis-client (>= 0.22.0) + redis-client (0.22.2) + connection_pool regexp_parser (2.9.2) reline (0.5.9) io-console (~> 0.5) @@ -281,6 +285,7 @@ DEPENDENCIES jbuilder puma (>= 5.0) rails (~> 7.1.3, >= 7.1.3.4) + redis (>= 4.0.1) selenium-webdriver sprockets-rails sqlite3 (~> 1.4) diff --git a/app/models/job.rb b/app/models/job.rb index f768568..618db7c 100644 --- a/app/models/job.rb +++ b/app/models/job.rb @@ -11,6 +11,9 @@ class Job < ApplicationRecord before_save :update_paid_at, if: :will_save_change_to_status? before_save :update_status_changed_at, if: :will_save_change_to_status? + after_create_commit -> { broadcast_prepend_later_to 'jobs', partial: 'jobs/job_tr' } + after_update_commit -> { broadcast_replace_later_to 'jobs', partial: 'jobs/job_tr' } + # NOTE: Multiple status if paing before brinting? enum status: { open: 0, @@ -40,7 +43,7 @@ class Job < ApplicationRecord .or(Job.where(status: %i[paid canceled]) .where('status_changed_at >= ?', Time.now.beginning_of_day)) # .in_status_order - # .order(created_at: :asc) + .order(created_at: :desc) .order(:costumer_firstname, :costumer_lastname) end diff --git a/app/views/jobs/index.html.erb b/app/views/jobs/index.html.erb index 19f9e49..dec5b19 100644 --- a/app/views/jobs/index.html.erb +++ b/app/views/jobs/index.html.erb @@ -1,3 +1,4 @@ +<%= turbo_stream_from 'jobs' %>
<%= notice %>
@@ -7,7 +8,7 @@| Status |
|---|