Sha256: f3c2d7d3d1a410d824bc499a0530a20e58c6403f22e133c14147001f701612b5

Contents?: true

Size: 1.5 KB

Versions: 23

Compression:

Stored size: 1.5 KB

Contents

module Naf
  class LoggerStylesController < Naf::ApplicationController

    before_filter :set_cols_and_attributes

    def index
      @rows = Naf::LoggerStyle.all
      render template: 'naf/datatable'
    end

    def show
      @logger_style = Naf::LoggerStyle.find(params[:id])
    end

    def destroy
      @logger_style = Naf::LoggerStyle.find(params[:id])
      @logger_style.destroy
      flash[:notice] = "Logger Style '#{@logger_style.name}' was successfully deleted."
      redirect_to(action: "index")
    end

    def new
      @logger_style = Naf::LoggerStyle.new
      @logger_style.logger_style_names.build
    end

    def create
      @logger_style = Naf::LoggerStyle.new(params[:logger_style])
      if @logger_style.save
        redirect_to(@logger_style,
                    notice: "Logger Style '#{@logger_style.name}' was successfully created.")
      else
        render action: "new"
      end
    end

    def edit
      @logger_style = Naf::LoggerStyle.find(params[:id])
    end

    def update
      @logger_style = Naf::LoggerStyle.find(params[:id])
      if @logger_style.update_attributes(params[:logger_style])
        redirect_to(@logger_style,
                    notice: "Logger Style '#{@logger_style.name}' was successfully updated.")
      else
        render action: "edit"
      end
    end

    private

    def set_cols_and_attributes
      @attributes = Naf::LoggerStyle.attribute_names.map(&:to_sym)
      @cols = [:id, :name, :note, :_logger_names, :logger_levels]
    end

  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
naf-2.1.13 app/controllers/naf/logger_styles_controller.rb
naf-2.1.12 app/controllers/naf/logger_styles_controller.rb
naf-2.1.11 app/controllers/naf/logger_styles_controller.rb
naf-2.1.10 app/controllers/naf/logger_styles_controller.rb
naf-2.1.9 app/controllers/naf/logger_styles_controller.rb
naf-2.1.8 app/controllers/naf/logger_styles_controller.rb
naf-2.1.6 app/controllers/naf/logger_styles_controller.rb
naf-2.1.5 app/controllers/naf/logger_styles_controller.rb
naf-2.1.4 app/controllers/naf/logger_styles_controller.rb
naf-2.1.3 app/controllers/naf/logger_styles_controller.rb
naf-2.1.2 app/controllers/naf/logger_styles_controller.rb
naf-2.1.1 app/controllers/naf/logger_styles_controller.rb
naf-2.1.0 app/controllers/naf/logger_styles_controller.rb
naf-2.0.4 app/controllers/naf/logger_styles_controller.rb
naf-2.0.3 app/controllers/naf/logger_styles_controller.rb
naf-2.0.2 app/controllers/naf/logger_styles_controller.rb
naf-2.0.1 app/controllers/naf/logger_styles_controller.rb
naf-2.0.0 app/controllers/naf/logger_styles_controller.rb
naf-1.1.4 app/controllers/naf/logger_styles_controller.rb
naf-1.1.3 app/controllers/naf/logger_styles_controller.rb