diff --git a/package-lock.json b/package-lock.json index bdcc0842..96a92da4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1292,7 +1292,7 @@ "resolved": "https://registry.npmjs.org/boom/-/boom-4.3.1.tgz", "integrity": "sha1-T4owBctKfjiJ90kDD9JbluAdLjE=", "requires": { - "hoek": "4.2.0" + "hoek": "4.2.1" } }, "bootstrap": { @@ -1724,9 +1724,9 @@ "dev": true }, "combined-stream": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.5.tgz", - "integrity": "sha1-k4NwpXtKUd6ix3wV1cX9+JUWQAk=", + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz", + "integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=", "requires": { "delayed-stream": "1.0.0" } @@ -2025,9 +2025,9 @@ "boom": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/boom/-/boom-5.2.0.tgz", - "integrity": "sha1-XdnabuOl8wIHdDYpDLcX0/SlTgI=", + "integrity": "sha512-Z5BTk6ZRe4tXXQlkqftmsAUANpXmuwlsF5Oov8ThoMbQRzdGTA1ngYRW160GexgOgjsFOKJz0LYhoNi+2AMBUw==", "requires": { - "hoek": "4.2.0" + "hoek": "4.2.1" } } } @@ -2646,7 +2646,7 @@ "resolved": "https://registry.npmjs.org/esri2geo/-/esri2geo-0.1.4.tgz", "integrity": "sha1-31d6VZfQUwTa4RDepxCWQVeaa80=", "requires": { - "request": "2.83.0" + "request": "2.85.0" } }, "estraverse": { @@ -3087,12 +3087,12 @@ "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" }, "form-data": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.1.tgz", - "integrity": "sha1-b7lPvXGIUwbXPRXMSX/kzE7NRL8=", + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.2.tgz", + "integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=", "requires": { "asynckit": "0.4.0", - "combined-stream": "1.0.5", + "combined-stream": "1.0.6", "mime-types": "2.1.17" } }, @@ -4434,11 +4434,11 @@ "hawk": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/hawk/-/hawk-6.0.2.tgz", - "integrity": "sha1-r02RTrBl+bXOTZ0RwcshJu7MMDg=", + "integrity": "sha512-miowhl2+U7Qle4vdLqDdPt9m09K6yZhkLDTWGoUiUzrQCn+mHHSmfJgAyGaLRZbPmTqfFFjRV1QWCW0VWUJBbQ==", "requires": { "boom": "4.3.1", "cryptiles": "3.1.2", - "hoek": "4.2.0", + "hoek": "4.2.1", "sntp": "2.1.0" } }, @@ -4454,9 +4454,9 @@ } }, "hoek": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/hoek/-/hoek-4.2.0.tgz", - "integrity": "sha1-ctnQdU9/4lyi0BrY+PmpRJqJUm0=" + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/hoek/-/hoek-4.2.1.tgz", + "integrity": "sha512-QLg82fGkfnJ/4iy1xZ81/9SIJiq1NGFUMGs6ParyjBZr6jW2Ufj/snDqTHixNlHdPNwN2RLVD0Pi3igeK9+JfA==" }, "home-or-tmp": { "version": "2.0.0", @@ -4572,7 +4572,7 @@ "requires": { "assert-plus": "1.0.0", "jsprim": "1.4.1", - "sshpk": "1.13.1" + "sshpk": "1.14.1" } }, "https-browserify": { @@ -5096,16 +5096,16 @@ } }, "knreise-api": { - "version": "2.0.7", - "resolved": "https://registry.npmjs.org/knreise-api/-/knreise-api-2.0.7.tgz", - "integrity": "sha1-KAv7Na2th47Ogi+YwBrGJrBX+J8=", + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/knreise-api/-/knreise-api-2.0.8.tgz", + "integrity": "sha512-9IPA/NX1500bPUNCOEITomlDOr6SkbC2hr4weEEWeWca1X4hWEWN0cMv3Ik5x+ldpRJmTisbcV736Nxh/NDQ8Q==", "requires": { "@mapbox/togeojson": "0.16.0", "crypto-js": "3.1.8", "csvtojson": "1.1.9", "esri2geo": "0.1.4", "jquery": "2.2.4", - "request": "2.83.0", + "request": "2.85.0", "x2js": "2.0.1" } }, @@ -10698,8 +10698,8 @@ }, "qs": { "version": "6.5.1", - "resolved": "https://norkart2.pkgs.visualstudio.com/_packaging/norkart_npm/npm/registry/qs/-/qs-6.5.1.tgz", - "integrity": "sha1-NJzfbu+J7EXBLX1es/wMhwNDptg=" + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz", + "integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A==" }, "query-string": { "version": "4.3.4", @@ -11103,17 +11103,17 @@ } }, "request": { - "version": "2.83.0", - "resolved": "https://registry.npmjs.org/request/-/request-2.83.0.tgz", - "integrity": "sha1-ygtl2gLtYpNYh4COb1EDgQNOM1Y=", + "version": "2.85.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.85.0.tgz", + "integrity": "sha512-8H7Ehijd4js+s6wuVPLjwORxD4zeuyjYugprdOXlPSqaApmL/QOy+EB/beICHVCHkGMKNh5rvihb5ov+IDw4mg==", "requires": { "aws-sign2": "0.7.0", "aws4": "1.6.0", "caseless": "0.12.0", - "combined-stream": "1.0.5", + "combined-stream": "1.0.6", "extend": "3.0.1", "forever-agent": "0.6.1", - "form-data": "2.3.1", + "form-data": "2.3.2", "har-validator": "5.0.3", "hawk": "6.0.2", "http-signature": "1.2.0", @@ -11126,15 +11126,15 @@ "qs": "6.5.1", "safe-buffer": "5.1.1", "stringstream": "0.0.5", - "tough-cookie": "2.3.3", + "tough-cookie": "2.3.4", "tunnel-agent": "0.6.0", - "uuid": "3.1.0" + "uuid": "3.2.1" }, "dependencies": { "uuid": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.1.0.tgz", - "integrity": "sha1-PdPT55Crwk17DToDT/q6vijrvAQ=" + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.2.1.tgz", + "integrity": "sha512-jZnMwlb9Iku/O3smGWvZhauCf6cvvpKi4BKRiliS3cxnI+Gz9j5MEpTz2UFuXiKPJocb7gnsLHwiS05ige5BEA==" } } }, @@ -11436,9 +11436,9 @@ "sntp": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/sntp/-/sntp-2.1.0.tgz", - "integrity": "sha1-LGzsFP7cIiJznK+bXD2F0cxaLMg=", + "integrity": "sha512-FL1b58BDrqS3A11lJ0zEdnJ3UOKqVxawAkF3k7F0CVN7VQ34aZrV+G8BZ1WC9ZL7NyrwsW0oviwsWDgRuVYtJg==", "requires": { - "hoek": "4.2.0" + "hoek": "4.2.1" } }, "sockjs": { @@ -11595,9 +11595,9 @@ "dev": true }, "sshpk": { - "version": "1.13.1", - "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.13.1.tgz", - "integrity": "sha1-US322mKHFEMW3EwY/hzx2UBzm+M=", + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.14.1.tgz", + "integrity": "sha1-Ew9Zde3a2WPx1W+SuaxsUfqfg+s=", "requires": { "asn1": "0.2.3", "assert-plus": "1.0.0", @@ -11920,9 +11920,9 @@ "dev": true }, "tough-cookie": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.3.tgz", - "integrity": "sha1-C2GKVWW23qkL80JdBNVe3EdadWE=", + "version": "2.3.4", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.4.tgz", + "integrity": "sha512-TZ6TTfI5NtZnuyy/Kecv+CnoROnyXn2DN97LontgQpCwsX2XyLYCC0ENhYkehSOwAp8rTQKc/NUIF7BkQ5rKLA==", "requires": { "punycode": "1.4.1" } diff --git a/package.json b/package.json index ff897e2d..eaebd40e 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "font-awesome": "^4.7.0", "install": "^0.10.2", "jquery": "^2.1.4", - "knreise-api": "^2.0.7", + "knreise-api": "^2.0.8", "leaflet": "^0.7.7", "leaflet-draw": "^0.4.13", "leaflet-easybutton": "^1.1.2", diff --git a/src/components/sidebar/SidebarContent.js b/src/components/sidebar/SidebarContent.js index d61bb51d..b86c07df 100644 --- a/src/components/sidebar/SidebarContent.js +++ b/src/components/sidebar/SidebarContent.js @@ -5,6 +5,16 @@ import {getImageCache, isInIframe} from '../../util'; import PositionDisplayer from './PositionDisplayer'; import MediaCarousel from './MediaCarousel'; +window.shorten = function (str, maxLen) { + if (!str) { + return str; + } + if (str.length <= maxLen) { + return str; + } + return str.substr(0, str.lastIndexOf(' ', maxLen)) + '…'; +}; + /* Handles display of content in a sidebar */ @@ -132,7 +142,7 @@ export default function SidebarContent(wrapper, element, top, options) { } function showFeature2(feature, callbacks, index, numFeatures) { - console.log(feature); + var getItem = feature.dataset.getItem; if (getItem) { var content = ''; @@ -179,7 +189,9 @@ export default function SidebarContent(wrapper, element, top, options) { var properties = _.clone(feature.properties); properties.provider = provider; - content += template(_.extend({image: null}, properties)); + var templateData = _.extend({image: null}, properties); + templateData.data = templateData; + content += template(templateData); if (options.footerTemplate && properties.link) { content += options.footerTemplate(properties); diff --git a/src/templates/templates/datasets/enkeltminne.tmpl b/src/templates/templates/datasets/enkeltminne.tmpl index 9a6e12b7..b949de4e 100644 --- a/src/templates/templates/datasets/enkeltminne.tmpl +++ b/src/templates/templates/datasets/enkeltminne.tmpl @@ -1,22 +1,20 @@ -<% if(!_.isUndefined(arguments[0].Navn)) { %> -

<%= Navn %>

+<% if(!_.isUndefined(data.Navn)) { %> +

<%= data.Navn %>

<% } else { %> -

<%= Enkeltminneart %>

+

Uten navn

<% } %>
- <% if(!_.isUndefined(arguments[0].Kulturminnesok)) { %>
Beskrivelse
-
<%= Kulturminnesok %>
- <% } %> +
<%= shorten(data.Beskrivelse, 300) || '--' %>
Enkeltminne-kategori
<%= Enkeltminnekategori %>
Enkeltminne-art
<%= Enkeltminneart %>
Datering
-
<%= Datering %>
+
<%= data.Datering || '--' %>
Vernestatus
<%= Vernetype %>
diff --git a/src/templates/templates/datasets/kulturmiljo.tmpl b/src/templates/templates/datasets/kulturmiljo.tmpl index 8617389e..4eff90a8 100644 --- a/src/templates/templates/datasets/kulturmiljo.tmpl +++ b/src/templates/templates/datasets/kulturmiljo.tmpl @@ -1,22 +1,19 @@ -<% if(!_.isUndefined(arguments[0].Navn)) { %> -

<%= Navn %>

+<% if(!_.isUndefined(data.Navn)) { %> +

<%= data.Navn %>

<% } else { %>

Uten navn

<% } %>
- <% if(!_.isUndefined(arguments[0].Kulturminnesok)) { %>
Beskrivelse
-
<%= Kulturminnesok %>
- <% } %> +
<%= shorten(data.Beskrivelse, 300) || shorten(data.Beskrivelse2, 300) || '--' %>
Kategori
<%= Kategori %>
- <% if(!_.isNull(arguments[0].Vernetype)) { %> + <% if(!_.isNull(data.Vernetype)) { %>
Vernetype
-
<%= Vernetype %>
+
<%= data.Vernetype %>
<% } %> -
diff --git a/src/templates/templates/datasets/kulturminne2.tmpl b/src/templates/templates/datasets/kulturminne2.tmpl index ca98300a..20c96279 100644 --- a/src/templates/templates/datasets/kulturminne2.tmpl +++ b/src/templates/templates/datasets/kulturminne2.tmpl @@ -1,5 +1,5 @@ -<% if(!_.isUndefined(arguments[0].Navn)) { %> -

<%= Navn %>

+<% if(!_.isUndefined(data.Navn)) { %> +

<%= data.Navn %>

<% } else { %>

Uten navn

<% } %> @@ -7,6 +7,8 @@
+
Beskrivelse
+
<%= shorten(data.Kulturminnesok, 300) || shorten(data.Beskrivelse, 300) || '--' %>
Kategori
<%= Lokalitetskategori %>
Lokalitetsart