Class: Que::View::JobsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/que/view/jobs_controller.rb

Constant Summary collapse

PER_PAGE =
20

Instance Method Summary collapse

Instance Method Details

#destroyObject



27
28
29
30
31
32
33
# File 'app/controllers/que/view/jobs_controller.rb', line 27

def destroy
  updated_rows = ::Que::View.delete_job(params[:id])
  redirect_to(
    root_path,
    notice: updated_rows.empty? ? 'Job is not deleted' : 'Job is deleted'
  )
end

#destroy_allObject



43
44
45
46
47
48
49
# File 'app/controllers/que/view/jobs_controller.rb', line 43

def destroy_all
  updated_rows = destroy_all_jobs(params[:status])
  redirect_to(
    jobs_path(status: params[:status]),
    notice: updated_rows.empty? ? 'No jobs deleted' : "#{updated_rows.count} jobs deleted"
  )
end

#indexObject



12
13
14
15
# File 'app/controllers/que/view/jobs_controller.rb', line 12

def index
  @jobs = find_jobs(index_params)
  paginate
end

#reschedule_allObject



35
36
37
38
39
40
41
# File 'app/controllers/que/view/jobs_controller.rb', line 35

def reschedule_all
  updated_rows = reschedule_all_jobs(params[:status], Time.now)
  redirect_to(
    jobs_path(status: params[:status]),
    notice: updated_rows.empty? ? 'No jobs rescheduled' : "#{updated_rows.count} jobs rescheduled"
  )
end

#showObject



17
# File 'app/controllers/que/view/jobs_controller.rb', line 17

def show; end

#updateObject



19
20
21
22
23
24
25
# File 'app/controllers/que/view/jobs_controller.rb', line 19

def update
  updated_rows = ::Que::View.reschedule_job(params[:id], Time.now)
  redirect_to(
    root_path,
    notice: updated_rows.empty? ? 'Job is not rescheduled' : 'Job is rescheduled'
  )
end