Sha256: fdc077515a52b83774ba3062a5c281d56c50a8ea7cee7e80ca7adda863bb0c7e
Contents?: true
Size: 1.27 KB
Versions: 8
Compression:
Stored size: 1.27 KB
Contents
# frozen_string_literal: true require_dependency 'c/admin_controller' module C class Admin::TeamMembersController < AdminController before_action :load_from_url, only: [:destroy, :edit, :update] load_and_authorize_resource class: C::TeamMember def index @team_members end def new; end def edit; end def create if @team_member.save redirect_to team_members_path, notice: 'Team Member created' else render :new end end def update if @team_member.update(team_member_params) redirect_to team_members_path, notice: 'Team Member updated' else render :edit end end def dashboard; end def destroy @team_member.destroy respond_to do |format| format.js format.html { redirect_to team_members_path } end end def sort @team_members = C::TeamMember.all @team_members.update_order(params[:team_member]) respond_to do |format| format.js { head :ok, content_type: 'text/html' } end end private def load_from_url @team_member = C::TeamMember.find(params[:id]) end def team_member_params params.require(:team_member).permit(:id, :name, :role, :image, :body) end end end
Version data entries
8 entries across 8 versions & 1 rubygems