Class: Kaui::TagDefinitionsController

Inherits:
EngineController show all
Defined in:
app/controllers/kaui/tag_definitions_controller.rb

Instance Method Summary collapse

Methods inherited from EngineController

#current_ability, #current_user, #options_for_klient

Instance Method Details

#createObject



20
21
22
23
24
25
26
27
28
29
30
# File 'app/controllers/kaui/tag_definitions_controller.rb', line 20

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

#destroyObject



32
33
34
35
36
37
38
39
40
41
42
# File 'app/controllers/kaui/tag_definitions_controller.rb', line 32

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

#indexObject



3
4
5
6
7
8
9
10
# File 'app/controllers/kaui/tag_definitions_controller.rb', line 3

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

#newObject



16
17
18
# File 'app/controllers/kaui/tag_definitions_controller.rb', line 16

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

#showObject



12
13
14
# File 'app/controllers/kaui/tag_definitions_controller.rb', line 12

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