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

ERB fixes for the backend (🐛+💅) #4891

Merged
merged 11 commits into from
Feb 1, 2023
2 changes: 1 addition & 1 deletion backend/app/assets/javascripts/spree/backend/shipments.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ adjustShipmentItems = function(shipment_number, variant_id, quantity){
json = response.responseJSON;
message = json.error;
for (error in json.errors) {
message += '<br />' + json.errors[error].join();
message += '<br>' + json.errors[error].join();
}
window.show_flash('error', message);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<td class="line-item-name">
{{ line_item.variant.name }}<br>
{{#if line_item.variant.options_text }}
{{ line_item.variant.options_text }}<br/>
{{ line_item.variant.options_text }}<br>
{{/if}}
<strong>{{ t "sku" }}:</strong> {{ line_item.variant.sku }}
</td>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<fieldset>
<table class="stock-levels" data-hook="stock-levels">
<colgroup>
<col style="width: 50%;" />
<col style="width: 50%;" />
<col style="width: 50%;">
<col style="width: 50%;">
</colgroup>
<thead>
<th>{{ t "name" }}</th>
Expand Down
4 changes: 2 additions & 2 deletions backend/app/helpers/spree/admin/adjustments_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ def display_line_item(line_item)
parts << variant.product.name
parts << "(#{variant.options_text})" if variant.options_text.present?
parts << line_item.display_amount
safe_join(parts, "<br />".html_safe)
safe_join(parts, "<br>".html_safe)
end

def display_shipment(shipment)
parts = [
"#{t('spree.shipment')} ##{shipment.number}",
shipment.display_cost
]
safe_join(parts, "<br />".html_safe)
safe_join(parts, "<br>".html_safe)
end

def display_order(_order)
Expand Down
2 changes: 1 addition & 1 deletion backend/app/helpers/spree/admin/base_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def error_message_on(object, method, _options = {})
obj = object.respond_to?(:errors) ? object : instance_variable_get("@#{object}")

if obj && obj.errors[method].present?
errors = safe_join(obj.errors[method], "<br />".html_safe)
errors = safe_join(obj.errors[method], "<br>".html_safe)
content_tag(:span, errors, class: 'formError')
else
''
Expand Down
2 changes: 1 addition & 1 deletion backend/app/helpers/spree/admin/stock_movements_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def display_variant(stock_movement)
variant = stock_movement.stock_item.variant
output = [variant.name]
output << variant.options_text unless variant.options_text.blank?
safe_join(output, "<br />".html_safe)
safe_join(output, "<br>".html_safe)
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
<% if @adjustment_reasons.any? %>
<table class="index" id='listing_adjustment_reasons'>
<colgroup>
<col style="width: 65%" />
<col style="width: 20%" />
<col style="width: 15%" />
<col style="width: 65%">
<col style="width: 20%">
<col style="width: 15%">
</colgroup>
<thead>
<tr data-hook="adjustment_reasons_header">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<div data-hook="admin_adjustment_reason_form_fields" class="row">
<div class="col-3">
<%= f.field_container :name do %>
<%= f.label :name, class: 'required' %><br />
<%= f.label :name, class: 'required' %><br>
<%= f.text_field :name, class: 'fullwidth' %>
<% end %>

<%= f.field_container :code do %>
<%= f.label :code, class: 'required' %><br />
<%= f.label :code, class: 'required' %><br>
<%= f.text_field :code, class: 'fullwidth' %>
<% end %>

Expand Down
2 changes: 1 addition & 1 deletion backend/app/views/spree/admin/adjustments/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<div class="col-3">
<%= f.field_container :label do %>
<%= f.label :adjustment_reason_id %><br/>
<%= f.label :adjustment_reason_id %><br>
<%= f.collection_select(:adjustment_reason_id, reasons_for(@adjustment), :id, :name, {include_blank: true}, {"data-placeholder" => t('spree.select_a_reason'), class: 'custom-select fullwidth'}) %>
<% end %>
</div>
Expand Down
4 changes: 2 additions & 2 deletions backend/app/views/spree/admin/adjustments/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@
<%= button_tag t('spree.add_coupon_code'), id: "add_coupon_code", class: 'btn btn-primary' %>
</div>
<% end %>
<%= javascript_tag do -%>
<script>
var order_number = '<%= @order.number %>';
<% end -%>
</script>
1 change: 0 additions & 1 deletion backend/app/views/spree/admin/adjustments/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
<% admin_breadcrumb(link_to plural_resource_name(Spree::Adjustment), spree.admin_order_adjustments_path(@order)) %>
<% admin_breadcrumb(t('spree.new_adjustment')) %>


<% content_for :page_actions do %>
<% end %>

Expand Down
12 changes: 6 additions & 6 deletions backend/app/views/spree/admin/cancellations/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

<table class="stock-contents index">
<colgroup>
<col style="width: 10%;" />
<col style="width: 35%;" />
<col style="width: 10%;" />
<col style="width: 15%;" />
<col style="width: 20%;" />
<col style="width: 10%;" />
<col style="width: 10%;">
<col style="width: 35%;">
<col style="width: 10%;">
<col style="width: 15%;">
<col style="width: 20%;">
<col style="width: 10%;">
</colgroup>

<thead>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<th class="wrap-text"><%= Spree::ReturnItem.human_attribute_name(:exchange_variant) %></th>
<th class="wrap-text"><%= Spree::ReturnItem.human_attribute_name(:acceptance_status_errors) %></th>
<th class="wrap-text"><%= Spree::ReturnItem.human_attribute_name(:reception_status) %></th>
<% unless return_items.all?(&:received?)%>
<% unless return_items.all?(&:received?) %>
<th class="wrap-text"><%= Spree::ReturnItem.human_attribute_name(:item_received?) %></th>
<% end %>
<% if show_decision %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
<% admin_breadcrumb(link_to plural_resource_name(Spree::CustomerReturn), spree.admin_order_customer_returns_url(@order)) %>
<% admin_breadcrumb(t('spree.new_customer_return')) %>


<% content_for :page_actions do %>
<% end %>

Expand Down
3 changes: 1 addition & 2 deletions backend/app/views/spree/admin/images/_image_row.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<tr id="<%= spree_dom_id image %>" data-hook="images_row">

<td>
<% if can?(:update_positions, Spree::Image) %>
<span class="handle"></span>
Expand Down Expand Up @@ -28,7 +27,7 @@
<%= f.select :viewable_id, options_for_select(@variants, image.viewable_id), {}, class: 'select2 fullwidth', autocomplete: "off" %>
<% end %>
</td>
<% end # @product.has_variants? %>
<% end %>

<td>
<%= fields_for image do |f| %>
Expand Down
1 change: 0 additions & 1 deletion backend/app/views/spree/admin/images/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
<% admin_breadcrumb(link_to plural_resource_name(Spree::Image), admin_product_images_path(@product)) %>
<% admin_breadcrumb(@image.filename) %>


<% content_for :page_actions do %>
<li><%= link_to t('spree.back_to_images_list'), admin_product_images_url(@product), class: 'btn btn-primary' %></li>
<% end %>
Expand Down
1 change: 0 additions & 1 deletion backend/app/views/spree/admin/images/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

<% admin_breadcrumb(plural_resource_name(Spree::Image)) %>


<% content_for :page_actions do %>
<% if can?(:create, Spree::Image) %>
<li>
Expand Down
4 changes: 2 additions & 2 deletions backend/app/views/spree/admin/option_types/_form.html.erb
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<div data-hook="admin_option_type_form_fields" class="align-center row">
<div class="col-6">
<%= f.field_container :name do %>
<%= f.label :name, class: 'required' %><br />
<%= f.label :name, class: 'required' %><br>
<%= f.text_field :name, class: "fullwidth" %>
<%= f.error_message_on :name %>
<% end %>
</div>

<div class="col-6">
<%= f.field_container :presentation do %>
<%= f.label :presentation, class: 'required' %><br />
<%= f.label :presentation, class: 'required' %><br>
<%= f.text_field :presentation, class: "fullwidth" %>
<%= f.error_message_on :presentation %>
<% end %>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<tr class="option_value fields" id="spree_<%= dom_id(f.object) %>" data-hook="option_value">
<tr class="option_value fields" id="spree_<%= dom_id(f.object) %>" data-hook="option_value">
<td>
<% if f.object.persisted? %>
<span class="handle"></span>
Expand Down
1 change: 0 additions & 1 deletion backend/app/views/spree/admin/option_types/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
<% admin_breadcrumb(link_to plural_resource_name(Spree::OptionType), spree.admin_option_types_path) %>
<% admin_breadcrumb(@option_type.name) %>


<% content_for :page_actions do %>
<li>
<span id="new_add_option_value" data-hook>
Expand Down
1 change: 0 additions & 1 deletion backend/app/views/spree/admin/option_types/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<% admin_breadcrumb(link_to plural_resource_name(Spree::Product), spree.admin_products_path) %>
<% admin_breadcrumb(plural_resource_name(Spree::OptionType)) %>


<% content_for :page_actions do %>
<% if can?(:create, Spree::OptionType) %>
<li id="new_ot_link">
Expand Down
4 changes: 2 additions & 2 deletions backend/app/views/spree/admin/orders/_adjustments.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<table>
<thead>
<tr>
<th><%= Spree::Adjustment.human_attribute_name(:name)%></th>
<th><%= Spree::Adjustment.human_attribute_name(:amount)%></th>
<th><%= Spree::Adjustment.human_attribute_name(:name) %></th>
<th><%= Spree::Adjustment.human_attribute_name(:amount) %></th>
</tr>
</thead>
<tbody data-hook="order_details_adjustments">
Expand Down
10 changes: 5 additions & 5 deletions backend/app/views/spree/admin/orders/_carton.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@

<table class="stock-contents carton index" data-hook="stock-contents">
<colgroup>
<col style="width: 10%;" />
<col style="width: 45%;" />
<col style="width: 15%;" />
<col style="width: 15%;" />
<col style="width: 15%;" />
<col style="width: 10%;">
<col style="width: 45%;">
<col style="width: 15%;">
<col style="width: 15%;">
<col style="width: 15%;">
</colgroup>

<thead>
Expand Down
4 changes: 2 additions & 2 deletions backend/app/views/spree/admin/orders/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@

<%= render "spree/admin/orders/order_details", { order: order } %>

<%= javascript_tag do -%>
<script>
var order_number = '<%= @order.number %>';
var shipments = [];

<% @order.shipments.each do |shipment| %>
shipments.push(<%== shipment.as_json(root: false, only: [:id, :tracking, :number, :state, :stock_location_id], include: [:inventory_units, :stock_location]).to_json %>);
<% end %>
<% end -%>
</script>
</div>
12 changes: 6 additions & 6 deletions backend/app/views/spree/admin/orders/_line_items.html.erb
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<table class="line-items index" data-hook="line-items">
<colgroup>
<col style="width: 10%;" />
<col style="width: 45%;" />
<col style="width: 10%;" />
<col style="width: 10%;" />
<col style="width: 10%;" />
<col style="width: 15%;" />
<col style="width: 10%;">
<col style="width: 45%;">
<col style="width: 10%;">
<col style="width: 10%;">
<col style="width: 10%;">
<col style="width: 15%;">
</colgroup>

<thead>
Expand Down
6 changes: 3 additions & 3 deletions backend/app/views/spree/admin/orders/_risk_analysis.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
<legend><%= "#{t('spree.risk_analysis')}: #{t('spree.not') unless @order.is_risky?} #{t('spree.risky')}" %></legend>
<table>
<thead>
<th><%= t('spree.risk')%></th>
<th><%= t('spree.status')%></th>
<th><%= t('spree.risk') %></th>
<th><%= t('spree.status') %></th>
</thead>
<tbody id="risk-analysis" data-hook="order_details_adjustments" class="with-border">
<tbody id="risk-analysis" data-hook="order_details_adjustments" class="with-border">
<tr class="">
<td><strong>
<%= t('spree.failed_payment_attempts') %>:
Expand Down
12 changes: 6 additions & 6 deletions backend/app/views/spree/admin/orders/_shipment.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@

<table class="stock-contents shipment index" data-hook="stock-contents">
<colgroup>
<col style="width: 17.5%;" />
<col style="width: 30%;" />
<col style="width: 12.5%;" />
<col style="width: 15%;" />
<col style="width: 15%;" />
<col style="width: 10%;" />
<col style="width: 17.5%;">
<col style="width: 30%;">
<col style="width: 12.5%;">
<col style="width: 15%;">
<col style="width: 15%;">
<col style="width: 10%;">
</colgroup>

<thead>
Expand Down
1 change: 0 additions & 1 deletion backend/app/views/spree/admin/orders/cart.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

<% admin_breadcrumb(t('spree.cart')) %>


<div data-hook="admin_order_edit_header">
<%= render partial: 'spree/shared/error_messages', locals: { target: @order } %>
</div>
Expand Down
1 change: 0 additions & 1 deletion backend/app/views/spree/admin/orders/confirm.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

<% admin_breadcrumb(t('spree.confirm_order')) %>


<%= render partial: 'spree/admin/orders/confirm/customer_details', locals: {order: @order} %>

<% if Spree::Order.checkout_step_names.include?(:delivery) %>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<fieldset class="no-border-bottom" data-hook="customer_details_total">
<legend><%= t('spree.customer') %></legend>
<div class="customer"><%= order.user.try(:email) %></div><br/>
<div class="customer"><%= order.user.try(:email) %></div><br>
</fieldset>

<fieldset class="no-border-bottom no-border-top">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@

<% admin_breadcrumb(t('spree.confirm_order')) %>


<div class="form-buttons filter-actions actions" data-hook="complete-order-button">
<div><%= t('spree.order_please_refresh') %></div><br/>
<div><%= t('spree.order_please_refresh') %></div><br>
<%= button_to [:advance, :admin, @order], { class: 'button', method: 'put' } do %>
<%= t('spree.order_refresh_totals') %>
<% end %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

<% admin_breadcrumb(t('spree.customer_details')) %>


<% content_for :page_actions do %>
<% end %>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@

<% admin_breadcrumb(t('spree.customer_details')) %>


<% content_for :page_actions do %>
<li><%= link_to t('spree.back_to_orders_list'), admin_orders_path, class: 'btn btn-primary' %></li>
<% end %>


<main class="col-5">
<section>
<%= content_tag :h4, t('spree.account') %>
Expand Down
3 changes: 1 addition & 2 deletions backend/app/views/spree/admin/orders/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

<% admin_breadcrumb(plural_resource_name(Spree::Order)) %>


<% content_for :page_actions do %>
<li>
<%= link_to t('spree.new_order'), new_admin_order_url, id: 'admin_new_order', class: 'btn btn-primary' %>
Expand Down Expand Up @@ -158,7 +157,7 @@
</span>
</td>
<td>
<% if order.payment_state %>
<% if order.payment_state %>
<span class="pill pill-<%= order.payment_state %>">
<%= t(order.payment_state, scope: 'spree.payment_states') %>
</span>
Expand Down
Loading