FEATURE: Add setting to show links on the left or right
This commit is contained in:
parent
175a027582
commit
a99331c590
|
@ -26,3 +26,14 @@
|
|||
.mobile-view .vdo {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
@if $links_position == left {
|
||||
.custom-header-links {
|
||||
margin-left: 1em;
|
||||
}
|
||||
.hide-menus {
|
||||
.custom-header-links {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<script type="text/discourse-plugin" version="0.8.20">
|
||||
const customHeaderLinks = settings.Custom_header_links;
|
||||
const linksPosition = (settings.links_position === "right") ? "header-buttons:before" : "home-logo:after";
|
||||
|
||||
if (!customHeaderLinks.length) return;
|
||||
|
||||
|
@ -48,7 +49,7 @@
|
|||
}
|
||||
});
|
||||
|
||||
api.decorateWidget("header-buttons:before", helper => {
|
||||
api.decorateWidget(linksPosition, helper => {
|
||||
return helper.h(
|
||||
"ul.custom-header-links", headerLinks
|
||||
);
|
||||
|
|
11
settings.yml
11
settings.yml
|
@ -2,4 +2,13 @@ Custom_header_links:
|
|||
type: list
|
||||
default: "External link, this link will open in a new tab, https://meta.discourse.org, vdo, blank, remove|Most Liked, Posts with the most amount of likes, /latest/?order=op_likes, vdo, self, keep|Privacy, Our Privacy Policy, /privacy, vdm, self, keep"
|
||||
description:
|
||||
en: 'Comma delimited in this order: link text, link title, URL, view, target, hide on scroll<br><b>Link text:</b> The text for the link<br><b>Link title:</b> the text that shows when the link is hovered<br><b>URL:</b> The path for the link (can be relative)<br><b>View:</b> vdm = desktop and mobile, vdo = desktop only, vmo = mobile only<br><b>Target:</b> blank = opens in a new tab, self = opens in the same tab<br><b>Hide on scroll:</b> remove = hides the link when the title is expanded on topic pages keep = keeps the link visible even when the title is visible on topic pages'
|
||||
en: "Comma delimited in this order: link text, link title, URL, view, target, hide on scroll<br><b>Link text:</b> The text for the link<br><b>Link title:</b> the text that shows when the link is hovered<br><b>URL:</b> The path for the link (can be relative)<br><b>View:</b> vdm = desktop and mobile, vdo = desktop only, vmo = mobile only<br><b>Target:</b> blank = opens in a new tab, self = opens in the same tab<br><b>Hide on scroll:</b> remove = hides the link when the title is expanded on topic pages keep = keeps the link visible even when the title is visible on topic pages"
|
||||
|
||||
links_position:
|
||||
default: right
|
||||
type: enum
|
||||
choices:
|
||||
- right
|
||||
- left
|
||||
description:
|
||||
en: "Note that when links are displayed on the left, they're automatically hidden while scrolling within topics to make room for the title"
|
||||
|
|
Loading…
Reference in New Issue