]> git.openstreetmap.org Git - rails.git/commitdiff
add _section_divider component utilizing hr tags
authorEmin Kocan <kocanmn.dev@gmail.com>
Thu, 27 Jun 2024 15:22:41 +0000 (17:22 +0200)
committerEmin Kocan <kocanmn.dev@gmail.com>
Thu, 27 Jun 2024 16:52:56 +0000 (18:52 +0200)
app/views/sessions/new.html.erb
app/views/shared/_section_divider.html.erb [new file with mode: 0644]
app/views/users/new.html.erb

index 70839d1608533e0da9f29eb5f1ef81a7e8cd75d9..57e6d014a3ce5e0ae85bab7f7223b3728b0c44de 100644 (file)
 <div id="login_login" class="auth-container mx-auto my-0">
   <% if @preferred_auth_provider %>
     <%= render :partial => "auth_providers" %>
-    <div class="d-flex justify-content-center align-items-center mb-2">
-      <div class="border-bottom border-1 flex-grow-1"></div>
-      <div class="text-secondary mx-3"><%= t ".or" %></div>
-      <div class="border-bottom border-1 flex-grow-1"></div>
-    </div>
-  <% end %>
+    <%= render :partial => "shared/section_divider", :locals => { :text => t(".or") } %>
+<% end %>
 
   <%= bootstrap_form_tag(:action => "login", :html => { :id => "login_form" }) do |f| %>
     <%= hidden_field_tag("referer", h(params[:referer]), :autocomplete => "off") %>
   <% end %>
 
   <% unless @preferred_auth_provider %>
-    <div class="d-flex justify-content-center align-items-center">
-      <div class="border-bottom border-1 flex-grow-1"></div>
-      <div class="text-secondary mx-3"><%= t ".with external" %></div>
-      <div class="border-bottom border-1 flex-grow-1"></div>
-    </div>
+    <%= render :partial => "shared/section_divider", :locals => { :text => t(".with external") } %>
     <%= render :partial => "auth_providers" %>
   <% end %>
 </div>
diff --git a/app/views/shared/_section_divider.html.erb b/app/views/shared/_section_divider.html.erb
new file mode 100644 (file)
index 0000000..ad6bffd
--- /dev/null
@@ -0,0 +1,5 @@
+<div class="d-flex align-items-center my-1">
+  <hr class="flex-grow-1 border-secondary" role="separator">
+  <span class="mx-3 text-secondary"><%= text %></span>
+  <hr class="flex-grow-1 border-secondary" role="separator">
+</div>
index b618f381107260222c9343f3e7db44ef64173654..c0cef51d99348a787e9ae7bf564a223cfc5f45d0 100644 (file)
 
     <% unless @preferred_auth_provider.nil? %>
       <%= render :partial => "auth_providers" %>
-      <div class="d-flex justify-content-center align-items-center mb-2">
-        <div class="border-bottom border-1 flex-grow-1"></div>
-        <div class="text-secondary mx-3"><%= t ".or" %></div>
-        <div class="border-bottom border-1 flex-grow-1"></div>
-      </div>
-    <% end %>
+      <%= render :partial => "shared/section_divider", :locals => { :text => t(".or") } %>
+<% end %>
   <% else %>
     <h4><%= t ".about.welcome" %></h4>
   <% end %>
   <% end %>
 
   <% if current_user.auth_uid.nil? and @preferred_auth_provider.nil? %>
-    <div class="d-flex justify-content-center align-items-center">
-      <div class="border-bottom border-1 flex-grow-1"></div>
-      <div class="text-secondary mx-3"><%= t ".use external auth" %></div>
-      <div class="border-bottom border-1 flex-grow-1"></div>
-    </div>
+    <%= render :partial => "shared/section_divider", :locals => { :text => t(".use external auth") } %>
     <%= render :partial => "auth_providers" %>
   <% end %>
 </div>