Class: Kaui::AccountTagsController
Instance Method Summary
collapse
#check_for_redirect_to_tenant_screen, #current_ability, #current_user, #options_for_klient, #retrieve_allowed_users_for_current_user, #retrieve_tenants_for_current_user
Instance Method Details
#edit ⇒ Object
3
4
5
6
7
8
9
10
|
# File 'app/controllers/kaui/account_tags_controller.rb', line 3
def edit
@account_id = params.require(:account_id)
fetch_tag_names = lambda { @tag_names = (Kaui::Tag.all_for_account(@account_id, false, 'NONE', options_for_klient).map { |tag| tag.tag_definition_name }).sort }
fetch_available_tags = lambda { @available_tags = Kaui::TagDefinition.all_for_account(options_for_klient) }
run_in_parallel fetch_tag_names, fetch_available_tags
end
|
#update ⇒ Object
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'app/controllers/kaui/account_tags_controller.rb', line 12
def update
account_id = params.require(:account_id)
tags = []
params.each do |tag, tag_name|
tag_info = tag.split('_')
next if tag_info.size != 2 or tag_info[0] != 'tag'
tags << tag_info[1]
end
Kaui::Tag.set_for_account(account_id, tags, current_user.kb_username, params[:reason], params[:comment], options_for_klient)
redirect_to kaui_engine.account_path(account_id), :notice => 'Account tags successfully set'
end
|