Class: Kaui::AccountEmailsController
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
10
11
12
13
14
15
16
17
18
19
20
|
# File 'app/controllers/kaui/account_emails_controller.rb', line 10
def create
@account_email = Kaui::AccountEmail.new(account_email_params.merge(account_id: params.require(:account_id)))
begin
@account_email.create(current_user.kb_username, params[:reason], params[:comment], options_for_klient)
redirect_to kaui_engine.account_path(@account_email.account_id), notice: 'Account email was successfully added'
rescue StandardError => e
flash.now[:error] = "Error while adding the email: #{as_string(e)}"
render action: :new
end
end
|
#destroy ⇒ Object
22
23
24
25
26
27
28
29
|
# File 'app/controllers/kaui/account_emails_controller.rb', line 22
def destroy
account_email = Kaui::AccountEmail.new(account_id: params.require(:account_id),
email: params.require(:id))
account_email.destroy(current_user.kb_username, params[:reason], params[:comment], options_for_klient)
redirect_to kaui_engine.account_path(account_email.account_id), notice: 'Account email was successfully deleted'
end
|
#new ⇒ Object
5
6
7
8
|
# File 'app/controllers/kaui/account_emails_controller.rb', line 5
def new
@account_email = Kaui::AccountEmail.new(account_id: params.require(:account_id),
email: params[:email])
end
|