Sha256: 2d341201b1df8d2d4df9c65055e8a062bb6c54faa0676932116beda1f7d4cd51

Contents?: true

Size: 1.24 KB

Versions: 1

Compression:

Stored size: 1.24 KB

Contents

require_dependency 'comable/admin/application_controller'

module Comable
  module Admin
    class TrackersController < Comable::Admin::ApplicationController
      load_and_authorize_resource class: Comable::Tracker.name

      def index
        @trackers = @trackers.page(params[:page])
      end

      def show
        render :edit
      end

      def new
      end

      def create
        if @tracker.save
          redirect_to comable.admin_tracker_path(@tracker), notice: Comable.t('successful')
        else
          flash.now[:alert] = Comable.t('failure')
          render :new
        end
      end

      def edit
      end

      def update
        if @tracker.update_attributes(tracker_params)
          redirect_to comable.admin_tracker_path(@tracker), notice: Comable.t('successful')
        else
          flash.now[:alert] = Comable.t('failure')
          render :edit
        end
      end

      def destroy
        @tracker.destroy
        redirect_to comable.admin_trackers_path, notice: Comable.t('successful')
      end

      private

      def tracker_params
        params.require(:tracker).permit(
          :activate_flag,
          :name,
          :tracker_id,
          :code,
          :place
        )
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
comable_backend-0.4.0 app/controllers/comable/admin/trackers_controller.rb