Skip to content

Commit

Permalink
Merge pull request #714 from eea/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
GhitaB authored Feb 20, 2025
2 parents 3d6d9ab + 41e40f3 commit e4f63c9
Show file tree
Hide file tree
Showing 6 changed files with 81 additions and 18 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ All notable changes to this project will be documented in this file. Dates are d

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

### [1.1.213](https://github.com/eea/volto-clms-theme/compare/1.1.212...1.1.213) - 20 February 2025

#### :bug: Bug Fixes

- fix: test [ana-oprea - [`223d5ad`](https://github.com/eea/volto-clms-theme/commit/223d5ad7b91c04c2db59b2541796c43771892247)]

#### :hammer_and_wrench: Others

- Refs #284562 - Show toolbar for Manager, Site Administrator, Editor, Reviewer, Contributor. Fix missing toolbar for editors. [GhitaB - [`d028514`](https://github.com/eea/volto-clms-theme/commit/d028514e10dcc027c685a97a72341cbf35669f40)]
### [1.1.212](https://github.com/eea/volto-clms-theme/compare/1.1.211...1.1.212) - 19 February 2025

#### :rocket: New Features
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eeacms/volto-clms-theme",
"version": "1.1.212",
"version": "1.1.213",
"description": "volto-clms-theme: Volto theme for CLMS site",
"main": "src/index.js",
"author": "CodeSyntax for the European Environment Agency",
Expand Down
18 changes: 16 additions & 2 deletions src/components/Blocks/CclFamiliesCardContainerBlock/FamilyCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,22 @@ const FamilyCard = (props) => {
href={hasLink ? url : null}
to={hasLink ? url : null}
className={'card-product-family'}
onClick={() => onClickImage()}
onKeyDown={() => onClickImage()}
onClick={() => {
onClickImage();
window.scrollTo({
top: 0,
left: 0,
behavior: 'smooth',
});
}}
onKeyDown={() => {
onClickImage();
window.scrollTo({
top: 0,
left: 0,
behavior: 'smooth',
});
}}
>
<div className="card-text">
<div className="card-product-familiy-title">{card?.title}</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import cx from 'classnames';
import { RenderBlocks } from '@plone/volto/components';
import { slugify } from '../../utils';
import './fontawesome';
import { connect } from 'react-redux';
import { connect, useSelector } from 'react-redux';
import { compose } from 'redux';
import { FormattedMessage } from 'react-intl';

import { withScrollToTarget } from '@eeacms/volto-tabs-block/hocs';

Expand Down Expand Up @@ -194,9 +195,46 @@ const TabsComponent = ({
};

const CclProductTabsWithSubtabsView = (props) => {
const locale = useSelector((state) => state.intl.locale);
const ExtraComponent = () => (
<div className="left-menu-detail">
<div className="menu-detail-image">
{props.metadata?.image ? (
<img
src={props.metadata?.image?.scales?.preview?.download}
alt={props.metadata?.title || 'Product map preview'}
/>
) : (
<img
src="https://eu-copernicus.github.io/copernicus-component-library/assets/images/image_placeholder.jpg"
alt="Product map preview"
style={{ opacity: 0.5 }}
/>
)}
</div>
{props.metadata?.show_in_mapviewer_link && (
<>
<div className="menu-detail-button">
<a
href={
'/' + locale + '/map-viewer?product=' + props.metadata['UID']
}
className="ccl-button ccl-button--default"
>
<FormattedMessage
id="View in the data viewer"
defaultMessage="View in the data viewer"
/>
</a>
</div>
</>
)}
</div>
);

return (
<div className="ccl-container ccl-container-flex tab-container">
<TabsComponent {...props} />
<TabsComponent {...props} ExtraComponent={ExtraComponent} />
</div>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,19 +144,10 @@ describe('CclProductTabsWithSubtabsView', () => {
expect(screen.queryByText('Subtab 1')).not.toBeInTheDocument();
});

it('renders ExtraComponent when provided', () => {
const ExtraComponent = () => (
<div data-testid="extra-component">Extra Content</div>
);

renderWithRouter(
<CclProductTabsWithSubtabsView
{...defaultProps}
ExtraComponent={ExtraComponent}
/>,
);
it('renders ExtraComponent', () => {
renderWithRouter(<CclProductTabsWithSubtabsView {...defaultProps} />);

expect(screen.getByTestId('extra-component')).toBeInTheDocument();
expect(screen.getByAltText('Product map preview')).toBeInTheDocument();
});

it('handles empty tabsList', () => {
Expand Down
13 changes: 12 additions & 1 deletion src/customizations/volto/components/manage/Toolbar/Toolbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,18 @@ class Toolbar extends Component {
});
const { expanded } = this.state;

if (this.props.roles && this.props.roles?.includes('Manager')) {
if (
this.props.roles &&
this.props.roles.some((role) =>
[
'Manager',
'Site Administrator',
'Editor',
'Reviewer',
'Contributor',
].includes(role),
)
) {
return (
this.props.token && (
<>
Expand Down

0 comments on commit e4f63c9

Please sign in to comment.