Skip to content

Commit 93ab626

Browse files
committed
1.6.0
1 parent 46223c7 commit 93ab626

File tree

10 files changed

+208
-75
lines changed

10 files changed

+208
-75
lines changed

config/env/Settings.Dev.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import { EnvSettings } from "./EnvSettings";
22

33
export class Settings_Dev extends EnvSettings {
44
ENTRYSCAPE_DATASETS_PATH="admin.dataportal.se"
5+
// ENTRYSCAPE_DATASETS_PATH="sandbox.admin.dataportal.se"
6+
57
ENTRYSCAPE_SPECS_PATH="editera.dataportal.se"
68
ENTRYSCAPE_TERMS_PATH="editera.dataportal.se"
79
ENTRYSCAPE_ORG_STATS_URL="https://admin.dataportal.se/charts/orgData.json"

server/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ var csp_headers = {
121121
],
122122
'frame-ancestors': ['https://dev.digg.se','https://digg.se','https://www.digg.se'],
123123
'connect-src': ['*'],
124+
'frame-src' : ["'self'", "https://www.youtube.com/"]
124125
};
125126
app.use('/', function(req, res, done) {
126127
csp.header(csp_headers, res);

src/components/Breadcrumb/Breadcrumb.tsx

Lines changed: 69 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -7,85 +7,97 @@ import { useQuery } from '@apollo/client';
77
import { gql } from 'apollo-boost';
88
import { Link } from 'react-router-dom';
99
let moment = require('moment');
10+
import Truncate from 'react-truncate';
1011

11-
export interface BreadcrumbProps{
12-
connectedtagpath:string;
13-
env: EnvSettings;
12+
export interface BreadcrumbProps {
13+
connectedtagpath: string;
14+
env: EnvSettings;
1415
}
1516
const hasWindow = typeof window !== 'undefined';
1617

1718
const breadcrumbQuery = gql`
1819
query breadcrumbs($siteurl: String!, $paths: [String], $lang: String) {
19-
tags(siteurl:$siteurl,connectedtagpathsor:$paths, lang: $lang)
20-
{
21-
connectedTagPath
20+
tags(siteurl: $siteurl, connectedtagpathsor: $paths, lang: $lang) {
21+
connectedTagPath
2222
title
2323
}
2424
}
2525
`;
2626

27-
export const Breadcrumb : React.FC<BreadcrumbProps> = (props) => {
27+
export const Breadcrumb: React.FC<BreadcrumbProps> = (props) => {
2828
moment.locale(i18n.languages[0]);
2929

30-
let connectedtagpath = '';
30+
let connectedtagpath = '';
3131

32-
if(props.connectedtagpath){
32+
if (props.connectedtagpath) {
3333
connectedtagpath = props.connectedtagpath;
3434
}
35-
36-
let pathsplitted :string[] = connectedtagpath ? connectedtagpath.split('/') : [];
37-
pathsplitted = pathsplitted.filter(function (x) { return x != ""; });
35+
36+
let pathsplitted: string[] = connectedtagpath
37+
? connectedtagpath.split('/')
38+
: [];
39+
pathsplitted = pathsplitted.filter(function (x) {
40+
return x != '';
41+
});
3842
var copy = [...pathsplitted];
39-
let path: string[] = []
43+
let path: string[] = [];
4044

41-
pathsplitted.forEach(element => {
42-
path.push(`/${copy.join('/')}/`)
45+
pathsplitted.forEach((element) => {
46+
path.push(`/${copy.join('/')}/`);
4347
copy.pop();
44-
});
48+
});
4549

46-
const {loading, error, data } =
47-
useQuery<{ tags: Array<any> }>(breadcrumbQuery,{
48-
variables:{
50+
const { loading, error, data } = useQuery<{ tags: Array<any> }>(
51+
breadcrumbQuery,
52+
{
53+
variables: {
4954
paths: path,
50-
lang: i18n.languages[0] ?? "sv",
51-
siteurl: props.env.CONTENTBACKEND_SITEURL
52-
}
53-
});
55+
lang: i18n.languages[0] ?? 'sv',
56+
siteurl: props.env.CONTENTBACKEND_SITEURL,
57+
},
58+
}
59+
);
60+
61+
const breadcrumb =
62+
!loading && data && data.tags
63+
? //sort the paths by most number of "/"
64+
data.tags.sort((a, b) => {
65+
let aNum = (a.connectedTagPath.match(/\//g) || []).length;
66+
let bNum = (b.connectedTagPath.match(/\//g) || []).length;
5467

55-
const breadcrumb = !loading && data && data.tags?
56-
//sort the paths by most number of "/"
57-
data.tags.sort((a,b) => {
58-
let aNum = (a.connectedTagPath.match(/\//g) || []).length;
59-
let bNum = (b.connectedTagPath.match(/\//g) || []).length;
68+
if (aNum > bNum) return 1;
69+
if (aNum < bNum) return -1;
70+
return 0;
71+
})
72+
: [];
6073

61-
if(aNum > bNum) return 1;
62-
if(aNum < bNum) return -1;
63-
return 0;
64-
})
65-
:
66-
[];
67-
68-
return(
69-
<div className="breadcrumb text-7">
70-
{loading && (
71-
<ul className="breadcrumb__list">
72-
<li className="breadcrumb__list--item"></li>
73-
</ul>
74-
)}
75-
{!loading && data && data!.tags && (
76-
<ul className="breadcrumb__list">
77-
<li className="breadcrumb__list--item text-7">
78-
<Link to={`/${i18n.languages[0]}`}>{i18n.t('common|home-text')}</Link>
79-
</li>
80-
{data!.tags.map((n, index) => {
81-
return (
82-
<li className="breadcrumb__list--item text-7">
83-
<Link to={`/${i18n.languages[0]}${n.connectedTagPath}`}>{n.title}</Link>
84-
</li>
85-
);
86-
})}
87-
</ul>
88-
)}
89-
</div>
74+
return (
75+
<div className="breadcrumb text-7">
76+
{loading && (
77+
<ul className="breadcrumb__list">
78+
<li className="breadcrumb__list--item"></li>
79+
</ul>
80+
)}
81+
{!loading && data && data!.tags && (
82+
<ul className="breadcrumb__list">
83+
<li className="breadcrumb__list--item text-7">
84+
<Link to={`/${i18n.languages[0]}`}>
85+
{i18n.t('common|home-text')}
86+
</Link>
87+
</li>
88+
{data!.tags.map((n, index) => {
89+
return (
90+
<li className="breadcrumb__list--item text-7">
91+
{/* <Truncate lines={1}> */}
92+
<Link to={`/${i18n.languages[0]}${n.connectedTagPath}`}>
93+
{n.title}
94+
</Link>
95+
{/* </Truncate> */}
96+
</li>
97+
);
98+
})}
99+
</ul>
100+
)}
101+
</div>
90102
);
91103
};

src/components/Search/EntryScape.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,8 @@ export class EntryScape {
287287

288288
values['inScheme_resource'] = metadata.find(null, "http://www.w3.org/2004/02/skos/core#inScheme").map((f:any) => {return f.getValue()} );
289289

290+
values['modified'] = metadata.find(null, "http://purl.org/dc/terms/modified").map((f:any) => {return f.getValue()} );
291+
290292
//theme needs to be translated
291293
//if(values['theme_literal'])
292294
//values['theme_literal'] = i18next.t('facetvalues|'+values['theme_literal']);
@@ -430,7 +432,7 @@ export class EntryScape {
430432
esQuery.sort('modified+asc');
431433
break;
432434
case SearchSortOrder.modified_desc:
433-
esQuery.sort('modified+desc');
435+
esQuery.sort('metadata.predicate.literal_s.3e2f60da+desc');
434436
break;
435437
case SearchSortOrder.score_desc:
436438
esQuery.sort('score+desc');
@@ -543,7 +545,7 @@ export class EntryScape {
543545

544546

545547
};
546-
548+
547549

548550
if(hitSpecification.pathResolver)
549551
hit.url = hitSpecification.pathResolver(child);

src/pages/DetailPages/DataServicePage.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,9 @@ export class DataServicePage extends React.Component<
143143
run: function(node, data, items, entry) {
144144
var v = entry.getMetadata().findFirstValue(null, 'dcterms:license');
145145
if (v.indexOf("http://creativecommons.org/") === 0) {
146+
146147
var variant;
148+
147149
if (v === "http://creativecommons.org/publicdomain/zero/1.0/") {
148150
variant = "Creative Commons";
149151
} else if (v.indexOf("http://creativecommons.org/licenses/") === 0) {

src/pages/DetailPages/DataSetPage.tsx

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,13 @@ export class DataSetPage extends React.Component<
292292
}
293293
},
294294
},
295+
{
296+
block: 'costIndicator2',
297+
extends: 'template',
298+
template: '{{#ifprop "schema:offers"}}<span class="esbIndicator" title="Avgift"><i class="fas fa-coins"></i>' +
299+
'<span class="esbIndicatorLabel">Avgift</span></span>{{/ifprop}}',
300+
},
301+
295302
{
296303
block: 'distributionList2',
297304
extends: 'list',
@@ -375,15 +382,18 @@ export class DataSetPage extends React.Component<
375382
robotsIndex={true}
376383
lang={i18n.languages[0]}
377384
socialMeta={{
378-
socialDescription : entry.description,
379-
socialTitle : entry.title,
380-
socialUrl : entry && entry.title
381-
? `${this.props.env.CANONICAL_URL}/${
382-
i18n.languages[0]
383-
}/${i18n.t('routes|datasets|path')}/${
384-
this.props.match.params.cid
385-
}_${this.props.match.params.eid}/${slugify(entry.title)}`
386-
: ''
385+
socialDescription: entry.description,
386+
socialTitle: entry.title,
387+
socialUrl:
388+
entry && entry.title
389+
? `${this.props.env.CANONICAL_URL}/${
390+
i18n.languages[0]
391+
}/${i18n.t('routes|datasets|path')}/${
392+
this.props.match.params.cid
393+
}_${this.props.match.params.eid}/${slugify(
394+
entry.title
395+
)}`
396+
: '',
387397
}}
388398
canonicalUrl={
389399
entry && entry.title
@@ -433,8 +443,8 @@ export class DataSetPage extends React.Component<
433443
{/* Left column */}
434444
{/* Left column */}
435445
<div className="detailpage__wrapper--leftcol">
436-
{/* Title */}
437-
<h1 className="text-2">{entry.title}</h1>
446+
{/* Title */}
447+
<h1 className="text-2">{entry.title}</h1>
438448
{/* Publisher */}
439449
<script
440450
type="text/x-entryscape-handlebar"
@@ -463,6 +473,11 @@ export class DataSetPage extends React.Component<
463473
data-entryscape="licenseIndicator2"
464474
className="licenseIndicator"
465475
></div>
476+
477+
<div
478+
data-entryscape="costIndicator2"
479+
className="costIndicator"
480+
></div>
466481
</div>
467482

468483
<div className="description">

src/pages/DetailPages/SpecificationPage.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,7 @@ export class SpecificationPage extends React.Component<
303303
<div
304304
className="specification__resource"
305305
data-entryscape="resourceDescriptors2"
306+
data-entryscape-rdftype= "prof:ResourceDescriptor"
306307
></div>
307308

308309
<div className="contact__publisher hbbr">

src/scss/Breadcrumb/breadcrumb.scss

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,21 @@
4141
a {
4242
text-decoration: none;
4343
cursor: default;
44+
margin-right: 0;
4445

4546
&:focus {
4647
outline: none !important;
4748
}
49+
50+
display: block;
51+
max-width: 52vmin;
52+
white-space: nowrap;
53+
overflow: hidden;
54+
text-overflow: ellipsis;
55+
56+
@media screen and (max-width: 550px) {
57+
max-width: 38vmin;
58+
}
4859
}
4960
}
5061

0 commit comments

Comments
 (0)