--- a/src/jocondelab/static/jocondelab/css/front-common.css Thu Oct 10 15:03:55 2013 +0200
+++ b/src/jocondelab/static/jocondelab/css/front-common.css Fri Oct 11 16:31:01 2013 +0200
@@ -78,7 +78,7 @@
text-decoration: underline; color: #800000;
}
-b {
+b, .bold {
font-weight: 800;
}
--- a/src/jocondelab/static/jocondelab/css/front-notice.css Thu Oct 10 15:03:55 2013 +0200
+++ b/src/jocondelab/static/jocondelab/css/front-notice.css Fri Oct 11 16:31:01 2013 +0200
@@ -180,11 +180,15 @@
text-align: right; margin: 5px 0;
}
-.button-links a {
+.back-button {
+ display: inline-block; margin: 5px 0;
+}
+
+.button-links a, .back-button {
color: #ffffff; font-size: 14px; font-weight: bold; padding: 4px 6px;
background: #202060; border-radius: 6px;
}
-.button-links a:hover {
- background: #404080;
+.button-links a:hover, .back-button:hover {
+ background: #404080; color: #cccccc;
}
--- a/src/jocondelab/static/jocondelab/js/front-common.js Thu Oct 10 15:03:55 2013 +0200
+++ b/src/jocondelab/static/jocondelab/js/front-common.js Fri Oct 11 16:31:01 2013 +0200
@@ -418,8 +418,12 @@
return;
}
var $datablock = $(".notice-list"),
- winbottom = $win.scrollTop() + $win.height(),
- databottom = $datablock.offset().top + $datablock.height();
+ dbo = $datablock.offset();
+ if (!dbo) {
+ return;
+ }
+ var winbottom = $win.scrollTop() + $win.height(),
+ databottom = dbo.top + $datablock.height();
if (winbottom >= databottom) {
loadingnext = true;
$(".loading-please-wait").show();
@@ -457,6 +461,7 @@
$(".loading-please-wait").hide();
scrollLoad(query);
resizeWikiInfo();
+ $("html,body").animate({scrollTop:$(".results").offset().top}, 500);
}
});
};
--- a/src/jocondelab/static/jocondelab/js/front-geo.js Thu Oct 10 15:03:55 2013 +0200
+++ b/src/jocondelab/static/jocondelab/js/front-geo.js Fri Oct 11 16:31:01 2013 +0200
@@ -53,35 +53,36 @@
showData();
}
- function selectFeature(feature) {
+ function selectFeature(dbpedia_uri, blockHistory) {
_(coordCache).each(function(coord) {
- coord.isCurrent = false;
- if (coord.marker) {
- coord.marker.setIcon(defaultIcon);
+ if (coord.dbpedia_uri === dbpedia_uri) {
+ coord.isCurrent = true;
+ coord.marker.setIcon(orangeIcon);
+ map.setView([coord.latitude, coord.longitude], Math.max(Math.min(12,map.getZoom() + 1),6));
+ showCoord(coord);
+ } else {
+ coord.isCurrent = false;
+ if (coord.marker) {
+ coord.marker.setIcon(defaultIcon);
+ }
}
});
_(countries).each(function(c) {
- if (c.layer) {
- c.layer.setStyle({weight: 1, color: "#000080", opacity: .3});
+ if (c.dbpedia_uri === dbpedia_uri) {
+ c.layer.setStyle({weight: 5, color: "#c00000", opacity: .8});
+ map.fitBounds(c.bounds);
+ } else {
+ if (c.layer) {
+ c.layer.setStyle({weight: 1, color: "#000080", opacity: .3});
+ }
}
});
- loadSearchResults({ dbpedia_uri: feature.dbpedia_uri });
+ loadSearchResults({ dbpedia_uri: dbpedia_uri });
+ if (!blockHistory) {
+ window.history.pushState("","","#"+encodeURIComponent(dbpedia_uri));
+ }
}
-
- function selectMarker(coord) {
- showCoord(coord);
- selectFeature(coord);
- coord.isCurrent = true;
- coord.marker.setIcon(orangeIcon);
- map.setView([coord.latitude, coord.longitude], Math.max(Math.min(12,map.getZoom() + 1),6));
- }
-
- function selectCountry(country) {
- selectFeature(country);
- country.layer.setStyle({weight: 5, color: "#c00000", opacity: .8});
- map.fitBounds(country.bounds);
- }
-
+
function showDbpedia(feature) {
clearCountryTimeout();
if (!feature) {
@@ -200,7 +201,7 @@
f.dbCountry.bounds = l.getBounds();
f.dbCountry.latlng = f.dbCountry.bounds.getCenter();
f.dbCountry.layer = l;
- l.on("click", function() { selectCountry(f.dbCountry); });
+ l.on("click", function() { selectFeature(f.dbCountry.dbpedia_uri); });
l.on("mouseover", function() {
if (!mapDragging && f.dbCountry !== currentCountry) {
showDbpedia(f.dbCountry);
@@ -225,13 +226,39 @@
});
gjs.addTo(map);
-
+
$.getJSON(urls.countries_geo_json, function(data) {
gjs.addData(data);
});
- var debouncedGetData = _.debounce(getData,500);
+ $(window).on("popstate", function() {
+ var h = document.location.hash.replace(/^#/,'');
+ if (/https?:\/\//.test(h)) {
+ selectFeature(h, true);
+ } else {
+ _(coordCache).each(function(coord) {
+ coord.isCurrent = false;
+ if (coord.marker) {
+ coord.marker.setIcon(defaultIcon);
+ }
+ });
+ _(countries).each(function(c) {
+ if (c.layer) {
+ c.layer.setStyle({weight: 1, color: "#000080", opacity: .3});
+ }
+ });
+ $(".results").empty();
+ map.setView([20, 0],2);
+ }
+ });
+
+ var h = document.location.hash.replace(/^#/,'');
+ if (/https?:\/\//.test(h)) {
+ loadSearchResults({dbpedia_uri: h});
+ }
+ var debouncedGetData = _.debounce(getData,1000);
+
debouncedGetData();
map.on("movestart", function() {
@@ -243,7 +270,7 @@
});
oms.addListener("click", function(marker) {
if (marker.coord) {
- selectMarker(marker.coord);
+ selectFeature(marker.coord.dbpedia_uri);
}
});
oms.addListener('spiderfy', function(markers) {
@@ -277,10 +304,8 @@
} else {
var feature = _(coordCache).find(function(c) { return c.dbpedia_uri === coord.dbpedia_uri; });
}
- selectMarker(feature);
- } else {
- selectCountry(countries[countryindex]);
}
+ selectFeature(coord.dbpedia_uri);
blockUnsticking = true;
window.setTimeout(function() { blockUnsticking = false;}, 0);
}
--- a/src/jocondelab/static/jocondelab/js/front-notice.js Thu Oct 10 15:03:55 2013 +0200
+++ b/src/jocondelab/static/jocondelab/js/front-notice.js Fri Oct 11 16:31:01 2013 +0200
@@ -153,7 +153,7 @@
var o = $curitem.offset();
$overlay.css({
top: o.top + $curitem.outerHeight(),
- left: o.left - $overlay.outerWidth(true),
+ left: o.left + $curitem.outerWidth(true) / 2,
}).show().attr("data-dbpedia-uri", termdata.dbpedia_uri);
if (termdata.thumbnail) {
$overlayImg.attr("src",termdata.thumbnail).show();
@@ -220,8 +220,12 @@
});
return false;
});
-
- $ncf.autocomplete({
+ $.widget( "custom.halfwidthautocomplete", $.ui.autocomplete, {
+ _resizeMenu: function() {
+ this.menu.element.outerWidth(this.element.outerWidth()/2);
+ }
+ });
+ $ncf.halfwidthautocomplete({
source: function( request, response ) {
if (labelsCache[request.term]) {
response(labelsCache[request.term]);
@@ -291,5 +295,10 @@
});
return false;
});
+
+ $(".back-button").click(function() {
+ window.history.back();
+ return false;
+ });
});
--- a/src/jocondelab/static/jocondelab/js/front-termlist.js Thu Oct 10 15:03:55 2013 +0200
+++ b/src/jocondelab/static/jocondelab/js/front-termlist.js Fri Oct 11 16:31:01 2013 +0200
@@ -1,31 +1,3 @@
-$(function() {
-
- var $tt = $(".term-tab"),
- $tc = $(".term-contents");
-
- function loadUrl(url) {
- $tc.empty().append($(".loading-please-wait").clone().show());
- $.ajax({
- url: url,
- dataType: "html",
- success: function(html) {
- $tc.html(html);
- $tc.find(".term-filter a").click(function() {
- loadUrl($(this).attr("href"));
- return false;
- });
- dbpediaBox.bind($tc.find(".terms h3"));
- }
- });
- }
-
- $tt.click(function() {
- var $this = $(this);
- $tt.removeClass("active");
- $this.addClass("active");
- loadUrl($this.find("a").attr("href"));
- return false;
- });
-
- dbpediaBox.bind(".term-cloud a");
+$(function() {
+ dbpediaBox.bind(".term-cloud a, .terms h3");
});
--- a/src/jocondelab/static/jocondelab/js/front-timeline.js Thu Oct 10 15:03:55 2013 +0200
+++ b/src/jocondelab/static/jocondelab/js/front-timeline.js Fri Oct 11 16:31:01 2013 +0200
@@ -131,6 +131,14 @@
function updateZoomFactor() {
zoomFactor = Math.pow(2, zoomLevel/2);
}
+ function updateSlider() {
+ startSlide = boundValue(userStartSlide);
+ endSlide = boundValue(userEndSlide);
+ var startPos = yrToSliderPos(startSlide),
+ endPos = yrToSliderPos(endSlide);
+ $slider.slider("values",[Math.min(startPos, endPos),Math.max(startPos, endPos)]);
+ updateSpans();
+ }
function updateCoords() {
/* Let's first check if the timeline width has been changed */
cWidth = $tlcontainer.width();
@@ -156,12 +164,7 @@
wLineDist = lineDistances[i];
}
/* If the slider range is larger than the window, we constrain it to the window */
- startSlide = boundValue(userStartSlide);
- endSlide = boundValue(userEndSlide);
- var startPos = yrToSliderPos(startSlide),
- endPos = yrToSliderPos(endSlide);
- $slider.slider("values",[Math.min(startPos, endPos),Math.max(startPos, endPos)]);
- updateSpans();
+ updateSlider();
}
var itemTpl = _.template(
@@ -259,7 +262,7 @@
currentTerm = $this.attr("data-dbpedia-uri");
$(".timeline-item-box").removeClass("timeline-current");
$this.addClass("timeline-current");
- loadSearchResults({ dbpedia_uri: currentTerm });
+ loadSearchWithState({ dbpedia_uri: currentTerm });
});
$(".timeline-span-from").text(Math.round(fromYear) || 1);
$(".timeline-span-to").text(Math.round(toYear));
@@ -301,6 +304,23 @@
}
);
}
+
+ function loadSearchWithState(data) {
+ window.history.pushState(data, "", "#" + $.param(data));
+ loadSearchResults(data);
+ }
+ function loadFromState(data) {
+ loadSearchResults(data);
+ if (data.dbpedia_uri) {
+ $(".timeline-item-box").removeClass("timeline-current");
+ $(".timeline-item-box[data-dbpedia-uri='" + data.dbpedia_uri + "']").addClass("timeline-current");
+ }
+ if (typeof data.from_year !== "undefined" && typeof data.to_year !== "undefined") {
+ userStartSlide = parseInt(data.from_year);
+ userEndSlide = parseInt(data.to_year);
+ updateSlider();
+ }
+ }
var throttledRedraw = _.throttle(function() {
updateCoords();
@@ -430,7 +450,7 @@
});
$(".timeline-mill-submit").click(function() {
- loadSearchResults({ from_year: startSlide, to_year: endSlide, show_years: 1 });
+ loadSearchWithState({ from_year: startSlide, to_year: endSlide, show_years: 1 });
});
updateZoomFactor();
@@ -438,5 +458,33 @@
getData();
$(window).resize(throttledRedraw);
+
+ var hash = document.location.hash.replace(/^#/,'')
+ if (hash) {
+ var paramtables = hash.split('&'),
+ firstState = {};
+ _(paramtables).each(function(p) {
+ var t = p.split('=');
+ firstState[t[0]] = t[1];
+ });
+ loadFromState(firstState);
+ } else {
+ var firstState = null;
+ }
+
+ $(window).on("popstate", function(e) {
+ var state = e.originalEvent.state || firstState;
+ if (state) {
+ loadFromState(state);
+ } else {
+ $(".timeline-item-box").removeClass("timeline-current");
+ $(".results").empty();
+ var $body = $("html,body"),
+ headoff = $("header").offset().top;
+ if ($body.scrollTop() > headoff) {
+ $("html,body").animate({scrollTop:headoff}, 500);
+ }
+ }
+ });
});
--- a/src/jocondelab/templates/jocondelab/front_notice.html Thu Oct 10 15:03:55 2013 +0200
+++ b/src/jocondelab/templates/jocondelab/front_notice.html Fri Oct 11 16:31:01 2013 +0200
@@ -37,6 +37,7 @@
{% block main %}
<div class="notice-colright-wrapper">
<div class="notice-colright">
+ <a class="back-button" href="{{request.META.HTTP_REFERER}}">Retour</a>
{% block datasheet %}
<table class="notice-datasheet">
{% if object.autr %}
@@ -68,7 +69,7 @@
{% if object.deno or object.appl %}
<tr>
<th>{% trans 'Désignation :' %}</th>
- <td>{% show_datasheet_row 'APPL' %}{% show_datasheet_row 'DENO' %}</td>
+ <td>{% show_datasheet_row 'DENO' isbold=True %}{% show_datasheet_row 'APPL' %}</td>
</tr>
{% endif %}
{% if object.repr %}
--- a/src/jocondelab/templates/jocondelab/front_search.html Thu Oct 10 15:03:55 2013 +0200
+++ b/src/jocondelab/templates/jocondelab/front_search.html Fri Oct 11 16:31:01 2013 +0200
@@ -28,7 +28,7 @@
<div class="results">{% include 'jocondelab/partial/wrapped_notice_list.html' %}</div>
- <div class="loading-please-wait"><img src="{{STATIC_URL}}jocondelab/img/loader.gif" /></div>
+ <div class="loading-please-wait"><img src="{{STATIC_URL}}jocondelab/img/loader.gif" alt="{% trans 'Chargement en cours' %}" /></div>
<p class="load-more"><a href="#">{% trans 'Afficher plus de résultats' %}</a></p>
{% endblock %}
--- a/src/jocondelab/templates/jocondelab/front_termlist.html Thu Oct 10 15:03:55 2013 +0200
+++ b/src/jocondelab/templates/jocondelab/front_termlist.html Fri Oct 11 16:31:01 2013 +0200
@@ -36,7 +36,41 @@
</ul>
<div class="term-contents">
- {% include "jocondelab/partial/termlist_contents.html" %}
+ {% if thesaurus %}
+ <p class="term-filter{% if not alpha_sort %} active{% endif %}">
+ <a href="{% url 'front_termlist' %}?thesaurus={{thesaurus}}">{% trans "Termes les plus fréquents" %}</a>
+ </p>
+ {% if show_alphabet %}
+ <ul class="term-filter letter-list">
+ {% for letter in alphabet %}
+ <li class="letter{% if letter == current_letter %} active{% endif %}"><a href="{% url 'front_termlist' %}?thesaurus={{thesaurus}}&letter={{letter|urlencode}}">{{letter}}</a></li>
+ {% endfor %}
+ </ul>
+ {% else %}
+ <p class="term-filter{% if alpha_sort %} active{% endif %}">
+ <a href="{% url 'front_termlist' %}?thesaurus={{thesaurus}}&alphabet=1">{% trans "Classer par ordre alphabétique" %}</a>
+ </p>
+ {% endif %}
+ <ul class="terms clearfix">
+ {% for term in terms %}
+ <li class="term" data-dbpedia-uri="{{term.dbpedia_uri}}">
+ <div class="term-image-wrap">
+ <img class="term-image" src="{{JOCONDE_IMAGE_BASE_URL}}{{term.image_url}}" />
+ </div>
+ <h3 data-dbpedia-uri="{{term.dbpedia_uri}}"><a href="{% url 'front_search' %}?dbpedia_uri={{term.dbpedia_uri|urlencode}}">{{term.label}}</a></h3>
+ {% if term.abstract %}<p>{{term.abstract|truncatechars:100}}</p>{% endif %}
+ </li>
+ {% endfor %}
+ </ul>
+ {% else %}
+ <ul class="term-cloud">
+ {% for word in words %}
+ <li style="font-size: {{word.font_size}}em">
+ <a href="{% url 'front_search' %}?dbpedia_uri={{word.uri|urlencode}}" data-dbpedia-uri="{{word.uri}}">{{word.label}}</a>
+ </li>
+ {% endfor %}
+ </ul>
+ {% endif %}
</div>
<div class="loading-please-wait"><img src="{{STATIC_URL}}jocondelab/img/loader.gif" /></div>
--- a/src/jocondelab/templates/jocondelab/partial/datasheet_row.html Thu Oct 10 15:03:55 2013 +0200
+++ b/src/jocondelab/templates/jocondelab/partial/datasheet_row.html Fri Oct 11 16:31:01 2013 +0200
@@ -1,7 +1,7 @@
{% load i18n %}
{% if linked_terms %}
-<ul class="datasheet-group notice-term-list">
+<ul class="datasheet-group notice-term-list{% if isbold %} bold{% endif %}">
{% for term in linked_terms.translated %}
<li class="notice-term term-translated">
<a href="{% url 'front_search' %}?dbpedia_uri={{term.dbpedia_uri|urlencode}}" data-dbpedia-uri="{{term.dbpedia_uri}}">{{term.label}}</a>
@@ -12,6 +12,6 @@
{% endfor %}
</ul>
{% elif base_field %}
-<span class="datasheet-group" dir="ltr">{{base_field}}</span>
+<span class="datasheet-group{% if isbold %} bold{% endif %}" dir="ltr">{{base_field}}</span>
{% endif %}
--- a/src/jocondelab/templates/jocondelab/partial/notice_list.html Thu Oct 10 15:03:55 2013 +0200
+++ b/src/jocondelab/templates/jocondelab/partial/notice_list.html Fri Oct 11 16:31:01 2013 +0200
@@ -7,29 +7,19 @@
<img class="notice-image" alt="{{notice.imagetitle}}" src="{{notice.image}}" onerror="window.onResultImageError(this);" />
</a>
<div class="notice-metadata">
- {% if notice.title %}
- <h2>
- <a href="{% url 'front_notice' notice.id %}">{% trans 'Titre :' %} <span class="notice-title" dir="ltr">{{notice.title}}</span></a></h2>
- </h2>
- {% elif notice.designation %}
- <h2>
- <a href="{% url 'front_notice' notice.id %}">{% trans 'Désignation :' %} <span class="notice-title" dir="ltr">{{notice.designation}}</span></a>
- </h2>
- {% endif %}
<ul>
- {% if notice.terms_by_thesaurus.AUTR %}
- <li class="notice-thesaurus">
- <h3>{% trans 'Artiste(s) :' %}</h3>
- <ul class="notice-term-list">
- {% for term in notice.terms_by_thesaurus.AUTR %}
+ {% if notice.terms_by_thesaurus.AUTR or notice.author %}
+ <li class="notice-thesaurus">
+ <h3>{% trans 'Artiste(s) :' %}</h3>
+ {% if notice.terms_by_thesaurus.AUTR %}
+ <ul class="notice-term-list">
+ {% for term in notice.terms_by_thesaurus.AUTR %}
<li class="notice-term"><a href="{% url 'front_search' %}?dbpedia_uri={{term.dbpedia_uri|urlencode}}" data-dbpedia-uri="{{term.dbpedia_uri}}">{{term.label}}</a></li>
- {% endfor %}
- </ul>
- </li>
- {% elif notice.author %}
- <li class="notice-thesaurus">
- <h3 class="notice-thesaurus-title">{% trans 'Artiste(s) :' %}</h3>
+ {% endfor %}
+ </ul>
+ {% else %}
<p class="notice-terms-list" dir="ltr">{{notice.author}}</p>
+ {% endif %}
</li>
{% endif %}
{% if notice.terms_by_thesaurus.ECOL %}
@@ -42,6 +32,13 @@
</ul>
</li>
{% endif %}
+ {% if notice.title %}
+ </ul>
+ <h2>
+ <a href="{% url 'front_notice' notice.id %}">{% trans 'Titre :' %} <span class="notice-title" dir="ltr">{{notice.title}}</span></a></h2>
+ </h2>
+ <ul>
+ {% endif %}
{% if notice.terms_by_thesaurus.DOMN %}
<li class="notice-thesaurus">
<h3>{% trans 'Domaine(s) :' %}</h3>
@@ -52,6 +49,13 @@
</ul>
</li>
{% endif %}
+ {% if notice.designation %}
+ </ul>
+ <h2>
+ <a href="{% url 'front_notice' notice.id %}">{% trans 'Désignation :' %} <span class="notice-title" dir="ltr">{{notice.designation}}</span></a>
+ </h2>
+ <ul>
+ {% endif %}
{% if notice.terms_by_thesaurus.REPR %}
<li class="notice-thesaurus">
<h3>{% trans 'Sujet représenté :' %}</h3>
--- a/src/jocondelab/templates/jocondelab/partial/termlist_contents.html Thu Oct 10 15:03:55 2013 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-{% load i18n %}
-
-{% if thesaurus %}
- <p class="term-filter{% if not alpha_sort %} active{% endif %}">
- <a href="{% url 'front_termlist' %}?thesaurus={{thesaurus}}">{% trans "Termes les plus fréquents" %}</a>
- </p>
- {% if show_alphabet %}
- <ul class="term-filter letter-list">
- {% for letter in alphabet %}
- <li class="letter{% if letter == current_letter %} active{% endif %}"><a href="{% url 'front_termlist' %}?thesaurus={{thesaurus}}&letter={{letter|urlencode}}">{{letter}}</a></li>
- {% endfor %}
- </ul>
- {% else %}
- <p class="term-filter{% if alpha_sort %} active{% endif %}">
- <a href="{% url 'front_termlist' %}?thesaurus={{thesaurus}}&alphabet=1">{% trans "Classer par ordre alphabétique" %}</a>
- </p>
- {% endif %}
- <ul class="terms clearfix">
- {% for term in terms %}
- <li class="term" data-dbpedia-uri="{{term.dbpedia_uri}}">
- <div class="term-image-wrap">
- <img class="term-image" src="{{JOCONDE_IMAGE_BASE_URL}}{{term.image_url}}" />
- </div>
- <h3 data-dbpedia-uri="{{term.dbpedia_uri}}"><a href="{% url 'front_search' %}?dbpedia_uri={{term.dbpedia_uri|urlencode}}">{{term.label}}</a></h3>
- {% if term.abstract %}<p>{{term.abstract|truncatechars:100}}</p>{% endif %}
- </li>
- {% endfor %}
- </ul>
-{% else %}
- <ul class="term-cloud">
- {% for word in words %}
- <li style="font-size: {{word.font_size}}em">
- <a href="{% url 'front_search' %}?dbpedia_uri={{word.uri|urlencode}}" data-dbpedia-uri="{{word.uri}}">{{word.label}}</a>
- </li>
- {% endfor %}
- </ul>
-{% endif %}
\ No newline at end of file
--- a/src/jocondelab/templates/jocondelab/partial/wrapped_notice_list.html Thu Oct 10 15:03:55 2013 +0200
+++ b/src/jocondelab/templates/jocondelab/partial/wrapped_notice_list.html Fri Oct 11 16:31:01 2013 +0200
@@ -4,16 +4,16 @@
<h2 class="resultcount">
{% if searchterms_label %}
{% if count %}
- {% blocktrans count counter=count %}
- <b>{{count}}</b> résultat pour <b>« {{searchterms_label}} »</b>
- {% plural %}
- <b>{{count}}</b> résultats pour <b>« {{searchterms_label}} »</b>
- {% endblocktrans %}
+ {% blocktrans count counter=count %}<b>{{count}}</b> résultat pour <b>« {{searchterms_label}} »</b>{% plural %}<b>{{count}}</b> résultats pour <b>« {{searchterms_label}} »</b>{% endblocktrans %}
{% else %}
{% blocktrans %}Aucun résultat pour <b>« {{searchterms_label}} »</b>{% endblocktrans %}
{% endif %}
{% else %}
- {% blocktrans %}<b>{{count}}</b> œuvres des musées de France{% endblocktrans %}
+ {% if count %}
+ {% blocktrans %}<b>{{count}}</b> œuvres des musées de France{% endblocktrans %}
+ {% else %}
+ {% blocktrans %}Aucun résultat{% endblocktrans %}
+ {% endif %}
{% endif %}
</h2>
--- a/src/jocondelab/templatetags/jlutils.py Thu Oct 10 15:03:55 2013 +0200
+++ b/src/jocondelab/templatetags/jlutils.py Fri Oct 11 16:31:01 2013 +0200
@@ -4,8 +4,10 @@
register = template.Library()
@register.inclusion_tag('jocondelab/partial/datasheet_row.html', takes_context=True)
-def show_datasheet_row(context, fieldname):
+def show_datasheet_row(context, fieldname, *args, **kwargs):
+ isbold = kwargs.get('isbold',False)
return {
+ "isbold": isbold,
"fieldname": fieldname,
"linked_terms": context['terms_by_thesaurus'].get(fieldname.upper(),None),
"base_field": getattr(context['object'],fieldname.lower())
@@ -13,4 +15,7 @@
@register.filter
def wikiurl(label, lang):
- return u"http://%s.wikipedia.org/wiki/%s"%(lang, urlquote(label.replace(" ","_")))
\ No newline at end of file
+ if label:
+ return u"http://%s.wikipedia.org/wiki/%s"%(lang, urlquote(label.replace(" ","_")))
+ else:
+ return u"http://%s.wikipedia.org/"%lang
\ No newline at end of file
--- a/src/jocondelab/views/front_office.py Thu Oct 10 15:03:55 2013 +0200
+++ b/src/jocondelab/views/front_office.py Fri Oct 11 16:31:01 2013 +0200
@@ -115,7 +115,7 @@
"id": n.id,
"title": n.titr,
"designation": " | ".join([ v for v in [ n.deno, n.appl] if v ]),
- "image": (settings.JOCONDE_IMG_BASE_URL + n.images.all()[0].url) if n.images.exists() else "",
+ "image": (settings.JOCONDE_IMG_BASE_URL + n.images.exclude(relative_url__endswith='v.jpg').order_by('id')[0].relative_url) if n.images.exists() else "",
"author": n.autr,
"terms_by_thesaurus": termsbythesaurus,
"datation": termsbythesaurus.get("PERI",[]) + termsbythesaurus.get("EPOQ",[])
@@ -151,7 +151,7 @@
context = super(NoticeView, self).get_context_data(**kwargs)
lang = self.request.GET.get('lang',self.request.LANGUAGE_CODE)[:2]
- context["images"] = [settings.JOCONDE_IMG_BASE_URL + i.url for i in self.object.images.exclude(relative_url__endswith='v.jpg')]
+ context["images"] = [settings.JOCONDE_IMG_BASE_URL + i.url for i in self.object.images.exclude(relative_url__endswith='v.jpg').order_by('id')]
context["title"] = self.object.titr if self.object.titr else self.object.deno
termsbythesaurus = {}
@@ -234,9 +234,6 @@
thesaurus = self.request.GET.get('thesaurus',None)
context['thesaurus'] = thesaurus
- if is_ajax:
- self.template_name = "jocondelab/partial/termlist_contents.html"
-
if thesaurus is None:
wqs = TagcloudTerm.objects.filter(term__dbpedia_fields__language_code=lang).values('term__dbpedia_fields__label','term__dbpedia_uri')
wqs = wqs.distinct().annotate(sum_notice=Sum('term__nb_illustrated_notice')).order_by('-sum_notice')
@@ -302,7 +299,7 @@
"dbpedia_uri": t['dbpedia_uri'],
"label": t.get('dbpedia_fields__label',t.get('label','')),
"abstract": t['dbpedia_fields__abstract'],
- "image_url": "%s%s"%(settings.JOCONDE_IMG_BASE_URL, t.get('image_url',t.get('notices__images__relative_url','')))
+ "image_url": "%s%s"%(settings.JOCONDE_IMG_BASE_URL, t.get('image_url',''))
} for t in terms]
context['termcount'] = len(terms)
else: