Add links to letteropener in dev

This commit is contained in:
Max Wofford
2025-03-07 18:25:45 -05:00
parent 71a597059b
commit f86209ccc0
5 changed files with 25 additions and 7 deletions

View File

@@ -39,6 +39,12 @@
background-color: var(--uchu-light-yellow);
}
.dev-tool {
border-radius: 5px;
border: 1px dashed var(--uchu-green);
background-color: var(--uchu-light-green);
}
.loading {
padding: 1rem;
color: #666;

View File

@@ -33,7 +33,7 @@ class SessionsController < ApplicationController
if email_address
token = email_address.user.create_email_signin_token
AuthMailer.sign_in_email(email_address, token).deliver_later
redirect_to root_path, notice: "Check your email for a sign-in link!"
redirect_to root_path(sign_in_email: true), notice: "Check your email for a sign-in link!"
else
redirect_to root_path, alert: "Email not found. Please sign in with Slack first."
end

View File

@@ -10,6 +10,11 @@ module ApplicationHelper
concat content_tag(element, class: "admin-tool #{class_name}", **options, &block)
end
def dev_tool(class_name = "", element = "div", **options, &block)
return unless Rails.env.development?
concat content_tag(element, class: "dev-tool #{class_name}", **options, &block)
end
def short_time_simple(time)
hours = time.to_i / 3600
minutes = (time.to_i % 3600) / 60

View File

@@ -38,12 +38,10 @@
<% end %>
</li>
<% end %>
<% if Rails.env.development? %>
<li>
<%= link_to letter_opener_path, class: "nav-item #{current_page?(letter_opener_path) ? 'active' : ''}" do %>
Letter Opener
<% end %>
</li>
<% dev_tool(nil, "li") do %>
<%= link_to letter_opener_path, class: "nav-item #{current_page?(letter_opener_path) ? 'active' : ''}" do %>
Letter Opener
<% end %>
<% end %>
<% admin_tool(nil, "li") do %>
<%= link_to avo_path, class: "nav-item #{current_page?(avo_path) ? 'active' : ''}" do %>

View File

@@ -31,6 +31,15 @@
</div>
<%= submit_tag "Send sign-in link", class: "auth-button email" %>
<% end %>
<% if params[:sign_in_email] %>
<div class="auth-success">
Check your email for a sign-in link!
</div>
<% dev_tool do %>
Because you're on localhost, <%= link_to "click here to view the email", letter_opener_path %>
<% end %>
<% end %>
</div>
<% end %>
</div>