forked from solidusio/solidus
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request solidusio#2400 from tvdeyen/promotions-ui-fixes
Promotions admin UI fixes
- Loading branch information
Showing
21 changed files
with
127 additions
and
139 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
...ts/javascripts/spree/backend/templates/promotions/calculators/fields/tiered_flat_rate.hbs
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
2 changes: 1 addition & 1 deletion
2
backend/app/views/spree/admin/promotions/_promotion_rule.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
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
14 changes: 4 additions & 10 deletions
14
backend/app/views/spree/admin/promotions/actions/_create_quantity_adjustments.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
54 changes: 25 additions & 29 deletions
54
...p/views/spree/admin/promotions/actions/_promotion_calculators_with_custom_fields.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 |
---|---|---|
@@ -1,33 +1,29 @@ | ||
<div class="col-12"> | ||
<div class="calculator-fields js-calculator-fields row"> | ||
|
||
<div class="col-6"> | ||
<div class="field"> | ||
<% field_name = "#{param_prefix}[calculator_type]" %> | ||
<%= label_tag field_name, Spree::Calculator.model_name.human %> | ||
<%= select_tag field_name, | ||
options_from_collection_for_select(calculators, :to_s, :description, promotion_action.calculator.type), | ||
class: 'type-select js-calculator-type custom-select fullwidth' %> | ||
</div> | ||
<div class="calculator-fields js-calculator-fields row"> | ||
<div class="col-6"> | ||
<div class="field"> | ||
<% field_name = "#{param_prefix}[calculator_type]" %> | ||
<%= label_tag field_name, t('spree.admin.promotions.actions.calculator_label') %> | ||
<%= select_tag field_name, | ||
options_from_collection_for_select(calculators, :to_s, :description, promotion_action.calculator.type), | ||
class: 'type-select js-calculator-type custom-select fullwidth' %> | ||
</div> | ||
|
||
<div class="col-6"> | ||
<div class="settings"> | ||
<% calculators.each do |calculator_class| %> | ||
<% calculator = promotion_action.calculator.class == calculator_class ? promotion_action.calculator : calculator_class.new %> | ||
<div class="js-calculator-preferences" data-calculator-type="<%= calculator_class %>"> | ||
<% type_name = calculator.type.demodulize.underscore %> | ||
<% if lookup_context.exists?("fields", | ||
["spree/admin/promotions/calculators/#{type_name}"], true) %> | ||
<%= render "spree/admin/promotions/calculators/#{type_name}/fields", | ||
calculator: calculator, prefix: param_prefix %> | ||
<% else %> | ||
<%= render "spree/admin/promotions/calculators/default_fields", | ||
calculator: calculator, prefix: param_prefix %> | ||
<% end %> | ||
</div> | ||
<% end %> | ||
</div> | ||
</div> | ||
<div class="col-6"> | ||
<div class="settings"> | ||
<% calculators.each do |calculator_class| %> | ||
<% calculator = promotion_action.calculator.class == calculator_class ? promotion_action.calculator : calculator_class.new %> | ||
<div class="js-calculator-preferences" data-calculator-type="<%= calculator_class %>"> | ||
<% type_name = calculator.type.demodulize.underscore %> | ||
<% if lookup_context.exists?("fields", | ||
["spree/admin/promotions/calculators/#{type_name}"], true) %> | ||
<%= render "spree/admin/promotions/calculators/#{type_name}/fields", | ||
calculator: calculator, prefix: param_prefix %> | ||
<% else %> | ||
<%= render "spree/admin/promotions/calculators/default_fields", | ||
calculator: calculator, prefix: param_prefix %> | ||
<% end %> | ||
</div> | ||
<% end %> | ||
</div> | ||
</div> | ||
</div> |
10 changes: 6 additions & 4 deletions
10
backend/app/views/spree/admin/promotions/calculators/distributed_amount/_fields.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
10 changes: 6 additions & 4 deletions
10
backend/app/views/spree/admin/promotions/calculators/flat_rate/_fields.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 |
---|---|---|
@@ -1,4 +1,6 @@ | ||
<%= fields_for "#{prefix}[calculator_attributes]", calculator do |f| %> | ||
<%= f.label :preferred_amount %> | ||
<%= render "spree/admin/shared/number_with_currency", f: f, amount_attr: :preferred_amount, currency_attr: :preferred_currency %> | ||
<% end %> | ||
<div class="field"> | ||
<%= fields_for "#{prefix}[calculator_attributes]", calculator do |f| %> | ||
<%= f.label :preferred_amount %> | ||
<%= render "spree/admin/shared/number_with_currency", f: f, amount_attr: :preferred_amount, currency_attr: :preferred_currency %> | ||
<% end %> | ||
</div> |
22 changes: 10 additions & 12 deletions
22
backend/app/views/spree/admin/promotions/rules/_item_total.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 |
---|---|---|
@@ -1,16 +1,14 @@ | ||
<div class="col-12"> | ||
<div class="row"> | ||
<div class="col-6"> | ||
<div class="field"> | ||
<%= select_tag "#{param_prefix}[preferred_operator]", options_for_select(Spree::Promotion::Rules::ItemTotal::OPERATORS.map{|o| [t(o, scope: 'spree.item_total_rule.operators'),o]}, promotion_rule.preferred_operator), {class: 'custom-select select_item_total fullwidth'} %> | ||
</div> | ||
<div class="row"> | ||
<div class="col-6"> | ||
<div class="field"> | ||
<%= select_tag "#{param_prefix}[preferred_operator]", options_for_select(Spree::Promotion::Rules::ItemTotal::OPERATORS.map{|o| [t(o, scope: 'spree.item_total_rule.operators'),o]}, promotion_rule.preferred_operator), {class: 'custom-select select_item_total fullwidth'} %> | ||
</div> | ||
<div class="col-6"> | ||
<div class="field"> | ||
<%= fields_for param_prefix, promotion_rule do |f| %> | ||
<%= render "spree/admin/shared/number_with_currency", f: f, amount_attr: :preferred_amount, currency_attr: :preferred_currency %> | ||
<% end %> | ||
</div> | ||
</div> | ||
<div class="col-6"> | ||
<div class="field"> | ||
<%= fields_for param_prefix, promotion_rule do |f| %> | ||
<%= render "spree/admin/shared/number_with_currency", f: f, amount_attr: :preferred_amount, currency_attr: :preferred_currency %> | ||
<% end %> | ||
</div> | ||
</div> | ||
</div> |
7 changes: 0 additions & 7 deletions
7
backend/app/views/spree/admin/promotions/rules/_landing_page.html.erb
This file was deleted.
Oops, something went wrong.
18 changes: 8 additions & 10 deletions
18
backend/app/views/spree/admin/promotions/rules/_nth_order.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 |
---|---|---|
@@ -1,14 +1,12 @@ | ||
<div class="col-12"> | ||
<div class="row"> | ||
<div class="col-6"> | ||
<div class="field"> | ||
<%= Spree::Promotion::Rules::NthOrder.human_attribute_name(:form_text) %> | ||
</div> | ||
<div class="row"> | ||
<div class="col-6"> | ||
<div class="field"> | ||
<%= Spree::Promotion::Rules::NthOrder.human_attribute_name(:form_text) %> | ||
</div> | ||
<div class="col-6"> | ||
<div class="field"> | ||
<%= number_field_tag "#{param_prefix}[preferred_nth_order]", promotion_rule.preferred_nth_order, class: 'fullwidth' %> | ||
</div> | ||
</div> | ||
<div class="col-6"> | ||
<div class="field"> | ||
<%= number_field_tag "#{param_prefix}[preferred_nth_order]", promotion_rule.preferred_nth_order, class: 'fullwidth' %> | ||
</div> | ||
</div> | ||
</div> |
19 changes: 8 additions & 11 deletions
19
backend/app/views/spree/admin/promotions/rules/_option_value.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
22 changes: 12 additions & 10 deletions
22
backend/app/views/spree/admin/promotions/rules/_product.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 |
---|---|---|
@@ -1,13 +1,15 @@ | ||
<div class="col-12"> | ||
<div class="field products_rule_products"> | ||
<%= label_tag "#{param_prefix}_product_ids_string", t('spree.product_rule.choose_products') %> | ||
<%= hidden_field_tag "#{param_prefix}[product_ids_string]", promotion_rule.product_ids.join(","), class: "product_picker fullwidth" %> | ||
<div class="row"> | ||
<div class="col-12"> | ||
<div class="field products_rule_products"> | ||
<%= label_tag "#{param_prefix}_product_ids_string", t('spree.product_rule.choose_products') %> | ||
<%= hidden_field_tag "#{param_prefix}[product_ids_string]", promotion_rule.product_ids.join(","), class: "product_picker fullwidth" %> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="col-12"> | ||
<div class="field"> | ||
<label> | ||
<%= t('spree.product_rule.label', select: select_tag("#{param_prefix}[preferred_match_policy]", options_for_select(Spree::Promotion::Rules::Product::MATCH_POLICIES.map{|s| [t("spree.product_rule.match_#{s}"),s] }, promotion_rule.preferred_match_policy), {class: 'select_product custom-select'})).html_safe %> | ||
</label> | ||
<div class="col-12"> | ||
<div class="field"> | ||
<label> | ||
<%= t('spree.product_rule.label', select: select_tag("#{param_prefix}[preferred_match_policy]", options_for_select(Spree::Promotion::Rules::Product::MATCH_POLICIES.map{|s| [t("spree.product_rule.match_#{s}"),s] }, promotion_rule.preferred_match_policy), {class: 'select_product custom-select'})).html_safe %> | ||
</label> | ||
</div> | ||
</div> | ||
</div> |
24 changes: 9 additions & 15 deletions
24
backend/app/views/spree/admin/promotions/rules/_taxon.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 |
---|---|---|
@@ -1,15 +1,9 @@ | ||
<div class="row"> | ||
<div class="col-11"> | ||
<div class="field taxons_rule_taxons"> | ||
<%= label_tag "#{param_prefix}_taxon_ids_string", t('spree.taxon_rule.choose_taxons') %> | ||
<%= hidden_field_tag "#{param_prefix}[taxon_ids_string]", promotion_rule.taxon_ids.join(","), class: "taxon_picker fullwidth", id: 'product_taxon_ids' %> | ||
</div> | ||
</div> | ||
<div class="col-12"> | ||
<div class="field"> | ||
<label> | ||
<%= t('spree.taxon_rule.label', select: select_tag("#{param_prefix}[preferred_match_policy]", options_for_select(Spree::Promotion::Rules::Taxon::MATCH_POLICIES.map{|s| [t("spree.taxon_rule.match_#{s}"),s] }, promotion_rule.preferred_match_policy), {class: 'select_taxon custom-select'})).html_safe %> | ||
</label> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="field taxons_rule_taxons"> | ||
<%= label_tag "#{param_prefix}_taxon_ids_string", t('spree.taxon_rule.choose_taxons') %> | ||
<%= hidden_field_tag "#{param_prefix}[taxon_ids_string]", promotion_rule.taxon_ids.join(","), class: "taxon_picker fullwidth", id: 'product_taxon_ids' %> | ||
</div> | ||
<div class="field"> | ||
<label> | ||
<%= t('spree.taxon_rule.label', select: select_tag("#{param_prefix}[preferred_match_policy]", options_for_select(Spree::Promotion::Rules::Taxon::MATCH_POLICIES.map{|s| [t("spree.taxon_rule.match_#{s}"),s] }, promotion_rule.preferred_match_policy), {class: 'select_taxon custom-select'})).html_safe %> | ||
</label> | ||
</div> |
8 changes: 3 additions & 5 deletions
8
backend/app/views/spree/admin/promotions/rules/_user.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 |
---|---|---|
@@ -1,6 +1,4 @@ | ||
<div class="col-12"> | ||
<div class="field"> | ||
<label><%= t('spree.user_rule.choose_users') %></label><br> | ||
<input type='hidden' name='<%= param_prefix %>[user_ids_string]' class='user_picker fullwidth' value='<%= promotion_rule.user_ids.join(",") %>'> | ||
</div> | ||
<div class="field"> | ||
<label><%= t('spree.user_rule.choose_users') %></label><br> | ||
<input type='hidden' name='<%= param_prefix %>[user_ids_string]' class='user_picker fullwidth' value='<%= promotion_rule.user_ids.join(",") %>'> | ||
</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
Oops, something went wrong.