Sha256: 9dc744a9d9544415a72a9a986fd65f223ce7c44790e0cc3d39ed7ca648ae8c2c

Contents?: true

Size: 1.41 KB

Versions: 11

Compression:

Stored size: 1.41 KB

Contents

class Kaui::TagDefinitionsController < Kaui::EngineController

  def index
    begin
      @tag_definitions = Kaui::TagDefinition.all('NONE', options_for_klient)
    rescue => e
      flash.now[:error] = "Error while retrieving tag definitions: #{as_string(e)}"
      @tag_definitions  = []
    end
  end

  def show
    @tag_definition = Kaui::TagDefinition.find_by_id(params[:id], 'NONE', options_for_klient)
  end

  def new
    @tag_definition = Kaui::TagDefinition.new
  end

  def create
    @tag_definition = Kaui::TagDefinition.new(params[:tag_definition])

    begin
      @tag_definition = @tag_definition.create(current_user.kb_username, params[:reason], params[:comment], options_for_klient)
      redirect_to kaui_engine.tag_definition_path(@tag_definition.id), :notice => 'Tag definition successfully created'
    rescue => e
      flash.now[:error] = "Error while creating tag definition: #{as_string(e)}"
      render :action => :new
    end
  end

  def destroy
    @tag_definition = Kaui::TagDefinition.find_by_id(params[:id], 'NONE', options_for_klient)

    begin
      @tag_definition.delete(current_user.kb_username, params[:reason], params[:comment], options_for_klient)
      redirect_to kaui_engine.tag_definitions_path, :notice => 'Tag definition successfully deleted'
    rescue => e
      flash.now[:error] = "Error while deleting tag definition: #{as_string(e)}"
      render :action => :index
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
kaui-0.11.0 app/controllers/kaui/tag_definitions_controller.rb
kaui-0.10.0 app/controllers/kaui/tag_definitions_controller.rb
kaui-0.9.0 app/controllers/kaui/tag_definitions_controller.rb
kaui-0.8.4 app/controllers/kaui/tag_definitions_controller.rb
kaui-0.8.3 app/controllers/kaui/tag_definitions_controller.rb
kaui-0.8.2 app/controllers/kaui/tag_definitions_controller.rb
kaui-0.8.1 app/controllers/kaui/tag_definitions_controller.rb
kaui-0.8.0 app/controllers/kaui/tag_definitions_controller.rb
kaui-0.7.2 app/controllers/kaui/tag_definitions_controller.rb
kaui-0.7.1 app/controllers/kaui/tag_definitions_controller.rb
kaui-0.7.0 app/controllers/kaui/tag_definitions_controller.rb