Sha256: 637b51aa569e002720550bd5d3ecaefe276c160e923c32f00b459335f27ebf51

Contents?: true

Size: 1.05 KB

Versions: 7

Compression:

Stored size: 1.05 KB

Contents

module Delayed
  module Web
    class JobsController < Delayed::Web::ApplicationController
      def queue
        if job.can_queue?
          job.queue!
          flash[:notice] = t(:notice, scope: 'delayed/web.flashes.jobs.queued')
        else
          status = t(job.status, scope: 'delayed/web.views.statuses')
          flash[:alert] = t(:alert, scope: 'delayed/web.flashes.jobs.queued', status: status)
        end
        redirect_to jobs_path
      end

      def destroy
        if job.can_destroy?
          job.destroy
          flash[:notice] = t(:notice, scope: 'delayed/web.flashes.jobs.destroyed')
        else
          status = t(job.status, scope: 'delayed/web.views.statuses')
          flash[:alert] = t(:alert, scope: 'delayed/web.flashes.jobs.destroyed', status: status)
        end
        redirect_to jobs_path
      end

      private

      def job
        @job ||= Delayed::Web::Job.find params[:id]
      end
      helper_method :job

      def jobs
        @jobs ||= Delayed::Web::Job.all
      end
      helper_method :jobs
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
delayed-web-0.4.9 app/controllers/delayed/web/jobs_controller.rb
delayed-web-0.4.7 app/controllers/delayed/web/jobs_controller.rb
delayed-web-0.4.6 app/controllers/delayed/web/jobs_controller.rb
delayed-web-0.4.5 app/controllers/delayed/web/jobs_controller.rb
delayed-web-0.4.4 app/controllers/delayed/web/jobs_controller.rb
delayed-web-0.4.3 app/controllers/delayed/web/jobs_controller.rb
delayed-web-0.4.2 app/controllers/delayed/web/jobs_controller.rb