mirror of
https://github.com/rickbarrette/simple-aircraft-manager-rails.git
synced 2026-11-17 23:50:36 -05:00
Profile: two columns on wide screens
The account and its security (sign-on, two-factor, sessions) on the left, calendar, certificates, this device and integrations on the right; one column on phones. The account form gets a title like the other cards. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e199e6feeb
commit
faae719b12
3 files changed
+46
-27
No files matched your search
@@ -1,5 +1,10 @@
|
||||
<h1 class="mb-4 text-2xl font-bold"><%= t(".your_profile") %></h1>
|
||||
<%= form_with model: @user, url: profile_path, method: :patch, class: "card card-body space-y-4 max-w-md" do |f| %>
|
||||
<%# One column on a phone; on a wide screen, the account and its security on
|
||||
the left and everything else on the right. %>
|
||||
<div class="grid max-w-5xl items-start gap-5 lg:grid-cols-2">
|
||||
<div class="space-y-5">
|
||||
<%= form_with model: @user, url: profile_path, method: :patch, class: "card card-body space-y-4" do |f| %>
|
||||
<h2 class="card-title"><%= t(".account") %></h2>
|
||||
<%= f.errors_summary %>
|
||||
<%= f.field :name %>
|
||||
<%= f.field :email_address, as: :email, label: t(".email") %>
|
||||
@@ -20,10 +25,10 @@
|
||||
<p class="hint"><%= t(".needed_to_change_your_email_html", sso_uid: (t(".signed_up_with_and_never", so: Sso.label) if Sso.enabled? && @user.sso_uid?)) %></p>
|
||||
</div>
|
||||
<%= f.submit t(".save") %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% if Sso.enabled? %>
|
||||
<section class="card card-body mt-5 max-w-md">
|
||||
<% if Sso.enabled? %>
|
||||
<section class="card card-body">
|
||||
<h2 class="card-title"><%= t(".single_sign_on") %></h2>
|
||||
<% if @user.sso_uid? %>
|
||||
<p class="mt-1 text-sm text-slate-600"><%= t(".your_account_is_linked_to_html", so: Sso.label) %></p>
|
||||
@@ -36,9 +41,9 @@
|
||||
<div class="mt-3"><%= button_to t(".link", so: Sso.label), "/auth/#{Sso::PROVIDER}", class: "btn-secondary btn-sm", data: { turbo: false } %></div>
|
||||
<% end %>
|
||||
</section>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<section class="card card-body mt-5 max-w-md" id="two-factor">
|
||||
<section class="card card-body" id="two-factor">
|
||||
<h2 class="card-title"><%= t(".two_factor_sign_in") %></h2>
|
||||
<% if @user.otp_enabled? %>
|
||||
<p class="mt-1 text-sm text-slate-600"><span class="badge-green"><%= t(".on") %></span> <%= t(".since_signing_in_with_your_html", to_date: (fmt_date(@user.otp_enabled_at.to_date)), recovery_codes_left: @user.recovery_codes_left) %></p>
|
||||
@@ -51,9 +56,23 @@
|
||||
<p class="mt-1 text-sm text-slate-600"><%= t(".add_a_code_from_an_html", enabled: (t(".signing_in_with_uses_its", so: Sso.label) if Sso.enabled?)) %></p>
|
||||
<div class="mt-3"><%= link_to t(".set_up"), new_two_factor_path, class: "btn-secondary btn-sm" %></div>
|
||||
<% end %>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
<section class="card card-body mt-5 max-w-md" id="calendar">
|
||||
<section class="card card-body">
|
||||
<h2 class="card-title"><%= t(".sessions") %></h2>
|
||||
<% others = @user.sessions.where.not(id: Current.session.id).count %>
|
||||
<p class="mt-1 text-sm text-slate-600">
|
||||
<%= t(".you_re_signed_in_on", count: others) %>
|
||||
<%= t(".sessions_unused_for_sign_out_html", days: (Authentication::SESSION_IDLE_TIMEOUT.in_days.to_i)) %>
|
||||
</p>
|
||||
<% if others.positive? %>
|
||||
<div class="mt-3"><%= button_to t(".sign_out_everywhere_else"), other_sessions_path, method: :delete, class: "btn-secondary btn-sm" %></div>
|
||||
<% end %>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<div class="space-y-5">
|
||||
<section class="card card-body" id="calendar">
|
||||
<h2 class="card-title"><%= t(".calendar_feed") %></h2>
|
||||
<p class="mt-1 text-sm text-slate-600"><%= t(".what_s_coming_due_on") %></p>
|
||||
<% if @user.calendar_token.present? %>
|
||||
@@ -68,9 +87,9 @@
|
||||
<% else %>
|
||||
<div class="mt-3"><%= button_to t(".create_calendar_link"), calendar_token_path, class: "btn-secondary btn-sm" %></div>
|
||||
<% end %>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
<section class="card card-body mt-5 max-w-md" id="certificates">
|
||||
<section class="card card-body" id="certificates">
|
||||
<h2 class="card-title"><%= t(".certificates") %></h2>
|
||||
<p class="mt-1 text-sm text-slate-600"><%= t(".your_faa_certificates_for_signing") %></p>
|
||||
<% if @user.certificates.any? %>
|
||||
@@ -93,9 +112,9 @@
|
||||
</div>
|
||||
<p class="hint sm:col-span-2"><%= t(".an_inspection_authorization_expires_on") %></p>
|
||||
<% end %>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
<section class="card card-body mt-5 max-w-md space-y-4" id="device">
|
||||
<section class="card card-body space-y-4" id="device">
|
||||
<h2 class="card-title"><%= t(".this_device") %></h2>
|
||||
<div data-controller="install">
|
||||
<h3 class="text-sm font-semibold"><%= t(".install_heading") %></h3>
|
||||
@@ -115,24 +134,14 @@
|
||||
<button type="button" class="btn-secondary btn-sm" data-push-target="test" data-action="push#sendTest" hidden><%= t(".notifications_test") %></button>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
<section class="card card-body mt-5 max-w-md">
|
||||
<h2 class="card-title"><%= t(".sessions") %></h2>
|
||||
<% others = @user.sessions.where.not(id: Current.session.id).count %>
|
||||
<p class="mt-1 text-sm text-slate-600">
|
||||
<%= t(".you_re_signed_in_on", count: others) %>
|
||||
<%= t(".sessions_unused_for_sign_out_html", days: (Authentication::SESSION_IDLE_TIMEOUT.in_days.to_i)) %>
|
||||
</p>
|
||||
<% if others.positive? %>
|
||||
<div class="mt-3"><%= button_to t(".sign_out_everywhere_else"), other_sessions_path, method: :delete, class: "btn-secondary btn-sm" %></div>
|
||||
<% end %>
|
||||
</section>
|
||||
|
||||
<section class="card card-body mt-5 max-w-md">
|
||||
<section class="card card-body">
|
||||
<h2 class="card-title"><%= t(".integrations") %></h2>
|
||||
<p class="mt-1 text-sm text-slate-600">
|
||||
<%= link_to t(".airtrail_sync"), air_trail_connection_path, class: "link" %>:
|
||||
<%= t(".push_the_flights_you_log_html", off: (current_user.air_trail_connection&.enabled? ? "on" : "off")) %>
|
||||
</p>
|
||||
</section>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
@@ -2943,6 +2943,7 @@ en:
|
||||
profiles:
|
||||
edit:
|
||||
your_profile: Your Profile
|
||||
account: Account
|
||||
email: Email
|
||||
weekly_maintenance_reminders: Weekly maintenance reminders
|
||||
a_monday_email_about_overdue: A Monday email about overdue and upcoming inspections, ADs, parts and documents on aircraft you own, and certificates of yours about to expire. Only sent when something needs attention.
|
||||
|
||||
@@ -92,4 +92,13 @@ class WorkflowPolishTest < ActionDispatch::IntegrationTest
|
||||
assert_select "dl > div.detail-row > dt", minimum: 6
|
||||
assert_select "dl dd.col-span-3", 0
|
||||
end
|
||||
|
||||
test "the profile is two columns on a wide screen: the account and its security, then the rest" do
|
||||
sign_in @owner
|
||||
get edit_profile_path
|
||||
assert_select "div.max-w-5xl > div", 2
|
||||
assert_select "div.max-w-5xl > div:first-child h2", text: "Account"
|
||||
assert_select "div.max-w-5xl > div:first-child #two-factor"
|
||||
assert_select "div.max-w-5xl > div:last-child #device"
|
||||
end
|
||||
end
|
||||
Reference in new issue
Block a user