[openstreetmap/openstreetmap-website] Refactor account form to use bootstrap (#3074)

Tobias notifications at github.com
Wed Jan 27 18:25:22 UTC 2021


@tordans commented on this pull request.

Just two thinks I noticed. Great refactoring. 

> -
-    <div class="standard-form-row">
-      <label class="standard-label"><%= t "users.new.confirm password" %></label>
-      <%= f.password_field :pass_crypt_confirmation, :value => "", :autocomplete => :off %>
+<%= bootstrap_form_for current_user, :url => { :action => :account }, :method => :post, :html => { :multipart => true, :id => "accountForm", :autocomplete => :off } do |f| %>
+
+  <%= f.text_field :display_name %>
+  <%= f.email_field :email, :disabled => true, :label => t(".current email address") %>
+  <%= f.email_field :new_email, :autocomplete => :off %>
+  <%= f.password_field :pass_crypt, :value => "", :autocomplete => :off %>
+  <%= f.password_field :pass_crypt_confirmation, :value => "", :autocomplete => :off %>
+
+  <fieldset class="form-group">
+    <label for="user_auth_provider"><%= t(".external auth") %></label>
+    <div class="form-row">
+      <%= f.select(:auth_provider, Auth.providers, :hide_label => "true", :wrapper => { :class => "col-auto mb-0" }) %>

```suggestion
      <%= f.select(:auth_provider, Auth.providers, :hide_label => true, :wrapper => { :class => "col-auto mb-0" }) %>
```

To keep in sync with one line below. 


> -    <div class="standard-form-row">
-      <label class="standard-label"><%= t "users.new.confirm password" %></label>
-      <%= f.password_field :pass_crypt_confirmation, :value => "", :autocomplete => :off %>
+<%= bootstrap_form_for current_user, :url => { :action => :account }, :method => :post, :html => { :multipart => true, :id => "accountForm", :autocomplete => :off } do |f| %>
+
+  <%= f.text_field :display_name %>
+  <%= f.email_field :email, :disabled => true, :label => t(".current email address") %>
+  <%= f.email_field :new_email, :autocomplete => :off %>
+  <%= f.password_field :pass_crypt, :value => "", :autocomplete => :off %>
+  <%= f.password_field :pass_crypt_confirmation, :value => "", :autocomplete => :off %>
+
+  <fieldset class="form-group">
+    <label for="user_auth_provider"><%= t(".external auth") %></label>
+    <div class="form-row">
+      <%= f.select(:auth_provider, Auth.providers, :hide_label => "true", :wrapper => { :class => "col-auto mb-0" }) %>
+      <%= f.text_field(:auth_uid, :hide_label => true, :wrapper => { :class => "col mb-0" }) %>

Optionally: to make it more accessible you could add the sr-only class to the label and a descriptive label text. 

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/3074#pullrequestreview-577629162
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20210127/81012e21/attachment-0001.htm>


More information about the rails-dev mailing list