Sha256: 24132016c72f7c136af9aaa63d41bb65784acba4b59d48e901fd5cafbd3d7325
Contents?: true
Size: 1.39 KB
Versions: 13
Compression:
Stored size: 1.39 KB
Contents
class Oxen::PrintersController < AbstractResourcesController def update authorize resource flash[:notice] = t('.success.updated', resource: resource_class.to_s ) if resource.update_attributes(resource_params) && update_parenthood respond_with resource, location: "/admin/accounts/#{resource.account.id}" rescue Exception => e scoop_from_error e end private def set_fab_button_options opt = { items: {}} case params[:action] when 'edit','update';# opt[:items].merge! list: { ajax: 'get', icon: 'list', class: 'blue', url: "/admin/accounts/#{resource.account.id}" } when 'show'; # opt[:items].merge! list: { ajax: 'get', icon: 'list', class: 'blue', url: "/admin/accounts/#{resource.account.id}" } when 'index'; # opt[:items].merge! list: { ajax: 'get', icon: 'list', class: 'blue', url: "/admin/accounts/#{resource.account.id}" } end @fab_button_options = opt end # Never trust parameters from the scary internet, only allow the white list through. # "printer"=>{"name"=>"Label", "cups_printer"=>"havehuset_label", "command"=>"lp %2 %3", "paper"=>"A4", "active"=>"1"}} def resource_params params[:printer][:account_id] = current_user.admin? ? params[:parent_id] : current_user.account.id params.require(:printer).permit(:account_id, :active, :name, :cups_printer, :command, :paper) end end
Version data entries
13 entries across 13 versions & 1 rubygems