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

Add headers to shipment method and tracking number #2169

Merged
merged 3 commits into from
Aug 21, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions backend/app/assets/javascripts/spree/backend/shipments.js
Original file line number Diff line number Diff line change
Expand Up @@ -332,10 +332,8 @@ var ShipmentEditView = Backbone.View.extend({

var show = _this.$('tr.show-tracking');
show.toggle()
.find('.tracking-value')
.html($("<strong>")
.html(Spree.translations.tracking + ": "))
.append(document.createTextNode(data.tracking));
.find('.tracking-value')
.text(data.tracking);
});
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,21 @@ table tbody tr {
&.highlight {

@each $action in $actions {
&.action-#{$action} td {
background-color: get-value($actions, $actions-bg-colors, $action);
border-color: get-value($actions, $actions-brd-colors, $action);
&.action-#{$action} {
td, th {
background-color: get-value($actions, $actions-bg-colors, $action);
border-color: get-value($actions, $actions-brd-colors, $action);
}
}
}

&.action-remove td, &.action-void td, &.action-failure td {
text-decoration: line-through;

&.actions {
text-decoration: none;
&.action-remove, &.action-void, &.action-failure {
td, th {
text-decoration: line-through;
}
}
}

&.before-highlight {
@each $action in $actions {
&.action-#{$action} td {
border-bottom-color: get-value($actions, $actions-brd-colors, $action);
td.actions {
text-decoration: none;
}
}
}
Expand Down
36 changes: 16 additions & 20 deletions backend/app/views/spree/admin/orders/_shipment.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@

<table class="stock-contents shipment index" data-hook="stock-contents">
<colgroup>
<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: 15%;" />
<col style="width: 15%;" />
<col style="width: 10%;" />
</colgroup>

<thead>
Expand All @@ -48,17 +48,11 @@

<% unless shipment.shipped? %>
<tr class="edit-method hidden total">
<td colspan="5">
<div class="row">
<div class="col-12">
<div class="field">
<%= label_tag 'selected_shipping_rate_id', Spree::ShippingMethod.model_name.human %>
<%= select_tag :selected_shipping_rate_id,
options_for_select(shipment.shipping_rates.map {|sr| ["#{sr.name} #{sr.display_price}", sr.id] }, shipment.selected_shipping_rate_id),
{class: 'custom-select fullwidth', data: {'shipment-number' => shipment.number } } %>
</div>
</div>
</div>
<th><%= Spree::ShippingMethod.model_name.human %></th>
<td colspan="4">
<%= select_tag :selected_shipping_rate_id,
options_for_select(shipment.shipping_rates.map {|sr| ["#{sr.name} #{sr.display_price}", sr.id] }, shipment.selected_shipping_rate_id),
{class: 'custom-select fullwidth', data: {'shipment-number' => shipment.number } } %>
</td>
<td class="actions">
<% if can? :update, shipment %>
Expand All @@ -73,14 +67,15 @@

<tr class="show-method total">
<% if rate = shipment.selected_shipping_rate %>
<td colspan="4">
<th><%= Spree::ShippingMethod.model_name.human %></th>
<td colspan="3">
<%= rate.name %>
</td>
<td class="total">
<%= shipment.display_cost %>
</td>
<% else %>
<td colspan='5'><%= Spree.t(:no_shipping_method_selected) %></td>
<td colspan="5"><%= Spree.t(:no_shipping_method_selected) %></td>
<% end %>

<td class="actions">
Expand All @@ -91,8 +86,8 @@
</tr>

<tr class="edit-tracking hidden total">
<td colspan="5">
<label><%= Spree::Shipment.human_attribute_name(:tracking) %>:</label>
<th><%= Spree::Shipment.human_attribute_name(:tracking) %></th>
<td colspan="4">
<%= text_field_tag :tracking, shipment.tracking, id: nil %>
</td>
<td class="actions">
Expand All @@ -112,9 +107,10 @@
<% end %>

<tr class="show-tracking total">
<td colspan="5" class="tracking-value">
<th><%= Spree::Shipment.human_attribute_name(:tracking) %></th>
<td colspan="4" class="tracking-value">
<% if shipment.tracking.present? %>
<strong><%= Spree::Shipment.human_attribute_name(:tracking) %>:</strong> <%= shipment.tracking %>
<%= shipment.tracking %>
<% else %>
<i><%= Spree.t(:no_tracking_present) %></i>
<% end %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
data-item-quantity="<%= item.quantity %>"
data-variant-id="<%= item.variant.id %>"
>
<td class="item-image">
<td class="item-image align-center">
<%= render 'spree/admin/shared/image', image: item.variant.display_image, size: :mini %>
</td>
<td class="item-name">
Expand Down
6 changes: 3 additions & 3 deletions backend/spec/features/admin/orders/order_details_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
click_icon :check

expect(page).not_to have_css("input[name=tracking]")
expect(page).to have_content("Tracking: FOOBAR")
expect(page).to have_content("Tracking Number FOOBAR")
end

it "can change the shipping method" do
Expand All @@ -99,7 +99,7 @@
within("table.index tr.show-method") do
click_icon :edit
end
select "UPS Ground $100.00", from: "Shipping Method"
select "UPS Ground $100.00", from: "selected_shipping_rate_id"
click_icon :check

expect(page).not_to have_css('#selected_shipping_rate_id')
Expand Down Expand Up @@ -511,7 +511,7 @@
within("table.index tr.show-method") do
click_icon :edit
end
select "UPS Ground $100.00", from: "Shipping Method"
select "UPS Ground $100.00", from: "selected_shipping_rate_id"
click_icon :check

expect(page).not_to have_css('#selected_shipping_rate_id')
Expand Down