|
1 | 1 | <!-- Search Bar --> |
2 | 2 | <div class="input-group" id="adv-search"> |
3 | | - <%= form_tag(root_url, :method => "get", id: "search-form") do %> |
| 3 | + <%= form_tag(root_url, :method => "get", id: "search-form") do %> |
4 | 4 | <%= text_field_tag :search, params[:search], placeholder: "Search..." , class: "form-control" %> |
5 | | - <%= submit_tag "Search" , class: "form_submit" , type: "button"%> |
6 | | - <% end %> |
7 | | - <!-- <input type="text" class="form-control" placeholder="Search...."/> |
8 | | - <div class="input-group-btn"> |
9 | | - <div class="btn-group" role="group"> |
10 | | - <div class="dropdown dropdown-lg"> --> |
11 | | - <!-- <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false"> |
12 | | - <span class="caret"></span></button> |
13 | | - <div class="dropdown-menu dropdown-menu-right" role="menu"> |
14 | | - <form class="form-horizontal" role="form"> |
15 | | - <div class="form-group"> |
16 | | - <label for="filter">Filter by</label> |
17 | | - <select class="form-control"> |
18 | | - <option value="0">Featured</option> |
19 | | - <option value="1">Most popular</option> |
20 | | - <option value="2" selected="selected">Top rated</option> |
21 | | - <option value="3">Most commented</option> |
22 | | - </select> |
23 | | - </div> |
24 | | - <div class="form-group"> |
25 | | - <label for="contain">Top Seller</label> |
26 | | - <input class="form-control" type="text"/> |
27 | | - </div> |
28 | | - <div class="form-group"> |
29 | | - <label for="contain">Contains the words</label> |
30 | | - <input class="form-control" type="text"/> |
31 | | - </div> |
32 | | - <button type="submit" class="btn btn-primary"> |
33 | | - <span class="glyphicon glyphicon-search" aria-hidden="true"></span></button> |
34 | | - </form> |
35 | | - </div> --> |
36 | | - <!-- </div> |
37 | | - <button type="button" class="btn btn-primary"> |
38 | | - <span class="glyphicon glyphicon-search" aria-hidden="true"></span></button> |
39 | | - </div> |
40 | | - </div> --> |
| 5 | + <%= submit_tag "Search" , class: "form_submit"%> |
| 6 | +<% end %> |
| 7 | +<!-- <input type="text" class="form-control" placeholder="Search...."/> <div class="input-group-btn"> <div class="btn-group" role="group"> <div class="dropdown dropdown-lg"> --> |
| 8 | +<!-- <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false"> <span class="caret"></span></button> <div class="dropdown-menu dropdown-menu-right" role="menu"> <form class="form-horizontal" |
| 9 | +role="form"> <div class="form-group"> <label for="filter">Filter by</label> <select class="form-control"> <option value="0">Featured</option> <option value="1">Most popular</option> <option value="2" selected="selected">Top rated</option> <option |
| 10 | +value="3">Most commented</option> </select> </div> <div class="form-group"> <label for="contain">Top Seller</label> <input class="form-control" type="text"/> </div> <div class="form-group"> <label for="contain">Contains the words</label> <input |
| 11 | +class="form-control" type="text"/> </div> <button type="submit" class="btn btn-primary"> <span class="glyphicon glyphicon-search" aria-hidden="true"></span></button> </form> </div> --> |
| 12 | +<!-- </div> <button type="button" class="btn btn-primary"> <span class="glyphicon glyphicon-search" aria-hidden="true"></span></button> </div> </div> --> |
41 | 13 | </div> |
42 | 14 |
|
43 | | -<!-- Only Admin is allowed to create new products --> |
44 | | -<% if logged_in? && current_user.admin? %> |
| 15 | +<%= will_paginate @products %> |
| 16 | + |
| 17 | +<div> |
| 18 | + <!-- Only Admin is allowed to create new products --> |
| 19 | + <% if logged_in? && current_user.admin? %> |
45 | 20 | <%= link_to new_product_path , class: "btn btn-success" , style: "margin-top:15px;" do %> |
46 | 21 | <i class="glyphicon glyphicon-plus" style="color:black;"></i> |
47 | | - Create New Product |
48 | | -<%end %> |
49 | | -<% end %> |
| 22 | + Create New Product (Admin) |
| 23 | + <%end %> |
| 24 | + <% end %> |
50 | 25 |
|
51 | | -<br/> |
| 26 | + <h2> |
| 27 | + <% if params[:search].nil? || params[:search].empty? %> |
| 28 | + All Products (<%= @products.count %>) |
| 29 | + <%else %> |
| 30 | + Found => [ |
| 31 | + <%= pluralize(@products.count, " ] Products") %> |
| 32 | + <%end %> |
| 33 | + </h2> |
| 34 | +</div> |
52 | 35 |
|
53 | | -<%= will_paginate @products %> |
54 | 36 |
|
55 | 37 | <ul class="users"> |
56 | | - <% if @products.present? %> |
| 38 | +<% if @products.present? %> |
57 | 39 |
|
58 | | - <%= render @products %> |
59 | | - <%# @products.each do |product| %> |
60 | | - <%#= render 'shared/product' , product: product %> |
61 | | - <%# end %> |
62 | | - </ul> |
| 40 | +<%= render @products %> |
| 41 | +<%# @products.each do |product| %> |
| 42 | + <%#= render 'shared/product' , product: product %> |
| 43 | + <%# end %> |
| 44 | + </ul> |
63 | 45 |
|
64 | | - <%= will_paginate @products %> |
| 46 | + <%= will_paginate @products %> |
65 | 47 |
|
66 | | - <% else %> |
67 | | - <p>There are no posts containing the term(s) |
68 | | - <%= params[:search] %>.</p> |
69 | | - <% end %> |
70 | | - <br> |
| 48 | + <% else %> |
| 49 | + <p> |
| 50 | + <br /><br /><hr /> |
| 51 | + There are no products containing the term(s) |
| 52 | + => [ <strong><%= params[:search] %></strong> ] . |
| 53 | + |
| 54 | + </p> |
| 55 | + <% end %> |
| 56 | + <br> |
0 commit comments