Skip to content

Self-hosted project management for devs and their clients: tickets, time tracking, docs and meetings, with an AI assistant that cites its sources. AGPL-3.0.

1.2 KB
Raw Blame
<%# One row of the billing form: label plus optional hint on the left, the field on the
    right (the two-column settings pattern). Locals: form, field; optional: type, hint,
    required, autocomplete.

    The label text comes from `activerecord.attributes.account.*` via human_attribute_name,
    NOT from own view keys: B1 already put those in both locales and pinned them, so a
    second set here would be a place for the two to disagree. %>
<% type = local_assigns.fetch(:type, :text_field) %>
<% hint = local_assigns[:hint] %>
<% required = local_assigns.fetch(:required, false) %>
<div class="grid grid-cols-1 md:grid-cols-3 gap-2 md:gap-8 py-5 border-t border-cream-200">
  <div class="md:col-span-1">
    <%= form.label field, class: 'block text-sm font-bold text-cream-900' do %>
      <%= Account.human_attribute_name(field) %><%= tag.span(' *', class: 'text-cream-500') if required %>
    <% end %>
    <% if hint.present? %>
      <p class="text-xs text-cream-600 mt-1"><%= hint %></p>
    <% end %>
  </div>
  <div class="md:col-span-2">
    <%= form.public_send(type, field,
                         class: billing_input_classes,
                         autocomplete: local_assigns.fetch(:autocomplete, 'off')) %>
  </div>
</div>