Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Admin pricing view #1510

Merged
merged 11 commits into from
Nov 9, 2016
Prev Previous commit
Next Next commit
Expand price table view to show prices for master seperately
  • Loading branch information
Graham Bouvier committed Nov 7, 2016
commit 01b6f85c5fb639d5c3b7fb1d348734ba5592cb66
46 changes: 41 additions & 5 deletions backend/app/views/spree/admin/prices/_table.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,41 @@
<%= paginate prices, theme: "solidus_admin" %>
<%= paginate variant_prices, theme: "solidus_admin" %>

<div class="row">
<div class="col-xs-8">
<table class="index master_prices">
<thead data-hook="master_prices_header">
<tr>
<th colspan="3">Master Variant</th>
</tr>
<tr>
<th><%= Spree::Price.human_attribute_name(:country) %></th>
<th><%= Spree::Price.human_attribute_name(:currency) %></th>
<th><%= Spree::Price.human_attribute_name(:amount) %></th>
<th class="actions"></th>
</tr>
</thead>
<% master_prices.each do |price| %>
<tr id="<%= spree_dom_id price %>" data-hook="prices_row" class="<%= "deleted" if price.deleted? %> <%= cycle('odd', 'even')%>">
<td><%= price.display_country %></td>
<td><%= price.currency %></td>
<td class="align-right"><%= price.money.to_html %></td>
<td class="actions">
<% if can?(:update, price) %>
<%= link_to_edit(price, :no_text => true) unless price.deleted? %>
<% end %>
<% if can?(:destroy, price) %>
&nbsp;
<%= link_to_delete(price, :no_text => true) unless price.deleted? %>
<% end %>
</td>
</tr>
<% end %>
</table>
</div>
<div class="col-xs-4">

</div>
</div>

<table class="index prices">
<thead data-hook="prices_header">
Expand All @@ -10,12 +47,11 @@
<th class="actions"></th>
</tr>
</thead>

<tbody>
<% prices.each do |price| %>
<% variant_prices.each do |price| %>
<tr id="<%= spree_dom_id price %>" data-hook="prices_row" class="<%= "deleted" if price.deleted? %> <%= cycle('odd', 'even')%>">
<td><%= price.variant.descriptive_name %></td>
<td><%= price.display_country %>
<td><%= price.display_country %></td>
<td><%= price.currency %></td>
<td class="align-right"><%= price.money.to_html %></td>
<td class="actions">
Expand All @@ -32,4 +68,4 @@
</tbody>
</table>

<%= paginate prices, theme: "solidus_admin" %>
<%= paginate variant_prices, theme: "solidus_admin" %>
2 changes: 1 addition & 1 deletion backend/app/views/spree/admin/prices/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,4 @@
</div>
<% end %>

<%= render 'table', prices: @prices %>
<%= render 'table', variant_prices: @variant_prices, master_prices: @master_prices %>