-
Notifications
You must be signed in to change notification settings - Fork 4.9k
/
index.html.erb
102 lines (89 loc) · 3.9 KB
/
index.html.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<% content_for :page_title do %>
<%= Spree.t(:listing_products) %>
<% end %>
<% content_for :page_actions do %>
<li id="new_product_link">
<%= button_link_to Spree.t(:new_product), new_object_url, { :remote => true, :icon => 'icon-plus', :id => 'admin_new_product' } %>
</li>
<% end if can?(:create, Spree::Product) %>
<%= render :partial => 'spree/admin/shared/product_sub_menu' %>
<% content_for :table_filter_title do %>
<%= Spree.t(:search) %>
<% end %>
<% content_for :table_filter do %>
<div data-hook="admin_products_sidebar">
<%= search_form_for [:admin, @search] do |f| %>
<%- locals = {:f => f} %>
<div data-hook="admin_products_index_search">
<div class="alpha nine columns">
<div class="field">
<%= f.label :name_cont, Spree.t(:name) %>
<%= f.text_field :name_cont, :size => 15 %>
</div>
</div>
<div class="four columns">
<div class="field">
<%= f.label :variants_including_master_sku_cont, Spree.t(:sku) %>
<%= f.text_field :variants_including_master_sku_cont, :size => 15 %>
</div>
</div>
<div class="three columns omega">
<div class="field checkbox">
<label>
<%= f.check_box :deleted_at_null, {:checked => params[:q][:deleted_at_null].blank?}, '', '1' %>
<%= Spree.t(:show_deleted) %>
</label>
</div>
</div>
</div>
<div class="clear"></div>
<div class="form-buttons actions filter-actions" data-hook="admin_products_index_search_buttons">
<%= button Spree.t(:search), 'icon-search' %>
</div>
<% end %>
</div>
<% end %>
<div id="new_product_wrapper" data-hook></div>
<%= paginate @collection %>
<% if @collection.any? %>
<table class="index" id="listing_products">
<colgroup>
<col style="width: 15%;">
<col style="width: 10%;">
<col style="width: 48%;">
<col style="width: 10%;">
<col style="width: 17%;">
</colgroup>
<thead>
<tr data-hook="admin_products_index_headers">
<th><%= Spree.t(:sku) %></th>
<th colspan="2"><%= sort_link @search,:name, Spree.t(:name), { :default_order => "desc" }, {:title => 'admin_products_listing_name_title'} %></th>
<th><%= sort_link @search,:master_default_price_amount, Spree.t(:master_price), {}, {:title => 'admin_products_listing_price_title'} %></th>
<th data-hook="admin_products_index_header_actions" class="actions"></th>
</tr>
</thead>
<tbody>
<% @collection.each do |product| %>
<tr <%== "style='color: red;'" if product.deleted? %> id="<%= spree_dom_id product %>" data-hook="admin_products_index_rows" class="<%= cycle('odd', 'even') %>">
<td class="align-center"><%= product.sku rescue '' %></td>
<td class="align-center"><%= mini_image(product) %></td>
<td><%= link_to product.try(:name), edit_admin_product_path(product) %></td>
<td class="align-center"><%= product.display_price.to_html rescue '' %></td>
<td class="actions" data-hook="admin_products_index_row_actions">
<%= link_to_edit product, :no_text => true, :class => 'edit' if can?(:edit, product) && !product.deleted? %>
<%= link_to_clone product, :no_text => true, :class => 'clone' if can?(:clone, product) %>
<%= link_to_delete product, :no_text => true if can?(:delete, product) && !product.deleted? %>
</td>
</tr>
<% end %>
</tbody>
</table>
<% else %>
<div class="alpha twelve columns no-objects-found">
<%= Spree.t(:no_resource_found, resource: I18n.t(:other, scope: 'activerecord.models.spree/product')) %>,
<%= link_to Spree.t(:add_one), spree.new_admin_product_path %>!
</div>
<% end %>
<%= paginate @collection %>