The personal finance app for everyone (by everyone)
Ruby
<%# locals: (occurrence:, suggestion: nil, drawer: false) %>
<%# The bill's one verb, picked by BillsHelper#bills_row_verb.
Every row used to carry the same "Details" button plus a pay action plus a
category badge, which at 375px added up to more than the row was wide: the
bill's own name collapsed to nothing and the page scrolled sideways. A row
now offers a verb only when the bill needs you now, and only where it has
room for the words (the row's slot is hidden below @lg). On a phone the
subline already says why the row matters, and tapping it opens the drawer.
`drawer: true` is what the drawer passes. There the verb comes from
bills_drawer_verb, is always present, and renders at full size. %>
<% verb = drawer ? bills_drawer_verb(occurrence, suggestion: suggestion) : bills_row_verb(occurrence, suggestion: suggestion) %>
<% if verb == :pay %>
<%= render "recurring_transactions/pay_link", recurring_transaction: occurrence.recurring_transaction %>
<% elsif verb %>
<%= render DS::Link.new(
text: t("bills.#{verb}"),
icon: BillsHelper::VERB_ICONS[verb],
variant: drawer ? "primary" : "outline",
size: drawer ? "md" : "sm",
href: recurring_occurrence_path(occurrence),
frame: :drawer
) %>
<% end %>