Skip to content

Commit

Permalink
Merge pull request #1682 from ClimateWatch-Vizzuality/fix-ndcp-embed-…
Browse files Browse the repository at this point in the history
…contained

Fix embed url generation for components embedded with the old contained method
  • Loading branch information
SARodrigues committed May 16, 2024
2 parents a01adf2 + c7f6ea9 commit c367301
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion app/javascript/app/components/modal-share/modal-share.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ const mapStateToProps = (state, { shouldEmbedQueryParams = true }) => {
const { isOpen: isModalOpen, sharePath } = state.modalShare;
const { origin, pathname, search, hash } = location;
const queryParams = shouldEmbedQueryParams ? search + hash : '';
const embedUri = `/embed${sharePath || pathname.replace('/embed', '')}`;
const embedUri = `/embed${sharePath ||
pathname.replace('/embed', '').replace('/contained', '')}`;
const url = `${origin}${embedUri}${encodeURIComponent(queryParams)}`;
const copyUrl = () => copy(url);
const iframeCode = `<iframe src="${url}" frameborder="0" style="height: 600px; width: 1230px"></iframe>`;
Expand Down
4 changes: 3 additions & 1 deletion app/javascript/app/layouts/embed/embed-component.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ import styles from './embed-styles.scss';
class Embed extends PureComponent {
render() {
const { route, location } = this.props;
const link = location.pathname.replace('/embed', '');
const link = location.pathname
.replace('/embed', '')
.replace('/contained', '');
const isNdcp = isPageNdcp(location);
return (
<div className={cx(styles.embed, { [styles.embedNdcp]: isNdcp })}>
Expand Down

0 comments on commit c367301

Please sign in to comment.