Initial commit: Rails port of Simple Aircraft Manager

Rails 8.1 + SQLite rewrite of marbindrakon/simple-aircraft-manager,
designed to self-host as a single container (Solid Queue/Cache/Cable,
Active Storage on disk, Hotwire + importmap, Tailwind).

- Airworthiness engine ported from health/services.py (ADs, grounding
  squawks, inspection recurrency, component replacement)
- Hours updates and flight logs cascading to in-service components,
  optional airworthiness enforcement
- Components, squawks, ADs, inspections, logbook, documents, major
  records, oil/fuel consumption stats and charts, activity log
- Admin/owner/pilot RBAC and public share links (status/maintenance)
- Docker Compose and Kamal deployment, env-driven production config
- Service and integration tests

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rickyandClaude Opus 5.5 committed 2026-11-04 17:59:08 -05:00
commit 38df19c331
264 files changed
+8365

No files matched your search

+54
View File
@@ -0,0 +1,54 @@
# Wraps fields with a label, hint, and inline errors using the app's Tailwind classes.
# <%= f.field :tail_number %>
# <%= f.field :tach_time, as: :number, step: 0.1 %>
# <%= f.field :status, as: :select, collection: Aircraft::STATUSES.invert %>
# <%= f.field :public, as: :checkbox, label: "Show on share links" %>
class AppFormBuilder < ActionView::Helpers::FormBuilder
def field(method, as: :text, label: nil, hint: nil, collection: nil, include_blank: false, wrapper: {}, **opts)
label_text = label || method.to_s.humanize
errors = object.respond_to?(:errors) ? object.errors[method] : []
if as == :checkbox
return @template.content_tag(:div, class: [ "flex items-start gap-2", wrapper[:class] ]) do
check_box(method, { class: "mt-0.5 h-4 w-4 rounded border-slate-300 text-sky-700" }.merge(opts)) +
@template.content_tag(:div) do
label(method, label_text, class: "text-sm text-slate-700") +
(hint ? @template.content_tag(:p, hint, class: "hint") : "".html_safe)
end
end
end
input_opts = { class: "input" }.merge(opts)
input =
case as
when :textarea then text_area(method, { rows: 4 }.merge(input_opts))
when :number then number_field(method, input_opts)
when :date then date_field(method, input_opts)
when :datetime then datetime_field(method, input_opts)
when :email then email_field(method, input_opts)
when :password then password_field(method, input_opts)
when :file then file_field(method, opts.merge(class: "block text-sm text-slate-600 file:mr-3 file:rounded-md file:border-0 file:bg-slate-100 file:px-3 file:py-1.5 file:text-sm file:font-medium hover:file:bg-slate-200"))
when :select then select(method, collection, { include_blank: include_blank }, input_opts)
else text_field(method, input_opts)
end
@template.content_tag(:div, class: wrapper[:class]) do
label(method, label_text, class: "label") + input +
(hint ? @template.content_tag(:p, hint, class: "hint") : "".html_safe) +
errors.map { |e| @template.content_tag(:p, "#{label_text} #{e}", class: "field-error") }.join.html_safe
end
end
def errors_summary
return "".html_safe unless object&.errors&.any?
@template.content_tag(:div, class: "rounded-md bg-red-50 p-3 text-sm text-red-700 ring-1 ring-red-200") do
@template.content_tag(:ul, class: "list-disc pl-5") do
object.errors.full_messages.map { |m| @template.content_tag(:li, m) }.join.html_safe
end
end
end
def submit(value = nil, **opts)
super(value, { class: "btn-primary" }.merge(opts))
end
end