mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-04 22:16:08 +00:00
Replace select box with text when only one OC is available for selection
This commit is contained in:
@@ -60,6 +60,14 @@ ordercycle {
|
||||
}
|
||||
|
||||
select {
|
||||
background-image: url('/assets/white-caret.svg');
|
||||
}
|
||||
|
||||
p {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
select, p {
|
||||
width: inherit;
|
||||
display: inline-block;
|
||||
color: $white;
|
||||
@@ -70,7 +78,6 @@ ordercycle {
|
||||
line-height: 1.5em;
|
||||
padding: 0.5em 1.25em 0.5em 0.75em;
|
||||
height: 2.35em;
|
||||
background-image: url('/assets/white-caret.svg');
|
||||
background-size: 30px auto;
|
||||
border-radius: 0 0.25em 0.25em 0;
|
||||
min-width: 13em;
|
||||
|
||||
@@ -30,13 +30,18 @@
|
||||
.select-label
|
||||
%span= t :enterprises_ready_for
|
||||
|
||||
%select.select2.avenir#order_cycle_id{"ng-model" => "order_cycle.order_cycle_id",
|
||||
"ofn-change-order-cycle" => true,
|
||||
"disabled" => require_customer?,
|
||||
"ng-options" => "oc.id as oc.time for oc in #{oc_select_options.to_json}"}
|
||||
- if oc_select_options.count == 1
|
||||
%p
|
||||
= oc_select_options.first[:time]
|
||||
|
||||
- if oc_select_options.count > 1
|
||||
%option{value: "", disabled: "", selected: ""}= t :shopping_oc_select
|
||||
- else
|
||||
%select.select2.avenir#order_cycle_id{"ng-model" => "order_cycle.order_cycle_id",
|
||||
"ofn-change-order-cycle" => true,
|
||||
"disabled" => require_customer?,
|
||||
"ng-options" => "oc.id as oc.time for oc in #{oc_select_options.to_json}"}
|
||||
|
||||
- if oc_select_options.count > 1
|
||||
%option{value: "", disabled: "", selected: ""}= t :shopping_oc_select
|
||||
|
||||
- content_for :ordercycle_sidebar do
|
||||
.show-for-large-up.large-4.columns
|
||||
|
||||
@@ -50,7 +50,7 @@ feature "As a consumer I want to shop with a distributor", js: true do
|
||||
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 "option[selected]", text: 'turtles'
|
||||
expect(page).to have_selector "p", text: 'turtles'
|
||||
end
|
||||
|
||||
describe "with multiple order cycles" do
|
||||
|
||||
Reference in New Issue
Block a user