Added icons, helperfunction and new fancy notice message
Added icons from webcrunch resp. heroicons Added helperfunction to display inline svg with the plugin inline-svg Implemented fancy notice message webcrunch. Realy nice but does only work with javascript on.
This commit is contained in:
@@ -23,8 +23,10 @@ class JobsController < ApplicationController
|
||||
|
||||
respond_to do |format|
|
||||
if @job.save
|
||||
Turbo::StreamsChannel.broadcast_prepend_later_to 'jobs', target: :jobs, partial: 'jobs/job_tr', locals: {job: @job}
|
||||
format.html { redirect_to jobs_url, notice: 'Job was successfully created.' }
|
||||
flash[:notice] = 'Job was successfully created.'
|
||||
Turbo::StreamsChannel.broadcast_prepend_later_to 'jobs', target: :jobs, partial: 'jobs/job_tr',
|
||||
locals: { job: @job }
|
||||
format.html { redirect_to jobs_url }
|
||||
format.json { render :show, status: :created, location: @job }
|
||||
else
|
||||
format.html { render :new, status: :unprocessable_entity }
|
||||
@@ -46,11 +48,11 @@ class JobsController < ApplicationController
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# DELETE /jobs/1 or /jobs/1.json
|
||||
def destroy
|
||||
@job.destroy!
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
Turbo::StreamsChannel.broadcast_remove_to 'jobs', target: @job
|
||||
format.html { redirect_to jobs_url, notice: 'Job was successfully destroyed.' }
|
||||
@@ -59,12 +61,16 @@ class JobsController < ApplicationController
|
||||
end
|
||||
|
||||
def cancel
|
||||
@job.canceled! if @job.able_to_cancel?
|
||||
|
||||
if @job.canceled!
|
||||
flash[:notice] = 'Job successfully canceled'
|
||||
else
|
||||
flash[:alert] = 'Job could not be canceled'
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
broadcast_update_job
|
||||
format.turbo_stream {} # prevent redirect_tos
|
||||
format.html { redirect_to jobs_url, notice: 'Job was successfully canceled.' }
|
||||
format.turbo_stream
|
||||
format.html { redirect_to jobs_url }
|
||||
format.json { head :no_content }
|
||||
end
|
||||
end
|
||||
@@ -77,7 +83,7 @@ class JobsController < ApplicationController
|
||||
end
|
||||
|
||||
def broadcast_update_job
|
||||
Turbo::StreamsChannel.broadcast_replace_later_to 'jobs', target: @job, partial: 'jobs/job_tr', locals: {job: @job}
|
||||
Turbo::StreamsChannel.broadcast_replace_later_to 'jobs', target: @job, partial: 'jobs/job_tr', locals: { job: @job }
|
||||
end
|
||||
|
||||
# Only allow a list of trusted parameters through.
|
||||
|
||||
Reference in New Issue
Block a user