summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2014-10-13 13:18:52 -0600
committermo khan <mo@mokhan.ca>2014-10-13 13:18:52 -0600
commit2d92ea754a580e67f69928404c20c616d034dfc9 (patch)
treeeb6fe6f365ce43c3e2f46153b509d9753d268050
parent2575f945ef2f24bb2e6f0bcd3cc54458f45712dc (diff)
add product details page.
-rw-r--r--app/controllers/admin/products_controller.rb4
-rw-r--r--app/views/admin/products/index.html.erb2
-rw-r--r--app/views/admin/products/show.html.erb47
-rw-r--r--config/routes.rb2
4 files changed, 53 insertions, 2 deletions
diff --git a/app/controllers/admin/products_controller.rb b/app/controllers/admin/products_controller.rb
index 91e6be20..28c3c55e 100644
--- a/app/controllers/admin/products_controller.rb
+++ b/app/controllers/admin/products_controller.rb
@@ -8,5 +8,9 @@ module Admin
def index
@products = @product_api.search(params[:q])
end
+
+ def show
+ @product = @product_api.find(params[:id])
+ end
end
end
diff --git a/app/views/admin/products/index.html.erb b/app/views/admin/products/index.html.erb
index bfa6e056..7f706654 100644
--- a/app/views/admin/products/index.html.erb
+++ b/app/views/admin/products/index.html.erb
@@ -13,7 +13,7 @@
<tbody>
<% @products.each do |product| %>
<tr>
- <td><%= link_to product.asin, product.url %></td>
+ <td><%= link_to product.asin, admin_product_path(product.asin) %></td>
<td>
<%= link_to product.title, product.url %> is made by <%= product.manufacturer %> in category <%= product.category %>
</td>
diff --git a/app/views/admin/products/show.html.erb b/app/views/admin/products/show.html.erb
new file mode 100644
index 00000000..a458838e
--- /dev/null
+++ b/app/views/admin/products/show.html.erb
@@ -0,0 +1,47 @@
+<div class="row-fluid">
+ <div class="span2">
+ <%= render partial: "my/shared/my_nav" %>
+ </div>
+ <div class="span10">
+ <table class="table">
+ <tr>
+ <td>asin</td>
+ <td><%= link_to @product.asin, @product.detail_page_url %></td>
+ </tr>
+ <tr>
+ <td>attributes</td>
+ <td><%= @product.item_attributes %></td>
+ </tr>
+ <tr>
+ <td>images</td>
+ <td>
+ <% @product.image_sets.image_set.each do |image| %>
+ <%= image_tag image.large_image.url %>
+ <%= image_tag image.medium_image.url %>
+ <%= image_tag image.small_image.url %>
+ <%= image_tag image.swatch_image.url %>
+ <%= image_tag image.thumbnail_image.url %>
+ <%= image_tag image.tiny_image.url %>
+ <% end %>
+ </td>
+ </tr>
+ <tr>
+ <td>reviews</td>
+ <td>
+ <%= @product.editorial_reviews.editorial_review.content %>
+ </td>
+ </tr>
+ <tr>
+ <td>links</td>
+ <td>
+ <ul>
+ <% @product.item_links.item_link.each do |link| %>
+ <li><%= link_to link.description, link.url %></li>
+ <% end %>
+ </ul>
+ </td>
+ </tr>
+ </table>
+ </div>
+</div>
+
diff --git a/config/routes.rb b/config/routes.rb
index c669b9ba..9dd18ad6 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -84,7 +84,7 @@ Cake::Application.routes.draw do
resources :blobs, only: [:index, :show]
resources :errors, only: [:index, :create]
resources :sessions, only: [:index, :destroy]
- resources :products, only: [:index]
+ resources :products, only: [:index, :show]
end
namespace :my do