Class: Kaui::TagDefinitionsController
Constant Summary
EngineControllerUtil::SIMPLE_PAGINATION_THRESHOLD
Instance Method Summary
collapse
#check_for_redirect_to_tenant_screen, #current_ability, #current_user, #options_for_klient, #populate_account_details, #retrieve_allowed_users_for_current_user, #retrieve_tenants_for_current_user
Instance Method Details
#create ⇒ Object
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'app/controllers/kaui/tag_definitions_controller.rb', line 16
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 StandardError => e
flash.now[:error] = "Error while creating tag definition: #{as_string(e)}"
render action: :new
end
end
|
#destroy ⇒ Object
29
30
31
32
33
34
35
36
37
38
39
|
# File 'app/controllers/kaui/tag_definitions_controller.rb', line 29
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 StandardError => e
flash.now[:error] = "Error while deleting tag definition: #{as_string(e)}"
render action: :index
end
end
|
#index ⇒ Object
5
6
7
8
9
10
|
# File 'app/controllers/kaui/tag_definitions_controller.rb', line 5
def index
@tag_definitions = Kaui::TagDefinition.all('NONE', options_for_klient)
rescue StandardError => e
flash.now[:error] = "Error while retrieving tag definitions: #{as_string(e)}"
@tag_definitions = []
end
|
#new ⇒ Object
12
13
14
|
# File 'app/controllers/kaui/tag_definitions_controller.rb', line 12
def new
@tag_definition = Kaui::TagDefinition.new
end
|