Skip to content

Commit

Permalink
Merge pull request #211 from knreise/kultur_metadata_197
Browse files Browse the repository at this point in the history
show description for kultur (ref #197 #198)
  • Loading branch information
atlefren authored Mar 16, 2018
2 parents d56ef98 + 70a6a03 commit cf6079f
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 61 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 @@ -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 = '';
Expand Down Expand Up @@ -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
12 changes: 5 additions & 7 deletions src/templates/templates/datasets/enkeltminne.tmpl
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
<% 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>
<dd><%= Enkeltminneart %></dd>
<dt>Datering</dt>
<dd><%= Datering %></dd>
<dd><%= data.Datering || '--' %></dd>
<dt>Vernestatus</dt>
<dd><%= Vernetype %></dd>
</dl>
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 cf6079f

Please sign in to comment.