mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Pull out type change form into a partial
This commit is contained in:
48
app/views/spree/admin/overview/_change_type_form.html.haml
Normal file
48
app/views/spree/admin/overview/_change_type_form.html.haml
Normal file
@@ -0,0 +1,48 @@
|
||||
= form_for @enterprise, url: main_app.set_sells_admin_enterprise_path(@enterprise), html: { name: "enterprise", novalidate: true } do |enterprise_form|
|
||||
-# Have to use hidden:'true' on this input rather than type:'hidden' as the latter seems to break ngPattern and therefore validation
|
||||
%input{ hidden: "true", name: "sells", ng: { required: true, pattern: "/^(none|own)$/", model: 'sells', value: "sells"} }
|
||||
.options.sixteen.columns.alpha
|
||||
- if @enterprise.is_primary_producer
|
||||
%input{ type: 'checkbox', hidden: true, name: "producer_profile_only", ng: { required: true, model: 'producer_profile_only', value: "producer_profile_only"} }
|
||||
.basic_producer.option.one-third.column.alpha
|
||||
%a.full-width.button.selector{ ng: { click: "sells='none';producer_profile_only=true;", class: "{selected: sells=='none' && producer_profile_only==true}" } }
|
||||
.top
|
||||
%h3 Producer Profile
|
||||
%p Connect through OFN
|
||||
.bottom ALWAYS FREE
|
||||
%p.description
|
||||
You want to use Open Food Network as a place for people to find and contact you.
|
||||
|
||||
.producer_shop.option.one-third.column
|
||||
%a.full-width.button.selector{ ng: { click: "sells='none';producer_profile_only=false;", class: "{selected: sells=='none' && producer_profile_only==false}" } }
|
||||
.top
|
||||
%h3 Sell products
|
||||
%p As a supplier
|
||||
.bottom ALWAYS FREE
|
||||
%p.description
|
||||
Add your products to Open Food Network, allowing customers to see your product range, and allowing you to act as a supplier to other shopfronts.
|
||||
|
||||
.full_hub.option.one-third.column.omega.disabled
|
||||
%a.full-width.button.selector{ ng: { click: "sells='own';producer_profile_only=false;", class: "{selected: sells=='own' && producer_profile_only==false}" } }
|
||||
.top
|
||||
%h3 Sell products
|
||||
%p Through an OFN shopfront
|
||||
.bottom 30 DAY TRIAL
|
||||
%p.description
|
||||
Test out having your own shopfront with full access to all Shopfront features for 30 days. After your trial expires you can keep your Shopfront for a subscription cost of $50 per month.
|
||||
|
||||
- else
|
||||
.shop_profile.option.one-third.column.alpha
|
||||
%a.full-width.button.selector{ ng: { class: "{selected: sells=='none'}" } }
|
||||
.top
|
||||
%h3 Shop Profile
|
||||
%p Get a listing
|
||||
.bottom ALWAYS FREE
|
||||
%p.description
|
||||
You want to use OFN as a place for people to find and contact you.
|
||||
|
||||
.sixteen.columns.alpha
|
||||
.admin-cta
|
||||
%span.error{ ng: { show: "(enterprise.sells.$error.pattern || enterprise.sells.$error.pattern) && submitted" } }
|
||||
Please choose one of the options above.
|
||||
%input{ type: 'submit', value: 'Next', ng: { click: "submit(enterprise)" } }
|
||||
@@ -10,55 +10,4 @@
|
||||
%h2 Next step
|
||||
%p Choose your starting point:
|
||||
|
||||
= form_for @enterprise, url: main_app.set_sells_admin_enterprise_path(@enterprise), html: { name: "enterprise", novalidate: true } do |enterprise_form|
|
||||
-# Have to use hidden:'true' on this input rather than type:'hidden' as the latter seems to break ngPattern and therefore validation
|
||||
%input{ hidden: "true", name: "sells", ng: { required: true, pattern: "/^(none|own)$/", model: 'sells', value: "sells"} }
|
||||
.options.sixteen.columns.alpha
|
||||
- if @enterprise.is_primary_producer
|
||||
%input{ type: 'checkbox', hidden: true, name: "producer_profile_only", ng: { required: true, model: 'producer_profile_only', value: "producer_profile_only"} }
|
||||
.basic_producer.option.one-third.column.alpha
|
||||
%a.full-width.button.selector{ ng: { click: "sells='none';producer_profile_only=true;", class: "{selected: sells=='none' && producer_profile_only==true}" } }
|
||||
.top
|
||||
%h3 Producer Profile
|
||||
%p Connect through OFN
|
||||
.bottom ALWAYS FREE
|
||||
%p.description
|
||||
You want to use Open Food Network as a place for people to find and contact you.
|
||||
|
||||
.producer_shop.option.one-third.column
|
||||
%a.full-width.button.selector{ ng: { click: "sells='none';producer_profile_only=false;", class: "{selected: sells=='none' && producer_profile_only==false}" } }
|
||||
.top
|
||||
%h3 Sell products
|
||||
%p As a supplier
|
||||
.bottom ALWAYS FREE
|
||||
%p.description
|
||||
Add your products to Open Food Network, allowing customers to see your product range, and allowing you to act as a supplier to other shopfronts.
|
||||
|
||||
.full_hub.option.one-third.column.omega.disabled
|
||||
%a.full-width.button.selector{ ng: { click: "sells='own';producer_profile_only=false;", class: "{selected: sells=='own' && producer_profile_only==false}" } }
|
||||
.top
|
||||
%h3 Sell products
|
||||
%p Through an OFN shopfront
|
||||
.bottom 30 DAY TRIAL
|
||||
%p.description
|
||||
Test out having your own shopfront with full access to all Shopfront features for 30 days. After your trial expires you can keep your Shopfront for a subscription cost of $50 per month.
|
||||
|
||||
- else
|
||||
.shop_profile.option.one-third.column.alpha
|
||||
%a.full-width.button.selector{ ng: { class: "{selected: sells=='none'}" } }
|
||||
.top
|
||||
%h3 Shop Profile
|
||||
%p Get a listing
|
||||
.bottom ALWAYS FREE
|
||||
%p.description
|
||||
You want to use OFN as a place for people to find and contact you.
|
||||
|
||||
.sixteen.columns.alpha
|
||||
.admin-cta
|
||||
%span.error{ ng: { show: "(enterprise.sells.$error.pattern || enterprise.sells.$error.pattern) && submitted" } }
|
||||
Please choose one of the options above.
|
||||
%input{ type: 'submit', value: 'Next', ng: { click: "submit(enterprise)" } }
|
||||
|
||||
|
||||
|
||||
|
||||
= render partial: "change_type_form"
|
||||
|
||||
Reference in New Issue
Block a user