Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for #203: visible children of hidden parents #1048

Merged
merged 9 commits into from Aug 2, 2022

Conversation

dairiki
Copy link
Contributor

@dairiki dairiki commented Jul 22, 2022

This PR allows one to have visible children under a hidden parent page. No artifact (e.g. index.html) will be built for the hidden parent, but artifact(s) will now be built for any explicitly non-hidden children.

Contrary to what the documentation says, up until now, Lektor made no attempt to build children of a hidden parent.

Other changes here:

  • Fixes some related bugs having to do with URL resolution to pages that have hidden parents.
  • Fix the builders pruning logic to prune artifacts that belong to hidden pages. (These were presumably built at a time when the page was not marked as hidden.)
  • Fix the BooleanInputWidget’s logic for setting checkboxes to the indeterminate state. Previously, checkboxes were only set to indeterminate if their default value was true. I think the proper (more useful) behavior is to set the checkbox to indeterminate if the contents.lr file does not explicitly set a value for the field, regardless of what the default value is.
  • Updates the BooleanInputWidget (checkbox) so that typing <Delete> or <Backspace> (while it has the focus) will revert it to unset (or indeterminate) state, rather than true or false. This is important for the _hidden field, since when the _hidden field is unset it means something different (e.g. "inherit from parent") than when _hidden = false (or _hidden = true).

Issue(s) Resolved

Fixes #203

Related Issues / Links

Clarified documentation on the _missing field in lektor/lektor-website@7a6ccd0

Description of Changes

  • Wrote at least one-line docstrings (for any new functions)
  • Added unit test(s) covering the changes (if testable)
  • Should implement a real tri-state checkbox widget in the admin UI. (_hidden unset ≠ _hidden = no)

@dairiki dairiki changed the title Bug.203 non hidden children Fixes for #203: visible children of hidden parents Jul 22, 2022
@dairiki dairiki force-pushed the bug.203-non-hidden-children branch from 8f17c81 to 142865e Compare July 22, 2022 03:42
Previously, checkboxes were only being marked _indeterminate_
if the default ("placeholder") value was true.  They should be
indeterminate whenever this is no explicitly set value.

Also lower the opacity for indeterminate checkboxes, to make them more
visually distinctive.
- Test devserver when serving hidden pages and their children
- Test URL resolution below hidden pages
- Add tests that children of hidden pages get built
- Test that artifacts of hidden pages get pruned
Even though hidden records produce no artifacts, they may have
non-hidden children.

See lektor#203
There may be non-hidden children below hidden pages.
@dairiki dairiki force-pushed the bug.203-non-hidden-children branch from 142865e to d1057c0 Compare July 27, 2022 04:45
@dairiki dairiki marked this pull request as ready for review July 27, 2022 21:44
@dairiki dairiki marked this pull request as draft July 29, 2022 19:14
@dairiki dairiki force-pushed the bug.203-non-hidden-children branch from 075449e to fc3e87a Compare July 29, 2022 23:55
One can now type the <delete> or <backspace> key to "unset" the
checkbox.

This is useful for the `_hidden` field where, _unset_ has different
semantics than `false`.
@dairiki dairiki force-pushed the bug.203-non-hidden-children branch from fc3e87a to f0d87b7 Compare July 30, 2022 00:34
@dairiki dairiki marked this pull request as ready for review July 30, 2022 03:51
Previous method of checking the `checked` HTML attribute doesn't work
since React Controlled Components never update the `checked` HTML
attribute after the initial mount.
@dairiki dairiki merged commit e48ac73 into lektor:master Aug 2, 2022
@dairiki
Copy link
Contributor Author

dairiki commented Aug 3, 2022

This is now fixed in the master branch (and the 3.4.0b1 pre-release).

If there's a desire for this to be backported to the 3.3 branch, let me know.

@dairiki dairiki deleted the bug.203-non-hidden-children branch August 3, 2022 05:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

overriding parent _hidden field in content does not have desired effect
1 participant