From 4e1eefa877f2e3acb387f2e2227698998f0a1a9d Mon Sep 17 00:00:00 2001 From: Cillian O'Ruanaidh Date: Wed, 17 Mar 2021 10:04:26 +0000 Subject: [PATCH] Extract location map from registration form into its own partial, also add missing new lines --- .../admin/enterprises/_new_form.html.haml | 2 +- app/views/layouts/registration.html.haml | 2 +- .../registration/steps/_details.html.haml | 18 +----------------- .../registration/steps/_location_map.html.haml | 18 ++++++++++++++++++ 4 files changed, 21 insertions(+), 19 deletions(-) create mode 100644 app/views/registration/steps/_location_map.html.haml diff --git a/app/views/admin/enterprises/_new_form.html.haml b/app/views/admin/enterprises/_new_form.html.haml index 99737eb635..fb8ece2995 100644 --- a/app/views/admin/enterprises/_new_form.html.haml +++ b/app/views/admin/enterprises/_new_form.html.haml @@ -120,4 +120,4 @@   .row .twelve.columns.alpha - = render partial: "spree/admin/shared/new_resource_links" \ No newline at end of file + = render partial: "spree/admin/shared/new_resource_links" diff --git a/app/views/layouts/registration.html.haml b/app/views/layouts/registration.html.haml index ff42853481..56900bbec2 100644 --- a/app/views/layouts/registration.html.haml +++ b/app/views/layouts/registration.html.haml @@ -35,4 +35,4 @@ = yield :injection_data = render "layouts/i18n_script" - = render "layouts/bugherd_script" \ No newline at end of file + = render "layouts/bugherd_script" diff --git a/app/views/registration/steps/_details.html.haml b/app/views/registration/steps/_details.html.haml index 40c993bccc..faabc3b965 100644 --- a/app/views/registration/steps/_details.html.haml +++ b/app/views/registration/steps/_details.html.haml @@ -56,24 +56,8 @@ %select.chunky{ id: 'enterprise_country', name: 'country', required: true, ng: { init: "setDefaultCountry(#{Spree::Config[:default_country_id]})", model: 'enterprise.country', options: 'c as c.name for c in countries' } } %span.error{ ng: { show: "details.country.$error.required && submitted" } } = t(".country_field_error") - - if using_google_maps? - %div - .center{ ng: {if: "latLong"}} - %strong {{'registration.steps.details.drag_pin' | t}} - .small-12.medium-9.large-12.columns.end - .map-container--registration{id: "registration-map", ng: {if: "!!map"}} - %ui-gmap-google-map{ center: "map.center", zoom: "map.zoom"} - %ui-gmap-marker{idKey: 1, coords: "latLong", options: '{ draggable: true}'} - .center - %input.button.primary{ type: "button", value: "{{'registration.steps.details.locate_address' | t}}", ng: { click: "locateAddress()" } } - .center{ ng: {if: "latLong"}} - .field - %input{ type: 'checkbox', id: 'confirm_address', name: 'confirm_address', ng: { model: 'addressConfirmed', change: 'confirmAddressChange(confirmAddress)'} } - %label{ for: 'confirm_address' } {{'registration.steps.details.confirm_address' | t}} - .small-12.medium-9.large-12.columns.end{ ng: {if: "latLong"}} - .field - %strong {{'registration.steps.details.drag_map_marker' | t}} + = render 'registration/steps/location_map' if using_google_maps? .row.buttons .small-12.columns diff --git a/app/views/registration/steps/_location_map.html.haml b/app/views/registration/steps/_location_map.html.haml new file mode 100644 index 0000000000..a52e4970ae --- /dev/null +++ b/app/views/registration/steps/_location_map.html.haml @@ -0,0 +1,18 @@ +%div + .center{ ng: {if: "latLong"}} + %strong {{'registration.steps.details.drag_pin' | t}} + .small-12.medium-9.large-12.columns.end + .map-container--registration{id: "registration-map", ng: {if: "!!map"}} + %ui-gmap-google-map{ center: "map.center", zoom: "map.zoom"} + %ui-gmap-marker{idKey: 1, coords: "latLong", options: '{ draggable: true}'} + + .center + %input.button.primary{ type: "button", value: "{{'registration.steps.details.locate_address' | t}}", ng: { click: "locateAddress()" } } + .center{ ng: {if: "latLong"}} + .field + %input{ type: 'checkbox', id: 'confirm_address', name: 'confirm_address', ng: { model: 'addressConfirmed', change: 'confirmAddressChange(confirmAddress)'} } + %label{ for: 'confirm_address' } {{'registration.steps.details.confirm_address' | t}} + .small-12.medium-9.large-12.columns.end{ ng: {if: "latLong"}} + .field + %strong {{'registration.steps.details.drag_map_marker' | t}} +