Skip to content

Commit

Permalink
Revert indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
drnic committed Nov 10, 2024
1 parent a493402 commit d8c76e5
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 56 deletions.
41 changes: 20 additions & 21 deletions app/views/authentications/new.html.erb
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
<% content_for :heading, "Welcome back" %>
<% if Feature.registration? %>
<span class="text-sm text-center">
Don't have an account? <%= link_to "Sign up", register_path, class: "underline" %>
</span>
<% end %>
<% if Feature.google_authentication? %>
<%= button_to "Log In with Google", "/auth/google",
<%= button_to "Log In with Google", "/auth/google",
method: "post",
class: %|
text-white font-medium
Expand All @@ -21,9 +14,9 @@
turbo: false,
}
%>
<span class="text-sm text-center <%= Feature.disabled?(:password_authentication) && 'hidden' %>">
- Or -
</span>
<span class="text-sm text-center <%= Feature.disabled?(:password_authentication) && 'hidden' %>">
- Or -
</span>
<% end %>
<% if Feature.microsoft_graph_authentication? %>
Expand All @@ -46,23 +39,29 @@
- Or -
</span>
<% end %>
<% content_for :heading, "Welcome back" %>
<% if Feature.registration? %>
<span class="text-sm text-center">
Don't have an account? <%= link_to "Sign up", register_path, class: "underline" %>
</span>
<% end %>
<% if Feature.password_authentication? %>
<%= form_with(url: login_path, method: :post, class: "flex flex-col space-y-4 w-80") do |f| %>
<%= f.email_field :email,
<%= form_with(url: login_path, method: :post, class: "flex flex-col space-y-4 w-80") do |f| %>
<%= f.email_field :email,
value: params[:email],
id: "email",
autofocus: params[:email].present? ? false : true,
placeholder: "Email address",
class: "border border-gray-400 rounded p-3 dark:text-black"
%>
<%= f.password_field :password,
<%= f.password_field :password,
id: "password",
autofocus: params[:email].present? ? true : false,
placeholder: "Password",
class: "border border-gray-400 rounded p-3 dark:text-black"
%>
<%= f.submit "Log In",
<%= f.submit "Log In",
class: %|
text-white font-medium
bg-brand-blue dark:bg-gray-900
Expand All @@ -73,10 +72,10 @@
|,
data: { turbo_submits_with: "Authenticating..." }
%>
<% end %>
<% if Feature.password_reset_email? %>
<span class="text-sm text-center">
<%= link_to "Forgot your password?", new_password_reset_path, class: "underline" %>
</span>
<% end %>
<% end %>
<% if Feature.password_reset_email? %>
<span class="text-sm text-center">
<%= link_to "Forgot your password?", new_password_reset_path, class: "underline" %>
</span>
<% end %>
<% end %>
72 changes: 37 additions & 35 deletions app/views/users/new.html.erb
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<% content_for :heading, "Create your account" %>
<% if @person.errors.any? %>
<div id="error_explanation" class="px-3 py-2 mt-3 font-medium text-red-500 rounded-lg bg-red-50">
<ul>
<% @person.errors.full_messages.reverse.each do |error| # We want the User error first %>
<li><%= error.gsub(/Personable |credentials /, '').capitalize %><%# Cleanup "Personable password is ..." %></li>
<% end %>
</ul>
</div>
<div id="error_explanation" class="px-3 py-2 mt-3 font-medium text-red-500 rounded-lg bg-red-50">
<ul>
<% @person.errors.full_messages.reverse.each do |error| # We want the User error first %>
<li><%= error.gsub(/Personable |credentials /, '').capitalize %><%# Cleanup "Personable password is ..." %></li>
<% end %>
</ul>
</div>
<% end %>
<% if Feature.google_authentication? %>
<%= button_to "Sign Up with Google", "/auth/google",
<%= button_to "Sign Up with Google", "/auth/google",
method: "post",
class: %|
text-white font-medium
Expand All @@ -25,9 +25,9 @@
turbo: false,
}
%>
<span class="text-sm text-center <%= Feature.disabled?(:password_authentication) && 'hidden' %>">
- Or -
</span>
<span class="text-sm text-center <%= Feature.disabled?(:password_authentication) && 'hidden' %>">
- Or -
</span>
<% end %>
<% if Feature.microsoft_graph_authentication? %>
Expand All @@ -52,7 +52,7 @@
<% end %>
<% if Feature.password_authentication? %>
<%= form_with method: :post,
<%= form_with method: :post,
model: @person,
url: users_path,
class: "flex flex-col space-y-4 w-80",
Expand All @@ -61,48 +61,50 @@
transition_toggle_class: "max-h-0 max-h-40"
} do |f|
%>
<%= f.hidden_field :personable_type, id: "personable_type", value: "User" %>
<%= f.hidden_field :personable_type, id: "personable_type", value: "User" %>
<%= f.label :email, class: "input input-bordered flex items-center justify-between" do %>
<span>Email <span class="">*</span></span>
<%= f.email_field :email,
<%= f.label :email, class: "input input-bordered flex items-center justify-between" do %>
<span>Email <span class="">*</span></span>
<%= f.email_field :email,
autofocus: true,
placeholder: "Email",
class: "w-44 border-0 dark:text-black"
%>
<% end %>
<% end %>
<%= f.fields_for :personable_attributes, @person.personable do |user_fields| %>
<%= user_fields.fields_for :credentials_attributes, @person.personable.credentials.build, index: "0" do |credential_fields| %>
<%= credential_fields.hidden_field :type, value: "PasswordCredential" %>
<%= credential_fields.label :password, class: "input input-bordered flex items-center justify-between" do %>
<span>Password <span class="">*</span></span>
<%= credential_fields.password_field :password,
<%= f.fields_for :personable_attributes, @person.personable do |user_fields| %>
<%= user_fields.fields_for :credentials_attributes, @person.personable.credentials.build, index: "0" do |credential_fields| %>
<%= credential_fields.hidden_field :type, value: "PasswordCredential" %>
<%= credential_fields.label :password, class: "input input-bordered flex items-center justify-between" do %>
<span>Password <span class="">*</span></span>
<%= credential_fields.password_field :password,
placeholder: "Password",
class: "w-44 border-0 dark:text-black",
data: { action: "focus->transition#toggleClassOn" }
%>
<% end %>
<% end %>
<% end %>
<% end %>

<div class="
<div class="
overflow-hidden
<%= @person.errors.any? ? "max-h-40" : "max-h-0" %>
flex flex-col
transition-all duration-100 ease-in
space-y-4
" data-transition-target="transitionable">
"
data-transition-target="transitionable"
>

<%= user_fields.label :name, class: "input input-bordered flex items-center justify-between" do %>
<span>Full Name <span class="">*</span></span>
<%= user_fields.text_field :name,
<%= user_fields.label :name, class: "input input-bordered flex items-center justify-between" do %>
<span>Full Name <span class="">*</span></span>
<%= user_fields.text_field :name,
placeholder: "First & Last name",
class: "w-44 border-0 dark:text-black"
%>
<% end %>
</div>
<% end %>
<%= f.submit "Sign Up",
<% end %>
</div>
<% end %>
<%= f.submit "Sign Up",
class: %|
text-white font-medium
bg-brand-blue dark:bg-gray-900
Expand All @@ -113,7 +115,7 @@
|,
data: { turbo_submits_with: "Creating..." }
%>
<% end # password_authentication? %>
<% end # password_authentication? %>
<% end %>
<span class="text-sm text-center">
Expand Down

0 comments on commit d8c76e5

Please sign in to comment.