Files
growstuff/app/controllers/admin/job_templates_controller.rb
T
2026-10-24 18:40:10 +13:00

18 lines
666 B
Ruby

# frozen_string_literal: true
module Admin
# Every crop's job templates in one list, for crop wranglers to find the
# drafts waiting to be checked and published.
class JobTemplatesController < ApplicationController
before_action :authenticate_member!
before_action { authorize! :wrangle, Crop }
def index
@status = params[:status] if CropJobTemplate.statuses.key?(params[:status])
@templates = CropJobTemplate.joins(:crop).includes(:creator, :steps, crop: :parent).order('crops.name', :name)
@templates = @templates.where(status: @status) if @status
@templates = @templates.paginate(page: params[:page])
end
end
end