diff --git a/.DS_Store b/.DS_Store
new file mode 100644
index 00000000..a3876594
Binary files /dev/null and b/.DS_Store differ
diff --git a/.gitignore b/.gitignore
index 3cf2c8c5..b45d58db 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,3 +17,5 @@ nbproject
coverage/
.sass-cache/
.vagrant/
+
+.DS_Store
diff --git a/Gemfile b/Gemfile
index 8dc7f8c2..3b2fb162 100644
--- a/Gemfile
+++ b/Gemfile
@@ -31,4 +31,6 @@ group :development, :test do
# webrat is needed to make some specs pass
gem 'webrat'
gem 'yard'
+ gem 'nifty-generators'
end
+gem "mocha", :group => :test
diff --git a/Gemfile.lock b/Gemfile.lock
index b0c9ab9c..d81d0fd5 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -75,11 +75,15 @@ GEM
nokogiri (~> 1.4)
ntlm-http (~> 0.1, >= 0.1.1)
webrobots (~> 0.0, >= 0.0.9)
+ metaclass (0.0.1)
mime-types (1.19)
+ mocha (0.14.0)
+ metaclass (~> 0.0.1)
multi_json (1.2.0)
net-http-digest_auth (1.2.1)
net-http-persistent (2.8)
net-ldap (0.3.1)
+ nifty-generators (0.4.6)
nokogiri (1.5.6)
ntlm-http (0.1.1)
pg (0.14.1)
@@ -185,7 +189,9 @@ DEPENDENCIES
haml-rails
jquery-rails (>= 0.2.6)
mechanize
+ mocha
net-ldap
+ nifty-generators
nokogiri
pg
rails (~> 3.1)
diff --git a/app/.DS_Store b/app/.DS_Store
new file mode 100644
index 00000000..57a40af0
Binary files /dev/null and b/app/.DS_Store differ
diff --git a/app/assets/.DS_Store b/app/assets/.DS_Store
new file mode 100644
index 00000000..df19a44a
Binary files /dev/null and b/app/assets/.DS_Store differ
diff --git a/app/assets/images/.DS_Store b/app/assets/images/.DS_Store
new file mode 100644
index 00000000..8e649cac
Binary files /dev/null and b/app/assets/images/.DS_Store differ
diff --git a/app/assets/images/icons/.DS_Store b/app/assets/images/icons/.DS_Store
new file mode 100644
index 00000000..bee662fd
Binary files /dev/null and b/app/assets/images/icons/.DS_Store differ
diff --git a/app/assets/images/store/add_to_cart.png b/app/assets/images/store/add_to_cart.png
new file mode 100644
index 00000000..be181088
Binary files /dev/null and b/app/assets/images/store/add_to_cart.png differ
diff --git a/app/assets/images/store/paypal_checkout.png b/app/assets/images/store/paypal_checkout.png
new file mode 100644
index 00000000..75a1e2e5
Binary files /dev/null and b/app/assets/images/store/paypal_checkout.png differ
diff --git a/app/assets/javascripts/product.js.coffee b/app/assets/javascripts/product.js.coffee
new file mode 100644
index 00000000..76156794
--- /dev/null
+++ b/app/assets/javascripts/product.js.coffee
@@ -0,0 +1,3 @@
+# Place all the behaviors and hooks related to the matching controller here.
+# All this logic will automatically be available in application.js.
+# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
diff --git a/app/assets/javascripts/store.js.coffee b/app/assets/javascripts/store.js.coffee
new file mode 100644
index 00000000..76156794
--- /dev/null
+++ b/app/assets/javascripts/store.js.coffee
@@ -0,0 +1,3 @@
+# Place all the behaviors and hooks related to the matching controller here.
+# All this logic will automatically be available in application.js.
+# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
diff --git a/app/assets/jquery-ui/.DS_Store b/app/assets/jquery-ui/.DS_Store
new file mode 100644
index 00000000..010ce48b
Binary files /dev/null and b/app/assets/jquery-ui/.DS_Store differ
diff --git a/app/assets/stylesheets/carts.css.scss b/app/assets/stylesheets/carts.css.scss
new file mode 100644
index 00000000..d1240e43
--- /dev/null
+++ b/app/assets/stylesheets/carts.css.scss
@@ -0,0 +1,44 @@
+// Place all the styles related to the Store controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
+
+.store-banner-area{
+ position: relative;
+}
+
+#store-banner-welcome-msg{
+}
+
+#store-banner-subtitle{
+ font-style: italic;
+}
+
+.store-content-area{
+ position: relative;
+ margin-top: 50px;
+}
+
+
+@mixin default-left{
+ position: relative;
+ float: left;
+ width: 75%;
+ padding-right: 10px;
+}
+
+
+.store-cart-area{
+ @include default-left;
+
+ #checkout-button{
+ float: right;
+ }
+}
+
+
+.store-sidebar{
+ position: relative;
+ float: right;
+ width: 20%;
+ padding-left: 10px;
+}
diff --git a/app/assets/stylesheets/product.css.scss b/app/assets/stylesheets/product.css.scss
new file mode 100644
index 00000000..896706d8
--- /dev/null
+++ b/app/assets/stylesheets/product.css.scss
@@ -0,0 +1,131 @@
+// Place all the styles related to the Store controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
+
+.store-banner-area{
+ position: relative;
+}
+
+#store-banner-welcome-msg{
+}
+
+#store-banner-subtitle{
+ font-style: italic;
+}
+
+.store-content-area{
+ position: relative;
+ margin-top: 50px;
+}
+
+
+@mixin default-left{
+ position: relative;
+ float: left;
+ width: 75%;
+ padding-right: 10px;
+}
+
+.store-product-listings{
+ @include default-left;
+}
+
+
+.single-product-listings{
+ @include default-left;
+
+ .single-product-image{
+ position: relative;
+ .image{max-width: 100%;}
+ }
+
+
+ .left-info{
+ position: relative;
+ float: left;
+ width: 70%;
+
+ .product-name{
+ font-size: 40px;
+ }
+ }
+
+ .right-info{
+ position: relative;
+ float: right;;
+ width: 20%;
+
+ .product-price{
+ font-size: 40px;
+ }
+
+ }
+
+ .description{
+ clear: both;
+ position: relative;
+ float: left;
+ }
+
+ .checkout{
+ position: relative;
+ float: right;
+ }
+}
+
+.store-sidebar{
+ position: relative;
+ float: right;
+ width: 20%;
+ padding-left: 10px;
+}
+
+.product-box{
+ position: relative;
+ float: left;
+ width: 250px;
+ height: 156px;
+ background-color: BLACK;
+ margin: 10px;
+ overflow: hidden;
+
+ .product-info-box{
+ position: absolute;
+ bottom: 0px;
+ left: 0;
+ width: 100%;
+ padding: 0 10px;
+ background-color: WHITE;
+ opacity: 0.7;
+
+ .product-name{
+ font-weight: bold;
+ font: bold 20px Cuprum;
+ color: #403f3f;
+ }
+
+ .product-description{
+ text-overflow: ellipsis;
+ /* need following for ellipsis effect */
+ display: block;
+ white-space: nowrap;
+ overflow: hidden;
+ }
+
+ .product-price{
+ font-size: 20px;
+ }
+ }
+
+ .product-image{
+ position: relative;
+ width: 250px;
+ height: 156px;
+ z-index: 0;
+ }
+
+}
+
+
+
+
diff --git a/app/assets/stylesheets/store.css.scss b/app/assets/stylesheets/store.css.scss
new file mode 100644
index 00000000..c7d4ed07
--- /dev/null
+++ b/app/assets/stylesheets/store.css.scss
@@ -0,0 +1,84 @@
+// Place all the styles related to the Store controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
+
+.store-banner-area{
+ position: relative;
+}
+
+#store-banner-welcome-msg{
+}
+
+#store-banner-subtitle{
+ font-style: italic;
+}
+
+.store-content-area{
+ position: relative;
+ margin-top: 50px;
+}
+
+.store-product-listings{
+ position: relative;
+ float: left;
+ width: 75%;
+ padding-right: 10px;
+
+}
+
+.store-sidebar{
+ position: relative;
+ float: right;
+ width: 20%;
+ padding-left: 10px;
+}
+
+.product-box{
+ position: relative;
+ float: left;
+ width: 250px;
+ height: 156px;
+ background-color: BLACK;
+ margin: 10px;
+ overflow: hidden;
+
+ .product-info-box{
+ position: absolute;
+ bottom: 0px;
+ left: 0;
+ width: 100%;
+ padding: 0 10px;
+ background-color: WHITE;
+ opacity: 0.7;
+
+ .product-name{
+ font-weight: bold;
+ font: bold 20px Cuprum;
+ color: #403f3f;
+ }
+
+ .product-description{
+ text-overflow: ellipsis;
+ /* need following for ellipsis effect */
+ display: block;
+ white-space: nowrap;
+ overflow: hidden;
+ }
+
+ .product-price{
+ font-size: 20px;
+ }
+ }
+
+ .product-image{
+ position: relative;
+ width: 250px;
+ height: 156px;
+ z-index: 0;
+ }
+
+}
+
+
+
+
diff --git a/app/controllers/.DS_Store b/app/controllers/.DS_Store
new file mode 100644
index 00000000..52b02851
Binary files /dev/null and b/app/controllers/.DS_Store differ
diff --git a/app/controllers/admin/admin_controller.rb b/app/controllers/admin/admin_controller.rb
index b371e7fd..64f4a393 100644
--- a/app/controllers/admin/admin_controller.rb
+++ b/app/controllers/admin/admin_controller.rb
@@ -1,5 +1,5 @@
class Admin::AdminController < ApplicationController
- #before_filter :authorize_officers, :except=>[:signup_slots, :signup_courses, :update_slots, :add_course, :find_courses]
+ before_filter :authorize_officers, :except=>[:signup_slots, :signup_courses, :update_slots, :add_course, :find_courses]
before_filter :authorize_comms, :except=>[:signup_slots, :signup_courses, :update_slots, :add_course, :find_courses]
def super_page
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 367a6ed1..18eabe91 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -173,5 +173,10 @@ def redirect_back_or_default(path, *args)
send(:redirect_to, request.referer || path, *args)
end
+ def current_cart
+ session[:cart_id] ||= Cart.create!.id
+ @current_cart ||= Cart.find(session[:cart_id])
+ return @current_cart
+ end
end
diff --git a/app/controllers/carts_controller.rb b/app/controllers/carts_controller.rb
new file mode 100644
index 00000000..f966b6db
--- /dev/null
+++ b/app/controllers/carts_controller.rb
@@ -0,0 +1,19 @@
+class CartsController < ApplicationController
+ # def new
+ # @cart = Cart.new
+ # end
+
+ # def create
+ # @cart = Cart.new(params[:cart])
+ # if @cart.save
+ # redirect_to root_url, :notice => "Successfully created cart."
+ # else
+ # render :action => 'new'
+ # end
+ # end
+
+ def show
+ @cart = current_cart
+ end
+
+end
diff --git a/app/controllers/line_items_controller.rb b/app/controllers/line_items_controller.rb
new file mode 100644
index 00000000..474cc4a4
--- /dev/null
+++ b/app/controllers/line_items_controller.rb
@@ -0,0 +1,10 @@
+class LineItemsController < ApplicationController
+
+ def create
+ @product = Sellable.find(params[:pid])
+ @line_item = LineItem.create!(:cart => current_cart, :sellable => @product, :quantity => 1, :unit_price => @product.price)
+ flash[:notice] = "Added #{@product.name} to cart."
+ redirect_to cart_path(id: current_cart.id)
+ end
+
+end
diff --git a/app/controllers/orders_controller.rb b/app/controllers/orders_controller.rb
new file mode 100644
index 00000000..224fa26b
--- /dev/null
+++ b/app/controllers/orders_controller.rb
@@ -0,0 +1,14 @@
+class OrdersController < ApplicationController
+ def new
+ @order = Order.new
+ end
+
+ def create
+ @order = Order.new(params[:order])
+ if @order.save
+ redirect_to root_url, :notice => "Successfully created order."
+ else
+ render :action => 'new'
+ end
+ end
+end
diff --git a/app/controllers/product_controller.rb b/app/controllers/product_controller.rb
new file mode 100644
index 00000000..caf580c1
--- /dev/null
+++ b/app/controllers/product_controller.rb
@@ -0,0 +1,102 @@
+class ProductController < ApplicationController
+ # before_filter :authorize_studrel, except: [:index, :show]
+
+ def index
+ @products = Sellable.all
+ end
+
+ def show
+ @product = Sellable.find(params[:pid])
+ end
+
+ def new
+ end
+
+ def create
+
+ # if image_info = params[:product][:image_info]
+ # File.open(img_location(params[:pid]),"wb") do |f|
+ # f.write(image_info.read)
+ # end
+ # params[:product][:image] = create_image_field(params[:pid])
+ # else
+ # flash[:notice] = "Please attach picture"
+ # render 'new'
+ # return
+ # end
+
+ #First we check for image existence
+ unless image_info = params[:product][:image_info]
+ flash[:notice] = "Please attach picture"
+ render 'new'
+ return
+ end
+
+ # Now we can create a record
+ params[:product][:image] = create_image_field('default') #create default path
+ @product = Sellable.new(params[:product].except(:image_info))
+
+ unless @product.valid?
+ flash[:notice] = "Please fill out all the fields"
+ render 'new'
+ return
+ end
+ @product.save
+
+ # Now we can load the image and correct the image path
+ if image_info
+ File.open(img_location(@product.id),"wb") do |f|
+ f.write(image_info.read)
+ end
+ @product.image = create_image_field(@product.id)
+ end
+
+ #Finally we save
+ @product.save
+ flash[:notice] = "Saved"
+ redirect_to show_path(@product)
+ end
+
+ def edit
+ @product = Sellable.find(params[:pid])
+ end
+
+ def update
+ @product = Sellable.find(params[:pid])
+
+ unless @product.update_attributes(params[:product].except(:image_info))
+ render 'edit'
+ return
+ end
+
+ if image_info = params[:product][:image_info]
+ File.open(img_location(@product.id),"wb") do |f|
+ f.write(image_info.read)
+ end
+ @product.image = create_image_field(@product.id)
+ end
+
+ @product.save
+ flash[:notice] = "Saved"
+ redirect_to show_path(@product)
+
+ end
+
+ def destroy
+ @product = Sellable.find(params[:pid])
+ @product.destroy
+ redirect_to store_path
+ end
+
+
+ private
+
+ def img_location(pid)
+ "public/pictures/product_images/#{pid}.png"
+ end
+
+ def create_image_field(pid)
+ "/pictures/product_images/#{pid}.png"
+ end
+
+end
diff --git a/app/controllers/store_controller.rb b/app/controllers/store_controller.rb
new file mode 100644
index 00000000..484d8649
--- /dev/null
+++ b/app/controllers/store_controller.rb
@@ -0,0 +1,6 @@
+class StoreController < ApplicationController
+ def index
+ @products = Sellable.all
+ end
+
+end
diff --git a/app/helpers/.DS_Store b/app/helpers/.DS_Store
new file mode 100644
index 00000000..3942967c
Binary files /dev/null and b/app/helpers/.DS_Store differ
diff --git a/app/helpers/carts_helper.rb b/app/helpers/carts_helper.rb
new file mode 100644
index 00000000..d99c380c
--- /dev/null
+++ b/app/helpers/carts_helper.rb
@@ -0,0 +1,2 @@
+module CartsHelper
+end
diff --git a/app/helpers/line_items_helper.rb b/app/helpers/line_items_helper.rb
new file mode 100644
index 00000000..8f607daa
--- /dev/null
+++ b/app/helpers/line_items_helper.rb
@@ -0,0 +1,2 @@
+module LineItemsHelper
+end
diff --git a/app/helpers/orders_helper.rb b/app/helpers/orders_helper.rb
new file mode 100644
index 00000000..443227fd
--- /dev/null
+++ b/app/helpers/orders_helper.rb
@@ -0,0 +1,2 @@
+module OrdersHelper
+end
diff --git a/app/helpers/product_helper.rb b/app/helpers/product_helper.rb
new file mode 100644
index 00000000..4b68e4d3
--- /dev/null
+++ b/app/helpers/product_helper.rb
@@ -0,0 +1,3 @@
+module ProductHelper
+
+end
diff --git a/app/helpers/store_helper.rb b/app/helpers/store_helper.rb
new file mode 100644
index 00000000..92636194
--- /dev/null
+++ b/app/helpers/store_helper.rb
@@ -0,0 +1,2 @@
+module StoreHelper
+end
diff --git a/app/models/cart.rb b/app/models/cart.rb
new file mode 100644
index 00000000..762ce66d
--- /dev/null
+++ b/app/models/cart.rb
@@ -0,0 +1,39 @@
+class Cart < ActiveRecord::Base
+
+ # === List of columns ===
+ # id : integer
+ # purchased_at : datetime
+ # created_at : datetime
+ # updated_at : datetime
+ # =======================
+
+
+
+ has_many :line_items
+
+ def total_price
+ # convert to array so it doesn't try to do sum on database directly
+ line_items.to_a.sum(&:full_price)
+ end
+
+ def paypal_url(return_url)
+ values = {
+ :business => 'hkn_seller@hkn.com',
+ :cmd => '_cart',
+ :upload => 1,
+ :return => return_url,
+ :invoice => id
+ }
+ line_items.each_with_index do |item, index|
+ values.merge!({
+ "amount_#{index+1}" => item.unit_price,
+ "item_name_#{index+1}" => item.sellable.name,
+ "item_number_#{index+1}" => item.id,
+ "quantity_#{index+1}" => item.quantity
+ })
+ end
+ #delete "sandbox from URL to enable production mode"
+ return "https://www.sandbox.paypal.com/cgi-bin/webscr?" + values.to_query
+ end
+end
+
diff --git a/app/models/line_item.rb b/app/models/line_item.rb
new file mode 100644
index 00000000..4b54fda2
--- /dev/null
+++ b/app/models/line_item.rb
@@ -0,0 +1,19 @@
+class LineItem < ActiveRecord::Base
+
+ # === List of columns ===
+ # id : integer
+ # created_at : datetime
+ # updated_at : datetime
+ # quantity : integer
+ # unit_price : integer
+ # cart_id : integer
+ # sellable_id : integer
+ # =======================
+
+ belongs_to :cart
+ belongs_to :sellable
+
+ def full_price
+ unit_price * quantity
+ end
+end
diff --git a/app/models/order.rb b/app/models/order.rb
new file mode 100644
index 00000000..84d17094
--- /dev/null
+++ b/app/models/order.rb
@@ -0,0 +1,16 @@
+class Order < ActiveRecord::Base
+
+ # === List of columns ===
+ # id : integer
+ # card_id : integer
+ # ip_address : string
+ # first_name : string
+ # last_name : string
+ # card_type : string
+ # card_expires_on : date
+ # created_at : datetime
+ # updated_at : datetime
+ # =======================
+
+ attr_accessible :card_id, :ip_address, :first_name, :last_name, :card_type, :card_expires_on
+end
diff --git a/app/models/sellable.rb b/app/models/sellable.rb
new file mode 100644
index 00000000..4e9266de
--- /dev/null
+++ b/app/models/sellable.rb
@@ -0,0 +1,30 @@
+class Sellable < ActiveRecord::Base
+
+ # === List of columns ===
+ # id : integer
+ # name : string
+ # price : decimal
+ # category : string
+ # description : text
+ # created_at : datetime
+ # updated_at : datetime
+ # image : string
+ # =======================
+
+ validates :name, presence: true
+ validates :price, presence: true
+ validates :category, presence: true
+ validates :image, presence: true
+
+ # Returns the raw location for saving purposes
+ def image_location()
+ return "public/pictures/product_images/#{id}.png"
+ end
+
+ # Save the image field, so image_tag(product.image) can be used
+ def initialize_image_field()
+ image = "/pictures/product_images/#{id}.png"
+ end
+
+
+end
diff --git a/app/views/.DS_Store b/app/views/.DS_Store
new file mode 100644
index 00000000..64c35688
Binary files /dev/null and b/app/views/.DS_Store differ
diff --git a/app/views/admin/.DS_Store b/app/views/admin/.DS_Store
new file mode 100644
index 00000000..593433f2
Binary files /dev/null and b/app/views/admin/.DS_Store differ
diff --git a/app/views/carts/purchase.html.erb b/app/views/carts/purchase.html.erb
new file mode 100644
index 00000000..9e78feff
--- /dev/null
+++ b/app/views/carts/purchase.html.erb
@@ -0,0 +1,4 @@
+<% title "Purchase Successful" %>
+
+
Thank you for your order! We will process it within one business day.
+<%= link_to "Back to Products", products_path %>
\ No newline at end of file
diff --git a/app/views/carts/show.html.erb b/app/views/carts/show.html.erb
new file mode 100644
index 00000000..cfbc6beb
--- /dev/null
+++ b/app/views/carts/show.html.erb
@@ -0,0 +1,44 @@
+HKN Shopping Cart
+
+<%= render 'product/banner' %>
+
+
+
+
+
+
+
+ | Product |
+ Qty |
+ Unit Price |
+ Full Price |
+
+ <% @cart.line_items.each do |line_item| %>
+
+ | <%=h line_item.sellable.name %> |
+ <%= line_item.quantity %> |
+ <%= number_to_currency(line_item.unit_price) %> |
+ <%= number_to_currency(line_item.full_price) %> |
+
+ <% end %>
+
+ |
+ Total: <%= number_to_currency @cart.total_price %>
+ |
+
+
+
+
+ <%= link_to "Continue Shopping", store_path %>
+ <%= link_to (image_tag 'store/paypal_checkout.png', id: 'checkout-button'), @cart.paypal_url(store_path)%>
+
+
+
+
+
+ <%= render 'product/sidebar' %>
+
+
+
+
+
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
index b0884825..ceb088d6 100644
--- a/app/views/layouts/application.html.erb
+++ b/app/views/layouts/application.html.erb
@@ -41,15 +41,20 @@
Welcome, <%= link_to @current_user.full_name, @current_user %>
+
Settings
Logout
<%= @current_user.username %>
<% else %>
- <%= link_to "Log In", "/login"%> | <%= link_to "Register", "/register"%>
+
+ <%= link_to "Log In", "/login"%> | <%= link_to "Register", "/register"%>
guest
<% end %>
+
+ <%= link_to 'Store', store_path %>
+
<%= render 'notifications/notifications' if @auth['comms'] %>
diff --git a/app/views/orders/new.html.erb b/app/views/orders/new.html.erb
new file mode 100644
index 00000000..fa05235b
--- /dev/null
+++ b/app/views/orders/new.html.erb
@@ -0,0 +1,32 @@
+<% title "New Order" %>
+
+<%= form_for @order do |f| %>
+ <%= f.error_messages %>
+
+ <%= f.label :card_id %>
+ <%= f.number_field :card_id %>
+
+
+ <%= f.label :ip_address %>
+ <%= f.text_field :ip_address %>
+
+
+ <%= f.label :first_name %>
+ <%= f.text_field :first_name %>
+
+
+ <%= f.label :last_name %>
+ <%= f.text_field :last_name %>
+
+
+ <%= f.label :card_type %>
+ <%= f.text_field :card_type %>
+
+
+ <%= f.label :card_expires_on %>
+ <%= f.date_select :card_expires_on %>
+
+ <%= f.submit %>
+<% end %>
+
+
diff --git a/app/views/product/_banner.html.erb b/app/views/product/_banner.html.erb
new file mode 100644
index 00000000..92fc4d2b
--- /dev/null
+++ b/app/views/product/_banner.html.erb
@@ -0,0 +1,4 @@
+
+
Welcome to HKN Gear Store
+ All money is a matter of belief. - Adam Smith
+
\ No newline at end of file
diff --git a/app/views/product/_sidebar.html.erb b/app/views/product/_sidebar.html.erb
new file mode 100644
index 00000000..a8b115cd
--- /dev/null
+++ b/app/views/product/_sidebar.html.erb
@@ -0,0 +1,16 @@
+
\ No newline at end of file
diff --git a/app/views/product/destroy.html.haml b/app/views/product/destroy.html.haml
new file mode 100644
index 00000000..e8c72b5f
--- /dev/null
+++ b/app/views/product/destroy.html.haml
@@ -0,0 +1,2 @@
+%h1 Product#destroy
+%p Find me in app/views/product/destroy.html.haml
\ No newline at end of file
diff --git a/app/views/product/edit.html.erb b/app/views/product/edit.html.erb
new file mode 100644
index 00000000..5ab1819f
--- /dev/null
+++ b/app/views/product/edit.html.erb
@@ -0,0 +1,48 @@
+Editing Product
+
+<%= form_for :product, url: update_path(@product), method: :put do |f| %>
+ <% if @product.errors.any? %>
+
+
<%= pluralize(@product.errors.count, "error") %> prohibited
+ this post from being saved:
+
+ <% @product.errors.full_messages.each do |msg| %>
+ - <%= msg %>
+ <% end %>
+
+
+ <% end %>
+
+ <%= image_tag @product.image unless @product.image.blank? %>
+
+
+ <%= f.label :Image %>
+ <%= f.file_field :image_info %>
+
+
+
+ <%= f.label :Name %>
+ <%= f.text_field :name %>
+
+
+
+
+ <%= f.label :Category %>
+ <%= f.text_field :category %>
+
+
+
+ <%= f.label :Price %>
+ <%= f.number_field :price %>
+
+
+ <%= f.label :Description %>
+ <%= f.text_area :description %>
+
+
+
+ <%= f.submit %>
+
+<% end %>
+
+<%= link_to 'Back', show_path(@product) %>
\ No newline at end of file
diff --git a/app/views/product/index.html.erb b/app/views/product/index.html.erb
new file mode 100644
index 00000000..9af870a7
--- /dev/null
+++ b/app/views/product/index.html.erb
@@ -0,0 +1,28 @@
+<%= render 'banner' %>
+
+
+
+ <% @products.each do |product| %>
+
+
+
><%= image_tag product.image, class:'product-image' %>
+
+
+ <%= link_to product.name, show_path(product), class:'product-name' %>
+ $<%= product.price %>
+
+ <%= product.description %>
+ <% if true %>
+
+ <%= link_to 'Delete', delete_path(product), method: :destroy, confirm: 'Are you sure you want to delete this product?' %> |
+ <%= link_to 'Edit', edit_path(product) %>
+ <% end %>
+
+
+ <% end %>
+
+
+
+ <%= render 'sidebar' %>
+
+
\ No newline at end of file
diff --git a/app/views/product/new.html.erb b/app/views/product/new.html.erb
new file mode 100644
index 00000000..351bc98b
--- /dev/null
+++ b/app/views/product/new.html.erb
@@ -0,0 +1,30 @@
+<%= form_for :product do |f| %>
+
+ <%= f.label :Name %>
+ <%= f.text_field :name %>
+
+
+
+ <%= f.label :Category %>
+ <%= f.text_field :category %>
+
+
+
+ <%= f.label :Price %>
+ <%= f.number_field :price %>
+
+
+
+ <%= f.label :Description %>
+ <%= f.text_area :description %>
+
+
+
+ <%= f.label :Image %>
+ <%= f.file_field :image_info %>
+
+
+
+ <%= f.submit %>
+
+<% end %>
\ No newline at end of file
diff --git a/app/views/product/show.html.erb b/app/views/product/show.html.erb
new file mode 100644
index 00000000..79b6a4c5
--- /dev/null
+++ b/app/views/product/show.html.erb
@@ -0,0 +1,29 @@
+<%= render 'banner' %>
+
+
+
<%= link_to '< Back to Store', store_path %>
+
+
+
+ <%= image_tag @product.image, class:'image' unless @product.image.blank? %>
+
+
+
+
<%= @product.name%>
+
+
+
$<%= @product.price%>
+
+
+
+
Category: <%= @product.category%>
+
<%= @product.description%>
+
+
+
+ <%= link_to (image_tag 'store/add_to_cart.png'), line_items_path(pid: @product.id), method: :post %>
+
+
+ <%= render 'sidebar' %>
+
+
\ No newline at end of file
diff --git a/app/views/product/update.html.haml b/app/views/product/update.html.haml
new file mode 100644
index 00000000..91962101
--- /dev/null
+++ b/app/views/product/update.html.haml
@@ -0,0 +1,2 @@
+%h1 Product#update
+%p Find me in app/views/product/update.html.haml
\ No newline at end of file
diff --git a/app/views/store/index.html.erb b/app/views/store/index.html.erb
new file mode 100644
index 00000000..2e722c9b
--- /dev/null
+++ b/app/views/store/index.html.erb
@@ -0,0 +1,32 @@
+
+
Welcome to HKN Gear Store
+ All money is a matter of belief. - Adam Smith
+
+
+
+
+ <% @products.each do |product| %>
+
+
+
><%= image_tag product.image, class:'product-image' %>
+
+
+ <%= link_to product.name, show_path(product), class:'product-name' %>
+ $<%= product.price %>
+ <%= product.description %>
+ <%= link_to 'Delete', delete_path(product), method: :destroy, confirm: 'Are you sure you want to delete this product?' %> |
+ <%= link_to 'Edit', edit_path(product) %>
+
+
+ <% end %>
+
+
+
+
+
\ No newline at end of file
diff --git a/config/.DS_Store b/config/.DS_Store
new file mode 100644
index 00000000..bae92f64
Binary files /dev/null and b/config/.DS_Store differ
diff --git a/config/routes.rb b/config/routes.rb
index 9cb1d399..788a225d 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,5 +1,27 @@
HknRails::Application.routes.draw do
+
+
+ scope 'store' do
+ # get '/', to: 'store#index', as: 'store'
+ # resources :product
+ # get "product/index"
+
+ resources :line_items
+ resources :carts
+ resources :orders
+
+ # current_cart 'cart', controller: 'carts', action: 'show', id: 'current'
+
+ get '/', to: 'product#index', as: 'store'
+ get '/product/:pid' => "product#show", as: 'show'
+ get '/new' => 'product#new', as: 'new'
+ post 'new' => 'product#create', as: 'create'
+ get '/product/:pid/edit' => "product#edit", as: 'edit'
+ put '/product/:pid/edit' => "product#update", as: 'update'
+ post '/product/:pid/delete' => "product#destroy", as: 'delete'
+ end
+
match "test_exception_notification" => "application#test_exception_notification"
#Department tours
@@ -17,11 +39,11 @@
match "reject_challenge/:id" => "admin#reject_challenge"
# TODO: Shouldn't this be done with resources?
scope "candidate_announcements" do
- match "/" => "admin#candidate_announcements"
- post "create_announcement" => "admin#create_announcement", :as => "create_announcement"
- match "edit_announcement/:id" => "admin#edit_announcement", :as => "edit_announcement"
- post "update_announcement" => "admin#update_announcement", :as => "update_announcement"
- match "delete_announcement/:id" => "admin#delete_announcement", :as => "delete_announcement"
+ match "/" => "admin#candidate_announcements"
+ post "create_announcement" => "admin#create_announcement", :as => "create_announcement"
+ match "edit_announcement/:id" => "admin#edit_announcement", :as => "edit_announcement"
+ post "update_announcement" => "admin#update_announcement", :as => "update_announcement"
+ match "delete_announcement/:id" => "admin#delete_announcement", :as => "delete_announcement"
end
end
@@ -43,12 +65,12 @@
end
scope "election", :as => "election" do
- get "details" => "elections#details", :as => :details
+ get "details" => "elections#details", :as => :details
- put "edit_details/:username" => "elections#update_details", :as => :update_details, :constraints => {:username => /.+/}
- get "edit_details/:username" => "elections#edit_details", :as => :edit_details, :constraints => {:username => /.+/}
+ put "edit_details/:username" => "elections#update_details", :as => :update_details, :constraints => {:username => /.+/}
+ get "edit_details/:username" => "elections#edit_details", :as => :edit_details, :constraints => {:username => /.+/}
- get "minutes" => "elections#election_minutes", :as => :minutes
+ get "minutes" => "elections#election_minutes", :as => :minutes
end
scope "pres" do
@@ -138,13 +160,12 @@
member do
post "respond"
#for some reason this stopped working... :(
- post "dismiss" => "dept_tour_requests#destroy"
+ post "dismiss" => "dept_tour_requests#destroy"
+ end
end
- end
-
- get "home/index"
- root :to => "home#index"
+ get "home/index"
+ root :to => "home#index"
# Login
get "login" => "user_sessions#new", :as => :login
@@ -327,18 +348,18 @@
# Exams
scope "exams" do
match '/' => "exams#index",
- :as => :exams
+ :as => :exams
match "search(/:q)" => "exams#search",
- :as => :exams_search
+ :as => :exams_search
match "course/:dept_abbr" => "exams#department",
- :as => :exams_department
+ :as => :exams_department
match "course/:dept_abbr/:full_course_number" => "exams#course",
- :as => :exams_course
+ :as => :exams_course
match 'course' => redirect('/exams')
get 'new' => "exams#new",
- :as => :exams_new
+ :as => :exams_new
post 'create' => "exams#create",
- :as => :exams_create
+ :as => :exams_create
end
#resources :exams
diff --git a/db/.DS_Store b/db/.DS_Store
new file mode 100644
index 00000000..97a45759
Binary files /dev/null and b/db/.DS_Store differ
diff --git a/db/migrate/20131201020545_create_sellables.rb b/db/migrate/20131201020545_create_sellables.rb
new file mode 100644
index 00000000..3f9c3c64
--- /dev/null
+++ b/db/migrate/20131201020545_create_sellables.rb
@@ -0,0 +1,13 @@
+class CreateSellables < ActiveRecord::Migration
+ def change
+ create_table :sellables do |t|
+ t.string :name
+ t.decimal :price
+ t.string :category
+ t.text :description
+ t.binary :image
+
+ t.timestamps
+ end
+ end
+end
diff --git a/db/migrate/20131201064613_remove_image_from_sellables.rb b/db/migrate/20131201064613_remove_image_from_sellables.rb
new file mode 100644
index 00000000..6320c0d2
--- /dev/null
+++ b/db/migrate/20131201064613_remove_image_from_sellables.rb
@@ -0,0 +1,9 @@
+class RemoveImageFromSellables < ActiveRecord::Migration
+ def up
+ remove_column :sellables, :image
+ end
+
+ def down
+ add_column :sellables, :image, :binary
+ end
+end
diff --git a/db/migrate/20131201064652_add_image_to_sellables.rb b/db/migrate/20131201064652_add_image_to_sellables.rb
new file mode 100644
index 00000000..0afbcf49
--- /dev/null
+++ b/db/migrate/20131201064652_add_image_to_sellables.rb
@@ -0,0 +1,5 @@
+class AddImageToSellables < ActiveRecord::Migration
+ def change
+ add_column :sellables, :image, :string
+ end
+end
diff --git a/db/migrate/20131203064727_create_orders.rb b/db/migrate/20131203064727_create_orders.rb
new file mode 100644
index 00000000..ef8a1887
--- /dev/null
+++ b/db/migrate/20131203064727_create_orders.rb
@@ -0,0 +1,17 @@
+class CreateOrders < ActiveRecord::Migration
+ def self.up
+ create_table :orders do |t|
+ t.integer :card_id
+ t.string :ip_address
+ t.string :first_name
+ t.string :last_name
+ t.string :card_type
+ t.date :card_expires_on
+ t.timestamps
+ end
+ end
+
+ def self.down
+ drop_table :orders
+ end
+end
diff --git a/db/migrate/20131203071438_create_carts.rb b/db/migrate/20131203071438_create_carts.rb
new file mode 100644
index 00000000..8cc52b8b
--- /dev/null
+++ b/db/migrate/20131203071438_create_carts.rb
@@ -0,0 +1,12 @@
+class CreateCarts < ActiveRecord::Migration
+ def self.up
+ create_table :carts do |t|
+ t.datetime :purchased_at
+ t.timestamps
+ end
+ end
+
+ def self.down
+ drop_table :carts
+ end
+end
diff --git a/db/migrate/20131203075340_create_line_items.rb b/db/migrate/20131203075340_create_line_items.rb
new file mode 100644
index 00000000..71b1cc46
--- /dev/null
+++ b/db/migrate/20131203075340_create_line_items.rb
@@ -0,0 +1,8 @@
+class CreateLineItems < ActiveRecord::Migration
+ def change
+ create_table :line_items do |t|
+
+ t.timestamps
+ end
+ end
+end
diff --git a/db/migrate/20131203082701_add_details_to_line_item.rb b/db/migrate/20131203082701_add_details_to_line_item.rb
new file mode 100644
index 00000000..bf7df791
--- /dev/null
+++ b/db/migrate/20131203082701_add_details_to_line_item.rb
@@ -0,0 +1,6 @@
+class AddDetailsToLineItem < ActiveRecord::Migration
+ def change
+ add_column :line_items, :quantity, :integer
+ add_column :line_items, :unit_price, :integer
+ end
+end
diff --git a/db/migrate/20131203091527_add_more_details_to_line_item.rb b/db/migrate/20131203091527_add_more_details_to_line_item.rb
new file mode 100644
index 00000000..255cf94c
--- /dev/null
+++ b/db/migrate/20131203091527_add_more_details_to_line_item.rb
@@ -0,0 +1,6 @@
+class AddMoreDetailsToLineItem < ActiveRecord::Migration
+ def change
+ add_column :line_items, :cart_id, :integer
+ add_column :line_items, :sellable_id, :integer
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 9faa9f09..7d6bbbd4 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20130519233001) do
+ActiveRecord::Schema.define(:version => 20131203091527) do
create_table "alumnis", :force => true do |t|
t.string "grad_semester"
@@ -87,6 +87,12 @@
t.integer "quiz_score", :default => 0, :null => false
end
+ create_table "carts", :force => true do |t|
+ t.datetime "purchased_at"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
create_table "challenges", :force => true do |t|
t.string "name"
t.text "description"
@@ -338,6 +344,15 @@
t.datetime "updated_at"
end
+ create_table "line_items", :force => true do |t|
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.integer "quantity"
+ t.integer "unit_price"
+ t.integer "cart_id"
+ t.integer "sellable_id"
+ end
+
create_table "locations", :force => true do |t|
t.string "name"
t.integer "capacity"
@@ -353,6 +368,17 @@
t.datetime "updated_at"
end
+ create_table "orders", :force => true do |t|
+ t.integer "card_id"
+ t.string "ip_address"
+ t.string "first_name"
+ t.string "last_name"
+ t.string "card_type"
+ t.date "card_expires_on"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
create_table "people", :force => true do |t|
t.string "first_name", :null => false
t.string "last_name", :null => false
@@ -440,6 +466,16 @@
t.datetime "updated_at"
end
+ create_table "sellables", :force => true do |t|
+ t.string "name"
+ t.decimal "price"
+ t.string "category"
+ t.text "description"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.string "image"
+ end
+
create_table "sessions", :force => true do |t|
t.string "session_id", :null => false
t.text "data"
diff --git a/lib/.DS_Store b/lib/.DS_Store
new file mode 100644
index 00000000..7c06f185
Binary files /dev/null and b/lib/.DS_Store differ
diff --git a/public/.DS_Store b/public/.DS_Store
new file mode 100644
index 00000000..9ab0b85e
Binary files /dev/null and b/public/.DS_Store differ
diff --git a/public/pictures/.DS_Store b/public/pictures/.DS_Store
new file mode 100644
index 00000000..9bd69bca
Binary files /dev/null and b/public/pictures/.DS_Store differ
diff --git a/public/pictures/product_images/.png b/public/pictures/product_images/.png
new file mode 100644
index 00000000..dce04006
Binary files /dev/null and b/public/pictures/product_images/.png differ
diff --git a/public/pictures/product_images/11.png b/public/pictures/product_images/11.png
new file mode 100644
index 00000000..dc7295c6
Binary files /dev/null and b/public/pictures/product_images/11.png differ
diff --git a/public/pictures/product_images/12.png b/public/pictures/product_images/12.png
new file mode 100644
index 00000000..88e34d21
Binary files /dev/null and b/public/pictures/product_images/12.png differ
diff --git a/public/pictures/product_images/13.png b/public/pictures/product_images/13.png
new file mode 100644
index 00000000..2a0735b6
Binary files /dev/null and b/public/pictures/product_images/13.png differ
diff --git a/public/pictures/product_images/14.png b/public/pictures/product_images/14.png
new file mode 100644
index 00000000..5109d707
Binary files /dev/null and b/public/pictures/product_images/14.png differ
diff --git a/public/pictures/product_images/15.png b/public/pictures/product_images/15.png
new file mode 100644
index 00000000..09488b7b
Binary files /dev/null and b/public/pictures/product_images/15.png differ
diff --git a/public/pictures/product_images/16.png b/public/pictures/product_images/16.png
new file mode 100644
index 00000000..fd9bae37
Binary files /dev/null and b/public/pictures/product_images/16.png differ
diff --git a/public/pictures/product_images/18.png b/public/pictures/product_images/18.png
new file mode 100644
index 00000000..9d5531d5
Binary files /dev/null and b/public/pictures/product_images/18.png differ
diff --git a/public/pictures/product_images/19.png b/public/pictures/product_images/19.png
new file mode 100644
index 00000000..60748ccf
Binary files /dev/null and b/public/pictures/product_images/19.png differ
diff --git a/script/.DS_Store b/script/.DS_Store
new file mode 100644
index 00000000..21a2f362
Binary files /dev/null and b/script/.DS_Store differ
diff --git a/script/import_django/.DS_Store b/script/import_django/.DS_Store
new file mode 100644
index 00000000..700c3c9a
Binary files /dev/null and b/script/import_django/.DS_Store differ
diff --git a/script/import_django/course_surveys/.DS_Store b/script/import_django/course_surveys/.DS_Store
new file mode 100644
index 00000000..44152c39
Binary files /dev/null and b/script/import_django/course_surveys/.DS_Store differ
diff --git a/script/import_django/export_django/.DS_Store b/script/import_django/export_django/.DS_Store
new file mode 100644
index 00000000..1c0e1e78
Binary files /dev/null and b/script/import_django/export_django/.DS_Store differ
diff --git a/script/import_django/export_django/simplejson/.DS_Store b/script/import_django/export_django/simplejson/.DS_Store
new file mode 100644
index 00000000..2325b9c1
Binary files /dev/null and b/script/import_django/export_django/simplejson/.DS_Store differ
diff --git a/solr/.DS_Store b/solr/.DS_Store
new file mode 100644
index 00000000..f672f5a8
Binary files /dev/null and b/solr/.DS_Store differ
diff --git a/spec/.DS_Store b/spec/.DS_Store
new file mode 100644
index 00000000..e93b1e91
Binary files /dev/null and b/spec/.DS_Store differ
diff --git a/spec/controllers/.DS_Store b/spec/controllers/.DS_Store
new file mode 100644
index 00000000..b3a82495
Binary files /dev/null and b/spec/controllers/.DS_Store differ
diff --git a/spec/controllers/carts_controller_spec.rb b/spec/controllers/carts_controller_spec.rb
new file mode 100644
index 00000000..4790fc25
--- /dev/null
+++ b/spec/controllers/carts_controller_spec.rb
@@ -0,0 +1,23 @@
+require File.dirname(__FILE__) + '/../spec_helper'
+
+describe CartsController do
+ fixtures :all
+ render_views
+
+ it "new action should render new template" do
+ get :new
+ response.should render_template(:new)
+ end
+
+ it "create action should render new template when model is invalid" do
+ Cart.any_instance.stubs(:valid?).returns(false)
+ post :create
+ response.should render_template(:new)
+ end
+
+ it "create action should redirect when model is valid" do
+ Cart.any_instance.stubs(:valid?).returns(true)
+ post :create
+ response.should redirect_to(root_url)
+ end
+end
diff --git a/spec/controllers/line_items_controller_spec.rb b/spec/controllers/line_items_controller_spec.rb
new file mode 100644
index 00000000..892fac65
--- /dev/null
+++ b/spec/controllers/line_items_controller_spec.rb
@@ -0,0 +1,57 @@
+require File.dirname(__FILE__) + '/../spec_helper'
+
+describe LineItemsController do
+ fixtures :all
+ render_views
+
+ it "index action should render index template" do
+ get :index
+ response.should render_template(:index)
+ end
+
+ it "show action should render show template" do
+ get :show, :id => LineItem.first
+ response.should render_template(:show)
+ end
+
+ it "new action should render new template" do
+ get :new
+ response.should render_template(:new)
+ end
+
+ it "create action should render new template when model is invalid" do
+ LineItem.any_instance.stubs(:valid?).returns(false)
+ post :create
+ response.should render_template(:new)
+ end
+
+ it "create action should redirect when model is valid" do
+ LineItem.any_instance.stubs(:valid?).returns(true)
+ post :create
+ response.should redirect_to(line_item_url(assigns[:line_item]))
+ end
+
+ it "edit action should render edit template" do
+ get :edit, :id => LineItem.first
+ response.should render_template(:edit)
+ end
+
+ it "update action should render edit template when model is invalid" do
+ LineItem.any_instance.stubs(:valid?).returns(false)
+ put :update, :id => LineItem.first
+ response.should render_template(:edit)
+ end
+
+ it "update action should redirect when model is valid" do
+ LineItem.any_instance.stubs(:valid?).returns(true)
+ put :update, :id => LineItem.first
+ response.should redirect_to(line_item_url(assigns[:line_item]))
+ end
+
+ it "destroy action should destroy model and redirect to index action" do
+ line_item = LineItem.first
+ delete :destroy, :id => line_item
+ response.should redirect_to(line_items_url)
+ LineItem.exists?(line_item.id).should be_false
+ end
+end
diff --git a/spec/controllers/orders_controller_spec.rb b/spec/controllers/orders_controller_spec.rb
new file mode 100644
index 00000000..7cc713ab
--- /dev/null
+++ b/spec/controllers/orders_controller_spec.rb
@@ -0,0 +1,23 @@
+require File.dirname(__FILE__) + '/../spec_helper'
+
+describe OrdersController do
+ fixtures :all
+ render_views
+
+ it "new action should render new template" do
+ get :new
+ response.should render_template(:new)
+ end
+
+ it "create action should render new template when model is invalid" do
+ Order.any_instance.stubs(:valid?).returns(false)
+ post :create
+ response.should render_template(:new)
+ end
+
+ it "create action should redirect when model is valid" do
+ Order.any_instance.stubs(:valid?).returns(true)
+ post :create
+ response.should redirect_to(root_url)
+ end
+end
diff --git a/spec/controllers/product_controller_spec.rb b/spec/controllers/product_controller_spec.rb
new file mode 100644
index 00000000..ca01f9ce
--- /dev/null
+++ b/spec/controllers/product_controller_spec.rb
@@ -0,0 +1,54 @@
+require 'spec_helper'
+
+describe ProductController do
+
+ describe "GET 'index'" do
+ it "returns http success" do
+ get 'index'
+ response.should be_success
+ end
+ end
+
+ describe "GET 'show'" do
+ it "returns http success" do
+ get 'show'
+ response.should be_success
+ end
+ end
+
+ describe "GET 'new'" do
+ it "returns http success" do
+ get 'new'
+ response.should be_success
+ end
+ end
+
+ describe "GET 'create'" do
+ it "returns http success" do
+ get 'create'
+ response.should be_success
+ end
+ end
+
+ describe "GET 'edit'" do
+ it "returns http success" do
+ get 'edit'
+ response.should be_success
+ end
+ end
+
+ describe "GET 'update'" do
+ it "returns http success" do
+ get 'update'
+ response.should be_success
+ end
+ end
+
+ describe "GET 'destroy'" do
+ it "returns http success" do
+ get 'destroy'
+ response.should be_success
+ end
+ end
+
+end
diff --git a/spec/controllers/store_controller_spec.rb b/spec/controllers/store_controller_spec.rb
new file mode 100644
index 00000000..d8d384f4
--- /dev/null
+++ b/spec/controllers/store_controller_spec.rb
@@ -0,0 +1,12 @@
+require 'spec_helper'
+
+describe StoreController do
+
+ describe "GET 'index'" do
+ it "returns http success" do
+ get 'index'
+ response.should be_success
+ end
+ end
+
+end
diff --git a/spec/fixtures/carts.yml b/spec/fixtures/carts.yml
new file mode 100644
index 00000000..d83abb36
--- /dev/null
+++ b/spec/fixtures/carts.yml
@@ -0,0 +1,5 @@
+one:
+ purchased_at: 2013-12-03 07:14:38
+
+two:
+ purchased_at: 2013-12-03 07:14:38
diff --git a/spec/fixtures/orders.yml b/spec/fixtures/orders.yml
new file mode 100644
index 00000000..a4af311a
--- /dev/null
+++ b/spec/fixtures/orders.yml
@@ -0,0 +1,15 @@
+one:
+ card_id: 1
+ ip_address: MyString
+ first_name: MyString
+ last_name: MyString
+ card_type: MyString
+ card_expires_on: 2013-12-03
+
+two:
+ card_id: 1
+ ip_address: MyString
+ first_name: MyString
+ last_name: MyString
+ card_type: MyString
+ card_expires_on: 2013-12-03
diff --git a/spec/helpers/.DS_Store b/spec/helpers/.DS_Store
new file mode 100644
index 00000000..fa7980f8
Binary files /dev/null and b/spec/helpers/.DS_Store differ
diff --git a/spec/helpers/product_helper_spec.rb b/spec/helpers/product_helper_spec.rb
new file mode 100644
index 00000000..5c9a7385
--- /dev/null
+++ b/spec/helpers/product_helper_spec.rb
@@ -0,0 +1,15 @@
+require 'spec_helper'
+
+# Specs in this file have access to a helper object that includes
+# the ProductHelper. For example:
+#
+# describe ProductHelper do
+# describe "string concat" do
+# it "concats two strings with spaces" do
+# helper.concat_strings("this","that").should == "this that"
+# end
+# end
+# end
+describe ProductHelper do
+ pending "add some examples to (or delete) #{__FILE__}"
+end
diff --git a/spec/helpers/store_helper_spec.rb b/spec/helpers/store_helper_spec.rb
new file mode 100644
index 00000000..7d5f2121
--- /dev/null
+++ b/spec/helpers/store_helper_spec.rb
@@ -0,0 +1,15 @@
+require 'spec_helper'
+
+# Specs in this file have access to a helper object that includes
+# the StoreHelper. For example:
+#
+# describe StoreHelper do
+# describe "string concat" do
+# it "concats two strings with spaces" do
+# helper.concat_strings("this","that").should == "this that"
+# end
+# end
+# end
+describe StoreHelper do
+ pending "add some examples to (or delete) #{__FILE__}"
+end
diff --git a/spec/models/cart_spec.rb b/spec/models/cart_spec.rb
new file mode 100644
index 00000000..be014e3b
--- /dev/null
+++ b/spec/models/cart_spec.rb
@@ -0,0 +1,7 @@
+require File.dirname(__FILE__) + '/../spec_helper'
+
+describe Cart do
+ it "should be valid" do
+ Cart.new.should be_valid
+ end
+end
diff --git a/spec/models/line_item_spec.rb b/spec/models/line_item_spec.rb
new file mode 100644
index 00000000..2953b592
--- /dev/null
+++ b/spec/models/line_item_spec.rb
@@ -0,0 +1,5 @@
+require 'spec_helper'
+
+describe LineItem do
+ pending "add some examples to (or delete) #{__FILE__}"
+end
diff --git a/spec/models/order_spec.rb b/spec/models/order_spec.rb
new file mode 100644
index 00000000..fa10b844
--- /dev/null
+++ b/spec/models/order_spec.rb
@@ -0,0 +1,7 @@
+require File.dirname(__FILE__) + '/../spec_helper'
+
+describe Order do
+ it "should be valid" do
+ Order.new.should be_valid
+ end
+end
diff --git a/spec/models/sellable_spec.rb b/spec/models/sellable_spec.rb
new file mode 100644
index 00000000..182b9c55
--- /dev/null
+++ b/spec/models/sellable_spec.rb
@@ -0,0 +1,5 @@
+require 'spec_helper'
+
+describe Sellable do
+ pending "add some examples to (or delete) #{__FILE__}"
+end
diff --git a/spec/views/.DS_Store b/spec/views/.DS_Store
new file mode 100644
index 00000000..2b4ba2cf
Binary files /dev/null and b/spec/views/.DS_Store differ
diff --git a/spec/views/admin/.DS_Store b/spec/views/admin/.DS_Store
new file mode 100644
index 00000000..92bdf72b
Binary files /dev/null and b/spec/views/admin/.DS_Store differ
diff --git a/spec/views/product/create.html.haml_spec.rb b/spec/views/product/create.html.haml_spec.rb
new file mode 100644
index 00000000..258355a9
--- /dev/null
+++ b/spec/views/product/create.html.haml_spec.rb
@@ -0,0 +1,5 @@
+require 'spec_helper'
+
+describe "product/create.html.haml" do
+ pending "add some examples to (or delete) #{__FILE__}"
+end
diff --git a/spec/views/product/destroy.html.haml_spec.rb b/spec/views/product/destroy.html.haml_spec.rb
new file mode 100644
index 00000000..fc1d4ff6
--- /dev/null
+++ b/spec/views/product/destroy.html.haml_spec.rb
@@ -0,0 +1,5 @@
+require 'spec_helper'
+
+describe "product/destroy.html.haml" do
+ pending "add some examples to (or delete) #{__FILE__}"
+end
diff --git a/spec/views/product/edit.html.haml_spec.rb b/spec/views/product/edit.html.haml_spec.rb
new file mode 100644
index 00000000..fce18dcf
--- /dev/null
+++ b/spec/views/product/edit.html.haml_spec.rb
@@ -0,0 +1,5 @@
+require 'spec_helper'
+
+describe "product/edit.html.haml" do
+ pending "add some examples to (or delete) #{__FILE__}"
+end
diff --git a/spec/views/product/index.html.haml_spec.rb b/spec/views/product/index.html.haml_spec.rb
new file mode 100644
index 00000000..b98b13ca
--- /dev/null
+++ b/spec/views/product/index.html.haml_spec.rb
@@ -0,0 +1,5 @@
+require 'spec_helper'
+
+describe "product/index.html.haml" do
+ pending "add some examples to (or delete) #{__FILE__}"
+end
diff --git a/spec/views/product/new.html.haml_spec.rb b/spec/views/product/new.html.haml_spec.rb
new file mode 100644
index 00000000..48982b54
--- /dev/null
+++ b/spec/views/product/new.html.haml_spec.rb
@@ -0,0 +1,5 @@
+require 'spec_helper'
+
+describe "product/new.html.haml" do
+ pending "add some examples to (or delete) #{__FILE__}"
+end
diff --git a/spec/views/product/show.html.haml_spec.rb b/spec/views/product/show.html.haml_spec.rb
new file mode 100644
index 00000000..99655fa2
--- /dev/null
+++ b/spec/views/product/show.html.haml_spec.rb
@@ -0,0 +1,5 @@
+require 'spec_helper'
+
+describe "product/show.html.haml" do
+ pending "add some examples to (or delete) #{__FILE__}"
+end
diff --git a/spec/views/product/update.html.haml_spec.rb b/spec/views/product/update.html.haml_spec.rb
new file mode 100644
index 00000000..ec8a52e4
--- /dev/null
+++ b/spec/views/product/update.html.haml_spec.rb
@@ -0,0 +1,5 @@
+require 'spec_helper'
+
+describe "product/update.html.haml" do
+ pending "add some examples to (or delete) #{__FILE__}"
+end
diff --git a/spec/views/store/index.html.haml_spec.rb b/spec/views/store/index.html.haml_spec.rb
new file mode 100644
index 00000000..cfc76740
--- /dev/null
+++ b/spec/views/store/index.html.haml_spec.rb
@@ -0,0 +1,5 @@
+require 'spec_helper'
+
+describe "store/index.html.haml" do
+ pending "add some examples to (or delete) #{__FILE__}"
+end
diff --git a/vagrant/bootstrap.sh b/vagrant/bootstrap.sh
index 5254952f..3f2dae02 100755
--- a/vagrant/bootstrap.sh
+++ b/vagrant/bootstrap.sh
@@ -22,6 +22,9 @@ gem install rails -v 3.1.11
cd /vagrant
bundle install
+# Install Imagemagick, necessary for Store
+sudo apt-get install imagemagick
+
# Modify database.yml
cp vagrant/database.yml.vagrant config/database.yml
diff --git a/vendor/.DS_Store b/vendor/.DS_Store
new file mode 100644
index 00000000..2d2ae8f7
Binary files /dev/null and b/vendor/.DS_Store differ
diff --git a/vendor/plugins/.DS_Store b/vendor/plugins/.DS_Store
new file mode 100644
index 00000000..8d00cd93
Binary files /dev/null and b/vendor/plugins/.DS_Store differ
diff --git a/vendor/plugins/acts_as_notification/.DS_Store b/vendor/plugins/acts_as_notification/.DS_Store
new file mode 100644
index 00000000..81519073
Binary files /dev/null and b/vendor/plugins/acts_as_notification/.DS_Store differ
diff --git a/vendor/plugins/bartt-ssl_requirement-1.2.4/.DS_Store b/vendor/plugins/bartt-ssl_requirement-1.2.4/.DS_Store
new file mode 100644
index 00000000..1aaaeb26
Binary files /dev/null and b/vendor/plugins/bartt-ssl_requirement-1.2.4/.DS_Store differ
diff --git a/vendor/plugins/dynamic_form/.DS_Store b/vendor/plugins/dynamic_form/.DS_Store
new file mode 100644
index 00000000..4a001524
Binary files /dev/null and b/vendor/plugins/dynamic_form/.DS_Store differ
diff --git a/vendor/plugins/dynamic_form/lib/.DS_Store b/vendor/plugins/dynamic_form/lib/.DS_Store
new file mode 100644
index 00000000..71441244
Binary files /dev/null and b/vendor/plugins/dynamic_form/lib/.DS_Store differ
diff --git a/vendor/plugins/dynamic_form/lib/action_view/.DS_Store b/vendor/plugins/dynamic_form/lib/action_view/.DS_Store
new file mode 100644
index 00000000..9afafc25
Binary files /dev/null and b/vendor/plugins/dynamic_form/lib/action_view/.DS_Store differ
diff --git a/vendor/plugins/what_column/.DS_Store b/vendor/plugins/what_column/.DS_Store
new file mode 100644
index 00000000..54934f9b
Binary files /dev/null and b/vendor/plugins/what_column/.DS_Store differ
diff --git a/vendor/plugins/what_column/lib/.DS_Store b/vendor/plugins/what_column/lib/.DS_Store
new file mode 100644
index 00000000..d463b9eb
Binary files /dev/null and b/vendor/plugins/what_column/lib/.DS_Store differ
diff --git a/vendor/plugins/what_column/test/.DS_Store b/vendor/plugins/what_column/test/.DS_Store
new file mode 100644
index 00000000..c0135118
Binary files /dev/null and b/vendor/plugins/what_column/test/.DS_Store differ