Merge pull request #10547 from vviekk/10419

Enable invoices config only controls Print bulk action
This commit is contained in:
Konrad
2023-03-26 13:53:20 +02:00
committed by GitHub
2 changed files with 22 additions and 18 deletions

View File

@@ -21,27 +21,27 @@
.row.index-controls{'ng-show' => '!RequestMonitor.loading && orders.length > 0'}
%div{style: "display: flex; justify-content: space-between;"}
- if Spree::Config[:enable_invoices?]
.ofn-drop-down-with-prepend
.ofn-drop-down-prepend{"ng-class": "selected_orders.length == 0 ? 'disabled' : ''"}
{{ "spree.admin.orders.index.selected" | t:{count: selected_orders.length} }}
.ofn-drop-down{"ng-class": "selected_orders.length == 0 ? 'disabled' : ''"}
%span{ :class => 'icon-reorder' }
="#{t('admin.actions')}".html_safe
%span{ 'ng-class' => "expanded && 'icon-caret-up' || !expanded && 'icon-caret-down'" }
%div.menu{ 'ng-show' => "expanded" }
%div.menu_item
%span.name{ "data-controller": "modal-link", "data-action": "click->modal-link#open", "data-modal-link-target-value": "resend_confirmation" }
= t('.resend_confirmation')
.ofn-drop-down-with-prepend
.ofn-drop-down-prepend{"ng-class": "selected_orders.length == 0 ? 'disabled' : ''"}
{{ "spree.admin.orders.index.selected" | t:{count: selected_orders.length} }}
.ofn-drop-down{"ng-class": "selected_orders.length == 0 ? 'disabled' : ''"}
%span{ :class => 'icon-reorder' }
="#{t('admin.actions')}".html_safe
%span{ 'ng-class' => "expanded && 'icon-caret-up' || !expanded && 'icon-caret-down'" }
%div.menu{ 'ng-show' => "expanded" }
%div.menu_item
%span.name{ "data-controller": "modal-link", "data-action": "click->modal-link#open", "data-modal-link-target-value": "resend_confirmation" }
= t('.resend_confirmation')
- if Spree::Config[:enable_invoices?]
%div.menu_item
%span.name{ "data-controller": "modal-link", "data-action": "click->modal-link#open", "data-modal-link-target-value": "send_invoice" }
= t('.send_invoice')
%div.menu_item
%span.name.invoices-modal{'ng-controller' => 'bulkInvoiceCtrl', 'ng-click' => 'createBulkInvoice()' }
= t('.print_invoices')
%div.menu_item
%span.name{ "data-controller": "modal-link", "data-action": "click->modal-link#open", "data-modal-link-target-value": "cancel_orders" }
= t('.cancel_orders')
%div.menu_item
%span.name{ "data-controller": "modal-link", "data-action": "click->modal-link#open", "data-modal-link-target-value": "cancel_orders" }
= t('.cancel_orders')
= render partial: 'admin/shared/angular_per_page_controls', locals: { position: "right", model: "orders" }

View File

@@ -22,21 +22,25 @@ describe "spree/admin/orders/index.html.haml" do
allow(view).to receive_messages spree_current_user: create(:user)
end
describe "print invoices button" do
it "displays button when invoices are enabled" do
describe "Bulk order actions" do
it "display all buttons when invoices are enabled" do
Spree::Config[:enable_invoices?] = true
render
expect(rendered).to have_content("Print Invoices")
expect(rendered).to have_content("Resend Confirmation")
expect(rendered).to have_content("Cancel Orders")
end
it "does not display button when invoices are disabled" do
it "does not display print button when invoices are disabled but others remain" do
Spree::Config[:enable_invoices?] = false
render
expect(rendered).to_not have_content("Print Invoices")
expect(rendered).to have_content("Resend Confirmation")
expect(rendered).to have_content("Cancel Orders")
end
end
end