mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-08 22:56:06 +00:00
Dont show 'closing in' message when oc closes in more than 3 months
This commit is contained in:
@@ -25,3 +25,6 @@ Darkswarm.controller "OrderCycleChangeCtrl", ($scope, $rootScope, $timeout, Orde
|
||||
Cart.reloadFinalisedLineItems()
|
||||
ChangeableOrdersAlert.reload()
|
||||
$rootScope.$broadcast 'orderCycleSelected'
|
||||
|
||||
$scope.closesInLessThan3Months = () ->
|
||||
moment().diff(moment(OrderCycle.orders_close_at(), "YYYY-MM-DD HH:mm:SS Z"), 'days') > -75
|
||||
|
||||
@@ -170,6 +170,10 @@ shop ordercycle {
|
||||
float: none;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.no-message-pad {
|
||||
padding: 0.95rem;
|
||||
}
|
||||
}
|
||||
|
||||
form.custom {
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
%div{"ng-controller" => "OrderCycleChangeCtrl", "ng-cloak" => true}
|
||||
%closing
|
||||
%div{"ng-if" => "OrderCycle.selected()"}
|
||||
= t :enterprises_next_closing
|
||||
%strong {{ OrderCycle.orders_close_at() | date_in_words }}
|
||||
%div{"ng-if" => "closesInLessThan3Months()"}
|
||||
= t :enterprises_next_closing
|
||||
%strong {{ OrderCycle.orders_close_at() | date_in_words }}
|
||||
%div.no-message-pad{"ng-if" => "!closesInLessThan3Months()"}
|
||||
%div{"ng-if" => "!OrderCycle.selected()"}
|
||||
= t :enterprises_choose
|
||||
|
||||
|
||||
@@ -49,11 +49,24 @@ feature "As a consumer I want to shop with a distributor", js: true do
|
||||
describe "selecting an order cycle" do
|
||||
let(:exchange1) { oc1.exchanges.to_enterprises(distributor).outgoing.first }
|
||||
|
||||
it "selects an order cycle if only one is open" do
|
||||
exchange1.update_attribute :pickup_time, "turtles"
|
||||
visit shop_path
|
||||
expect(page).to have_selector "p", text: 'turtles'
|
||||
expect(page).not_to have_content "choose when you want your order"
|
||||
describe "with only one open order cycle" do
|
||||
before { exchange1.update_attribute :pickup_time, "turtles" }
|
||||
|
||||
it "selects an order cycle" do
|
||||
visit shop_path
|
||||
expect(page).to have_selector "p", text: 'turtles'
|
||||
expect(page).not_to have_content "choose when you want your order"
|
||||
expect(page).to have_content "Next order closing in 2 days"
|
||||
end
|
||||
|
||||
describe "when order cycle closes in more than 3 months" do
|
||||
before { oc1.update orders_close_at: 5.months.from_now }
|
||||
|
||||
it "does not show 'closing in' message" do
|
||||
visit shop_path
|
||||
expect(page).not_to have_content "Next order closing in 2 days"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "with multiple order cycles" do
|
||||
|
||||
Reference in New Issue
Block a user