Commit 079a8c34 by vulehuan

dynamic product category on sidebar

parent 45c469cd
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
// Place all the styles related to the ProductCategory controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
class ProductCategoryController < ApplicationController
def show
end
end
<% terms = ProductCategory.all %>
<!-- Product category -->
<div class="box bg">
<h2>
......@@ -6,15 +7,15 @@
class="sprite-1 corner-right"></span>
</h2>
<ul class="list">
<li><a href="" title="">Category 1</a></li>
<li><a href="" title="">Category 2</a></li>
<li><a href="" title="">Category 3</a></li>
<li><a href="" title="">Category 4</a></li>
<li><a href="" title="">Category 5</a></li>
<li><a href="" title="">Category 6</a></li>
<li><a href="" title="">Category 7</a></li>
<li><a href="" title="">Category 8</a></li>
<li><a href="" title="">Category 9</a></li>
<li class="last"><a href="" title="">Category 10</a></li>
<%
n = terms.count
i = 1
terms.each do |term|
%>
<li<%= %Q{ class="last">} if i == n %>><a href="<%= product_category_path(term) %>" title=""><%= term.name %></a></li>
<%
i += 1
end
%>
</ul>
</div>
\ No newline at end of file
......@@ -48,7 +48,6 @@
</div>
</div>
<%= render 'layouts/footer' %>
<%= debug(params) if Rails.env.development? %>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
......
......@@ -39,7 +39,6 @@
<%= yield %>
</div>
<%= render 'layouts/footer' %>
<%= debug(params) if Rails.env.development? %>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
......
VenshopApp::Application.routes.draw do
resources :users
resources :sessions, only: [:new, :create, :destroy]
resources :product_category
get "default_pages/home"
get "users/new"
match '/testyahoo', to: 'users#testyahoo', via: 'get'
match '/signup', to: 'users#new', via: 'get'
match '/signin', to: 'sessions#new', via: 'get'
match '/signout', to: 'sessions#destroy', via: 'delete'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment