Sha256: 8a91c1897099d089ebaea023b8846820c3c5398a8dbab5c39149968ba246db7e

Contents?: true

Size: 1.45 KB

Versions: 12

Compression:

Stored size: 1.45 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 new
    @tag_definition = Kaui::TagDefinition.new
  end

  def create
    params[:tag_definition][:applicable_object_types] = params[:tag_definition][:applicable_object_types].values unless params[:tag_definition][:applicable_object_types].blank?
    @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_definitions_path, :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

12 entries across 12 versions & 1 rubygems

Version Path
kaui-2.1.0 app/controllers/kaui/tag_definitions_controller.rb
kaui-2.0.4 app/controllers/kaui/tag_definitions_controller.rb
kaui-2.0.3 app/controllers/kaui/tag_definitions_controller.rb
kaui-2.0.2 app/controllers/kaui/tag_definitions_controller.rb
kaui-2.0.1 app/controllers/kaui/tag_definitions_controller.rb
kaui-2.0.0 app/controllers/kaui/tag_definitions_controller.rb
kaui-1.4.1 app/controllers/kaui/tag_definitions_controller.rb
kaui-1.4.0 app/controllers/kaui/tag_definitions_controller.rb
kaui-1.3.0 app/controllers/kaui/tag_definitions_controller.rb
kaui-1.2.0 app/controllers/kaui/tag_definitions_controller.rb
kaui-1.1.0 app/controllers/kaui/tag_definitions_controller.rb
kaui-1.0.0 app/controllers/kaui/tag_definitions_controller.rb