Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
creating the checkout form. testing the output of the form.
- Loading branch information
1 parent
81110ed
commit c3e6978
Showing
3 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
class Order < ActiveRecord::Base | ||
has_many :line_items | ||
|
||
PAYMENT_TYPES = [ | ||
["Check", "check"], | ||
["Credit card", "cc"], | ||
["Purchase order", "po"] | ||
] | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<div class="depot-form"> | ||
|
||
<%= error_messages_for 'order' %> | ||
<% form_for :order, :url => {:action => :save_order} do |form| -%> | ||
<fieldset> | ||
<legend>Please Enter Your Details</legend> | ||
<p> | ||
<%= label :order, :name, "Name:" %> | ||
<%= form.text_field :name, :size => 40 %> | ||
</p> | ||
<p> | ||
<%= label :order, :address, "Address:" %> | ||
<%= form.text_area :address, :rows => 3, :cols => 40 %> | ||
</p> | ||
<p> | ||
<%= label :order, :email, "E-Mail:" %> | ||
<%= form.text_field :email, :size => 40 %> | ||
</p> | ||
|
||
<p> | ||
<%= label :order, :pay_type, "Pay with:" %> | ||
<%= | ||
form.select :pay_type, | ||
Order::PAYMENT_TYPES, | ||
:prompt => "Select a payment method" | ||
%> | ||
</p> | ||
<%= submit_tag "Place Order", :class => "submit" %> | ||
</fieldset> | ||
<% end -%> | ||
|
||
</div> |
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