Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

order views

  • Loading branch information...
commit 66c0cbb7b0ec2db553614075b091cf8d6609fb7c 1 parent ee75905
Andy Glass authored April 04, 2012
2  Gemfile
@@ -24,5 +24,5 @@ group :development, :test do
24 24
   gem 'rspec-rails'
25 25
   gem 'capybara'
26 26
   gem 'launchy'
27  
-  gem 'guard'
  27
+  gem 'guard-rspec'
28 28
 end
4  Gemfile.lock
@@ -60,6 +60,8 @@ GEM
60 60
     guard (1.0.1)
61 61
       ffi (>= 0.5.0)
62 62
       thor (~> 0.14.6)
  63
+    guard-rspec (0.6.0)
  64
+      guard (>= 0.10.0)
63 65
     hike (1.2.1)
64 66
     i18n (0.6.0)
65 67
     journey (1.0.3)
@@ -154,7 +156,7 @@ DEPENDENCIES
154 156
   coffee-rails (~> 3.2.1)
155 157
   dynamic_form
156 158
   fabrication
157  
-  guard
  159
+  guard-rspec
158 160
   jquery-rails
159 161
   launchy
160 162
   rails (= 3.2.3)
18  Guardfile
@@ -11,24 +11,6 @@ guard 'rspec', :version => 2 do
11 11
   watch(%r{^app/(.*)(\.erb|\.haml)$})                 { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
12 12
   watch(%r{^app/controllers/(.+)_(controller)\.rb$})  { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
13 13
   watch(%r{^spec/support/(.+)\.rb$})                  { "spec" }
14  
-  watch('config/routes.rb')                           { "spec/routing" }
15  
-  watch('app/controllers/application_controller.rb')  { "spec/controllers" }
16  
-  # Capybara request specs
17  
-  watch(%r{^app/views/(.+)/.*\.(erb|haml)$})          { |m| "spec/requests/#{m[1]}_spec.rb" }
18  
-end
19  
-
20  
-
21  
-guard 'rspec', :version => 2 do
22  
-  watch(%r{^spec/.+_spec\.rb$})
23  
-  watch(%r{^lib/(.+)\.rb$})     { |m| "spec/lib/#{m[1]}_spec.rb" }
24  
-  watch('spec/spec_helper.rb')  { "spec" }
25  
-
26  
-  # Rails example
27  
-  watch(%r{^app/(.+)\.rb$})                           { |m| "spec/#{m[1]}_spec.rb" }
28  
-  watch(%r{^app/(.*)(\.erb|\.haml)$})                 { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
29  
-  watch(%r{^app/controllers/(.+)_(controller)\.rb$})  { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
30  
-  watch(%r{^spec/support/(.+)\.rb$})                  { "spec" }
31  
-  watch('config/routes.rb')                           { "spec/routing" }
32 14
   watch('app/controllers/application_controller.rb')  { "spec/controllers" }
33 15
   # Capybara request specs
34 16
   watch(%r{^app/views/(.+)/.*\.(erb|haml)$})          { |m| "spec/requests/#{m[1]}_spec.rb" }
0  app/assets/javascripts/order.js.coffee → app/assets/javascripts/orders.js.coffee
File renamed without changes
2  app/assets/stylesheets/order.css.scss → app/assets/stylesheets/orders.css.scss
... ...
@@ -1,3 +1,3 @@
1  
-// Place all the styles related to the Order controller here.
  1
+// Place all the styles related to the Orders controller here.
2 2
 // They will automatically be included in application.css.
3 3
 // You can use Sass (SCSS) here: http://sass-lang.com/
11  app/controllers/order_controller.rb → app/controllers/orders_controller.rb
... ...
@@ -1,9 +1,8 @@
1  
-class OrderController < ApplicationController
2  
-
  1
+class OrdersController < ApplicationController
3 2
   before_filter :lookup_order, :only => [:show, :edit, :destroy, :update]
4 3
   
5 4
   def index
6  
-    @orders = order.all
  5
+    @orders = Order.all
7 6
   end
8 7
 
9 8
   def show
@@ -15,11 +14,11 @@ def destroy
15 14
   end
16 15
 
17 16
   def new
18  
-    @order = order.new
  17
+    @order = Order.new
19 18
   end
20 19
 
21 20
   def create
22  
-    @order = order.new(params[:order])
  21
+    @order = Order.new(params[:order])
23 22
     if @order.save
24 23
       redirect_to order_path(@order)
25 24
     else
@@ -37,6 +36,6 @@ def update
37 36
   end
38 37
 
39 38
   def lookup_order
40  
-    @order = order.find(params[:id])
  39
+    @order = Order.find(params[:id])
41 40
   end
42 41
 end
2  app/helpers/order_helper.rb
... ...
@@ -1,2 +0,0 @@
1  
-module OrderHelper
2  
-end
2  app/helpers/orders_helper.rb
... ...
@@ -0,0 +1,2 @@
  1
+module OrdersHelper
  2
+end
4  app/views/layouts/application.html.erb
@@ -7,9 +7,7 @@
7 7
   <%= csrf_meta_tags %>
8 8
 </head>
9 9
 <body>
10  
-  <div id="user_nav">
11  
-    <%= link_to "Register", new_user_path %>
12  
-  </div>
  10
+  
13 11
 <%= yield %>
14 12
 
15 13
 </body>
0  app/views/order/index.html.erb
No changes.
13  app/views/orders/index.html.erb
... ...
@@ -0,0 +1,13 @@
  1
+<h1>Dashboard</h1>
  2
+
  3
+<ul id="orders">
  4
+ <% @orders.each do |order| %>
  5
+   <li>
  6
+    <%= order.status %>
  7
+    <%=link_to order.id, order_path(order) %>
  8
+   </li>
  9
+
  10
+ <% end %>
  11
+</ul>
  12
+
  13
+<%= link_to "New order", new_order_path, :id => "new-order",  :class => "new_order"%>
16  app/views/orders/show.html.erb
... ...
@@ -0,0 +1,16 @@
  1
+ <h1><%= @order.id %></h1>
  2
+<p>
  3
+ <%= @order.status %>
  4
+  <%= @order.user_id %>
  5
+ <%= @order.created_at %>
  6
+ <%= @order.updated_at %>
  7
+</p>
  8
+
  9
+<%= link_to "edit!", edit_order_path(@order)%>
  10
+
  11
+<%=link_to "destroy!", order_path(@order),
  12
+ :method => :delete,
  13
+ :confirm => "Delete \"#{@order.id}\"?" %>
  14
+
  15
+<%=link_to "Back to All orders", orders_path, :id => "orders-index", :class => "link" %>
  16
+ 
1  config/routes.rb
@@ -3,6 +3,7 @@
3 3
   resources :products
4 4
   root :to => "products#index"
5 5
   resources :users
  6
+  resources :orders
6 7
 
7 8
 end
8 9
   # The priority is based upon order of creation:
5  spec/controllers/order_controller_spec.rb
... ...
@@ -1,5 +0,0 @@
1  
-require 'spec_helper'
2  
-
3  
-describe OrderController do
4  
-
5  
-end
5  spec/controllers/orders_controller_spec.rb
... ...
@@ -0,0 +1,5 @@
  1
+require 'spec_helper'
  2
+
  3
+describe OrdersController do
  4
+
  5
+end
6  spec/helpers/order_helper_spec.rb → spec/helpers/orders_helper_spec.rb
... ...
@@ -1,15 +1,15 @@
1 1
 require 'spec_helper'
2 2
 
3 3
 # Specs in this file have access to a helper object that includes
4  
-# the OrderHelper. For example:
  4
+# the OrdersHelper. For example:
5 5
 #
6  
-# describe OrderHelper do
  6
+# describe OrdersHelper do
7 7
 #   describe "string concat" do
8 8
 #     it "concats two strings with spaces" do
9 9
 #       helper.concat_strings("this","that").should == "this that"
10 10
 #     end
11 11
 #   end
12 12
 # end
13  
-describe OrderHelper do
  13
+describe OrdersHelper do
14 14
   pending "add some examples to (or delete) #{__FILE__}"
15 15
 end

0 notes on commit 66c0cbb

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