Repository navigation
Conversation
This shortens the import list from Widget.Common. Eventually I'd like to move all link generators to ReportPage.
|
As it stands, this seems to complicate the module namespace for code readers, and make some code more verbose, in exchange for simplifying a few import lines, which I think could be achieved in another way ? |
|
Of course I support the goal of grouping things together that belong together. Would this be helpful - a new module, eg Hledger.Web.Widget.Controls, holding the link rows and their helpers, the mode types, and each parameter's encoder and parser ? Common would shrink, ReportPage and Handlers would import Controls. |
|
On Mon, 26 Oct 2026, Simon Michael wrote:
[10144?s=20&v=4] simonmichael left a comment (hledgerorg/hledger#2821)
Of course I support the goal of grouping things together that belong
together. Would this be helpful - a new module, eg
Hledger.Web.Widget.Controls, holding the link rows and their helpers,
the mode types, and each parameter's encoder and parser ? Common would
shrink, ReportPage and Handlers would import Controls.
A new module would also be ok, but I do not see where to set a clear cut
between ReportPage and Controls. Also, if ReportPage provides the single
source of truth for web options, Controls would need to import ReportPage,
not vice versa.
You can also call the new module Links and then write Links.calc instead
of calcLinks in BalanceR.
|
|
Reminding myself of the context here. This PR is a small cosmetic one and can't be used as it stands. Let's continue this discussion over on #2807, which is about reducing duplication, and influences module layout. |
…r; calc uses it A multiple-choice URL parameter such as calc was described in several places that nothing kept in agreement: its parser, its encoder, its row of links, the options summary's names for it, and its name as a string literal across the handlers (#2798). Now a Param value holds its name, its modes in display order, each mode's URL word, and its labels, and the parser (parseParam, readParam, lookupParam), the row of links (paramLinks), the URL settings (paramSetting, paramSettings) and the options summary's names (paramPhrase) are made from it. The new Hledger.Web.Param module also takes the generic links row renderer (linksRow, linksRowClass, linksRowGroups) from Widget.Common, which now imports it, avoiding an import cycle. calc is the first parameter converted, replacing parseCalc, calcWord and calcLinks. Its labels and translator comments are unchanged, so its translations are too. The journal and register pages now carry only a valid calc value on their links, rather than any value given. Supersedes #2807 and #2821, following the design discussed in #2807. AI usage: Claude Fable 5.1/Opus 5.5, ~51k output tokens
|
Closed in favour of #2851. |
This shortens the import list from Widget.Common.
Eventually I'd like to move all link generators to ReportPage.