Skip to content

Commit

Permalink
show description for kultur (ref #197 #198)
Browse files Browse the repository at this point in the history
  • Loading branch information
Atle Frenvik Sveen committed Mar 16, 2018
1 parent d56ef98 commit 663a43f
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 60 deletions.
82 changes: 41 additions & 41 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
16 changes: 14 additions & 2 deletions src/components/sidebar/SidebarContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)) + '&hellip;';
}

/*
Handles display of content in a sidebar
*/
Expand Down Expand Up @@ -155,7 +165,7 @@ export default function SidebarContent(wrapper, element, top, options) {
}

function _doShowFeature(feature, callbacks, index, numFeatures) {

console.log(feature);
var dataset = feature.dataset;
var template = dataset.template;
var img = feature.properties.images;
Expand All @@ -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);
Expand Down
10 changes: 4 additions & 6 deletions src/templates/templates/datasets/enkeltminne.tmpl
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
<% if(!_.isUndefined(arguments[0].Navn)) { %>
<h3><%= Navn %></h3>
<% if(!_.isUndefined(data.Navn)) { %>
<h3><%= data.Navn %></h3>
<% } else { %>
<h3><%= Enkeltminneart %></h3>
<h3>Uten navn</h3>
<% } %>

<div id="image-strip"></div>

<dl>
<% if(!_.isUndefined(arguments[0].Kulturminnesok)) { %>
<dt>Beskrivelse</dt>
<dd><%= Kulturminnesok %></dd>
<% } %>
<dd><%= shorten(data.Beskrivelse, 300) || '' %></dd>
<dt>Enkeltminne-kategori</dt>
<dd><%= Enkeltminnekategori %></dd>
<dt>Enkeltminne-art</dt>
Expand Down
13 changes: 5 additions & 8 deletions src/templates/templates/datasets/kulturmiljo.tmpl
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
<% if(!_.isUndefined(arguments[0].Navn)) { %>
<h3><%= Navn %></h3>
<% if(!_.isUndefined(data.Navn)) { %>
<h3><%= data.Navn %></h3>
<% } else { %>
<h3>Uten navn</h3>
<% } %>
<div id="image-strip"></div>

<dl>
<% if(!_.isUndefined(arguments[0].Kulturminnesok)) { %>
<dt>Beskrivelse</dt>
<dd><%= Kulturminnesok %></dd>
<% } %>
<dd><%= shorten(data.Beskrivelse, 300) || shorten(data.Beskrivelse2, 300) || '' %></dd>
<dt>Kategori</dt>
<dd><%= Kategori %></dd>
<% if(!_.isNull(arguments[0].Vernetype)) { %>
<% if(!_.isNull(data.Vernetype)) { %>
<dt>Vernetype</dt>
<dd><%= Vernetype %></dd>
<dd><%= data.Vernetype %></dd>
<% } %>

</dl>

<a class="sidebar-link" href="https://kulturminnesok.no/minne/?queryString=https://data.kulturminne.no/askeladden/kulturmiljo/K<%= KulturmiljoID %>" target="_blank">
Expand Down
6 changes: 4 additions & 2 deletions src/templates/templates/datasets/kulturminne2.tmpl
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
<% if(!_.isUndefined(arguments[0].Navn)) { %>
<h3><%= Navn %></h3>
<% if(!_.isUndefined(data.Navn)) { %>
<h3><%= data.Navn %></h3>
<% } else { %>
<h3>Uten navn</h3>
<% } %>

<div id="image-strip"></div>

<dl>
<dt>Beskrivelse</dt>
<dd><%= shorten(data.Kulturminnesok, 300) || shorten(data.Beskrivelse, 300) %></dd>
<dt>Kategori</dt>
<dd><%= Lokalitetskategori %></dd>
<dt>Lokalitetsart</dt>
Expand Down

0 comments on commit 663a43f

Please sign in to comment.