Sha256: 024352431ffb23214423e15f1c003d43cd41577efb17e739b98b9179de8585c2

Contents?: true

Size: 1.68 KB

Versions: 1

Compression:

Stored size: 1.68 KB

Contents

module LesliAdmin
  class Dashboard::ComponentsController < ApplicationController
    before_action :set_dashboard_component, only: %i[ show edit update destroy ]

    # GET /dashboard/components
    def index
      @dashboard_components = Dashboard::Component.all
    end

    # GET /dashboard/components/1
    def show
    end

    # GET /dashboard/components/new
    def new
      @dashboard_component = Dashboard::Component.new
    end

    # GET /dashboard/components/1/edit
    def edit
    end

    # POST /dashboard/components
    def create
      @dashboard_component = Dashboard::Component.new(dashboard_component_params)

      if @dashboard_component.save
        redirect_to @dashboard_component, notice: "Component was successfully created."
      else
        render :new, status: :unprocessable_entity
      end
    end

    # PATCH/PUT /dashboard/components/1
    def update
      if @dashboard_component.update(dashboard_component_params)
        redirect_to @dashboard_component, notice: "Component was successfully updated.", status: :see_other
      else
        render :edit, status: :unprocessable_entity
      end
    end

    # DELETE /dashboard/components/1
    def destroy
      @dashboard_component.destroy
      redirect_to dashboard_components_url, notice: "Component was successfully destroyed.", status: :see_other
    end

    private
      # Use callbacks to share common setup or constraints between actions.
      def set_dashboard_component
        @dashboard_component = Dashboard::Component.find(params[:id])
      end

      # Only allow a list of trusted parameters through.
      def dashboard_component_params
        params.fetch(:dashboard_component, {})
      end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lesli_admin-0.6.1 app/controllers/lesli_admin/dashboard/components_controller.rb