Added broadcast to jobs create and update
This commit is contained in:
38
Gemfile
38
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'
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
<%= turbo_stream_from 'jobs' %>
|
||||
<div class="w-full">
|
||||
<% if notice.present? %>
|
||||
<p class="px-3 py-2 bg-green-100 mb-5 text-green-700 font-medium rounded-lg inline-block" id="notice"><%= notice %></p>
|
||||
@@ -7,7 +8,7 @@
|
||||
<h1 class="font-bold text-hsrm-gray text-4xl">Aktuelle Plottaufträge <span class="font-semibold text-sm"><%= Date.today.strftime("%d.%m.%Y") %></span></h1>
|
||||
<%= link_to "Plottauftrag aufgeben", new_job_path, class: "px-3 py-2 bg-hsrm-red drop-shadow-lg transition-colors hover:bg-hsrm-red-light text-white block font-medium" %>
|
||||
</div>
|
||||
<div id="jobs" class="overflow-auto min-w-full drop-shadow-lg">
|
||||
<div class="overflow-auto min-w-full drop-shadow-lg">
|
||||
<table class="w-full py-8 table-auto">
|
||||
<thead class="bg-gray-200 text-hsrm-gray border-b-2 border-hsrm-gray">
|
||||
<tr>
|
||||
@@ -21,7 +22,7 @@
|
||||
<th class="p-3 text-sm font-semibold tracking-wide text-left w-1"> Status </th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divivde-gray-300">
|
||||
<tbody id='jobs' class="divide-y divivde-gray-300">
|
||||
<%= render partial: "job_tr", collection: @jobs, as: :job %>
|
||||
<%#= link_to "Show this job", job, class: "ml-2 rounded-lg py-3 px-5 bg-gray-100 inline-block font-medium" %>
|
||||
</tbody>
|
||||
|
||||
Reference in New Issue
Block a user