app/controllers/clients_controller.rb
def add_new_login
    assert_params_must_have :id
    
    # Try adding new client login to system, any exceptions will be presented to user
    begin
      @client_new_login           = ClientsLogin.new
      @client_new_login.login     = params[:new_login]
      @client_new_login.password  = Digest::SHA1.hexdigest(params[:new_password])
      @client_new_login.client_id = params[:id]
      @client_new_login.save!
      @result_text = "Client added!"
    rescue Exception => exc
      @result_text = "Error: #{exc.message}"      
    end    
    
    render :update do |page|
      page.replace_html "client_logins", :partial => "list_logins"
      page['client_login_result_text'].innerHTML = @result_text
      page.visual_effect :highlight, "client_login_result_text"
    end
  end
#
# Adds new client login to system
# RJS action
#

Adds new client login to system
RJS action
Adds new client login to system RJS action
def add_new_login
    assert_params_must_have :id
    begin
      @client_new_login           = ClientsLogin.new
      @client_new_login.login     = params[:new_login]
      @client_new_login.password  = Digest::SHA1.hexdigest(params[:new_password])
      @client_new_login.client_id = params[:id]
      @client_new_login.save!
      @result_text = "Client added!"
    rescue Exception => exc
      @result_text = "Error: #{exc.message}"      
    end    
    render :update do |page|
      page.replace_html "client_logins", :partial => "list_logins"
      page['client_login_result_text'].innerHTML = @result_text
      page.visual_effect :highlight, "client_login_result_text"
    end
  end
def add_new_login assert_params_must_have :id begin @client_new_login = ClientsLogin . new @client_new_login . login = params [ :new_login ] @client_new_login . password = Digest :: SHA1 . hexdigest ( params [ :new_password ] ) @client_new_login . client_id = params [ :id ] @client_new_login . save! @result_text = "Client added!" rescue Exception => exc @result_text = "Error: #{exc.message}" end render :update do | page | page . replace_html "client_logins" , :partial => "list_logins" page [ 'client_login_result_text' ] . innerHTML = @result_text page . visual_effect :highlight , "client_login_result_text" end end
Adds new client login to system
RJS action
Adds new client login to system RJS action
# Try adding new client login to system, any exceptions will be presented to user
