refactor(web): drop the Wide button of the diff bar, the w shortcut covers it
- commit
- 502935e68076ff7827c55e701bded5ded639fed4
- author
- brice · · 2026-10-19 15:17 UTC
- committer
- brice · · 2026-10-19 15:17 UTC
- parent
- a1f8e85
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
5 files · +467 -522
M internal/adapters/web/diff.templ +0 -9
| @@ -73,7 +73,6 @@ templ Commit(l Layout, p CommitPage) { | |||
| 73 | 73 | <span class="dim">{ plural(p.NFiles, "file", "files") } · <span class="plus">+{ itoa(p.Adds) }</span> <span class="minus">-{ itoa(p.Dels) }</span></span> | |
| 74 | 74 | <span class="grow"></span> | |
| 75 | 75 | @diffViewMenu(p.DiffView) | |
| 76 | - | @wideButton() | |
| 77 | 76 | </div> | |
| 78 | 77 | if p.Invisible { | |
| 79 | 78 | <p class="notice"> | |
| @@ -131,14 +130,6 @@ templ diffViewMenu(p DiffView) { | |||
| 131 | 130 | </details> | |
| 132 | 131 | } | |
| 133 | 132 | ||
| 134 | - | // wideButton turns the wide mode (w, on every page) on or off: the rail goes | |
| 135 | - | // to the right edge and the code takes the rest. ermite.js keeps the choice. | |
| 136 | - | templ wideButton() { | |
| 137 | - | <button type="button" class="btn" data-js data-fire="wide" data-wide-toggle aria-pressed="false" aria-keyshortcuts="w" title="use the whole width of the screen"> | |
| 138 | - | Wide<kbd aria-hidden="true">w</kbd> | |
| 139 | - | </button> | |
| 140 | - | } | |
| 141 | - | ||
| 142 | 133 | // viewLink is a button of the diff tools. It is a link, so that the split | |
| 143 | 134 | // layout works without JavaScript; with it, and when both layouts are in the | |
| 144 | 135 | // page, a click only flips the layout. | |
| @@ -73,7 +73,6 @@ templ Commit(l Layout, p CommitPage) { | |||||
| 73 | <span class="dim">{ plural(p.NFiles, "file", "files") } · <span class="plus">+{ itoa(p.Adds) }</span> <span class="minus">-{ itoa(p.Dels) }</span></span> | 73 | <span class="dim">{ plural(p.NFiles, "file", "files") } · <span class="plus">+{ itoa(p.Adds) }</span> <span class="minus">-{ itoa(p.Dels) }</span></span> | ||
| 74 | <span class="grow"></span> | 74 | <span class="grow"></span> | ||
| 75 | @diffViewMenu(p.DiffView) | 75 | @diffViewMenu(p.DiffView) | ||
| 76 | - | @wideButton() | |||
| 77 | </div> | 76 | </div> | ||
| 78 | if p.Invisible { | 77 | if p.Invisible { | ||
| 79 | <p class="notice"> | 78 | <p class="notice"> | ||
| @@ -131,14 +130,6 @@ templ diffViewMenu(p DiffView) { | |||||
| 131 | </details> | 130 | </details> | ||
| 132 | } | 131 | } | ||
| 133 | 132 | ||||
| 134 | - | // wideButton turns the wide mode (w, on every page) on or off: the rail goes | |||
| 135 | - | // to the right edge and the code takes the rest. ermite.js keeps the choice. | |||
| 136 | - | templ wideButton() { | |||
| 137 | - | <button type="button" class="btn" data-js data-fire="wide" data-wide-toggle aria-pressed="false" aria-keyshortcuts="w" title="use the whole width of the screen"> | |||
| 138 | - | Wide<kbd aria-hidden="true">w</kbd> | |||
| 139 | - | </button> | |||
| 140 | - | } | |||
| 141 | - | ||||
| 142 | // viewLink is a button of the diff tools. It is a link, so that the split | 133 | // viewLink is a button of the diff tools. It is a link, so that the split | ||
| 143 | // layout works without JavaScript; with it, and when both layouts are in the | 134 | // layout works without JavaScript; with it, and when both layouts are in the | ||
| 144 | // page, a click only flips the layout. | 135 | // page, a click only flips the layout. | ||
M internal/adapters/web/diff_templ.go +423 -458 generated file: collapsed
M internal/adapters/web/mr.templ +0 -2
| @@ -434,7 +434,6 @@ templ mrBar(p MRPage) { | |||
| 434 | 434 | <div class="diff-tools mr-bar" role="group" aria-label="Diff view and merge"> | |
| 435 | 435 | <span class="dim">{ plural(p.NFiles, "file", "files") } · <span class="plus">+{ itoa(p.Adds) }</span> <span class="minus">-{ itoa(p.Dels) }</span></span> | |
| 436 | 436 | @diffViewMenu(p.DiffView) | |
| 437 | - | @wideButton() | |
| 438 | 437 | <span class="grow"></span> | |
| 439 | 438 | @MRChecksSum(p.ChecksSum) | |
| 440 | 439 | if p.Box != nil { | |
| @@ -564,7 +563,6 @@ templ Compare(l Layout, p ComparePage) { | |||
| 564 | 563 | <span class="dim">{ plural(p.NFiles, "file", "files") } · <span class="plus">+{ itoa(p.Adds) }</span> <span class="minus">-{ itoa(p.Dels) }</span></span> | |
| 565 | 564 | <span class="grow"></span> | |
| 566 | 565 | @diffViewMenu(p.DiffView) | |
| 567 | - | @wideButton() | |
| 568 | 566 | </div> | |
| 569 | 567 | if p.Invisible { | |
| 570 | 568 | <p class="notice"> | |
| @@ -434,7 +434,6 @@ templ mrBar(p MRPage) { | |||||
| 434 | <div class="diff-tools mr-bar" role="group" aria-label="Diff view and merge"> | 434 | <div class="diff-tools mr-bar" role="group" aria-label="Diff view and merge"> | ||
| 435 | <span class="dim">{ plural(p.NFiles, "file", "files") } · <span class="plus">+{ itoa(p.Adds) }</span> <span class="minus">-{ itoa(p.Dels) }</span></span> | 435 | <span class="dim">{ plural(p.NFiles, "file", "files") } · <span class="plus">+{ itoa(p.Adds) }</span> <span class="minus">-{ itoa(p.Dels) }</span></span> | ||
| 436 | @diffViewMenu(p.DiffView) | 436 | @diffViewMenu(p.DiffView) | ||
| 437 | - | @wideButton() | |||
| 438 | <span class="grow"></span> | 437 | <span class="grow"></span> | ||
| 439 | @MRChecksSum(p.ChecksSum) | 438 | @MRChecksSum(p.ChecksSum) | ||
| 440 | if p.Box != nil { | 439 | if p.Box != nil { | ||
| @@ -564,7 +563,6 @@ templ Compare(l Layout, p ComparePage) { | |||||
| 564 | <span class="dim">{ plural(p.NFiles, "file", "files") } · <span class="plus">+{ itoa(p.Adds) }</span> <span class="minus">-{ itoa(p.Dels) }</span></span> | 563 | <span class="dim">{ plural(p.NFiles, "file", "files") } · <span class="plus">+{ itoa(p.Adds) }</span> <span class="minus">-{ itoa(p.Dels) }</span></span> | ||
| 565 | <span class="grow"></span> | 564 | <span class="grow"></span> | ||
| 566 | @diffViewMenu(p.DiffView) | 565 | @diffViewMenu(p.DiffView) | ||
| 567 | - | @wideButton() | |||
| 568 | </div> | 566 | </div> | ||
| 569 | if p.Invisible { | 567 | if p.Invisible { | ||
| 570 | <p class="notice"> | 568 | <p class="notice"> | ||
M internal/adapters/web/mr_templ.go +42 -50 generated file: collapsed
M internal/adapters/web/static/js/ermite.js +2 -3
| @@ -557,14 +557,13 @@ | |||
| 557 | 557 | // The wide mode (w, on every page): the work area takes the whole width of | |
| 558 | 558 | // the screen, the rail at the right edge and the content in the rest. | |
| 559 | 559 | // The choice is kept by ermiteStore ("wide": '1' when wide) and shown | |
| 560 | - | // as html.wide, which the styles follow, and as aria-pressed on the | |
| 561 | - | // buttons [data-wide-toggle]. Another tab's change applies here at once. | |
| 560 | + | // as html.wide, which the styles follow. Another tab's change applies here | |
| 561 | + | // at once. | |
| 562 | 562 | window.ermiteWide = (() => { | |
| 563 | 563 | const pref = window.ermiteStore.pref('wide', { values: ['1', ''], fallback: '' }); | |
| 564 | 564 | function apply() { | |
| 565 | 565 | const wide = pref.get() === '1'; | |
| 566 | 566 | document.documentElement.classList.toggle?.('wide', wide); | |
| 567 | - | for (const b of document.querySelectorAll('[data-wide-toggle]')) b.setAttribute('aria-pressed', String(wide)); | |
| 568 | 567 | } | |
| 569 | 568 | function toggle() { | |
| 570 | 569 | pref.set(pref.get() === '1' ? '' : '1'); | |
| @@ -557,14 +557,13 @@ | |||||
| 557 | // The wide mode (w, on every page): the work area takes the whole width of | 557 | // The wide mode (w, on every page): the work area takes the whole width of | ||
| 558 | // the screen, the rail at the right edge and the content in the rest. | 558 | // the screen, the rail at the right edge and the content in the rest. | ||
| 559 | // The choice is kept by ermiteStore ("wide": '1' when wide) and shown | 559 | // The choice is kept by ermiteStore ("wide": '1' when wide) and shown | ||
| 560 | - | // as html.wide, which the styles follow, and as aria-pressed on the | 560 | + | // as html.wide, which the styles follow. Another tab's change applies here |
| 561 | - | // buttons [data-wide-toggle]. Another tab's change applies here at once. | 561 | + | // at once. |
| 562 | window.ermiteWide = (() => { | 562 | window.ermiteWide = (() => { | ||
| 563 | const pref = window.ermiteStore.pref('wide', { values: ['1', ''], fallback: '' }); | 563 | const pref = window.ermiteStore.pref('wide', { values: ['1', ''], fallback: '' }); | ||
| 564 | function apply() { | 564 | function apply() { | ||
| 565 | const wide = pref.get() === '1'; | 565 | const wide = pref.get() === '1'; | ||
| 566 | document.documentElement.classList.toggle?.('wide', wide); | 566 | document.documentElement.classList.toggle?.('wide', wide); | ||
| 567 | - | for (const b of document.querySelectorAll('[data-wide-toggle]')) b.setAttribute('aria-pressed', String(wide)); | |||
| 568 | } | 567 | } | ||
| 569 | function toggle() { | 568 | function toggle() { | ||
| 570 | pref.set(pref.get() === '1' ? '' : '1'); | 569 | pref.set(pref.get() === '1' ? '' : '1'); | ||