-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Admin pricing view #1510
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
03306bd
Add for_master and for_variant scopes to price model
9eec41f
Partition prices for master and variants in prices controller
01b6f85
Expand price table view to show prices for master seperately
31f43b0
Add I18n variables for static text in price table
106f1e6
Add table view for option types and values to admin prices view
cd5f6f9
Update prices controller spec to reflect new assigns
edcd253
Update pricing feature spec to reflect new assigns
431971c
Update changelog
471979f
Add fieldset legends to sections of admin price page
a793e5e
Remove options table view from admin prices view
bcff2f0
Render variants only if some exist prices on admin prices page
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
backend/app/views/spree/admin/prices/_master_variant_table.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<div class="row"> | ||
<div class="col-xs-12"> | ||
<fieldset class="no-border-bottom <%= "no-border-top" if !variants %>"> | ||
<% if variants %> | ||
<legend align="center"><%= I18n.t(:master_variant, scope: :spree) %> <%= admin_hint I18n.t(:master_variant, scope: :spree), I18n.t(:master_variant, scope: [:spree, :hints, "spree/price"]) %></legend> | ||
<% end %> | ||
<table class="index master_prices"> | ||
<colgroup> | ||
<col style="width: 30%"> | ||
<col style="width: 30%"> | ||
<col style="width: 20%"> | ||
<col style="width: 20%"> | ||
</colgroup> | ||
<thead data-hook="master_prices_header"> | ||
<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) %> | ||
| ||
<%= link_to_delete(price, :no_text => true) unless price.deleted? %> | ||
<% end %> | ||
</td> | ||
</tr> | ||
<% end %> | ||
</table> | ||
</fieldset> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,37 @@ | ||
<%= paginate prices, theme: "solidus_admin" %> | ||
<%= paginate variant_prices, theme: "solidus_admin" %> | ||
|
||
<table class="index prices"> | ||
<thead data-hook="prices_header"> | ||
<tr> | ||
<th><%= Spree::Variant.model_name.human %> </th> | ||
<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> | ||
<fieldset class="no-border-bottom"> | ||
<legend align="center"><%= I18n.t(:variant_pricing, scope: :spree) %></legend> | ||
<table class="index prices"> | ||
<thead data-hook="prices_header"> | ||
<tr> | ||
<th><%= Spree::Variant.model_name.human %> </th> | ||
<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> | ||
<tbody> | ||
<% 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> | ||
<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) %> | ||
| ||
<%= link_to_delete(price, :no_text => true) unless price.deleted? %> | ||
<% end %> | ||
</td> | ||
</tr> | ||
<% end %> | ||
</tbody> | ||
</table> | ||
</fieldset> | ||
|
||
<tbody> | ||
<% 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.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) %> | ||
| ||
<%= link_to_delete(price, :no_text => true) unless price.deleted? %> | ||
<% end %> | ||
</td> | ||
</tr> | ||
<% end %> | ||
</tbody> | ||
</table> | ||
|
||
<%= paginate prices, theme: "solidus_admin" %> | ||
<%= paginate variant_prices, theme: "solidus_admin" %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing instance variable names in controllers can be hazardous if people overrode those views. This has not been around for long at all, and I do not suspect many people have used this instance variable name, so I won't ask for a deprecation warning, but maybe a short note in the ChangeLog.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, noted in the ChangeLog.