class Wco::OfficeActionsController

def create

def create
  @oa = OA.new params[:oa].permit!
  authorize! :update, @oa
  if @oa.save
    flash_notice @oa
  else
    flash_alert @oa
  end
  redirect_to action: :index
end

def edit

def edit
  @oa = OA.find params[:id]
  authorize! :edit, @oa
end

def index

def index
  authorize! :index, OA
  @oas = OA.all
end

def new

def new
  @oa = OA.new
  authorize! :new, @oa
end

def set_lists

def set_lists
  @from_types_list = [ nil, 'Wco::Gallery', 'Wco::Tag' ]
  @from_type = params[:from_type]
  @from_ids_list = []
  if @from_type.present?
    @from_ids_list = @from_type.constantize.list
  end
  @publishers_list = Wco::Publisher.list
  @oats_list = OAT.list
end

def show

def show
  @oa = OA.find params[:id]
  authorize! :show, @oa
end

def update

def update
  @oa = OA.find params[:id]
  authorize! :update, @oa
  if @oa.update params[:oa].permit!
    flash_notice @oa
  else
    flash_alert @oa
  end
  redirect_to action: :index
end