Sha256: ee50e3b7ae9f456d5b360bd39bd42aa7f3019b0d1f1492b0f5b39b84d48b30d4

Contents?: true

Size: 1.25 KB

Versions: 16

Compression:

Stored size: 1.25 KB

Contents

module Gaku
  class Admin::EnrollmentStatusesController < Admin::BaseController

    respond_to :js,   only: %i( new create edit update destroy index )

    before_action :set_enrollment_status, only: %i( edit update destroy )

    def index
      @enrollment_statuses = EnrollmentStatus.includes(:translations)
      set_count
      respond_with @enrollment_statuss
    end

    def new
      @enrollment_status = EnrollmentStatus.new
      respond_with @enrollment_status
    end

    def create
      @enrollment_status = EnrollmentStatus.new(enrollment_status_params)
      @enrollment_status.save
      set_count
      respond_with @enrollment_status
    end

    def edit
    end

    def update
      @enrollment_status.update(enrollment_status_params)
      respond_with @enrollment_status
    end

    def destroy
      @enrollment_status.destroy
      set_count
      respond_with @enrollment_status
    end

    private

    def set_enrollment_status
      @enrollment_status = EnrollmentStatus.find(params[:id])
    end

    def enrollment_status_params
      params.require(:enrollment_status).permit(attributes)
    end

    def attributes
      %i( code name active immutable )
    end

    def set_count
      @count = EnrollmentStatus.count
    end

  end
end

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
gaku_admin-0.3.0 app/controllers/gaku/admin/enrollment_statuses_controller.rb
gaku_admin-0.3.0.pre.4 app/controllers/gaku/admin/enrollment_statuses_controller.rb
gaku_admin-0.3.0.pre.3 app/controllers/gaku/admin/enrollment_statuses_controller.rb
gaku_admin-0.3.0.pre.2 app/controllers/gaku/admin/enrollment_statuses_controller.rb
gaku_admin-0.3.0.pre.1 app/controllers/gaku/admin/enrollment_statuses_controller.rb
gaku_admin-0.3.0.pre.0 app/controllers/gaku/admin/enrollment_statuses_controller.rb
gaku-0.2.4 admin/app/controllers/gaku/admin/enrollment_statuses_controller.rb
gaku_admin-0.2.4 app/controllers/gaku/admin/enrollment_statuses_controller.rb
gaku-0.2.3 admin/app/controllers/gaku/admin/enrollment_statuses_controller.rb
gaku_admin-0.2.3 app/controllers/gaku/admin/enrollment_statuses_controller.rb
gaku-0.2.2 admin/app/controllers/gaku/admin/enrollment_statuses_controller.rb
gaku_admin-0.2.2 app/controllers/gaku/admin/enrollment_statuses_controller.rb
gaku-0.2.1 admin/app/controllers/gaku/admin/enrollment_statuses_controller.rb
gaku_admin-0.2.1 app/controllers/gaku/admin/enrollment_statuses_controller.rb
gaku-0.2.0 admin/app/controllers/gaku/admin/enrollment_statuses_controller.rb
gaku_admin-0.2.0 app/controllers/gaku/admin/enrollment_statuses_controller.rb