From 1e96f92df28e5a63fbd84ece749d5ecf99c1ea95 Mon Sep 17 00:00:00 2001 From: Cillian O'Ruanaidh Date: Thu, 22 Apr 2021 22:16:47 +0100 Subject: [PATCH] Fix the toggle address confirmed checkbox so the latitude/longitude gets set Before when you checked and unchecked the checkbox it was toggling the :isConfirmed variable. --- .../registration/registration_controller.js.coffee | 8 ++++---- app/views/registration/steps/_location_map.html.haml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/assets/javascripts/darkswarm/controllers/registration/registration_controller.js.coffee b/app/assets/javascripts/darkswarm/controllers/registration/registration_controller.js.coffee index a373740779..a01575fc8d 100644 --- a/app/assets/javascripts/darkswarm/controllers/registration/registration_controller.js.coffee +++ b/app/assets/javascripts/darkswarm/controllers/registration/registration_controller.js.coffee @@ -4,7 +4,7 @@ Darkswarm.controller "RegistrationCtrl", ($scope, RegistrationService, Enterpris $scope.select = RegistrationService.select $scope.geocodedAddress = '' $scope.latLong = null - $scope.addressConfirmed + $scope.addressConfirmed = false $scope.steps = ['details', 'contact', 'type', 'about', 'images', 'social'] # Filter countries without states since the form requires a state to be selected. @@ -39,9 +39,9 @@ Darkswarm.controller "RegistrationCtrl", ($scope, RegistrationService, Enterpris $scope.map = {center: {latitude: location.lat(), longitude: location.lng()}, zoom: 16 } ) - $scope.confirmAddressChange = (isConfirmed) -> - $scope.addressConfirmed = isConfirmed - if isConfirmed + $scope.toggleAddressConfirmed = -> + $scope.addressConfirmed = !$scope.addressConfirmed + if $scope.addressConfirmed $scope.enterprise.address.latitude = $scope.latLong.latitude $scope.enterprise.address.longitude = $scope.latLong.longitude else diff --git a/app/views/registration/steps/_location_map.html.haml b/app/views/registration/steps/_location_map.html.haml index a52e4970ae..6fd1b4addd 100644 --- a/app/views/registration/steps/_location_map.html.haml +++ b/app/views/registration/steps/_location_map.html.haml @@ -10,7 +10,7 @@ %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)'} } + %input{ type: 'checkbox', id: 'confirm_address', name: 'confirm_address', ng: { click: 'toggleAddressConfirmed()' } } %label{ for: 'confirm_address' } {{'registration.steps.details.confirm_address' | t}} .small-12.medium-9.large-12.columns.end{ ng: {if: "latLong"}} .field