Skip to content
Snippets Groups Projects
Commit 5f1e065b authored by root's avatar root
Browse files

Added shopping cart solution with fixes for Parsleyjs 2.0

parent a7ee87e6
No related branches found
No related tags found
No related merge requests found
......@@ -21,6 +21,7 @@
</div>
<script>
var map = L.map('map');
var bounds = [{% for row in models.places %}{%if !forloop.last && row.lat.value != null%}, {%endif%}{% if row.lat.value != null %}[{{ row.lat.value }}, {%endif%}{% if row.long.value != "" %}{{ row.long.value }}]{%endif%}{% endfor %}];
bounds = $.grep(bounds,function(n){ return(n) });
if (bounds.length > 1) { map.fitBounds(new L.LatLngBounds(bounds)); } else { map.setView(bounds[0], 7);}
......@@ -31,4 +32,6 @@
{% for row in models.places %}{% if row.long.value != null %}
L.marker([{{ row.lat.value }}, {{ row.long.value }}]).addTo(map).bindPopup("<b><a href=\"{{ row.uri.value }}\">{{row.label.value}}</a></b>").openPopup();
{% endif %}{% endfor %}
map.dragging.disable();
map.touchZoom.disable();
</script>
\ No newline at end of file
SELECT ?label (COUNT(?doc) AS ?total) WHERE {
?s a skos:Concept .
?s skos:prefLabel ?label .
?s skos:inScheme <http://data.ub.uib.no/conceptscheme/spesialsamlingens-emneregister> .
?doc dct:subject ?s .
}
GROUP BY ?label ?total
ORDER BY desc(?total)
LIMIT 10
{%include "../../includes/header.inc"%}
<div class="container main-body">
<div class="row">
<div class="col-md-3">
<div class="bs-sidebar hidden-xs hidden-sm affix">
<div class="browse-sidebar">
<h4>Bla i <span class="marcus-logo">Marcus</span></h4>
<ul class="list-unstyled">
{% include "../../includes/nav.inc" %}
</ul>
</div>
</div> <!-- End Sidebar -->
</div>
<div class="col-md-9">
<h1>Visualisering!</h1>
<h2>Antall objekt</h2>
<p class="lead">Klasser eller typer dokument.</p>
<div class="row">
<div class="col-md-12">
{{models.quantity|GoogleVizBarChart:"label,total"}}
</div>
</div>
<h2>Steder knyttet til våre samlinger</h2>
<p class="lead">Disse stedene har vi fått plassert på kartet, men mange steder er ikke plassert.</p>
<div class="row">
<div class="col-md-12">
{{models.main|GoogleMaps:"lat,long,label"}}
</div>
</div>
<h2>Emner</h2>
<p class="lead">Dette er de 50 vanligste emneordene i samlingene våre.</p>
<div class="row">
<div class="col-md-12">
{{models.subjects|GoogleVizColumnChart:"label,total"}}
</div>
</div>
<div id="d3" class="d3"></div>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script>
var margin = {top: 20, right: 20, bottom: 30, left: 40},
width = 960 - margin.left - margin.right,
height = 500 - margin.top - margin.bottom;
var x = d3.scale.ordinal()
.rangeRoundBands([0, width], .1);
var y = d3.scale.linear()
.range([height, 0]);
var xAxis = d3.svg.axis()
.scale(x)
.orient("bottom");
var yAxis = d3.svg.axis()
.scale(y)
.orient("left")
.ticks(10, "%");
var svg = d3.select(".d3").append("svg")
.attr("width", width + margin.left + margin.right)
.attr("height", height + margin.top + margin.bottom)
.append("g")
.attr("transform", "translate(" + margin.left + "," + margin.top + ")");
var data = [
{% for row in models.subjects %}
{name: "{{row.label.value}}", value: {{row.total.value}} },
{% endfor %}
]
d3.json("data", type, function(error, data) {
x.domain(data.map(function(d) { return d.letter; }));
y.domain([0, d3.max(data, function(d) { return d.frequency; })]);
svg.append("g")
.attr("class", "x axis")
.attr("transform", "translate(0," + height + ")")
.call(xAxis);
svg.append("g")
.attr("class", "y axis")
.call(yAxis)
.append("text")
.attr("transform", "rotate(-90)")
.attr("y", 6)
.attr("dy", ".71em")
.style("text-anchor", "end")
.text("Frequency");
svg.selectAll(".bar")
.data(data)
.enter().append("rect")
.attr("class", "bar")
.attr("x", function(d) { return x(d.letter); })
.attr("width", x.rangeBand())
.attr("y", function(d) { return y(d.frequency); })
.attr("height", function(d) { return height - y(d.frequency); });
});
function type(d) {
d.frequency = +d.frequency;
return d;
}
</script>
</div>
</div></div>
{%include "../../includes/footer.inc"%}
</body>
</html>
SELECT ?label ?lat ?long WHERE {
?s geo:long ?long .
?s geo:lat ?lat .
OPTIONAL { ?s skos:prefLabel ?label . }
OPTIONAL { ?s rdfs:label ?label . }
}
\ No newline at end of file
SELECT ?label (COUNT(?class) AS ?total) WHERE {
?s a ?class .
?class rdfs:label ?label .
FILTER(LANG(?label) = "")
}
GROUP BY ?label
ORDER BY desc(?total)
\ No newline at end of file
SELECT ?label (COUNT(?doc) AS ?total) WHERE {
?s a skos:Concept .
?s skos:prefLabel ?label .
?s skos:inScheme <http://data.ub.uib.no/conceptscheme/spesialsamlingens-emneregister> .
?doc dct:subject ?s .
}
GROUP BY ?label ?total
ORDER BY desc(?total)
LIMIT 50
This diff is collapsed.
......@@ -82,11 +82,19 @@ header nav ul.nav li a { font-size: 1.05em; }
}
/* MAP */
#places { margin-bottom: 20px;}
.map-wrap, #map-wrap { width: 100%; }
#map {width: 100%; height: 450px;}
#map-monument {width: 100%; height: 850px;}
.no-map { background-image: url(../img/no-map-bg.png); }
#map {width: 100%; height: 200px;}
/* Small devices (tablets, 768px and up) */
@media (min-width: @screen-sm-min) { ... }
/* Medium devices (desktops, 992px and up) */
@media (min-width: @screen-md-min) {
.map-wrap, #map-wrap { width: 100%; }
#map {width: 100%; height: 400px;}
}
#places { margin-bottom: 20px;}
#map-monument {width: 100%; height: 650px;}
/* DISQUS */
#disqus_thread { margin-top: 50px; padding-top: 20px; border-top: dotted 1px #bbb; clear: both;}
......
......@@ -2,7 +2,9 @@
<div itemscope itemtype="http://schema.org/CreativeWork" class="container main-body">
<div class="row">
<div class="col-md-3">
<div class="col-md-3">
<div class="bs-sidebar hidden-xs hidden-sm affix">
<p>
......@@ -36,7 +38,7 @@
{% endfor %}
</ul>
{% endif %}
<hr>
<hr>
......@@ -96,21 +98,17 @@
<hr>
<div class="browse-sidebar">
<!--
<span class="fa-stack fa-lg">
<i class="fa fa-circle fa-stack-2x"></i>
<i class="fa fa-bars fa-inverse fa-stack-1x"></i>
</span>
-->
<span class="h4">Bla i <span class="marcus-logo">Marcus</span>
</span>
<ul class="list-unstyled">
{% include "../../includes/nav.inc" %}
</ul>
</div>
</div> <!-- End Sidebar -->
</div>
</div>
<div class="col-md-9">
<div class="row">
<div class="col-md-12">
......@@ -166,17 +164,58 @@
<div id="map-monument"></div>
{% endif %}
</div>
<script>
<script>
L.Map = L.Map.extend({
openPopup: function(popup) {
// this.closePopup(); // just comment this
this._popup = popup;
return this.addLayer(popup).fire('popupopen', {
popup: this._popup
});
}
});
var map = L.map('map-monument');
map.locate({setView: true, maxZoom: 14});
var bounds = [{{first.places.lat.value}}, {{first.places.long.value}}];
map.setView(bounds, 17);
var defaultLayer = L.tileLayer.provider('OpenStreetMap.Mapnik').addTo(map);
var baseLayers = [ 'OpenStreetMap.Mapnik', 'MapQuestOpen.OSM', 'MapQuestOpen.Aerial', 'Stamen.Watercolor' ];
var overlayLayers = [ 'Kartverket', 'Rodekart9', 'Rodekart4', 'Rodekart1' ];
L.control.layers.provided(baseLayers, overlayLayers, {collapsed: true}).addTo(map);
map.touchZoom.disable();
map.boxZoom.disable();
map.scrollWheelZoom.disable();
function onLocationFound(e) {
var radius = e.accuracy / 2;
var you = (e.latlng);
var mon = new L.LatLng({{first.places.lat.value}}, {{first.places.long.value}});
var list = [you, mon];
var distance = Math.round(you.distanceTo(mon));
L.marker(e.latlng).addTo(map)
.bindPopup('<strong>Du er her</strong><br>...ca. ' + distance + ' meter<br> i luftlinje fra <br>' + '{% for row in models.main %}{% if row.title && row.title.value != "" %}{{row.title.value}}{% else %}{% if row.label && row.label.value != "" %}{{row.label.value}}{% else %} {{row.identifier.value}}{%endif%}{%endif%}{%endfor%}').openPopup();
var firstpolyline = new L.Polyline(list, {
color: 'gray',
weight: 4,
opacity: 1,
smoothFactor: 1,
dashArray: '13, 10'
});
map.addLayer(firstpolyline);
}
map.on('locationfound', onLocationFound);
{% for row in models.places %}{% if row.long.value != null %}
L.marker([{{ row.lat.value }}, {{ row.long.value }}]).addTo(map).bindPopup('<div style="width:220px;"><a href="{{first.depiction.uri.value}}" alt="{{first.depiction.label.value}}"><img style="width:220px;" src="{{first.depiction.img.value}}"></a><br><b>{{ first.main.label.value }}</b></div>').openPopup();
L.marker([{{ row.lat.value }}, {{ row.long.value }}]).addTo(map).bindPopup('<div style="width:180px;"><a href="{{first.depiction.uri.value}}" alt="{{first.depiction.label.value}}"><img style="width:180px;" src="{{first.depiction.img.value}}"></a><br><b>{{ first.main.label.value }}</b></div>').openPopup();
{% endif %}{% endfor %}
</script>
</div>
</div>
......@@ -297,8 +336,8 @@
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{%include "../../includes/footer.inc"%}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment