Skip to content

Commit a539f54

Browse files
committed
Fix PR #1749 review follow-ups — m2 attribute default, inline helper, docstring tone
1 parent 030fe33 commit a539f54

3 files changed

Lines changed: 3 additions & 7 deletions

File tree

lib/backpex/html/layout.ex

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -501,9 +501,8 @@ defmodule Backpex.HTML.Layout do
501501
"A unique id for this section. Used to save and load the opening state of this section and to wire aria-controls, so every section on the page must have its own."
502502

503503
attr :sidebar_section_states, :map,
504-
default: %{},
505504
doc:
506-
"map of section states. Read from the parent's `@sidebar_section_states` assign when not passed explicitly; falls back to `%{}` (all sections open by default)."
505+
"map of section states. When the attr is omitted, the component falls back to the parent's `@sidebar_section_states` assign (via `assign_new/3`), or `%{}` if the parent didn't set one. Unknown section ids default to open."
507506

508507
slot :inner_block
509508
slot :label, required: true, doc: "label to be displayed on the section."

lib/backpex/preferences/key.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ defmodule Backpex.Preferences.Key do
2222
making stored preferences hard to reason about. Switching the whole key to
2323
colons lets the module live as a single atomic segment.
2424
25-
## Separator precedence (read carefully)
25+
## Separator precedence
2626
2727
A single `":"` anywhere in the key flips the whole key to colon-split
2828
parsing. There is no "mixed" mode. Concretely:

lib/backpex/preferences/router.ex

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,6 @@ defmodule Backpex.Preferences.Router do
138138

139139
# Sort order: named patterns beat :default, longer patterns beat shorter,
140140
# exact matches beat wildcards at the same depth.
141-
{1, length, bool_to_int(exact?)}
141+
{1, length, if(exact?, do: 1, else: 0)}
142142
end
143-
144-
defp bool_to_int(true), do: 1
145-
defp bool_to_int(false), do: 0
146143
end

0 commit comments

Comments
 (0)