Compare commits

...

7 Commits

11 changed files with 142 additions and 113 deletions

View File

@@ -4,29 +4,29 @@ GEM
Ascii85 (2.0.1) Ascii85 (2.0.1)
action_policy (0.7.5) action_policy (0.7.5)
ruby-next-core (>= 1.0) ruby-next-core (>= 1.0)
actioncable (8.0.2) actioncable (8.0.2.1)
actionpack (= 8.0.2) actionpack (= 8.0.2.1)
activesupport (= 8.0.2) activesupport (= 8.0.2.1)
nio4r (~> 2.0) nio4r (~> 2.0)
websocket-driver (>= 0.6.1) websocket-driver (>= 0.6.1)
zeitwerk (~> 2.6) zeitwerk (~> 2.6)
actionmailbox (8.0.2) actionmailbox (8.0.2.1)
actionpack (= 8.0.2) actionpack (= 8.0.2.1)
activejob (= 8.0.2) activejob (= 8.0.2.1)
activerecord (= 8.0.2) activerecord (= 8.0.2.1)
activestorage (= 8.0.2) activestorage (= 8.0.2.1)
activesupport (= 8.0.2) activesupport (= 8.0.2.1)
mail (>= 2.8.0) mail (>= 2.8.0)
actionmailer (8.0.2) actionmailer (8.0.2.1)
actionpack (= 8.0.2) actionpack (= 8.0.2.1)
actionview (= 8.0.2) actionview (= 8.0.2.1)
activejob (= 8.0.2) activejob (= 8.0.2.1)
activesupport (= 8.0.2) activesupport (= 8.0.2.1)
mail (>= 2.8.0) mail (>= 2.8.0)
rails-dom-testing (~> 2.2) rails-dom-testing (~> 2.2)
actionpack (8.0.2) actionpack (8.0.2.1)
actionview (= 8.0.2) actionview (= 8.0.2.1)
activesupport (= 8.0.2) activesupport (= 8.0.2.1)
nokogiri (>= 1.8.5) nokogiri (>= 1.8.5)
rack (>= 2.2.4) rack (>= 2.2.4)
rack-session (>= 1.0.1) rack-session (>= 1.0.1)
@@ -34,35 +34,35 @@ GEM
rails-dom-testing (~> 2.2) rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6) rails-html-sanitizer (~> 1.6)
useragent (~> 0.16) useragent (~> 0.16)
actiontext (8.0.2) actiontext (8.0.2.1)
actionpack (= 8.0.2) actionpack (= 8.0.2.1)
activerecord (= 8.0.2) activerecord (= 8.0.2.1)
activestorage (= 8.0.2) activestorage (= 8.0.2.1)
activesupport (= 8.0.2) activesupport (= 8.0.2.1)
globalid (>= 0.6.0) globalid (>= 0.6.0)
nokogiri (>= 1.8.5) nokogiri (>= 1.8.5)
actionview (8.0.2) actionview (8.0.2.1)
activesupport (= 8.0.2) activesupport (= 8.0.2.1)
builder (~> 3.1) builder (~> 3.1)
erubi (~> 1.11) erubi (~> 1.11)
rails-dom-testing (~> 2.2) rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6) rails-html-sanitizer (~> 1.6)
activejob (8.0.2) activejob (8.0.2.1)
activesupport (= 8.0.2) activesupport (= 8.0.2.1)
globalid (>= 0.3.6) globalid (>= 0.3.6)
activemodel (8.0.2) activemodel (8.0.2.1)
activesupport (= 8.0.2) activesupport (= 8.0.2.1)
activerecord (8.0.2) activerecord (8.0.2.1)
activemodel (= 8.0.2) activemodel (= 8.0.2.1)
activesupport (= 8.0.2) activesupport (= 8.0.2.1)
timeout (>= 0.4.0) timeout (>= 0.4.0)
activestorage (8.0.2) activestorage (8.0.2.1)
actionpack (= 8.0.2) actionpack (= 8.0.2.1)
activejob (= 8.0.2) activejob (= 8.0.2.1)
activerecord (= 8.0.2) activerecord (= 8.0.2.1)
activesupport (= 8.0.2) activesupport (= 8.0.2.1)
marcel (~> 1.0) marcel (~> 1.0)
activesupport (8.0.2) activesupport (8.0.2.1)
base64 base64
benchmark (>= 0.3) benchmark (>= 0.3)
bigdecimal bigdecimal
@@ -77,7 +77,7 @@ GEM
uri (>= 0.13.1) uri (>= 0.13.1)
addressable (2.8.7) addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0) public_suffix (>= 2.0.2, < 7.0)
afm (0.2.2) afm (1.0.0)
ast (2.4.3) ast (2.4.3)
authentication-zero (3.0.2) authentication-zero (3.0.2)
base64 (0.3.0) base64 (0.3.0)
@@ -90,7 +90,7 @@ GEM
bindex (0.8.1) bindex (0.8.1)
bootsnap (1.18.6) bootsnap (1.18.6)
msgpack (~> 1.2) msgpack (~> 1.2)
brakeman (7.0.2) brakeman (7.1.0)
racc racc
builder (3.3.0) builder (3.3.0)
capybara (3.40.0) capybara (3.40.0)
@@ -117,7 +117,7 @@ GEM
ed25519 (1.4.0) ed25519 (1.4.0)
erb (5.0.2) erb (5.0.2)
erubi (1.13.1) erubi (1.13.1)
et-orbi (1.2.11) et-orbi (1.3.0)
tzinfo tzinfo
faker (3.5.2) faker (3.5.2)
i18n (>= 1.8.11, < 2) i18n (>= 1.8.11, < 2)
@@ -138,7 +138,7 @@ GEM
image_processing (1.14.0) image_processing (1.14.0)
mini_magick (>= 4.9.5, < 6) mini_magick (>= 4.9.5, < 6)
ruby-vips (>= 2.0.17, < 3) ruby-vips (>= 2.0.17, < 3)
importmap-rails (2.1.0) importmap-rails (2.2.2)
actionpack (>= 6.0.0) actionpack (>= 6.0.0)
activesupport (>= 6.0.0) activesupport (>= 6.0.0)
railties (>= 6.0.0) railties (>= 6.0.0)
@@ -150,10 +150,10 @@ GEM
pp (>= 0.6.0) pp (>= 0.6.0)
rdoc (>= 4.0.0) rdoc (>= 4.0.0)
reline (>= 0.4.2) reline (>= 0.4.2)
jbuilder (2.13.0) jbuilder (2.14.1)
actionview (>= 5.0.0) actionview (>= 7.0.0)
activesupport (>= 5.0.0) activesupport (>= 7.0.0)
json (2.12.2) json (2.13.2)
kamal (2.7.0) kamal (2.7.0)
activesupport (>= 7.0) activesupport (>= 7.0)
base64 (~> 0.2) base64 (~> 0.2)
@@ -188,7 +188,7 @@ GEM
net-smtp net-smtp
marcel (1.0.4) marcel (1.0.4)
matrix (0.4.3) matrix (0.4.3)
mini_magick (5.3.0) mini_magick (5.3.1)
logger logger
mini_mime (1.1.5) mini_mime (1.1.5)
mini_portile2 (2.8.9) mini_portile2 (2.8.9)
@@ -209,28 +209,28 @@ GEM
net-protocol net-protocol
net-ssh (7.3.0) net-ssh (7.3.0)
nio4r (2.7.4) nio4r (2.7.4)
nokogiri (1.18.8) nokogiri (1.18.9)
mini_portile2 (~> 2.8.2) mini_portile2 (~> 2.8.2)
racc (~> 1.4) racc (~> 1.4)
nokogiri (1.18.8-aarch64-linux-gnu) nokogiri (1.18.9-aarch64-linux-gnu)
racc (~> 1.4) racc (~> 1.4)
nokogiri (1.18.8-arm-linux-gnu) nokogiri (1.18.9-arm-linux-gnu)
racc (~> 1.4) racc (~> 1.4)
nokogiri (1.18.8-arm64-darwin) nokogiri (1.18.9-arm64-darwin)
racc (~> 1.4) racc (~> 1.4)
nokogiri (1.18.8-x86_64-darwin) nokogiri (1.18.9-x86_64-darwin)
racc (~> 1.4) racc (~> 1.4)
nokogiri (1.18.8-x86_64-linux-gnu) nokogiri (1.18.9-x86_64-linux-gnu)
racc (~> 1.4) racc (~> 1.4)
ostruct (0.6.3) ostruct (0.6.3)
pagy (9.3.5) pagy (9.4.0)
parallel (1.27.0) parallel (1.27.0)
parser (3.3.8.0) parser (3.3.9.0)
ast (~> 2.4.1) ast (~> 2.4.1)
racc racc
pdf-reader (2.14.1) pdf-reader (2.15.0)
Ascii85 (>= 1.0, < 3.0, != 2.0.0) Ascii85 (>= 1.0, < 3.0, != 2.0.0)
afm (~> 0.2.1) afm (>= 0.2.1, < 2)
hashery (~> 2.0) hashery (~> 2.0)
ruby-rc4 ruby-rc4
ttfunk ttfunk
@@ -242,12 +242,12 @@ GEM
date date
stringio stringio
public_suffix (6.0.2) public_suffix (6.0.2)
puma (6.6.0) puma (6.6.1)
nio4r (~> 2.0) nio4r (~> 2.0)
pwned (2.4.1) pwned (2.4.1)
raabro (1.4.0) raabro (1.4.0)
racc (1.8.1) racc (1.8.1)
rack (3.1.16) rack (3.2.0)
rack-session (2.1.1) rack-session (2.1.1)
base64 (>= 0.1.0) base64 (>= 0.1.0)
rack (>= 3.0.0) rack (>= 3.0.0)
@@ -255,20 +255,20 @@ GEM
rack (>= 1.3) rack (>= 1.3)
rackup (2.2.1) rackup (2.2.1)
rack (>= 3) rack (>= 3)
rails (8.0.2) rails (8.0.2.1)
actioncable (= 8.0.2) actioncable (= 8.0.2.1)
actionmailbox (= 8.0.2) actionmailbox (= 8.0.2.1)
actionmailer (= 8.0.2) actionmailer (= 8.0.2.1)
actionpack (= 8.0.2) actionpack (= 8.0.2.1)
actiontext (= 8.0.2) actiontext (= 8.0.2.1)
actionview (= 8.0.2) actionview (= 8.0.2.1)
activejob (= 8.0.2) activejob (= 8.0.2.1)
activemodel (= 8.0.2) activemodel (= 8.0.2.1)
activerecord (= 8.0.2) activerecord (= 8.0.2.1)
activestorage (= 8.0.2) activestorage (= 8.0.2.1)
activesupport (= 8.0.2) activesupport (= 8.0.2.1)
bundler (>= 1.15.0) bundler (>= 1.15.0)
railties (= 8.0.2) railties (= 8.0.2.1)
rails-dom-testing (2.3.0) rails-dom-testing (2.3.0)
activesupport (>= 5.0.0) activesupport (>= 5.0.0)
minitest minitest
@@ -276,12 +276,12 @@ GEM
rails-html-sanitizer (1.6.2) rails-html-sanitizer (1.6.2)
loofah (~> 2.21) loofah (~> 2.21)
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0) nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
rails-i18n (8.0.1) rails-i18n (8.0.2)
i18n (>= 0.7, < 2) i18n (>= 0.7, < 2)
railties (>= 8.0.0, < 9) railties (>= 8.0.0, < 9)
railties (8.0.2) railties (8.0.2.1)
actionpack (= 8.0.2) actionpack (= 8.0.2.1)
activesupport (= 8.0.2) activesupport (= 8.0.2.1)
irb (~> 1.13) irb (~> 1.13)
rackup (>= 1.0.0) rackup (>= 1.0.0)
rake (>= 12.2) rake (>= 12.2)
@@ -296,15 +296,15 @@ GEM
rdoc (6.14.2) rdoc (6.14.2)
erb erb
psych (>= 4.0.0) psych (>= 4.0.0)
redis (5.4.0) redis (5.4.1)
redis-client (>= 0.22.0) redis-client (>= 0.22.0)
redis-client (0.25.1) redis-client (0.25.2)
connection_pool connection_pool
regexp_parser (2.10.0) regexp_parser (2.11.2)
reline (0.6.1) reline (0.6.2)
io-console (~> 0.5) io-console (~> 0.5)
rexml (3.4.1) rexml (3.4.1)
rubocop (1.78.0) rubocop (1.79.2)
json (~> 2.3) json (~> 2.3)
language_server-protocol (~> 3.17.0.2) language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.1.0) lint_roller (~> 1.1.0)
@@ -312,7 +312,7 @@ GEM
parser (>= 3.3.0.2) parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0) rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 2.9.3, < 3.0) regexp_parser (>= 2.9.3, < 3.0)
rubocop-ast (>= 1.45.1, < 2.0) rubocop-ast (>= 1.46.0, < 2.0)
ruby-progressbar (~> 1.7) ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 4.0) unicode-display_width (>= 2.4.0, < 4.0)
rubocop-ast (1.46.0) rubocop-ast (1.46.0)
@@ -322,7 +322,7 @@ GEM
lint_roller (~> 1.1) lint_roller (~> 1.1)
rubocop (>= 1.75.0, < 2.0) rubocop (>= 1.75.0, < 2.0)
rubocop-ast (>= 1.38.0, < 2.0) rubocop-ast (>= 1.38.0, < 2.0)
rubocop-rails (2.32.0) rubocop-rails (2.33.3)
activesupport (>= 4.2.0) activesupport (>= 4.2.0)
lint_roller (~> 1.1) lint_roller (~> 1.1)
rack (>= 1.1) rack (>= 1.1)
@@ -338,15 +338,15 @@ GEM
ruby-vips (2.2.4) ruby-vips (2.2.4)
ffi (~> 1.12) ffi (~> 1.12)
logger logger
rubyzip (2.4.1) rubyzip (3.0.1)
securerandom (0.4.1) securerandom (0.4.1)
selenium-webdriver (4.34.0) selenium-webdriver (4.35.0)
base64 (~> 0.2) base64 (~> 0.2)
logger (~> 1.4) logger (~> 1.4)
rexml (~> 3.2, >= 3.2.5) rexml (~> 3.2, >= 3.2.5)
rubyzip (>= 1.2.2, < 3.0) rubyzip (>= 1.2.2, < 4.0)
websocket (~> 1.0) websocket (~> 1.0)
solid_cable (3.0.11) solid_cable (3.0.12)
actioncable (>= 7.2) actioncable (>= 7.2)
activejob (>= 7.2) activejob (>= 7.2)
activerecord (>= 7.2) activerecord (>= 7.2)
@@ -355,13 +355,13 @@ GEM
activejob (>= 7.2) activejob (>= 7.2)
activerecord (>= 7.2) activerecord (>= 7.2)
railties (>= 7.2) railties (>= 7.2)
solid_queue (1.2.0) solid_queue (1.2.1)
activejob (>= 7.1) activejob (>= 7.1)
activerecord (>= 7.1) activerecord (>= 7.1)
concurrent-ruby (>= 1.3.1) concurrent-ruby (>= 1.3.1)
fugit (~> 1.11.0) fugit (~> 1.11.0)
railties (>= 7.1) railties (>= 7.1)
thor (~> 1.3.1) thor (>= 1.3.1)
sprockets (4.2.2) sprockets (4.2.2)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
logger logger
@@ -370,12 +370,12 @@ GEM
actionpack (>= 6.1) actionpack (>= 6.1)
activesupport (>= 6.1) activesupport (>= 6.1)
sprockets (>= 3.0.0) sprockets (>= 3.0.0)
sqlite3 (2.7.2-aarch64-linux-gnu) sqlite3 (2.7.3-aarch64-linux-gnu)
sqlite3 (2.7.2-arm-linux-gnu) sqlite3 (2.7.3-arm-linux-gnu)
sqlite3 (2.7.2-arm64-darwin) sqlite3 (2.7.3-arm64-darwin)
sqlite3 (2.7.2-x86-linux-gnu) sqlite3 (2.7.3-x86-linux-gnu)
sqlite3 (2.7.2-x86_64-darwin) sqlite3 (2.7.3-x86_64-darwin)
sqlite3 (2.7.2-x86_64-linux-gnu) sqlite3 (2.7.3-x86_64-linux-gnu)
sshkit (1.24.0) sshkit (1.24.0)
base64 base64
logger logger
@@ -395,12 +395,12 @@ GEM
tailwindcss-ruby (3.4.17-arm64-darwin) tailwindcss-ruby (3.4.17-arm64-darwin)
tailwindcss-ruby (3.4.17-x86_64-darwin) tailwindcss-ruby (3.4.17-x86_64-darwin)
tailwindcss-ruby (3.4.17-x86_64-linux) tailwindcss-ruby (3.4.17-x86_64-linux)
thor (1.3.2) thor (1.4.0)
thruster (0.1.14) thruster (0.1.15)
thruster (0.1.14-aarch64-linux) thruster (0.1.15-aarch64-linux)
thruster (0.1.14-arm64-darwin) thruster (0.1.15-arm64-darwin)
thruster (0.1.14-x86_64-darwin) thruster (0.1.15-x86_64-darwin)
thruster (0.1.14-x86_64-linux) thruster (0.1.15-x86_64-linux)
timeout (0.4.3) timeout (0.4.3)
ttfunk (1.8.0) ttfunk (1.8.0)
bigdecimal (~> 3.1) bigdecimal (~> 3.1)
@@ -409,7 +409,7 @@ GEM
railties (>= 7.1.0) railties (>= 7.1.0)
tzinfo (2.0.6) tzinfo (2.0.6)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
unicode-display_width (3.1.4) unicode-display_width (3.1.5)
unicode-emoji (~> 4.0, >= 4.0.4) unicode-emoji (~> 4.0, >= 4.0.4)
unicode-emoji (4.0.4) unicode-emoji (4.0.4)
uri (1.0.3) uri (1.0.3)
@@ -476,4 +476,4 @@ DEPENDENCIES
web-console web-console
BUNDLED WITH BUNDLED WITH
2.5.17 2.7.1

View File

@@ -1,7 +1,7 @@
class JobsController < ApplicationController class JobsController < ApplicationController
skip_before_action :authenticate_user!, only: [ :index, :cancel_button ] skip_before_action :authenticate_user!, only: [ :index, :cancel_button, :badge ]
skip_before_action :verified_user!, only: [ :index ] skip_before_action :verified_user!, only: [ :index ]
skip_verify_authorized only: [ :index, :new, :create, :cancel_button ] skip_verify_authorized only: [ :index, :new, :create, :cancel_button, :badge]
# GET /jobs or /jobs.json # GET /jobs or /jobs.json
def index def index
@@ -53,6 +53,12 @@ class JobsController < ApplicationController
render partial: "jobs/cancel_button", locals: { job: @job } render partial: "jobs/cancel_button", locals: { job: @job }
end end
def badge
@job = Job.find(params[:id])
render partial: "jobs/badge", locals: { job: @job }
end
private private
def broadcast_update_status_cards_and_start_next_job_button def broadcast_update_status_cards_and_start_next_job_button

View File

@@ -0,0 +1,3 @@
<%= turbo_frame_tag dom_id(job, :badge) do %>
<%= link_to_if user_signed_in? && allowed_to?(:show, job, namespace: :Operator), job.id, operator_job_path(job), target: "_blank" %>
<% end %>

View File

@@ -1,13 +1,22 @@
<tr id="<%= dom_id job %>" class="bg-status-<%= job.status %>-light odd:bg-opacity-25 even:bg-opacity-15 text-hsrm-gray whitespace-nowrap hover:bg-opacity-30" data-stream-enter-class="animate-flash-increase"> <tr id="<%= dom_id job %>" class="bg-status-<%= job.status %>-light odd:bg-opacity-25 even:bg-opacity-15 text-hsrm-gray whitespace-nowrap hover:bg-opacity-30" data-stream-enter-class="animate-flash-increase">
<td class="p-2 py-3 text-center"> <td class="p-2 py-3 text-center">
<span class="badge badge-xl text-status-<%= job.status %> bg-status-<%= job.status %>-light rounded-lg shadow"> <span class="badge badge-xl text-status-<%= job.status %> bg-status-<%= job.status %>-light rounded-lg shadow">
<%= link_to_if user_signed_in? && allowed_to?(:show, job, namespace: :Operator), job.id, operator_job_path(job) %> <% # TODO: Refactor to helper function %>
<% if defined?(no_turbo_stream) && no_turbo_stream %>
<%= turbo_frame_tag dom_id(job, :badge) do %>
<%= render partial: "jobs/badge", locals: { job: job } %>
<% end %>
<% else %>
<%= turbo_frame_tag dom_id(job, :badge), src: badge_job_path(job), loading: 'lazy' do %>
<%= icon("ellipsis-horizontal-circle", class: "icon icon-disabled size-10", title: "Loading...") %>
<% end %>
<% end %>
</span> </span>
</td> </td>
<td class="p-2 py-3 text-center"> <td class="p-2 py-3 text-center">
<% if job.pdf.attached? && job.pdf.previewable? %> <% if job.pdf.attached? && job.pdf.previewable? %>
<%= image_tag(url_for(job.pdf.blob.preview(resize_to_limit: [100, 100])), class: "shadow") %> <%= image_tag(url_for(job.pdf.blob.preview(resize_to_limit: [100, 100])), class: "shadow") %>
<%#= image_tag job.pdf.preview(resize_to_limit: [50, 50]), class: "mx-auto" %> <%# = image_tag job.pdf.preview(resize_to_limit: [50, 50]), class: "mx-auto" %>
<% end %> <% end %>
</td> </td>
<td class="p-2 py-3"> <td class="p-2 py-3">

View File

@@ -23,7 +23,7 @@
<th class="w-1 p-2 py-3 text-center">Action</th> <th class="w-1 p-2 py-3 text-center">Action</th>
</tr> </tr>
</thead> </thead>
<tbody id='jobs' class="divide-y divivde-gray-300"> <tbody id="jobs" class="divide-y divivde-gray-300">
<%= render partial: "job_tr", collection: @jobs, as: :job, locals: { no_turbo_stream: @no_turbo_stream } %> <%= render partial: "job_tr", collection: @jobs, as: :job, locals: { no_turbo_stream: @no_turbo_stream } %>
</tbody> </tbody>
</table> </table>

View File

@@ -1,4 +1,4 @@
<header class="container flex items-center justify-between px-4 py-6 mx-auto border-b-2 border-gray-300"> <header class="container bg-white sticky z-10 top-0 flex items-center justify-between px-4 py-6 mx-auto border-b-2 border-gray-300">
<a href="/" class="text-4xl font-bold text-hsrm-gray">Plottservice FAB</a> <a href="/" class="text-4xl font-bold text-hsrm-gray">Plottservice FAB</a>
<nav> <nav>
<ul class="flex justify-center space-x-2 font-semibold items-color"> <ul class="flex justify-center space-x-2 font-semibold items-color">

View File

@@ -1,6 +1,8 @@
<div id="<%= dom_id job %>" class="flex flex-row space-x-4 shadow"> <div id="<%= dom_id job %>" class="flex flex-row space-x-4 shadow">
<div> <div>
<embed type="application/pdf" src="<%= url_for(@job.pdf) %>" width="600px" height="800px" class="" /> <% if @job.pdf.attached? && job.pdf.previewable? %>
<embed type="application/pdf" src="<%= url_for(@job.pdf) %>" width="600px" height="800px" class="" />
<% end %>
</div> </div>
<div> <div>
<p class="my-3"> <p class="my-3">

View File

@@ -17,13 +17,13 @@
</td> </td>
<td class="p-2 py-3"> <td class="p-2 py-3">
<% if job.pdf.attached? %> <% if job.pdf.attached? %>
<%#= link_to job.pdf.filename, rails_blob_path(job.pdf, disposition: "attachment") %> <% #= link_to job.pdf.filename, rails_blob_path(job.pdf, disposition: "attachment") %>
<%= link_to_if job.printing?, truncate(job.pdf.filename.to_s, length: 45), job.pdf, download:true %> <%= link_to_if job.printing?, truncate(job.pdf.filename.to_s, length: 45), job.pdf, download:true %>
<% if job.printing? %> <% if job.printing? %>
<%= link_to job.pdf, download:true do %> <%= link_to job.pdf, download:true do %>
<span class="badge badge-hover"> <span class="badge badge-hover">
<%= icon("document-arrow-down", class: "text-hsrm-gray size-6 inline", title: "Download") %> <%= icon("document-arrow-down", class: "text-hsrm-gray size-6 inline", title: "Download") %>
<%=number_to_human_size job.pdf.blob.byte_size%> <%= number_to_human_size job.pdf.blob.byte_size %>
</span> </span>
<% end %> <% end %>
<% end %> <% end %>

View File

@@ -1,6 +1,14 @@
<div id="<%= dom_id @job %>" class="flex flex-row space-x-4 shadow"> <div id="<%= dom_id @job %>" class="flex flex-row space-x-4 shadow">
<div> <div>
<embed type="application/pdf" src="<%= url_for(@job.pdf) %>#view=Fit" width="700px" height="900px" class="" /> <% if @job.pdf.attached? && @job.pdf.previewable? %>
<embed
type="application/pdf"
src="<%= url_for(@job.pdf) %> #view=Fit"
width="700px"
height="900px"
class=""
/>
<% end %>
</div> </div>
<div> <div>
<%= render "form", job: @job %> <%= render "form", job: @job %>

View File

@@ -14,6 +14,7 @@ Rails.application.routes.draw do
member do member do
patch "cancel" patch "cancel"
get "cancel_button" get "cancel_button"
get "badge"
end end
end end
resource :profile, only: [ :show, :edit, :destroy ] resource :profile, only: [ :show, :edit, :destroy ]

2
db/schema.rb generated
View File

@@ -10,7 +10,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.2].define(version: 2024_08_26_144016) do ActiveRecord::Schema[8.0].define(version: 2024_08_26_144016) do
create_table "active_storage_attachments", force: :cascade do |t| create_table "active_storage_attachments", force: :cascade do |t|
t.string "name", null: false t.string "name", null: false
t.string "record_type", null: false t.string "record_type", null: false