Keep the extra repayment amount and Apply on one row
Closes jaysbeekay/sure#469
Problem
On a loan's Extra repayments tab, the amount field filled the whole row and Apply wrapped beneath it. The input also drew its own dark border inside the field's card, a box inside a box. .form-field applies w-full (app/assets/tailwind/sure-design-system/components.css:39), so inside the flex flex-wrap row it took every column. The input had no form-field__input and the label no form-field__label.
Change
app/views/loans/tabs/_extra_repayments.html.erb only:
- The field is
form-field w-48.w-48is a scale token, and the utilities layer wins over the component'sw-full, so the field shares its row with Apply (and Clear, once an amount is applied). - The label carries
form-field__labeland the inputform-field__input, so the card is the field's only box, as on the loan form. - Unchanged: the form's URL, method and params (
extra_payment[amount]), the auto-submit target,min/step, and the Clear link..form-fielditself is not edited, so no other form changes.
Blast radius. The partial is rendered only by app/views/accounts/show/_extra_repayments_frame.html.erb. AccountsController#show and the auto-submit-form controller see the same request as before.
Screenshots
Default desktop viewport (1400px). Taken with the test suite's Selenium browser on this branch and on main.
| Light | Dark | |
|---|---|---|
Before (main) | ![]() | ![]() |
| After | ![]() | ![]() |
Tests
Each test was written first and seen to fail on main:
AccountsControllerTest"the extra repayment amount is a design-system field input": inside.form-field,label.form-field__label[for='extra_payment_amount']andinput.form-field__input[name='extra_payment[amount]']. Onmain: Expected exactly 1 element matching "label.form-field__label..." found 0.LoanExtraRepaymentsTest(new system test) "the extra repayment amount and Apply share one row": at the default 1400px viewport, Apply's top is above the field's bottom and Apply sits to the field's right. Onmain, Apply's top was 741 against the field's bottom 733, so it had wrapped.- Negative: the existing extra-repayment tests that submit an amount and read
extra-payoff-date/extra-months-soonerstill pass, so the form submits the same params.
Mutations, each on the committed fix and restored with git checkout --:
| Mutation | Result |
|---|---|
Drop w-48 | system test fails (Apply's top 719 vs field bottom 711) |
Drop form-field__input | controller test fails |
Drop form-field__label | controller test fails |
Validation
bin/rails testona6daf0b3b: 12,403 runs, 53,507 assertions, 0 failures, 0 errors, 35 skips.- System tests
loan_extra_repayments_test.rbandloan_payoff_chart_test.rb: 4 runs, 0 failures (remote Chromium). bin/rubocopon the changed tests: no offenses.erb_linton the partial: no errors.bin/brakeman --no-pager -q: 0 warnings.- Upstream
AGENTS.md: DS field classes, a scale token rather than an arbitrary width, no raw palette classes, no new styles in the design-system files, andt()strings unchanged.



