Files
simple-aircraft-manager-rails/app/views/admin/offsite_backups/show.html.erb
T
rickyandClaude Opus 5.5 89ed0a76f9 Move all user-facing text into config/locales/en.yml for localization
- Views use lazy t(".key") lookups; sentences with values or links stay
  whole (interpolation, _html keys); counts use one/other plurals
- Stored-value labels (statuses, types, priorities...) are LabelSets read
  from labels: in the current locale; field names and validation messages
  under activerecord:; flash and activity text under flash:
- Services, models, helpers, mailer subjects, the logbook PDF, procedures
  templates, records package README and transcription warnings localized;
  the PDF reuses LogbookEntry#certification_statement instead of a copy
- Scripts read js: strings from a JSON tag via app/javascript/i18n.js
- Dates through I18n.l (app, weekday, month_year, long formats); html lang
  follows the locale
- APP_LOCALE picks the language (falls back to English); missing
  translations raise in development and tests
- README: Translating section and APP_LOCALE

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 22:08:20 -05:00

60 lines
4.0 KiB
ERB

<% content_for :title, t(".off_site_backup") %>
<h1 class="mb-1 text-2xl font-bold"><%= t(".off_site_backup") %></h1>
<p class="mb-5 max-w-3xl text-sm text-slate-600"><%= t(".every_night_after_the_verified_html", offsite_backups_kept: (Setting.integer("offsite_backups_kept")), link: (link_to t(".settings"), edit_admin_settings_path, class: "link")) %></p>
<div class="grid gap-5 lg:grid-cols-2">
<section class="card card-body space-y-3">
<h2 class="card-title"><%= t(".google_drive") %></h2>
<% if @connection.connected? %>
<p class="text-sm"><span class="badge-green"><%= t(".connected") %></span> <%= t(".by_on_html", account_email: @connection.account_email, display_name: @connection.connected_by&.display_name, to_date: (fmt_date(@connection.connected_at&.to_date))) %>
<%= t(".folder_html", folder: (OffsiteConnection::ROOT_FOLDER)) %></p>
<p class="text-sm"><%= t(".uploaded_files_copied_of_html", files_copied: @files_copied, files_total: @files_total) %></p>
<div class="flex flex-wrap gap-2">
<%= button_to t(".back_up_now"), backup_now_admin_offsite_backup_path, class: "btn-primary" %>
<%= button_to t(".test_restore"), restore_test_admin_offsite_backup_path, class: "btn-secondary",
title: t(".download_the_newest_database_copy") %>
<%= button_to t(".disconnect"), admin_offsite_backup_path, method: :delete, class: "btn-secondary",
form: { data: { turbo_confirm: t(".stop_copying_backups_to_the", account_email: @connection.account_email) } } %>
</div>
<% elsif @connection.configured? %>
<p class="text-sm"><%= t(".the_oauth_client_is_saved") %></p>
<%= link_to t(".connect_google_drive"), connect_admin_offsite_backup_path, class: "btn-primary self-start", data: { turbo: false } %>
<% else %>
<p class="text-sm text-amber-800"><%= t(".not_set_up_follow_the") %></p>
<% end %>
<%= form_with model: @connection, url: admin_offsite_backup_path, method: :patch, class: "space-y-3 border-t border-slate-100 pt-3" do |f| %>
<%= f.field :client_id, label: t(".oauth_client_id"), placeholder: "1234567890-abc.apps.googleusercontent.com" %>
<%= f.field :client_secret, as: :password, label: t(".oauth_client_secret"), value: nil,
placeholder: (@connection.client_secret.present? ? t(".saved_leave_blank_to_keep") : nil), autocomplete: "off" %>
<%= f.submit t(".save_client"), class: "btn-secondary" %>
<% end %>
</section>
<section class="card card-body space-y-2 text-sm">
<h2 class="card-title"><%= t(".setting_up_google_once") %></h2>
<ol class="list-decimal space-y-1.5 pl-5">
<li><%= t(".open_the_google_cloud_console_html") %></li>
<li><%= t(".enable_the_google_drive_api_html") %></li>
<li><%= t(".under_google_auth_platform_branding_html") %></li>
<li><%= t(".under_clients_create_an_oauth_html") %>
<code class="mt-1 block break-all rounded bg-slate-100 px-2 py-1"><%= @connection.redirect_uri %></code>
<%= t(".it_must_be_the_address_html") %></li>
<li><%= t(".paste_the_client_id_and_html") %></li>
</ol>
<p class="text-slate-600"><%= t(".restoring_see_html", link: (link_to t(".help_administration"), help_page_path("administration", anchor: "restoring-from-google-drive"), class: "link")) %></p>
</section>
</div>
<section class="card mt-5">
<div class="card-header"><h2 class="card-title"><%= t(".recent_runs") %></h2></div>
<% if @runs.any? %>
<ul class="divide-y divide-slate-100 text-sm">
<% @runs.each do |r| %>
<li class="flex items-start gap-3 px-4 py-2"><span class="<%= r.ok ? 'badge-green' : 'badge-red' %>"><%= r.ok ? "OK" : t(".failed") %></span>
<span><span class="font-medium"><%= r.kind == "restore_test" ? t(".restore_test") : t(".backup") %></span> · <%= fmt_time(r.created_at.in_time_zone) %><span class="block text-xs text-slate-600"><%= r.message %></span></span></li>
<% end %>
</ul>
<% else %><%= empty_state t(".none_yet") %><% end %>
</section>