Created
June 26, 2013 01:45
-
-
Save chadoh/5864122 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'sinatra' | |
get '/' do | |
haml :index | |
end | |
get '/result' do | |
loan_eligibility = params[:loan_length]/params[:loan_amount] + params[:income] - params[:expenses] | |
haml :result | |
end | |
__END__ | |
@@ layout | |
%html | |
%head | |
%title Terrible Loan Calculator | |
%body | |
= yield | |
@@ index | |
%h1 Enter a potential customer's details and find out if they qualify for a loan! | |
%form(method='get' action='/result') | |
%input(type='text' name='loan_length' placeholder='loan_length') | |
%input(type='text' name='loan_amount' placeholder='loan_amount') | |
%input(type='text' name='income' placeholder='income') | |
%input(type='text' name='expenses' placeholder='expenses') | |
%input(type='submit' value='Determine loan eligibility') | |
@@ result | |
%h1 Loan Eligibility: #{loan_eligibility} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment