orbit4-5/app/controllers/admin/member_infos_controller.rb

56 lines
1.1 KiB
Ruby

class Admin::MemberInfosController < OrbitMemberController
before_action :set_attribute
before_action :set_member_info, only: [:edit, :update, :show, :destroy]
helper Admin::AttributeValuesViewHelper
def index
@attributes = MemberProfileField.order('created_at DESC')
@roles = Role.excludes('disabled' => true)
end
def new
@attribute = MemberProfileField.new
end
def show
end
def edit
end
def create
@attribute = MemberProfileField.new(member_info_params)
@attribute.save
redirect_to action: :index
end
def update
@attribute.update_params(member_info_params)
end
def destroy
@attribute.destroy
redirect_to action: :index
end
private
# Use callbacks to share common setup or constraints between actions.
def set_member_info
@attribute = MemberProfileField.find(params[:id])
end
# Never trust parameters from the scary internet, only allow the white list through.
def member_info_params
params.require(:member_profile_field).permit!
end
protected
def set_attribute
@attribute_type = 'info'
@class = 'infos'
end
end