mirror of
https://github.com/discourse/discourse-custom-header-links.git
synced 2026-10-01 22:03:56 -04:00
Revert "DEV: Migrate custom header links to new objects setting type (#53)"
This reverts commit 73747938bd.
This commit is contained in:
@@ -12,13 +12,12 @@
|
||||
>
|
||||
{{#each this.links as |link|}}
|
||||
<li
|
||||
class={{concat-class
|
||||
"headerLink"
|
||||
link.device
|
||||
link.locale
|
||||
link.linkClass
|
||||
link.hideOnScroll
|
||||
}}
|
||||
class="headerLink
|
||||
{{link.device}}
|
||||
{{link.keepOnScrollClass}}
|
||||
{{link.locale}}
|
||||
{{link.linkClass}}
|
||||
{{link.keepOnScroll}}"
|
||||
>
|
||||
<a
|
||||
title={{link.anchorAttributes.title}}
|
||||
|
||||
@@ -7,14 +7,16 @@ export default class CustomHeaderLinks extends Component {
|
||||
}
|
||||
|
||||
get links() {
|
||||
return settings.custom_header_links.reduce((result, link) => {
|
||||
const linkText = link.text;
|
||||
const linkTitle = link.title;
|
||||
const linkHref = link.url;
|
||||
const target = link.target;
|
||||
const hideOnScroll = link.hide_on_scroll;
|
||||
const locale = link.locale;
|
||||
const device = link.view;
|
||||
return settings.custom_header_links.split("|").reduce((result, item) => {
|
||||
let [
|
||||
linkText,
|
||||
linkTitle,
|
||||
linkHref,
|
||||
device,
|
||||
target = "",
|
||||
keepOnScroll,
|
||||
locale,
|
||||
] = item.split(",").map((s) => s.trim());
|
||||
|
||||
if (!linkText || (locale && document.documentElement.lang !== locale)) {
|
||||
return result;
|
||||
@@ -30,8 +32,8 @@ export default class CustomHeaderLinks extends Component {
|
||||
|
||||
result.push({
|
||||
device: `headerLink--${device}`,
|
||||
hideOnScroll: `headerLink--${hideOnScroll}`,
|
||||
locale: locale ? `headerLink--${locale}` : null,
|
||||
keepOnScroll: `headerLink--${keepOnScroll}`,
|
||||
locale: `headerLink--${locale}`,
|
||||
linkClass,
|
||||
anchorAttributes,
|
||||
linkText,
|
||||
|
||||
Reference in New Issue
Block a user