mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-25 20:46:48 +00:00
Add option 'allow guest orders' to enterprise
An enterprise manager can choose to allow guest orders (default) or require a valid login for checkout.
This commit is contained in:
@@ -45,3 +45,15 @@
|
||||
.five.columns.omega
|
||||
= f.radio_button :require_login, true
|
||||
= f.label :require_login, t('.shopfront_requires_login_true'), value: :true
|
||||
.row
|
||||
.alpha.eleven.columns
|
||||
.three.columns.alpha
|
||||
%label= t '.allow_guest_orders'
|
||||
%div{'ofn-with-tip' => t('.allow_guest_orders_tip')}
|
||||
%a= t 'admin.whats_this'
|
||||
.three.columns
|
||||
= f.radio_button :allow_guest_orders, false
|
||||
= f.label :allow_guest_orders, t('.allow_guest_orders_false'), value: :false
|
||||
.five.columns.omega
|
||||
= f.radio_button :allow_guest_orders, true
|
||||
= f.label :allow_guest_orders, t('.allow_guest_orders_true'), value: :true
|
||||
|
||||
@@ -201,6 +201,10 @@ en:
|
||||
shopfront_requires_login_tip: "Choose whether customers must login to view the shopfront."
|
||||
shopfront_requires_login_false: "Public"
|
||||
shopfront_requires_login_true: "Require customers to login"
|
||||
allow_guest_orders: "Guest orders"
|
||||
allow_guest_orders_tip: "Allow checkout as guest or require a registered user."
|
||||
allow_guest_orders_false: "Require login to order"
|
||||
allow_guest_orders_true: "Allow checkout as guest"
|
||||
|
||||
home:
|
||||
hubs:
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
class AddAllowGuestOrdersToEnterprise < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :enterprises, :allow_guest_orders, :boolean, default: true, null: false
|
||||
end
|
||||
end
|
||||
@@ -11,7 +11,7 @@
|
||||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20160819065331) do
|
||||
ActiveRecord::Schema.define(:version => 20160921060442) do
|
||||
|
||||
create_table "account_invoices", :force => true do |t|
|
||||
t.integer "user_id", :null => false
|
||||
@@ -248,6 +248,7 @@ ActiveRecord::Schema.define(:version => 20160819065331) do
|
||||
t.boolean "charges_sales_tax", :default => false, :null => false
|
||||
t.string "email_address"
|
||||
t.boolean "require_login", :default => false, :null => false
|
||||
t.boolean "allow_guest_orders", :default => true, :null => false
|
||||
end
|
||||
|
||||
add_index "enterprises", ["address_id"], :name => "index_enterprises_on_address_id"
|
||||
|
||||
@@ -90,6 +90,10 @@ feature %q{
|
||||
expect(page).to have_checked_field "enterprise_require_login_false"
|
||||
choose "Require customers to login"
|
||||
|
||||
# Require login for checkout
|
||||
expect(page).to have_checked_field "enterprise_allow_guest_orders_true"
|
||||
choose "Require login to order"
|
||||
|
||||
within (".side_menu") { click_link "Users" }
|
||||
select2_search user.email, from: 'Owner'
|
||||
|
||||
@@ -191,6 +195,7 @@ feature %q{
|
||||
page.should have_content 'This is my shopfront message.'
|
||||
page.should have_checked_field "enterprise_preferred_shopfront_order_cycle_order_orders_open_at"
|
||||
expect(page).to have_checked_field "enterprise_require_login_true"
|
||||
expect(page).to have_checked_field "enterprise_allow_guest_orders_false"
|
||||
end
|
||||
|
||||
describe "producer properties" do
|
||||
|
||||
Reference in New Issue
Block a user