Commit 7a5b6a9f
Changed files (7)
app
controllers
views
admin
photos
products
favorites
config
app/controllers/favorites_controller.rb
@@ -1,11 +1,6 @@
class FavoritesController < ApplicationController
before_action :authenticate!
- def index
- @creation = Creation.find(params[:cake_id])
- @favorites = @creation.favorites
- end
-
def create
cake = Creation.find(params[:cake_id])
current_user.add_favorite(cake)
app/views/admin/photos/show.html.erb
@@ -1,8 +1,8 @@
-<div class="row-fluid">
- <div class="span2">
+<div class="row">
+ <div class="col-3">
<%= render partial: "my/shared/my_nav" %>
</div>
- <div class="span10">
+ <div class="col-9">
<h1>Photo <small><%= @photo.id %></small></h1>
<p><%= link_to "<< Back", admin_photos_path %></p>
<table class="table table-condensed">
app/views/admin/products/_index.html.erb
@@ -6,7 +6,7 @@
<td>
<%= link_to product.item_attributes.title, admin_product_path(product.asin) %> is made by <%= product.item_attributes.manufacturer %> in category <%= product.item_attributes.product_group %>
</td>
- <td> <%= link_to 'View on Amazon', product.detail_page_url, class: 'btn', target: "_blank" %> </td>
+ <td> <%= link_to 'View on Amazon', product.detail_page_url, target: "_blank" %> </td>
</tr>
<% end %>
</tbody>
app/views/admin/products/index.html.erb
@@ -1,13 +1,13 @@
<%= provide(:search_path, admin_products_path) %>
-<div class="row-fluid">
- <div class="span2">
+<div class="row">
+ <div class="col-3">
<%= render partial: "my/shared/my_nav" %>
</div>
- <div class="span10">
+ <div class="col-9">
<h1>Product Catalog - Amazon</h1>
<%= form_tag admin_products_path(js: true), method: :get, name: 'search', class: 'form-horizontal', remote: true do %>
<%= text_field_tag :q, params[:q], class: "search-query", placeholder: "Search" %>
- <%= submit_tag 'Search', class: 'btn btn-primary' %>
+ <%= submit_tag 'Search', class: 'btn btn-primary', data: { disable_with: 'Searching...' } %>
<% end %>
<div id="results-container">
<%= render partial: "index" %>
app/views/admin/products/show.html.erb
@@ -1,9 +1,9 @@
<%= provide(:search_path, admin_products_path) %>
-<div class="row-fluid">
- <div class="span2">
+<div class="row">
+ <div class="col-3">
<%= render partial: "my/shared/my_nav" %>
</div>
- <div class="span10">
+ <div class="col-9">
<table class="table">
<tr>
<td>asin</td>
@@ -24,7 +24,7 @@
<td>
<% if @tool.present? %>
In the toolbox as <%= @tool.name %>
- <% else %>
+ <% else %>
<%= form_tag admin_products_path do %>
<%= text_field_tag :name, @product.item_attributes['title'] %>
<%= hidden_field_tag "asin", @product.asin %>
@@ -32,7 +32,7 @@
<% end %>
<% end %>
</td>
- </tr>
+ </tr>
<tr>
<td>attributes</td>
<td>
@@ -60,4 +60,3 @@
</table>
</div>
</div>
-
app/views/favorites/index.html.erb
@@ -1,21 +0,0 @@
-<% provide(:title, "#{@creation.name} by #{@creation.user.name} - fanclub") -%>
-<div class="row-fluid">
- <div class="span12">
- <h1> Fans of <%= link_to @creation.name, cake_path(@creation) %> </h1>
- <ul class="thumbnails">
- <% @creation.favorites.each do |favorite| %>
- <li class="span3">
- <div class="thumbnail">
- <%= link_to profile_path(favorite.user), class: 'thumbnail' do %>
- <%= avatar_for(favorite.user) %>
- <% end %>
- <div class="caption">
- <h5><%= favorite.user.name %></h5>
- <p><%= favorite.user.city %></p>
- </div>
- </div>
- </li>
- <% end %>
- </ul>
- </div>
-</div>
config/routes.rb
@@ -17,7 +17,7 @@ Cake::Application.routes.draw do
resources :cakes, only: [:index, :show], path: :cakes do
resources :photos, only: [:index, :show]
- resources :favorites, only: [:index, :create]
+ resources :favorites, only: [:create]
get 'page/:page', action: :index, on: :collection, as: :paginate
collection do
get :newest, action: 'index', sort: 'newest'