diff options
| author | mo <mokha@cisco.com> | 2017-09-01 22:46:52 -0600 |
|---|---|---|
| committer | mo <mokha@cisco.com> | 2017-09-01 22:46:52 -0600 |
| commit | 7a5b6a9f80d534bfa32bb6deb92ccb12762815e8 (patch) | |
| tree | 916bbb4c24321bf476cb862b09a1e42d97100ca3 | |
| parent | 6c0df4f225df1e09192b669815c22f569a832bc6 (diff) | |
upgrade products pages.
| -rw-r--r-- | app/controllers/favorites_controller.rb | 5 | ||||
| -rw-r--r-- | app/views/admin/photos/show.html.erb | 6 | ||||
| -rw-r--r-- | app/views/admin/products/_index.html.erb | 2 | ||||
| -rw-r--r-- | app/views/admin/products/index.html.erb | 8 | ||||
| -rw-r--r-- | app/views/admin/products/show.html.erb | 11 | ||||
| -rw-r--r-- | app/views/favorites/index.html.erb | 21 | ||||
| -rw-r--r-- | config/routes.rb | 2 |
7 files changed, 14 insertions, 41 deletions
diff --git a/app/controllers/favorites_controller.rb b/app/controllers/favorites_controller.rb index 095cc23a..d2901dde 100644 --- a/app/controllers/favorites_controller.rb +++ b/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) diff --git a/app/views/admin/photos/show.html.erb b/app/views/admin/photos/show.html.erb index 61095fea..11299105 100644 --- a/app/views/admin/photos/show.html.erb +++ b/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"> diff --git a/app/views/admin/products/_index.html.erb b/app/views/admin/products/_index.html.erb index b6096965..03db79ad 100644 --- a/app/views/admin/products/_index.html.erb +++ b/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> diff --git a/app/views/admin/products/index.html.erb b/app/views/admin/products/index.html.erb index 40e239c7..5cb3bf3c 100644 --- a/app/views/admin/products/index.html.erb +++ b/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" %> diff --git a/app/views/admin/products/show.html.erb b/app/views/admin/products/show.html.erb index 72301f08..360b19c1 100644 --- a/app/views/admin/products/show.html.erb +++ b/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> - diff --git a/app/views/favorites/index.html.erb b/app/views/favorites/index.html.erb deleted file mode 100644 index a406b57c..00000000 --- a/app/views/favorites/index.html.erb +++ /dev/null @@ -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> diff --git a/config/routes.rb b/config/routes.rb index dee759b1..22a51796 100644 --- a/config/routes.rb +++ b/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' |
