Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

ajax

  • Loading branch information...
commit 3e97d4f59b1a164aae4f48418122430a89094b69 1 parent 324c0c7
@haio authored
View
25 app/assets/javascripts/application.js
@@ -6,13 +6,18 @@
* We make no guarantees that this code is fit for any purpose.
* Visit http://www.pragmaticprogrammer.com/titles/rails4 for more book information.
***/
-/***
- * Excerpted from "Agile Web Development with Rails, 4rd Ed.",
- * published by The Pragmatic Bookshelf.
- * Copyrights apply to this code. It may not be used to create training material,
- * courses, books, articles, and the like. Contact us if you are in doubt.
- * We make no guarantees that this code is fit for any purpose.
- * Visit http://www.pragmaticprogrammer.com/titles/rails4 for more book information.
-***/
-// Place your application-specific JavaScript functions and classes here
-// This file is automatically included by javascript_include_tag :defaults
+// This is a manifest file that'll be compiled into application.js, which will include all the files
+// listed below.
+//
+// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
+// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
+//
+// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
+// the compiled file.
+//
+// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
+// GO AFTER THE REQUIRES BELOW.
+//
+//= require jquery
+//= require jquery_ujs
+//= require_tree .
View
33 app/assets/stylesheets/scaffolds.css.scss
@@ -3,47 +3,37 @@ body {
color: #333;
font-family: verdana, arial, helvetica, sans-serif;
font-size: 13px;
- line-height: 18px;
-}
+ line-height: 18px; }
p, ol, ul, td {
font-family: verdana, arial, helvetica, sans-serif;
font-size: 13px;
- line-height: 18px;
-}
+ line-height: 18px; }
pre {
background-color: #eee;
padding: 10px;
- font-size: 11px;
-}
+ font-size: 11px; }
a {
color: #000;
&:visited {
- color: #666;
- }
+ color: #666; }
&:hover {
color: #fff;
- background-color: #000;
- }
-}
+ background-color: #000; } }
div {
&.field, &.actions {
- margin-bottom: 10px;
- }
-}
+ margin-bottom: 10px; } }
#notice {
- color: green;
-}
+ color: green; }
.field_with_errors {
padding: 2px;
background-color: red;
- display: table;
-}
+ display: table; }
#error_explanation {
width: 450px;
@@ -60,10 +50,7 @@ div {
margin: -7px;
margin-bottom: 0px;
background-color: #c00;
- color: #fff;
- }
+ color: #fff; }
ul li {
font-size: 12px;
- list-style: square;
- }
-}
+ list-style: square; } }
View
2  app/controllers/products_controller.rb
@@ -14,7 +14,6 @@ def index
# GET /products/1.json
def show
@product = Product.find(params[:id])
-
respond_to do |format|
format.html # show.html.erb
format.json { render json: @product }
@@ -25,7 +24,6 @@ def show
# GET /products/new.json
def new
@product = Product.new
-
respond_to do |format|
format.html # new.html.erb
format.json { render json: @product }
View
6 app/helpers/application_helper.rb
@@ -1,2 +1,8 @@
module ApplicationHelper
+ def hidden_div_if(condition, attributes = {}, &block)
+ if condition
+ attributes["style"] = "display:none";
+ end
+ content_tag("div", attributes, &block)
+ end
end
View
41 app/views/layouts/application.html.erb
@@ -2,31 +2,36 @@
<!DOCTYPE html>
<html>
<head>
- <title>Depot</title>
-<!-- START_HIGHLIGHT -->
- <%= stylesheet_link_tag "scaffold" %>
- <%= stylesheet_link_tag "depot", :media => "all"%>
-<!-- END_HIGHLIGHT -->
- <%= javascript_include_tag :defaults %>
- <%= csrf_meta_tag %>
+ <title>Pragprog Books Online Store</title>
+ <%= stylesheet_link_tag "application", media: "all" %>
+ <%= javascript_include_tag "application" %>
+ <%= csrf_meta_tags %>
</head>
<!-- END:head -->
-<body>
- <div id="banner">
+<body class="<%= controller.controller_name %>">
+ <div id="banner">
<%= image_tag("logo.png") %>
- <%= @page_title || "Pragmatic Bookshelf" %><!-- <label id="code.depot.e.title"/> -->
+ <%= @page_title || "Pragmatic Bookshelf" %>
</div>
<div id="columns">
<div id="side">
- <a href="http://www....">Home</a><br />
- <a href="http://www..../faq">Questions</a><br />
- <a href="http://www..../news">News</a><br />
- <a href="http://www..../contact">Contact</a><br />
- </div>
- <div id="main">
- <%= yield %><!-- <label id="code.depot.e.include"/> -->
+<!-- START_HIGHLIGHT -->
+ <% if @cart %>
+ <%= hidden_div_if(@cart.line_items.empty?, :id => 'cart') do %>
+ <%= render @cart %>
+ <% end %>
+ <% end %>
+<!-- END_HIGHLIGHT -->
+ <ul>
+ <li><a href="http://www....">Home</a></li>
+ <li><a href="http://www..../faq">Questions</a></li>
+ <li><a href="http://www..../news">News</a></li>
+ <li><a href="http://www..../contact">Contact</a></li>
+ </ul>
+ </div>
+ <div id="main">
+ <%= yield %>
</div>
</div>
-
</body>
</html>
View
BIN  db/development.sqlite3
Binary file not shown
View
12 public/stylesheets/depot.css
@@ -176,3 +176,15 @@
border-top: 1px solid #595;
}
/* END:cartmain */
+
+
+#cart, #cart table {
+ font-size: smaller;
+ color: white;
+}
+
+#cart table {
+ border-top: 1px dotted #595;
+ border-bottom: 1px dotted #595;
+ margin-bottom: 10px;
+}
View
BIN  tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655
Binary file not shown
View
BIN  tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994
Binary file not shown
View
BIN  tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af
Binary file not shown

0 comments on commit 3e97d4f

Please sign in to comment.
Something went wrong with that request. Please try again.