Skip to content
Snippets Groups Projects
Commit 409ccf04 authored by Mark Harding's avatar Mark Harding
Browse files

Merge branch 'feat/footer-links-1944' into 'master'

(feat): footer items should open in new tab if they link to outside domains

Closes #1944

See merge request !575
parents b27c8c2e 88fb7924
No related branches found
No related tags found
1 merge request!575(feat): footer items should open in new tab if they link to outside domains
......@@ -96,6 +96,7 @@ export interface MindsUser {
featured_content?: Array<string>;
tile_ratio?: string;
styles?: { [key: string]: string };
domain: string;
has_custom_logo?: boolean;
has_custom_background?: boolean;
};
......
......@@ -4,7 +4,7 @@
*ngFor="let link of footerLinks"
class="m-proChannelFooter__link"
[href]="link.href"
target="_blank"
[target]="getTarget(link)"
>
{{ link.title }}
</a>
......
......@@ -8,14 +8,7 @@ import {
socialProfileMeta,
} from '../../../channels/social-profiles/meta';
export interface SocialProfileMeta {
key: string;
label: string;
link: string;
icon: string;
customIcon?: boolean;
domain: string;
}
export type FooterLink = { title: string; href: string };
@Component({
selector: 'm-pro--channel-footer',
......@@ -33,7 +26,7 @@ export class ProChannelFooterComponent {
return socialProfileMeta;
}
get footerLinks() {
get footerLinks(): FooterLink[] {
return this.channelService.currentChannel.pro_settings.footer_links;
}
......@@ -45,30 +38,6 @@ export class ProChannelFooterComponent {
return this.channelService.currentChannel.social_profiles;
}
getSocialProfileURL(url: string) {
if (url.includes('http://') || url.includes('https://')) {
return url;
} else {
return 'http://' + url;
}
}
getSocialProfileIconClass({ key = '' }) {
let meta = getSocialProfileMeta(key),
domClass;
if (meta.customIcon) {
domClass = `m-custom-icon m-custom-icon-${meta.icon}`;
} else {
domClass = `fa fa-fw fa-${meta.icon}`;
}
return domClass;
}
logout() {
this.auth.logout();
}
onUserChange() {
this.channelService.onChannelChange.next(this.user);
}
......@@ -99,4 +68,36 @@ export class ProChannelFooterComponent {
get isProDomain() {
return this.site.isProDomain;
}
getSocialProfileURL(url: string) {
if (url.includes('http://') || url.includes('https://')) {
return url;
} else {
return 'http://' + url;
}
}
getSocialProfileIconClass({ key = '' }) {
let meta = getSocialProfileMeta(key),
domClass;
if (meta.customIcon) {
domClass = `m-custom-icon m-custom-icon-${meta.icon}`;
} else {
domClass = `fa fa-fw fa-${meta.icon}`;
}
return domClass;
}
logout() {
this.auth.logout();
}
getTarget(link: FooterLink) {
const domain = this.isProDomain
? this.user.pro_settings.domain
: window.Minds.site_url;
const regex = new RegExp(`/${domain}/`);
return regex.exec(link.href) ? '_self' : '_blank';
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment