feat: add show in site navigation toggle for redirect editor

scarlett
NGPixel 3 weeks ago
parent b16402ae0f
commit 7682e839c8
No known key found for this signature in database

@ -1885,6 +1885,7 @@
"editor.redirect.pickerTitle": "Select Redirection Target",
"editor.redirect.showInterstitial": "Show Interstitial",
"editor.redirect.showInterstitialHint": "Show a short notice saying where the reader is going before taking them there. Off sends them straight on.",
"editor.redirect.showInTreeHint": "List this redirection in the site's browse menu. Off keeps it out, which is usually what a doorway left behind for an old path should do. It is listed in the file manager either way.",
"editor.redirect.summaryDirect": "Readers arriving at this page are sent to {target} right away.",
"editor.redirect.summaryIncomplete": "This redirection has no target yet, and cannot be saved until it does.",
"editor.redirect.summaryInterstitial": "Readers arriving at this page are told they are being sent to {target}, then taken there a few seconds later.",

@ -894,7 +894,13 @@ class Pages {
editor,
hash,
icon: input.icon ?? '',
isBrowsable: input.isBrowsable ?? true,
/*
A redirection is a doorway rather than a destination, so it stays out of the browse menu
unless its author says otherwise -- the same default the redirect editor's own toggle
opens on. Unlike `isSearchable` below this is a choice and not a rule: a redirection that
IS the name readers look for belongs in the menu, and saying so is all it takes.
*/
isBrowsable: input.isBrowsable ?? !isRedirect,
// -> A redirection has nothing to find: a result for it would be a result whose page is a
// doorway to the page the reader actually wanted, which is the one search should offer
isSearchable: isRedirect ? false : (input.isSearchable ?? true),

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 19 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 7.5 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 16 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 10 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 11 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 7.9 KiB

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" width="96px" height="96px"><defs><linearGradient id="sQjWWtniGrlgO5B5BYjBTa" x1="15.139" x2="33.352" y1="-.347" y2="49.695" data-name="Безымянный градиент 147" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#dfe9f2"/><stop offset=".391" stop-color="#d6e0e9"/><stop offset="1" stop-color="#bfc8d1"/></linearGradient><linearGradient id="sQjWWtniGrlgO5B5BYjBTb" x1="24" x2="24" y1="7.413" y2="40.126" data-name="Безымянный градиент 123" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#f44f5a"/><stop offset=".443" stop-color="#ee3d4a"/><stop offset="1" stop-color="#e52030"/></linearGradient></defs><path fill="#5c5f61" d="M36.435,35.435h2a1,1,0,0,1,1,1v3a0,0,0,0,1,0,0h-4a0,0,0,0,1,0,0v-3a1,1,0,0,1,1-1Z" transform="rotate(135 37.435 37.435)"/><path fill="#5c5f61" d="M8.565,8.565h4a0,0,0,0,1,0,0v3a1,1,0,0,1-1,1h-2a1,1,0,0,1-1-1v-3A0,0,0,0,1,8.565,8.565Z" transform="rotate(135 10.565 10.565)"/><path fill="#5c5f61" d="M8.565,35.435h4a0,0,0,0,1,0,0v3a1,1,0,0,1-1,1h-2a1,1,0,0,1-1-1v-3a0,0,0,0,1,0,0Z" transform="rotate(45 10.565 37.435)"/><path fill="#5c5f61" d="M36.435,8.565h2a1,1,0,0,1,1,1v3a0,0,0,0,1,0,0h-4a0,0,0,0,1,0,0v-3a1,1,0,0,1,1-1Z" transform="rotate(45 37.435 10.565)"/><path fill="url(#sQjWWtniGrlgO5B5BYjBTa)" d="M37.43506,10.565a19,19,0,1,0,0,26.87006A19.00015,19.00015,0,0,0,37.43506,10.565Zm-6.364,20.5061a10,10,0,1,1,0-14.14215A9.99987,9.99987,0,0,1,31.071,31.07105Z"/><path fill="url(#sQjWWtniGrlgO5B5BYjBTb)" d="M37.44,10.56l-6.37,6.37a9.9889,9.9889,0,0,1,0,14.14l6.37,6.37A19.03012,19.03012,0,0,0,37.44,10.56Zm-26.88,0a19.03012,19.03012,0,0,0,0,26.88l6.37-6.37a9.9889,9.9889,0,0,1,0-14.14Z"/></svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" width="96px" height="96px"><linearGradient id="y32pH~h~_bVsTtVf8afzja" x1="13.069" x2="31.926" y1="9.998" y2="37.275" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#7dd8f3"/><stop offset="1" stop-color="#45b0d0"/></linearGradient><path fill="url(#y32pH~h~_bVsTtVf8afzja)" d="M4,38V13h40v25c0,1.1-0.9,2-2,2H6C4.9,40,4,39.1,4,38z"/><path fill="#0f94bf" d="M38.5,21h-23c-0.276,0-0.5-0.224-0.5-0.5v-1c0-0.276,0.224-0.5,0.5-0.5h23c0.276,0,0.5,0.224,0.5,0.5 v1C39,20.776,38.776,21,38.5,21z"/><path fill="#0f94bf" d="M38.5,25h-23c-0.276,0-0.5-0.224-0.5-0.5v-1c0-0.276,0.224-0.5,0.5-0.5h23c0.276,0,0.5,0.224,0.5,0.5 v1C39,24.776,38.776,25,38.5,25z"/><path fill="#0f94bf" d="M38.5,29h-23c-0.276,0-0.5-0.224-0.5-0.5v-1c0-0.276,0.224-0.5,0.5-0.5h23c0.276,0,0.5,0.224,0.5,0.5 v1C39,28.776,38.776,29,38.5,29z"/><path fill="#0f94bf" d="M35,33H15.5c-0.276,0-0.5-0.224-0.5-0.5v-1c0-0.276,0.224-0.5,0.5-0.5H35V33z"/><path d="M44,17.602L28.101,33.504L26.868,38.4c-0.111,0.442,0.29,0.843,0.732,0.732l4.897-1.233L44,26.394 V17.602z" opacity=".05"/><path d="M44,18.309L28.941,33.371l-0.547,1.017l0,0l-0.001,0l-0.864,3.434 c-0.099,0.392,0.256,0.746,0.648,0.648l3.446-0.868l0,0l0,0l1.006-0.543L44,25.663V18.309z" opacity=".07"/><path d="M44,19.015l-7.498,7.5l-7.498,7.5l0.001,0.001l-0.002,0l-0.813,3.231 c-0.086,0.341,0.223,0.65,0.564,0.564l3.231-0.813l0-0.001l0,0l6.007-6.008L44,24.98V19.015z" opacity=".2"/><linearGradient id="y32pH~h~_bVsTtVf8afzjb" x1="4.808" x2="42.75" y1="6.78" y2="14.495" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#0077d2"/><stop offset="1" stop-color="#0b59a2"/></linearGradient><path fill="url(#y32pH~h~_bVsTtVf8afzjb)" d="M44,10v3H4v-3c0-1.1,0.9-2,2-2h36C43.1,8,44,8.9,44,10z"/><path fill="#0f94bf" d="M9.5,21h1c0.276,0,0.5-0.224,0.5-0.5v-1c0-0.276-0.224-0.5-0.5-0.5h-1C9.224,19,9,19.224,9,19.5v1 C9,20.776,9.224,21,9.5,21z"/><path fill="#0f94bf" d="M9.5,25h1c0.276,0,0.5-0.224,0.5-0.5v-1c0-0.276-0.224-0.5-0.5-0.5h-1C9.224,23,9,23.224,9,23.5v1 C9,24.776,9.224,25,9.5,25z"/><path fill="#0f94bf" d="M9.5,29h1c0.276,0,0.5-0.224,0.5-0.5v-1c0-0.276-0.224-0.5-0.5-0.5h-1C9.224,27,9,27.224,9,27.5v1 C9,28.776,9.224,29,9.5,29z"/><path fill="#0f94bf" d="M9.5,33h1c0.276,0,0.5-0.224,0.5-0.5v-1c0-0.276-0.224-0.5-0.5-0.5h-1C9.224,31,9,31.224,9,31.5v1 C9,32.776,9.224,33,9.5,33z"/><path fill="#c94f60" d="M47.781,20.141l-1.922-1.921c-0.292-0.293-0.768-0.293-1.061,0l-0.904,0.905l2.981,2.981l0.905-0.904 C48.073,20.908,48.073,20.434,47.781,20.141"/><path fill="#f0f0f0" d="M29.003,34.016L28,38l3.985-1.003l0.418-3.456L29.003,34.016z"/><path fill="#edbe00" d="M44.333,24.648L31.985,36.996l-2.981-2.981l12.348-12.348L44.333,24.648z"/><linearGradient id="y32pH~h~_bVsTtVf8afzjc" x1="44.112" x2="44.112" y1="19.312" y2="24.801" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#dedede"/><stop offset="1" stop-color="#d6d6d6"/></linearGradient><path fill="url(#y32pH~h~_bVsTtVf8afzjc)" d="M41.349,21.667l2.543-2.544l2.983,2.981l-2.543,2.544L41.349,21.667z"/><path fill="#787878" d="M28.508,35.985L28,38l2.014-0.508L28.508,35.985z"/></svg>

After

Width:  |  Height:  |  Size: 3.1 KiB

@ -69,6 +69,23 @@
</div>
<w-separator class="my-2" inset />
<!-- ----------------------- -->
<!-- Show in Site Navigation -->
<!-- ----------------------- -->
<w-item>
<blueprint-icon icon="tree-structure" />
<w-item-section>
<w-item-label>{{ t('editor.props.showInTree') }}</w-item-label>
<w-item-label caption>{{ t('editor.redirect.showInTreeHint') }}</w-item-label>
</w-item-section>
<w-item-section side>
<w-toggle
:model-value="pageStore.isBrowsable"
:aria-label="t(`editor.props.showInTree`)"
@update:model-value="setIsBrowsable" />
</w-item-section>
</w-item>
<w-separator class="my-2" inset />
<!-- ----------------------- -->
<!-- Interstitial -->
<!-- ----------------------- -->
<w-item>
@ -126,8 +143,9 @@ import { usePageStore } from '@/stores/page'
* The `redirect` editor: a page that sends its reader somewhere else.
*
* There is no content to write, so this is a form rather than an editor a title, where the page
* points, and whether the reader is told about it on the way. All three are the page's own fields:
* the title is the page's, and the other two are its content, as JSON. See `helpers/pageRedirect.js`.
* points, whether it is offered in the browse menu, and whether the reader is told about it on the
* way. Two of those are the page's own fields the title and `isBrowsable`, which the properties
* panel also edits and the other two are its content, as JSON. See `helpers/pageRedirect.js`.
*
* What the page then DOES with that is `PageRedirect.vue`, which is what the page view draws in place
* of an article.
@ -181,6 +199,18 @@ function setTitle(title) {
touch()
}
/**
* Whether the page is offered in the browse menu, which is the page's `isBrowsable` field rather than
* anything about the redirection the same toggle the properties panel carries, put here because it
* is the question a redirection actually raises. Off for a new one: a redirection is usually a doorway
* left behind for an old path, and a menu of those is a menu of the same pages twice. The file manager
* lists it either way; this is the reader's menu, not the author's.
*/
function setIsBrowsable(isBrowsable) {
pageStore.isBrowsable = isBrowsable
touch()
}
function setShowInterstitial(showInterstitial) {
state.showInterstitial = showInterstitial
touch()

@ -437,13 +437,15 @@ export const usePageStore = defineStore('page', {
// -> A page being created has no stored source to lose: whatever it starts with IS the source
contentLoaded: true,
render: '',
isBrowsable: true,
/*
A redirection is browsable like any other page and findable in none: a search result for one
would stand in front of the page the reader actually wanted. The server settles this either
way -- see `createPage` in `models/pages.ts` -- so this is the store agreeing with it rather
than deciding it.
A redirection is in neither the browse menu nor search by default: the first because it is a
doorway rather than a page to land on, the second because a result for one would stand in
front of the page the reader actually wanted. The server settles both the same way -- see
`createPage` in `models/pages.ts` -- so this is the store agreeing with it rather than
deciding it. The difference is that browsing is a choice the author can turn back on, in the
redirect editor or the properties panel, and searching is not offered at all.
*/
isBrowsable: editor !== 'redirect',
isSearchable: editor !== 'redirect',
// -> The page being created is very often the one that was missing, and it is not missing now
notFound: false,

Loading…
Cancel
Save