Skip to content

Enable geolocation for address field in proposal form#13423

Merged
alecslupu merged 24 commits intodevelopfrom
feature/geolocation-proposal-form
Nov 3, 2024
Merged

Enable geolocation for address field in proposal form#13423
alecslupu merged 24 commits intodevelopfrom
feature/geolocation-proposal-form

Conversation

@antopalidi
Copy link
Copy Markdown
Member

@antopalidi antopalidi commented Sep 23, 2024

🎩 What? Why?

This PR implements a feature allowing participants to use their device’s geolocation to automatically fill in the address field when creating a proposal.

⚙️ Feature Configuration for "Use my current location" Button

To enable the "Use my current location" button in the geocoded address field for additional components, you can configure this feature in Decidim::Core.

In the config_accessor :show_my_location_button, simply add the manifest names of the components you want to enable this feature for.

Here’s how you can configure it:

config_accessor :show_my_location_button do
  [:proposals]  # Add your components here
end

By default, this feature is enabled for the :proposals component, but you can easily extend it to other components by adding their manifest names to the array.

📌 Related Issues

Testing

  1. Create Proposal with Geolocation:

    • Open the proposal form.
    • Click the "Use my current location" button.
    • Verify that the browser prompts for location access permissions (grant or deny).
    • If permission is granted, ensure the address field is automatically populated based on the detected location.
    • If permission is denied, ensure the user receives a message explaining that geolocation is disabled and allows manual address entry.
  2. Edit Proposal with Geolocation:

    • Open an existing proposal for editing.
    • Test the "Use my current location" button in the same manner as above.
    • Ensure that users can override the auto-filled address or manually enter a new one.
  3. Geolocation Disabled in Browser:

    • Disable geolocation in browser settings.
    • Click "Use my current location" on the proposal form.
    • Confirm that an error message informs the user that geolocation is disabled and prompts them to manually enter the address.

Expected Results:

  • The address field is auto-filled when geolocation is successful.
  • Users can always manually override the address.
  • Clear error messages are shown for geolocation failures or when permissions are denied.

📷 Screenshots

2024-09-23 в 16 29 12 2024-09-23 в 16 30 20

♥️ Thank you!

@probot-autolabeler probot-autolabeler bot added javascript Pull requests that update Javascript code module: core module: proposals labels Sep 23, 2024
@antopalidi antopalidi added project: 2024-developments Barcelona City Council contract type: feature labels Sep 23, 2024
github-actions[bot]
github-actions bot previously approved these changes Sep 23, 2024
github-actions[bot]
github-actions bot previously approved these changes Sep 23, 2024
github-actions[bot]
github-actions bot previously approved these changes Sep 23, 2024
github-actions[bot]
github-actions bot previously approved these changes Sep 23, 2024
github-actions[bot]
github-actions bot previously approved these changes Sep 23, 2024
github-actions[bot]
github-actions bot previously approved these changes Sep 23, 2024
github-actions[bot]
github-actions bot previously approved these changes Sep 23, 2024
github-actions[bot]
github-actions bot previously approved these changes Sep 24, 2024
Co-authored-by: Ivan Vergés <ivan@pokecode.net>
github-actions[bot]
github-actions bot previously approved these changes Oct 31, 2024
Co-authored-by: Ivan Vergés <ivan@pokecode.net>
github-actions[bot]
github-actions bot previously approved these changes Oct 31, 2024
github-actions[bot]
github-actions bot previously approved these changes Oct 31, 2024
github-actions[bot]
github-actions bot previously approved these changes Oct 31, 2024
@antopalidi
Copy link
Copy Markdown
Member Author

antopalidi commented Oct 31, 2024

@alecslupu could you please take a look at these changes? I was also able to reproduce the issue you encountered, and I've implemented a fix for it as well. Let me know if you have any additional feedback

Copy link
Copy Markdown
Contributor

@alecslupu alecslupu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost there... 1-2 places to check and we should be ok with it...

image

Co-authored-by: Alexandru Emil Lupu <contact@alecslupu.ro>
Co-authored-by: Alexandru Emil Lupu <contact@alecslupu.ro>
@antopalidi antopalidi requested a review from alecslupu November 3, 2024 11:23
Copy link
Copy Markdown
Contributor

@alecslupu alecslupu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@alecslupu alecslupu dismissed microstudi’s stale review November 3, 2024 13:09

All the changes requested by contractor have been implemented. Dismissing to be able to merge.

@alecslupu alecslupu merged commit e903b79 into develop Nov 3, 2024
@alecslupu alecslupu deleted the feature/geolocation-proposal-form branch November 3, 2024 13:09
entantoencuanto added a commit that referenced this pull request Nov 6, 2024
…n-flow

* develop:
  Update UI design of detail page (#13356)
  Fix newsletter subscriber count (#13471)
  Fix editor image routing (#12683)
  Fix issues with the budgets proposals import (#12655)
  Fix initiative form is not taking into account the scope selected (#13598)
  Enable geolocation for address field in proposal form (#13423)
entantoencuanto added a commit that referenced this pull request Nov 6, 2024
…eature/ephemeral-verifications

* feat/improve-registration-and-verification-flow:
  Update UI design of detail page (#13356)
  Fix newsletter subscriber count (#13471)
  Fix editor image routing (#12683)
  Fix issues with the budgets proposals import (#12655)
  Fix initiative form is not taking into account the scope selected (#13598)
  Enable geolocation for address field in proposal form (#13423)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

javascript Pull requests that update Javascript code module: core module: proposals project: 2024-developments Barcelona City Council contract

Projects

No open projects
Archived in project

Development

Successfully merging this pull request may close these issues.

Enable geolocation for address field in proposal form

5 participants