-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
111 additions
and
33 deletions.
There are no files selected for viewing
Binary file not shown.
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,19 @@ | ||
class Order::CartController < Order::BaseController | ||
before_action :set_order | ||
|
||
def checkout | ||
end | ||
|
||
def review | ||
@order.attributes = order_params | ||
end | ||
|
||
private | ||
def set_order | ||
@order = User.active_order | ||
end | ||
|
||
def order_params | ||
params.require(:order).permit(:location_id) | ||
end | ||
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
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
4 changes: 2 additions & 2 deletions
4
app/helpers/flash_notice_helper.rb → app/helpers/added_item_helper.rb
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
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
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,4 +1,5 @@ | ||
class Location < ActiveRecord::Base | ||
has_one :address, dependent: :destroy | ||
has_many :orders | ||
accepts_nested_attributes_for :address | ||
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
class Order < ActiveRecord::Base | ||
belongs_to :user | ||
has_many :items | ||
belongs_to :location | ||
accepts_nested_attributes_for :items | ||
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
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 |
---|---|---|
|
@@ -41,4 +41,8 @@ def update? | |
def destroy? | ||
user.customer | ||
end | ||
|
||
def added_item? | ||
user.customer? | ||
end | ||
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,7 @@ | ||
class OrderPolicy < ApplicationPolicy | ||
attr_reader :user, :order | ||
|
||
def add_item? | ||
user.customer? | ||
end | ||
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,8 @@ | ||
%head | ||
%meta{name: 'viewport', content: 'width=device-width, initial-scale=1', chatset: 'utf-8'} | ||
%title= content_for?(:title) ? yield(:title) : 'Pagliacci Pizza – Seattle Area Pizza Delivery and Catering' | ||
= javascript_include_tag 'vendor/modernizr' | ||
= stylesheet_link_tag :application, media: 'all' | ||
= javascript_include_tag :application | ||
= csrf_meta_tags | ||
= favicon_link_tag 'favicon.ico' |
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,17 +1,14 @@ | ||
#order-top-bar | ||
#logo-subsection | ||
= image_tag 'pag-banner-logo-half-size.png' | ||
#phone-subsection | ||
= link_to '206.727.1717', 'tel:+12067261717' | ||
#login-subsection | ||
- if user_signed_in? | ||
= link_to 'Log out', destroy_user_session_path, method: :delete | ||
- else | ||
= link_to 'Sign in or create an account', new_user_session_path | ||
#numbers | ||
.notice | ||
= notice | ||
.alert | ||
= alert | ||
= link_to 'Sign in or Sign up', new_user_session_path | ||
.notice | ||
= notice | ||
.alert | ||
= alert | ||
.large-12.columns | ||
= yield |
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
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,13 +1,6 @@ | ||
!!! 5 | ||
%html{html_attrs} | ||
%head | ||
%meta{name: 'viewport', content: 'width=device-width, initial-scale=1', chatset: 'utf-8'} | ||
%title= content_for?(:title) ? yield(:title) : 'Pagliacci Pizza – Seattle Area Pizza Delivery and Catering' | ||
= javascript_include_tag 'vendor/modernizr' | ||
= stylesheet_link_tag :application, media: 'all' | ||
= javascript_include_tag :application | ||
= csrf_meta_tags | ||
= favicon_link_tag 'favicon.ico' | ||
= render 'layouts/head' | ||
%body | ||
.row#paper | ||
= render 'layouts/order_top_bar' |
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,3 @@ | ||
= form_tag 'review' | ||
= collection_select :order, :location_id, Location.all, :id, :name, prompt: true | ||
= submit_tag 'Review Order' |
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,4 @@ | ||
- @order.items.whole_pies.each do |i| | ||
= "#{i.sizes.first.name} #{i.name}" | ||
|
||
= @order.location.name |
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
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,4 @@ | ||
.small-12.columns | ||
= added_item_to_order @item | ||
= link_to 'Continue Shopping', order_home_path | ||
= link_to 'Checkout', order_checkout_path |
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
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,5 @@ | ||
class AddLocationToOrder < ActiveRecord::Migration | ||
def change | ||
add_column :orders, :location_id, :integer | ||
end | ||
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
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,19 @@ | ||
require 'helpers/test_helper' | ||
|
||
feature 'customer can complete order' do | ||
scenario 'customer wants to complete order' do | ||
sign_in :customer | ||
visit '' | ||
|
||
click_on 'ORDER ONLINE' | ||
click_on 'EXTRA PEPPERONI' | ||
select 'Large', from: 'item_sizes' | ||
click_on 'Add to Order' | ||
click_on 'Checkout' | ||
select 'Lake City Way', from: 'order[location_id]' | ||
click_on 'Review Order' | ||
|
||
page.must_have_content 'Lake City Way' | ||
page.must_have_content 'Large Extra Pepperoni' | ||
end | ||
end |
File renamed without changes.