Skip to content

Commit

Permalink
Merge pull request #24 from eea/develop
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
avoinea authored Apr 22, 2022
2 parents 448bfa5 + a1de24f commit cc5ac06
Show file tree
Hide file tree
Showing 12 changed files with 2,050 additions and 41 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,19 @@ 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).

#### [0.5.3](https://github.com/eea/volto-eea-website-theme/compare/0.5.2...0.5.3)

- Apply Draft bg only on View [`8910d78`](https://github.com/eea/volto-eea-website-theme/commit/8910d78baf0663d9eb820a3846ae24dea8eaa674)
- lint fixes [`ffc9edd`](https://github.com/eea/volto-eea-website-theme/commit/ffc9edd7dd90033d9ed8ccbe17c5327e68128b6f)
- change(buttons): customized Form, Sharing and ObjectBrowserWidget.jsx [`c307131`](https://github.com/eea/volto-eea-website-theme/commit/c307131f911dc05c2a9ef7d9c79357cd85de0fc4)
- change(ModalForm): added circular class to modal action buttons [`c418021`](https://github.com/eea/volto-eea-website-theme/commit/c418021da30aee28113edecea53ebd9d2316dfcd)
- Improved Title block banner + add social icons [`eeb049b`](https://github.com/eea/volto-eea-website-theme/commit/eeb049bb02146a48949b8ff5f5d09727e99fe192)

#### [0.5.2](https://github.com/eea/volto-eea-website-theme/compare/0.5.1...0.5.2)

> 8 April 2022
- Release [`#22`](https://github.com/eea/volto-eea-website-theme/pull/22)
- fix(banner): Friendly name for content-type if not available via RestAPI [`e9ea96f`](https://github.com/eea/volto-eea-website-theme/commit/e9ea96f3d74998e9d4e5ee9494183cdd40500666)
- Small fix on replace all [`98fe72e`](https://github.com/eea/volto-eea-website-theme/commit/98fe72e4493aa322b704da1ddff91ee5021b66ce)
- Make '@type' friendly in Page header [`9d15a78`](https://github.com/eea/volto-eea-website-theme/commit/9d15a78d445482ffe58b14839a2176b82c55bf71)
Expand Down
4 changes: 2 additions & 2 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,10 @@ pipeline {
unstash "xunit-reports"
unstash "cypress-coverage"
def scannerHome = tool 'SonarQubeScanner';
def nodeJS = tool 'NodeJS11';
def nodeJS = tool 'NodeJS';
withSonarQubeEnv('Sonarqube') {
sh '''sed -i "s#/opt/frontend/my-volto-project/src/addons/${GIT_NAME}/##g" xunit-reports/coverage/lcov.info'''
sh "export PATH=$PATH:${scannerHome}/bin:${nodeJS}/bin; sonar-scanner -Dsonar.javascript.lcov.reportPaths=./xunit-reports/coverage/lcov.info,./cypress-coverage/coverage/lcov.info -Dsonar.sources=./src -Dsonar.projectKey=$GIT_NAME-$BRANCH_NAME -Dsonar.projectVersion=$BRANCH_NAME-$BUILD_NUMBER"
sh "export PATH=${scannerHome}/bin:${nodeJS}/bin:$PATH; sonar-scanner -Dsonar.javascript.lcov.reportPaths=./xunit-reports/coverage/lcov.info,./cypress-coverage/coverage/lcov.info -Dsonar.sources=./src -Dsonar.projectKey=$GIT_NAME-$BRANCH_NAME -Dsonar.projectVersion=$BRANCH_NAME-$BUILD_NUMBER"
sh '''try=2; while [ \$try -gt 0 ]; do curl -s -XPOST -u "${SONAR_AUTH_TOKEN}:" "${SONAR_HOST_URL}api/project_tags/set?project=${GIT_NAME}-${BRANCH_NAME}&tags=${SONARQUBE_TAGS},${BRANCH_NAME}" > set_tags_result; if [ \$(grep -ic error set_tags_result ) -eq 0 ]; then try=0; else cat set_tags_result; echo "... Will retry"; sleep 60; try=\$(( \$try - 1 )); fi; done'''
}
}
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-eea-website-theme",
"version": "0.5.2",
"version": "0.5.3",
"description": "@eeacms/volto-eea-website-theme: Volto add-on",
"main": "src/index.js",
"author": "European Environment Agency: IDM2 A-Team",
Expand Down
5 changes: 2 additions & 3 deletions src/components/manage/Blocks/Title/Edit.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,18 @@ export const TitleBlockEdit = (props) => {
onFocusNextBlock,
block,
blockNode,
properties,
metadata,
data,
detached,
editable,
} = props;
const metadata = props.metadata || props.properties;

const editor = useMemo(() => withReact(createEditor()), []);
const intl = useIntl();

const disableNewBlocks = data.disableNewBlocks || detached;

const text = metadata?.['title'] || properties?.['title'] || '';
const text = metadata?.['title'] || '';

const handleChange = useCallback(
(value) => {
Expand Down
12 changes: 6 additions & 6 deletions src/components/manage/Blocks/Title/schema.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const metadataSchema = {
title: 'Metadata',
const infoSchema = {
title: 'Info',
fieldsets: [
{
id: 'default',
Expand Down Expand Up @@ -27,7 +27,7 @@ export default {
'hideCreationDate',
'hidePublishingDate',
'hideModificationDate',
'metadata',
'info',
],
},
{
Expand Down Expand Up @@ -66,10 +66,10 @@ export default {
title: 'Hide download button',
type: 'boolean',
},
metadata: {
title: 'Extra metadata',
info: {
title: 'Extra info',
widget: 'object_list',
schema: metadataSchema,
schema: infoSchema,
},
// contentType: {
// title: 'Type',
Expand Down
3 changes: 3 additions & 0 deletions src/components/theme/Banner/Banner.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ const socialPlatforms = {
shareLink: (url) =>
`https://www.linkedin.com/sharing/share-offsite/?url=${url}`,
},
reddit: {
shareLink: (url, title) => `https://reddit.com/submit?url=${url}`,
},
};

export const getImageSource = (image) => {
Expand Down
52 changes: 24 additions & 28 deletions src/components/theme/Banner/View.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,10 @@ const Title = ({ config = {}, properties }) => {
};

const View = (props) => {
const { banner = {}, moment, fluid, intl, location, types = [] } = props;
const metadata = props.metadata || props.properties;
const {
banner = {},
properties,
moment,
fluid,
intl,
location,
types = [],
} = props;
const {
metadata = [],
info = [],
hideContentType,
hideCreationDate,
hidePublishingDate,
Expand All @@ -101,11 +94,9 @@ const View = (props) => {
// Set dates
const getDate = useCallback(
(hidden, key) => {
return !hidden && properties[key]
? moment.default(properties[key])
: null;
return !hidden && metadata[key] ? moment.default(metadata[key]) : null;
},
[moment, properties],
[moment, metadata],
);
const creationDate = useMemo(() => getDate(hideCreationDate, 'created'), [
getDate,
Expand All @@ -120,20 +111,20 @@ const View = (props) => {
[getDate, hideModificationDate],
);
// Set image source
const image = getImageSource(properties['image']);
const image = getImageSource(metadata['image']);
// Get type
const type = useMemo(() => {
return (
types.filter(
(type) =>
flattenToAppURL(type['@id']) ===
`/@types/${properties['@type'] || parameters.type}`,
`/@types/${metadata['@type'] || parameters.type}`,
)[0]?.title ||
friendlyId(properties['@type']) ||
properties['@type'] ||
friendlyId(metadata['@type']) ||
metadata['@type'] ||
parameters.type
);
}, [types, properties, parameters]);
}, [types, metadata, parameters]);

return (
<Banner {...props}>
Expand All @@ -155,25 +146,30 @@ const View = (props) => {
<div className="actions">
<Banner.Action
icon="ri-facebook-fill"
color="blue"
onClick={() => {
sharePage(properties['@id'], 'facebook');
sharePage(metadata['@id'], 'facebook');
}}
/>
<Banner.Action
icon="ri-twitter-fill"
color="blue"
onClick={() => {
sharePage(properties['@id'], 'twitter');
sharePage(metadata['@id'], 'twitter');
}}
/>
<Banner.Action
icon="ri-linkedin-fill"
color="blue"
onClick={() => {
sharePage(properties['@id'], 'linkedin');
sharePage(metadata['@id'], 'linkedin');
}}
/>
<Banner.Action icon="blogger b" />
<Banner.Action
icon="ri-reddit-line"
onClick={() => {
sharePage(metadata['@id'], 'reddit');
}}
/>
<Banner.Action icon="stumbleupon circle" />
</div>
</>
)}
Expand Down Expand Up @@ -202,7 +198,7 @@ const View = (props) => {
</>
}
>
<Title config={banner.title} properties={properties} />
<Title config={banner.title} properties={metadata} />
<Banner.Metadata>
<Banner.MetadataField
type="type"
Expand All @@ -228,9 +224,9 @@ const View = (props) => {
value={modificationDate}
title={`${intl.formatMessage(messages.modified_on)} {}`}
/>
{metadata.map((item, index) => (
{info.map((item, index) => (
<Banner.MetadataField
key={`header-metadata-${index}`}
key={`header-info-${index}`}
value={item.description}
/>
))}
Expand Down
2 changes: 1 addition & 1 deletion src/components/theme/DraftBackground/draft.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
body:not(.wf-state-published) {
body.view-viewview:not(.wf-state-published) {
background-image: url('draft.png') !important;
}
Loading

0 comments on commit cc5ac06

Please sign in to comment.