From ce8695a891277ae1c3d67425e0718231da0836bd Mon Sep 17 00:00:00 2001 From: Hugoren Martinako Date: Thu, 4 Apr 2024 11:39:18 +0200 Subject: [PATCH] include admin fields and translations --- .../fields/_phone_number.html.erb | 17 +++++++++++++++++ config/locales/en.yml | 4 +++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/app/views/decidim/extra_user_fields/admin/extra_user_fields/fields/_phone_number.html.erb b/app/views/decidim/extra_user_fields/admin/extra_user_fields/fields/_phone_number.html.erb index 99d9e65..8dd7cff 100644 --- a/app/views/decidim/extra_user_fields/admin/extra_user_fields/fields/_phone_number.html.erb +++ b/app/views/decidim/extra_user_fields/admin/extra_user_fields/fields/_phone_number.html.erb @@ -2,4 +2,21 @@
<%= form.check_box :phone_number, label: t(".label"), help_text: t(".description") %>
+
+ <% + # TODO: move wherever it takes + def telephone_pattern + "^(\\+34)?[0-9]{9}$" + end + + def telephone_placeholder + "+34987654321" + end + %> + <%# TODO: replace with the proper rails helpers fields %> + + + <%#= form.text_field :phone_number_pattern, label: t(".pattern"), placeholder: telephone_pattern %> + <%#= form.text_field :phone_number_placeholder, label: t(".placeholder"), placeholder: telephone_placeholder %> +
diff --git a/config/locales/en.yml b/config/locales/en.yml index 69912b0..8ae0d88 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -44,9 +44,11 @@ en: in a location label: Enable location field phone_number: - description: This field is a String field. User will be able to fill + description: This field is a telephone field. User will be able to fill in a phone number label: Enable phone number field + pattern: Phone number pattern + placeholder: Phone number placeholder postal_code: description: This field is a String field. User will be able to fill in a postal code