Skip to content

Commit

Permalink
Make phone placeholder translatable
Browse files Browse the repository at this point in the history
  • Loading branch information
entantoencuanto committed Apr 18, 2024
1 parent 7ce59fc commit b420da1
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class ExtraUserFieldsForm < Decidim::Form
attribute :location, Boolean

attribute :phone_number_pattern, String
attribute :phone_number_placeholder, String
translatable_attribute :phone_number_placeholder, String
# Block ExtraUserFields Attributes

# EndBlock
Expand Down
2 changes: 1 addition & 1 deletion app/views/decidim/extra_user_fields/_profile_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<% end %>

<% if current_organization.activated_extra_field?(:phone_number) %>
<%= f.telephone_field :phone_number, placeholder: f.object.phone_number_extra_user_field_placeholder, pattern: f.object.phone_number_extra_user_field_pattern %>
<%= f.telephone_field :phone_number, placeholder: translated_attribute(f.object.phone_number_extra_user_field_placeholder), pattern: f.object.phone_number_extra_user_field_pattern %>
<% end %>

<% if current_organization.activated_extra_field?(:location) %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<% end %>

<% if current_organization.activated_extra_field?(:phone_number) %>
<%= f.telephone_field :phone_number, placeholder: f.object.phone_number_extra_user_field_placeholder, pattern: f.object.phone_number_extra_user_field_pattern %>
<%= f.telephone_field :phone_number, placeholder: translated_attribute(f.object.phone_number_extra_user_field_placeholder), pattern: f.object.phone_number_extra_user_field_pattern %>
<% end %>

<% if current_organization.activated_extra_field?(:location) %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
</div>
<div class="row column pl-4" id="phone_fields" <%= "hidden" unless form.object.phone_number %>>
<%= form.text_field :phone_number_pattern, help_text: t(".pattern_help_html"), label: t(".pattern"), placeholder: "^(\\+34|0034|34)?[ -]*[6-9][ -]*([0-9][ -]*){8}$", data: { type: :phone_number } %>
<%= form.text_field :phone_number_placeholder, label: t(".placeholder"), placeholder: "+34987654321" %>
<%= form.translated :text_field, :phone_number_placeholder, label: t(".placeholder"), placeholder: "+34987654321" %>
</div>
</div>

0 comments on commit b420da1

Please sign in to comment.