class Admin::MemberCounselorsController < OrbitAdminController def uploads @files = HpsFile.all.desc(:created_at).page(params[:page]).per(10) @table_fields = ["member_counselor.file_date","member_counselor.file_title", "member_counselor.downloaded_times", "member_counselor.account", "member_counselor.user_type", "actions"] end def index @counselors = HpsMember.all.desc(:created_at).page(params[:page]).per(10) @table_fields = ["member_counselor.account","member_counselor.name", "member_counselor.user_type"] end def new @counselor = HpsMember.new end def edit @counselor = HpsMember.find(params[:id]) end def create @counselor = HpsMember.new(counselor_params) if @counselor.save redirect_to admin_member_counselors_path else render :action => "new" end end def destroy counselor = HpsMember.find(params[:id]) counselor.destroy redirect_to admin_member_counselors_path(:page => params[:page]) end def update @counselor = HpsMember.find(params[:id]) if @counselor.update_attributes(counselor_params) redirect_to admin_member_counselors_path(:page => params[:page]) else render :action => "edit" end end def get_info @objects = [] case params[:get_info] when "counties" @objects = HpsCity.find(params[:id]).hps_counties.asc(:old_id) when "schools" @objects = HpsCounty.find(params[:id]).hps_schools.asc(:old_id) end render :layout => false end def destroy_upload hpsupload = HpsFile.find(params[:id]) hpsupload.destroy redirect_to uploads_admin_member_counselors_path end private def counselor_params params.require(:hps_member).permit! end end