Class: Kaui::AccountEmailsController

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

Instance Method Summary collapse

Methods inherited from EngineController

#current_ability, #current_user, #options_for_klient

Instance Method Details

#createObject



12
13
14
15
16
17
18
19
20
21
22
23
# File 'app/controllers/kaui/account_emails_controller.rb', line 12

def create
  @account_email = Kaui::AccountEmail.new(params[:account_email])

   = Kaui::Account.new(:account_id => @account_email.)
  begin
    .add_email(@account_email.email, current_user.kb_username, params[:reason], params[:comment], options_for_klient)
    redirect_to (.), :notice => 'Account email was successfully added'
  rescue => e
    flash.now[:error] = "Error while adding the email: #{as_string(e)}"
    render :action => :new
  end
end

#destroyObject



25
26
27
28
29
30
31
32
33
34
35
# File 'app/controllers/kaui/account_emails_controller.rb', line 25

def destroy
   = Kaui::Account.new(:account_id => params[:id])

  begin
    .remove_email(params[:email], current_user.kb_username, params[:reason], params[:comment], options_for_klient)
    redirect_to (.), :notice => 'Account email was successfully deleted'
  rescue => e
    flash.now[:error] = "Error while deleting account email: #{as_string(e)}"
    render :action => :show, :id => .
  end
end

#newObject



8
9
10
# File 'app/controllers/kaui/account_emails_controller.rb', line 8

def new
  @account_email = Kaui::AccountEmail.new(:account_id => params[:account_id])
end

#showObject



3
4
5
6
# File 'app/controllers/kaui/account_emails_controller.rb', line 3

def show
  @account_id     = params[:id]
  @account_emails = Kaui::AccountEmail.(@account_id, 'NONE', options_for_klient)
end