Skip to content

Commit afa5cee

Browse files
Add latitude and longitude fields to merchant proposal form
1 parent da3666e commit afa5cee

File tree

9 files changed

+39
-11
lines changed

9 files changed

+39
-11
lines changed

app/controllers/merchant_proposals_controller.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ def merchant_proposal_params
6969
:name, :category, :other_category,
7070
:description,
7171
:street, :postcode, :city, :country,
72+
:latitude, :longitude,
7273
:phone, :website, :email,
7374
:contact_session, :contact_signal,
7475
:contact_matrix, :contact_jabber, :contact_telegram,

app/models/merchant_proposal.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ class MerchantProposal
1515
attribute :postcode, :string
1616
attribute :city, :string
1717
attribute :country, :string
18+
attribute :latitude, :string
19+
attribute :longitude, :string
1820
attribute :phone, :string
1921
attribute :email, :string
2022
attribute :website, :string

app/services/merchant_proposal_issue.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ class MerchantProposalIssue < ApplicationService
22
ALLOWED_ATTRIBUTES = %w[
33
name category other_category
44
street postcode city country
5+
latitude longitude
56
phone website description coins ask_kyc
67
contact_facebook contact_twitter contact_telegram
78
contact_signal contact_session contact_tripadvisor

app/views/merchant_proposals/new.html.slim

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ article
2727
section
2828
p.uppercase.text-primary.mb-3= t('.form.general_info')
2929

30-
.grid.grid-col-1.lg:grid-cols-2.gap-3.lg:gap-6.mb-3.lg:mb-6
30+
.grid.grid-cols-1.lg:grid-cols-2.gap-3.lg:gap-6.mb-3.lg:mb-6
3131
= f.input :name
3232

3333
= f.input :category,
@@ -51,18 +51,24 @@ article
5151
} \
5252
}
5353

54-
= f.input :street
55-
= f.input :postcode
54+
fieldset.fieldset.bg-base-200.border-base-300.rounded-box.border.p-4.lg:col-span-2
55+
legend.fieldset-legend Adresse
5656

57-
= f.input :city
57+
.grid.grid-col-1.lg:grid-cols-2.gap-3.lg:gap-6.mb-3.lg:mb-6
58+
= f.input :street
59+
= f.input :postcode
5860

59-
.fieldset.w-full
60-
= f.input :country,
61-
prompt: :translate,
62-
format: :with_flag,
63-
wrapper: false,
64-
input_html: { class: 'select w-full' },
65-
label_html: { class: 'fieldset-legend' }
61+
= f.input :city
62+
.fieldset.w-full
63+
= f.input :country,
64+
prompt: :translate,
65+
format: :with_flag,
66+
wrapper: false,
67+
input_html: { class: 'select w-full' },
68+
label_html: { class: 'fieldset-legend' }
69+
70+
= f.input :latitude, as: :float
71+
= f.input :longitude, as: :float
6672

6773
= f.input :phone
6874
= f.input :email

config/locales/en/activerecord.en.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ en:
5151
<<: *merchant_attributes
5252
other_category: Other category
5353
proposition_from: Follow-up email (optional)
54+
latitude: Latitude
55+
longitude: Longitude
5456

5557
activerecord:
5658
models:

config/locales/en/simple_form.en.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ en:
109109
postcode: W1U 4QF
110110
city: London
111111

112+
latitude: "46.232192999999995"
113+
longitude: "2.209666999999996"
114+
112115
tutorial_report:
113116
title: Clear and concise title of the anomaly
114117
description: Clearly describe the anomaly(ies) you encountered while reading the tutorial.
@@ -157,6 +160,9 @@ en:
157160
ask_kyc: Check if the merchant requires identity verification to be payed
158161
proposition_from: Please provide your email address if you would like to be kept informed of this merchant's processing.
159162

163+
latitude: Specify the latitude if you know it
164+
longitude: Specify the longitude if you know it
165+
160166
itinerary:
161167
my_address: Your location is not logged on the server
162168
use_my_ip: IP geolocation can be inaccurate and may not correspond if you use a VPN.

config/locales/fr/activerecord.fr.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ fr:
5454
<<: *merchant_attributes
5555
other_category: Autre catégorie
5656
proposition_from: Email de suivi (facultatif)
57+
latitude: Latitude
58+
longitude: Longitude
5759

5860
activerecord:
5961
models:

config/locales/fr/simple_form.fr.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ fr:
110110
postcode: 75000
111111
city: Paris
112112

113+
latitude: "46.232192999999995"
114+
longitude: "2.209666999999996"
115+
113116
tutorial_report:
114117
title: Titre clair et concis de l'anomalie
115118
description: Décrivez clairement la ou les anomalies que vous avez rencontrées en lisant le tutoriel.
@@ -158,6 +161,9 @@ fr:
158161
ask_kyc: Cocher si le commerçant demande une validation d'identité (KYC) pour accepter le paiement
159162
proposition_from: Indiquez votre email si vous souhaitez être tenu informé du traitement de ce commerçant
160163

164+
latitude: Indiquez la latitude si vous la connaissez
165+
longitude: Indiquez la longitude si vous la connaissez
166+
161167
itinerary:
162168
my_address: Votre localisation n'est pas logguée sur le serveur
163169
use_my_ip: La géolocalisation par IP peut être imprécise et ne pas correspondre si vous passez par un VPN

spec/mailers/previews/merchant_mailer_preview.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ def send_new_merchant
99
postcode: '12345',
1010
city: 'Foobar',
1111
country: 'CH',
12+
latitude: '46.232192999999995',
13+
longitude: '2.209666999999996',
1214
description: 'Eos est harum archit',
1315
coins: MerchantProposal::ALLOWED_COINS,
1416
website: 'https://mywebsite.com',

0 commit comments

Comments
 (0)