forked from lighthouse-labs/jungle-rails
-
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
guub
committed
Nov 25, 2016
1 parent
63b28cc
commit 1af6a26
Showing
11 changed files
with
75 additions
and
6 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,5 +1,5 @@ | ||
class AdminController < ApplicationController | ||
|
||
http_basic_authenticate_with name: "jungle", password: "boogie" | ||
http_basic_authenticate_with name: ENV['ADMIN_NAME'], password: ENV['ADMIN_PASSWORD'] | ||
|
||
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,21 @@ | ||
class SessionsController < ApplicationController | ||
|
||
def new | ||
end | ||
|
||
def create | ||
if user = User.authenticate_with_credentials(params[:email], params[:password]) | ||
session[:user_id] = user.id | ||
redirect_to '/' | ||
else | ||
flash[:notice] = "Incorrect email or password." | ||
redirect_to '/login' | ||
end | ||
end | ||
|
||
def destroy | ||
session[:user_id] = nil | ||
redirect_to '/' | ||
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,2 @@ | ||
module ApplicationController | ||
end |
This file was deleted.
Oops, something went wrong.
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 @@ | ||
class ApplicationMailer < ActionMailer::Base | ||
default from: "from@example.com" | ||
layout 'mailer' | ||
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,9 @@ | ||
class OrderMailer < ApplicationMailer | ||
default from: 'no-reply@jungle.com' | ||
|
||
def receipt_email(order) | ||
@order = order | ||
@products = Product.joins(:line_items).where('line_items.order_id' => order.id).select('products.name, line_items.quantity, line_items.item_price_cents, line_items.total_price_cents') | ||
mail(to: @order.email, subject: "Jungle Receipt for order ##{@order.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type' /> | ||
</head> | ||
<body> | ||
<h1>Thank you for your order</h1> | ||
<p>You ordered:</p> | ||
<% @products.each do |product| %> | ||
<p><%=product.quantity%> <%=product.name%> for $<%=product.item_price_cents/100.00%></p> | ||
<% end %> | ||
<p>Total: $<%= (@order.total_cents/100.00).round(2) %></p> | ||
</body> | ||
</html> |
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 |
---|---|---|
|
@@ -29,6 +29,7 @@ | |
<%= @cart_total %> | ||
</th> | ||
</tr> | ||
<div> To @order.email </div> | ||
</tfoot> | ||
</table> | ||
</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
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,22 @@ | ||
0 info it worked if it ends with ok | ||
1 verbose cli [ '/home/vagrant/.nvm/versions/node/v6.7.0/bin/node', | ||
1 verbose cli '/home/vagrant/.nvm/versions/node/v6.7.0/bin/npm', | ||
1 verbose cli 'start' ] | ||
2 info using npm@3.10.3 | ||
3 info using node@v6.7.0 | ||
4 verbose stack Error: ENOENT: no such file or directory, open '/vagrant/package.json' | ||
4 verbose stack at Error (native) | ||
5 verbose cwd /vagrant/jungle | ||
6 error Linux 4.4.0-21-generic | ||
7 error argv "/home/vagrant/.nvm/versions/node/v6.7.0/bin/node" "/home/vagrant/.nvm/versions/node/v6.7.0/bin/npm" "start" | ||
8 error node v6.7.0 | ||
9 error npm v3.10.3 | ||
10 error path /vagrant/package.json | ||
11 error code ENOENT | ||
12 error errno -2 | ||
13 error syscall open | ||
14 error enoent ENOENT: no such file or directory, open '/vagrant/package.json' | ||
15 error enoent ENOENT: no such file or directory, open '/vagrant/package.json' | ||
15 error enoent This is most likely not a problem with npm itself | ||
15 error enoent and is related to npm not being able to find a file. | ||
16 verbose exit [ -2, true ] |