Sha256: 125830634223420d34f661797f23844cf0029c5706e3e6012e0200b4695f9b2e
Contents?: true
Size: 1.48 KB
Versions: 9
Compression:
Stored size: 1.48 KB
Contents
module ForemanTasks class RecurringLogicsController < ::ApplicationController before_action :find_recurring_logic, :only => [:show, :cancel, :enable, :disable] def index @errors = params[:errors] @recurring_logics = filter(resource_base) end def show; end def enable change_enabled(true) end def disable change_enabled(false) end def cancel @recurring_logic.cancel redirect_to :action => :index end def clear_cancelled scope = resource_base.search_for('state=cancelled') scope.destroy_all redirect_to :action => :index end def controller_name 'foreman_tasks_recurring_logics' end def resource_class ::ForemanTasks::RecurringLogic end private def change_enabled(value) begin @recurring_logic.update!(:enabled => value) rescue RecurringLogicCancelledException => e @errors = e.message end redirect_to :action => :index, :errors => @errors end def find_recurring_logic @recurring_logic ||= ::ForemanTasks::RecurringLogic.find(params[:id]) end def filter(scope) scope.search_for(params[:search]) .paginate(:page => params[:page], :per_page => params[:per_page]) end def action_permission case params[:action] when 'clear_cancelled' 'edit' else super end end def controller_permission 'recurring_logics' end end end
Version data entries
9 entries across 9 versions & 1 rubygems