Skip to content

Commit

Permalink
Force reload on all themes links
Browse files Browse the repository at this point in the history
  • Loading branch information
avoinea committed Jan 25, 2021
1 parent 0d97a48 commit b63e90f
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 7 deletions.
59 changes: 55 additions & 4 deletions src/customizations/components/theme/Footer/Footer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ import EUflag from '../../../../../theme/site/assets/images/europe-flag.svg';
* @returns {string} Markup of the component
*/
class Footer extends Component {
onLinkClick(evt, url) {
evt.preventDefault();
window.location = url;
}

render() {
return (
<Segment className="footer-wrapper">
Expand Down Expand Up @@ -244,18 +249,40 @@ class Footer extends Component {
</span>
</div>
<div className="mx-2">
<a href="https://www.eea.europa.eu/contact-us">
<a
href="https://www.eea.europa.eu/contact-us"
onClick={(evt) =>
this.onLinkClick(
evt,
'https://www.eea.europa.eu/contact-us',
)
}
>
<Icon name="comment" />
</a>
<span>
<a
href="https://www.eea.europa.eu/contact-us"
className="block"
onClick={(evt) =>
this.onLinkClick(
evt,
'https://www.eea.europa.eu/contact-us',
)
}
>
Ask your question
</a>
<br />
<a href="https://www.eea.europa.eu/media/">
<a
href="https://www.eea.europa.eu/media/"
onClick={(evt) =>
this.onLinkClick(
evt,
'https://www.eea.europa.eu/media/',
)
}
>
Media enquiries
</a>
</span>
Expand Down Expand Up @@ -293,7 +320,15 @@ class Footer extends Component {
<p className="colophon-links">
<Icon name="database" />
Engineered by:&nbsp;
<a href="https://www.eea.europa.eu/help/contact-info">
<a
href="https://www.eea.europa.eu/help/contact-info"
onClick={(evt) =>
this.onLinkClick(
evt,
'https://www.eea.europa.eu/help/contact-info',
)
}
>
EEA Web Team
</a>
</p>
Expand All @@ -313,6 +348,9 @@ class Footer extends Component {
<p className="colophon-links">
<a
href="https://www.eea.europa.eu/code"
onClick={(evt) =>
this.onLinkClick(evt, 'https://www.eea.europa.eu/code')
}
title="Code for developers"
>
Code for developers
Expand All @@ -326,7 +364,14 @@ class Footer extends Component {
</p>

<p className="colophon-links">
<a href="https://www.eea.europa.eu/legal/">Legal notice</a>
<a
href="https://www.eea.europa.eu/legal/"
onClick={(evt) =>
this.onLinkClick(evt, 'https://www.eea.europa.eu/legal/')
}
>
Legal notice
</a>
</p>

<p className="colophon-links">
Expand All @@ -343,6 +388,12 @@ class Footer extends Component {
<p className="colophon-links">
<a
href="https://www.eea.europa.eu/login_form"
onClick={(evt) =>
this.onLinkClick(
evt,
'https://www.eea.europa.eu/login_form',
)
}
title="Log in to CMS"
>
<strong>CMS login</strong>
Expand Down
7 changes: 6 additions & 1 deletion src/customizations/components/theme/Logo/Logo.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,16 @@ const messages = defineMessages({
const Logo = () => {
const lang = useSelector((state) => state.intl.locale);
const intl = useIntl();
const url = settings.isMultilingual ? `/${lang}` : '/';

return (
<Link
to={settings.isMultilingual ? `/${lang}` : '/'}
to={url}
title={intl.formatMessage(messages.site)}
onClick={(evt) => {
evt.preventDefault();
window.location = url;
}}
>
<Image
src={LogoImage}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
Icon,
Input,
List,
Popup
Popup,
} from 'semantic-ui-react';

const messages = defineMessages({
Expand Down Expand Up @@ -58,6 +58,7 @@ class SearchWidget extends Component {
this.onChangeText = this.onChangeText.bind(this);
this.onChangeSection = this.onChangeSection.bind(this);
this.onGoToSearchPage = this.onGoToSearchPage.bind(this);
this.onLinkClick = this.onLinkClick.bind(this);
this.state = {
text: '',
section: false,
Expand All @@ -66,6 +67,17 @@ class SearchWidget extends Component {
};
}

/**
* Click an internal link
* @method onLinkClick
* @returns {undefined}
*/
onLinkClick(evt, url) {
evt.preventDefault();
this.closeMobileMenu();
window.location = url;
}

/**
* On change text
* @method onChangeText
Expand Down Expand Up @@ -168,6 +180,12 @@ class SearchWidget extends Component {
<a
className="pull-right"
href="https://www.eea.europa.eu/help/glossary"
onClick={(evt) =>
this.onLinkClick(
evt,
'https://www.eea.europa.eu/help/glossary',
)
}
>
A-Z Glossary
</a>
Expand Down
1 change: 0 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ const applyConfig = (config) => {
config.settings.allowed_cors_destinations = [
...(config.settings.allowed_cors_destinations || []),
'www.eea.europa.eu',
'www.eea.europa.eu/eea-custom-search.tags',
];

return config;
Expand Down

0 comments on commit b63e90f

Please sign in to comment.