--- a/data/extra-years.csv Fri Oct 11 18:04:02 2013 +0200
+++ b/data/extra-years.csv Mon Oct 14 17:39:06 2013 +0200
@@ -1,4 +1,4 @@
-term_label;Ressource DbPedia;start_year;end_year
+term_label;dbpedia_uri;start_year;end_year
;http://fr.dbpedia.org/resource/19e_si%C3%A8cle;1801;1900
;http://fr.dbpedia.org/resource/18e_si%C3%A8cle;1701;1800
;http://fr.dbpedia.org/resource/17e_si%C3%A8cle;1601;1700
@@ -119,3 +119,17 @@
Wanli;http://fr.dbpedia.org/resource/Ming_Wanli;1572;1620
XXIIIe dynastie;;-818;-715
XXIXe dynastie;;-398;-380
+;http://fr.dbpedia.org/resource/Alexandre_le_Grand;-356;-323
+;http://fr.dbpedia.org/resource/Constantin_Ier_%28empereur_romain%29;306;337
+;http://fr.dbpedia.org/resource/Lucien_Bonaparte;1775;1840
+;http://fr.dbpedia.org/page/Fran%C3%A7ois-Antoine_de_Boissy_d%27Anglas;1756;1826
+;http://fr.dbpedia.org/resource/Hyks%C3%B4s;-1674;-1548
+;http://fr.dbpedia.org/page/Jean-Baptiste_de_Belloy;1709;1808
+;http://fr.dbpedia.org/resource/P%C3%A9pin_le_Bref;715;768
+;http://fr.dbpedia.org/resource/M%C3%A9rov%C3%A9e;412;455
+;http://fr.dbpedia.org/resource/Clovis_Ier;466;511
+;http://fr.dbpedia.org/resource/S%C3%A9leucos_VI;-96;-93
+;http://fr.dbpedia.org/resource/Cyrus_II;-559;-529
+;http://fr.dbpedia.org/resource/Horace;-65;-8
+;http://fr.dbpedia.org/resource/Virgile;-70;-19
+;http://fr.dbpedia.org/resource/Confucius;-551;-479
--- a/src/jocondelab/models/data.py Fri Oct 11 18:04:02 2013 +0200
+++ b/src/jocondelab/models/data.py Mon Oct 14 17:39:06 2013 +0200
@@ -52,7 +52,7 @@
app_label = 'jocondelab'
def __unicode__(self):
- return u'%s: %d - %d'%(self.term.dbpedia_uri, self.start_year, self.end_year)
+ return u'%s: %d - %d'%(self.term.label, self.start_year, self.end_year)
class DbpediaGeo(models.Model):
term = models.ForeignKey(Term, unique=True, blank=False, null=False, db_index=True, related_name="geo")
@@ -63,7 +63,7 @@
app_label = 'jocondelab'
def __unicode__(self):
- return u'%s: %.4f%s, %.4f%s'%(self.term.dbpedia_uri, abs(self.latitude), 'N' if self.latitude > 0 else 'S', abs(self.longitude), 'E' if self.longitude > 0 else 'W')
+ return u'%s: %.4f%s, %.4f%s'%(self.term.label, abs(self.latitude), 'N' if self.latitude > 0 else 'S', abs(self.longitude), 'E' if self.longitude > 0 else 'W')
class NoticeYears(models.Model):
notice = models.ForeignKey(Notice, unique=True, blank=False, null=False, db_index=True, related_name="years")
--- a/src/jocondelab/static/jocondelab/css/front-common.css Fri Oct 11 18:04:02 2013 +0200
+++ b/src/jocondelab/static/jocondelab/css/front-common.css Mon Oct 14 17:39:06 2013 +0200
@@ -117,11 +117,11 @@
font-family: 'OpenSans'; font-size: 10px; overflow-x: hidden;
}
-.header-wrapper, .menus-wrapper, .main-wrapper, .language-menu-wrapper {
+.header-wrapper, .menu-wrapper, .main-wrapper {
padding: 0 10px; clear: both;
}
-.language-menu-wrapper {
+.menu-wrapper {
background: #ffffff;
}
@@ -129,11 +129,11 @@
background: url('../img/background-pinstripe-blue.png');
}
-.menus-wrapper {
- background: #ffffff; box-shadow: 0 2px 4px #666666;
+.main-menu-wrapper, .header-wrapper {
+ box-shadow: 0 2px 2px #cccccc;
}
-header, .main, footer, .menu-list, .language-menu {
+header, .main, footer, .menu-list {
margin: 0 auto; max-width: 960px; clear: both;
}
@@ -175,7 +175,7 @@
}
.header-widgets {
- float: right;
+ display: none; float: right;
}
html[dir=rtl] .header-widgets {
@@ -202,10 +202,6 @@
font-weight: 800;
}
-.header-widgets {
- padding: 5px 0;
-}
-
/* HEADER > SEARCH FORM */
.search-input, .search-form .tagit {
@@ -302,10 +298,6 @@
background-position: -28px -26px;
}
-.language-menu-link {
- display: none;
-}
-
/* MENUS */
@@ -314,7 +306,7 @@
}
.menu-list {
- width: 100%; font-size: 13px; padding: 8px 0; line-height: 2em; text-align: right;
+ width: 100%; font-size: 13px; padding: 5px 0; line-height: 2em; text-align: right;
}
.menu-item {
@@ -333,10 +325,6 @@
display: none;
}
-.main-menu {
- display: none;
-}
-
/* DBPEDIA OVERLAY */
.dbpedia-overlay {
@@ -425,7 +413,7 @@
}
.notice-contents h2 {
- font-size: 15px; margin-bottom: 6px; line-height: 1.1em;
+ font-size: 13px; margin-bottom: 6px; line-height: 1.1em;
}
.notice-title {
@@ -433,12 +421,28 @@
}
.notice-thesaurus {
- font-size: 13px; margin-bottom: 6px;
+ font-size: 12px; margin-bottom: 6px;
}
.notice-term {
- display: inline-block; padding: 3px; background: #d0e0f0;
- border-radius: 3px; margin: 0 5px 2px 0;
+ display: inline-block; background: #d0e0f0;
+ border-radius: 3px;
+}
+
+.notice-metadata .notice-term {
+ padding: 2px; margin: 0 4px 2px 0;
+}
+
+.notice-datasheet .notice-term {
+ font-size: 13px; padding: 3px; margin: -2px 5px 4px 0;
+}
+
+.notice-term.term-untranslated {
+ background: transparent; padding: 0;
+}
+
+.notice-label {
+ display: inline-block; font-style: italic;
}
.notice-term:hover {
@@ -535,12 +539,20 @@
@media screen and (max-width: 540px) {
- .language-menu-link {
- display: table-cell;
+ .header-widgets {
+ display: block;
}
- .language-menu {
+ .menu-list {
display: none;
}
}
+
+@media screen and (min-width: 540px) {
+
+ .menu-list {
+ display: block !important;
+ }
+
+}
--- a/src/jocondelab/static/jocondelab/css/front-geo.css Fri Oct 11 18:04:02 2013 +0200
+++ b/src/jocondelab/static/jocondelab/css/front-geo.css Mon Oct 14 17:39:06 2013 +0200
@@ -1,5 +1,5 @@
.map-container {
- position: relative; width: 100%; height: 460px; margin-top: 10px;
+ position: relative; width: 100%; height: 460px; margin-top: 15px;
}
#map {
--- a/src/jocondelab/static/jocondelab/css/front-home.css Fri Oct 11 18:04:02 2013 +0200
+++ b/src/jocondelab/static/jocondelab/css/front-home.css Mon Oct 14 17:39:06 2013 +0200
@@ -1,5 +1,5 @@
.about-jl {
- font-size: 18px; font-weight: bold; margin: 20px 0;
+ font-size: 18px; font-weight: bold; margin: 15px 0;
}
.module-list {
--- a/src/jocondelab/static/jocondelab/css/front-notice.css Fri Oct 11 18:04:02 2013 +0200
+++ b/src/jocondelab/static/jocondelab/css/front-notice.css Mon Oct 14 17:39:06 2013 +0200
@@ -75,14 +75,6 @@
padding-top: 10px;
}
-.notice-term {
- margin: -2px 5px 4px 0;
-}
-
-.notice-term.term-untranslated {
- background: transparent; padding: 0;
-}
-
.notice-term.term-untranslated:after {
content: " ;";
}
--- a/src/jocondelab/static/jocondelab/css/front-termlist.css Fri Oct 11 18:04:02 2013 +0200
+++ b/src/jocondelab/static/jocondelab/css/front-termlist.css Mon Oct 14 17:39:06 2013 +0200
@@ -9,7 +9,7 @@
}
.term-tabs {
- width: 100%; clear: both; height: 41px; margin-top: 20px;
+ width: 100%; clear: both; height: 41px; margin-top: 15px;
}
.term-tab {
--- a/src/jocondelab/static/jocondelab/css/front-timeline.css Fri Oct 11 18:04:02 2013 +0200
+++ b/src/jocondelab/static/jocondelab/css/front-timeline.css Mon Oct 14 17:39:06 2013 +0200
@@ -1,5 +1,5 @@
.timeline-section-title {
- font-size: 16px; font-weight: bold; margin: 10px 0 0; padding: 5px 10px; background: #ffffff;
+ font-size: 16px; font-weight: bold; margin: 15px 0 0; padding: 5px 10px; background: #ffffff;
border-width: 1px; border-color: #cccccc; border-style: solid solid none;
border-radius: 10px 10px 0 0; display: inline-block;
}
@@ -21,7 +21,7 @@
}
.timeline-canvas {
- width: 100%; height: 100%; background: #ffffff;
+ width: 100%; height: 100%;
}
.timeline-list {
--- a/src/jocondelab/static/jocondelab/js/front-common.js Fri Oct 11 18:04:02 2013 +0200
+++ b/src/jocondelab/static/jocondelab/js/front-common.js Mon Oct 14 17:39:06 2013 +0200
@@ -333,7 +333,7 @@
$nc.css({
left: isleft ? "0" : "",
right: isleft ? "" : "0",
- width: isfull ? nw : (nw + 260),
+ width: isfull ? nw : (nw + 250),
"margin-top": ((gridsize - nh) / 3 - 10) + "px",
"margin-left": isleft ? ((gridsize - nw) / 2 - 10) + "px" : 0,
"margin-right": isleft ? 0 : ((gridsize - nw) / 2 - 10) + "px"
@@ -514,34 +514,13 @@
}).scroll(recentreDbpediaBox);
$overlayImg.load(recentreDbpediaBox);
-
- var hideTo, $mm = $(".main-menu");
-
- function hideMenu() {
- clearTimeout(hideTo);
- hideTo = setTimeout(function() {
- $mm.stop(true).slideUp();
- }, 3000);
- }
- function showMenu(selector) {
- clearTimeout(hideTo);
- $mm.stop(true).slideDown();
- }
- $(".main-menu-link").mouseenter(showMenu).mouseleave(hideMenu).click(function() {
- $mm.stop(true).slideToggle();
- return false;
- });
-
- $mm.mouseover(showMenu).mouseout(hideMenu);
-
+
$(".language-menu-link").click(function() {
$(".language-menu").slideToggle();
});
- $(".language-menu a").click(function() {
- $(".language-input").val($(this).attr("data-language-code"));
- $(".language-form").submit();
- return false;
+ $(".main-menu-link").click(function() {
+ $(".main-menu").slideToggle();
});
});
--- a/src/jocondelab/static/jocondelab/js/front-notice.js Fri Oct 11 18:04:02 2013 +0200
+++ b/src/jocondelab/static/jocondelab/js/front-notice.js Mon Oct 14 17:39:06 2013 +0200
@@ -295,10 +295,5 @@
});
return false;
});
-
- $(".back-button").click(function() {
- window.history.back();
- return false;
- });
});
--- a/src/jocondelab/static/jocondelab/js/front-timeline.js Fri Oct 11 18:04:02 2013 +0200
+++ b/src/jocondelab/static/jocondelab/js/front-timeline.js Mon Oct 14 17:39:06 2013 +0200
@@ -169,8 +169,8 @@
var itemTpl = _.template(
'<li class="timeline-item"><div class="timeline-item-box<%- current ? " timeline-current" : "" %>"'
- + ' data-dbpedia-uri="<%- item.dbpedia_uri %>" style="left: <%- left %>px; width: <%- width %>px;">'
- + '<div class="timeline-item-label"><%- item.label %></div></div></li>'
+ + ' data-dbpedia-uri="<%- dbpedia_uri %>" style="left: <%- left %>px; width: <%- width %>px;">'
+ + '<div class="timeline-item-label"><%- label %></div></div></li>'
);
function redrawView() {
@@ -240,7 +240,7 @@
/* Now displaying the different terms that we will show on the timeline */
var html = _(tlCache).chain()
.filter(function(item) { // Only show those within the range
- return (item.end_year >= fromYear && item.start_year <= toYear);
+ return (item.end_year >= fromYear && item.start_year <= toYear && item.label);
}).first(itemCount) // Take the first 12
.sortBy(function(item) { // Sort by mean year
return (item.start_year + item.end_year);
@@ -249,7 +249,8 @@
r = Math.min(cWidth, Math.max(0, yrToX(item.end_year + 1)));
return itemTpl({
current: (item.dbpedia_uri == currentTerm),
- item: item,
+ dbpedia_uri: item.dbpedia_uri,
+ label: (item.label.length > 24) ? item.label.substr(0,20) + '…' : item.label,
left: Math.min(l,r),
width: Math.abs(r-l)
});
--- a/src/jocondelab/templates/jocondelab/front_base.html Fri Oct 11 18:04:02 2013 +0200
+++ b/src/jocondelab/templates/jocondelab/front_base.html Mon Oct 14 17:39:06 2013 +0200
@@ -42,7 +42,7 @@
</head>
<body>
{% block body %}
- <div class="language-menu-wrapper">
+ <div class="menu-wrapper language-menu-wrapper">
<ul class="language-menu menu-list">
{% get_language_info_list for LANGUAGES as languages %}
{% for language in languages %}
@@ -67,9 +67,11 @@
<td class="menu-link language-menu-link">
<a href="#" title="{% trans 'Changer de langue' %}"></a>
</td>
+ {% block main_menu_link %}
<td class="menu-link main-menu-link">
<a href="#" title="{% trans 'Menu' %}"></a>
</td>
+ {% endblock %}
</tr>
</table>
<h1><a href="{% url 'front_home' %}">Joconde<span class="title-lab">Lab</span></a></h1>
@@ -82,11 +84,11 @@
{% csrf_token %}
<input class="language-input" type="hidden" name="language" value="{% if lang %}{{lang|slice:':2'}}{% else %}{{LANGUAGE_CODE|slice:':2'}}{% endif %}" />
</form>
- <div class="menus-wrapper">
+ {% block main_menu %}
+ <div class="menu-wrapper main-menu-wrapper">
<ul class="main-menu menu-list">
- {% url 'front_home' as url %}
- <li class="menu-item{% if request.path == url %} menu-item-current{% endif %}">
- <a href="{{url}}">{% trans 'Accueil' %}</a>
+ <li class="menu-item">
+ <a href="{% url 'front_home' %}">{% trans 'Accueil' %}</a>
</li>
{% url 'front_about' as url %}
<li class="menu-item{% if request.path == url %} menu-item-current{% endif %}">
@@ -113,6 +115,7 @@
</li>
</ul>
</div>
+ {% endblock %}
<div class="main-wrapper">
<section class="main">
{% block main %}
--- a/src/jocondelab/templates/jocondelab/front_credits.html Fri Oct 11 18:04:02 2013 +0200
+++ b/src/jocondelab/templates/jocondelab/front_credits.html Mon Oct 14 17:39:06 2013 +0200
@@ -17,7 +17,7 @@
</div>
<div class="credits-section">
- <h2>Métier</h2>
+ <h2>Équipe responsable du site Joconde</h2>
<h3>Direction générale des patrimoines – Service des musées de France - Sous-direction des collections - Bureau de la diffusion numérique des collections</h3>
<ul>
<li>
@@ -51,7 +51,7 @@
<h3>Secrétariat général - Sous-direction des systèmes d'information</h3>
<ul>
<li>
- <span class="person-role">Secrétariat général - Sous-direction des systèmes d'informationSous-directeur :</span>
+ <span class="person-role">Sous-directeur :</span>
<span class="person-name">Jean-Séverin LAIR</span>
</li>
<li>
--- a/src/jocondelab/templates/jocondelab/front_home.html Fri Oct 11 18:04:02 2013 +0200
+++ b/src/jocondelab/templates/jocondelab/front_home.html Mon Oct 14 17:39:06 2013 +0200
@@ -15,6 +15,9 @@
{% block breadcrumbs %}<a href="{% url 'front_home' %}">{% trans 'Accueil' %}</a>{% endblock %}
+{% block main_menu %}{% endblock %}
+{% block main_menu_link %}{% endblock %}
+
{% block main %}
<div class="hide-on-search">
<h2 class="about-jl">{% trans 'Bienvenue sur JocondeLab' %}</h2>
--- a/src/jocondelab/templates/jocondelab/front_notice.html Fri Oct 11 18:04:02 2013 +0200
+++ b/src/jocondelab/templates/jocondelab/front_notice.html Mon Oct 14 17:39:06 2013 +0200
@@ -37,7 +37,6 @@
{% 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 %}
--- a/src/jocondelab/templates/jocondelab/partial/notice_list.html Fri Oct 11 18:04:02 2013 +0200
+++ b/src/jocondelab/templates/jocondelab/partial/notice_list.html Mon Oct 14 17:39:06 2013 +0200
@@ -8,26 +8,17 @@
</a>
<div class="notice-metadata">
<ul>
- {% 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>
- {% else %}
- <p class="notice-terms-list" dir="ltr">{{notice.author}}</p>
- {% endif %}
- </li>
- {% endif %}
- {% if notice.terms_by_thesaurus.ECOL %}
+ {% if notice.terms_by_thesaurus.AUTR.translated or notice.terms_by_thesaurus.AUTR.untranslated %}
<li class="notice-thesaurus">
- <h3>{% trans 'École :' %}</h3>
<ul class="notice-term-list">
- {% for term in notice.terms_by_thesaurus.ECOL %}
- <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>
+ <li class="notice-label">{% trans 'Artiste(s) :' %}</li>
+ {% for term in notice.terms_by_thesaurus.AUTR.translated %}
+ <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 %}
+ {% for term in notice.terms_by_thesaurus.AUTR.untranslated %}
+ <li class="notice-term term-untranslated" dir="ltr">{{term.label}}</li>
{% endfor %}
</ul>
</li>
@@ -35,53 +26,55 @@
{% 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>
+ <a href="{% url 'front_notice' notice.id %}"><span class="notice-title" dir="ltr">{{notice.title|truncatechars:60}}</span></a>
</h2>
<ul>
{% endif %}
- {% if notice.terms_by_thesaurus.DOMN %}
+ {% if notice.terms_by_thesaurus.DOMN.translated %}
<li class="notice-thesaurus">
- <h3>{% trans 'Domaine(s) :' %}</h3>
<ul class="notice-term-list">
- {% for term in notice.terms_by_thesaurus.DOMN %}
- <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>
- {% 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>
- <ul class="notice-term-list">
- {% for term in notice.terms_by_thesaurus.REPR %}
- <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>
+ <li class="notice-label">{% trans 'Domaine(s) :' %}</li>
+ {% for term in notice.terms_by_thesaurus.DOMN.translated %}
+ <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>
{% endif %}
- {% if notice.terms_by_thesaurus.SREP %}
- <li class="notice-thesaurus">
- <h3>{% trans 'Source :' %}</h3>
- <ul class="notice-term-list">
- {% for term in notice.terms_by_thesaurus.SREP %}
- <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>
+ {% if notice.designation and not notice.title %}
+ <li class="notice-thesaurus">
+ <ul class="notice-term-list">
+ <li class="notice-label">{% trans 'Désignation :' %}</li>
+ <li class="notice-term term-untranslated" dir="ltr">{{notice.designation}}</li>
+ </ul>
+ </li>
+ {% endif %}
+ {% if notice.terms_by_thesaurus.REPR.translated %}
+ <li class="notice-thesaurus">
+ <ul class="notice-term-list">
+ <li class="notice-label">{% trans 'Sujet représenté :' %}</li>
+ {% for term in notice.terms_by_thesaurus.REPR.translated|slice:":8" %}
+ <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 %}
+ {% if notice.terms_by_thesaurus.REPR.translated|length > 8 %}
+ <li class="notice-term term-untranslated">
+ <a href="{% url 'front_notice' notice.id %}" title="{{notice.imagetitle}}">…</a>
+ </li>
+ {% endif %}
+ </ul>
+ </li>
{% endif %}
{% if notice.datation or notice.years %}
<li class="notice-thesaurus">
- <h3>{% trans 'Datation :' %}</h3>
<ul class="notice-term-list">
+ <li class="notice-label">{% trans 'Datation :' %}</li>
{% for term in notice.datation %}
- <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>
+ <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 %}
{% if notice.years %}
{% endif %}
@@ -89,16 +82,6 @@
</ul>
</li>
{% endif %}
- {% if notice.terms_by_thesaurus.LIEUX %}
- <li class="notice-thesaurus">
- <h3>{% trans 'Provenance :' %}</h3>
- <ul class="notice-term-list">
- {% for term in notice.terms_by_thesaurus.LIEUX %}
- <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>
- {% endif %}
</ul>
</div>
</div>
--- a/src/jocondelab/views/ajax.py Fri Oct 11 18:04:02 2013 +0200
+++ b/src/jocondelab/views/ajax.py Mon Oct 14 17:39:06 2013 +0200
@@ -6,7 +6,7 @@
'''
from jocondelab.models import DbpediaYears, DbpediaGeo, DbpediaFields, ContributedTerm, ContributedFields, Contribution
-from core.models import Notice, Term, Thesaurus
+from core.models import Notice, Thesaurus
import django.utils.simplejson as json
from django.core.paginator import Paginator
from django.http import HttpResponse
--- a/src/jocondelab/views/front_office.py Fri Oct 11 18:04:02 2013 +0200
+++ b/src/jocondelab/views/front_office.py Mon Oct 14 17:39:06 2013 +0200
@@ -17,6 +17,28 @@
from django.utils.translation import ugettext
from django.utils.http import urlencode
+def get_terms_by_thesaurus(notice, lang):
+ termsbythesaurus = {}
+ for nt in Term.objects.filter(noticeterm__notice=notice, dbpedia_fields=None).select_related('thesaurus').order_by('label').distinct():
+ term = {
+ "thesaurus": nt.thesaurus.label,
+ "dbpedia_uri": nt.dbpedia_uri,
+ "translated": False,
+ "label": nt.label
+ }
+ th = termsbythesaurus.setdefault(term["thesaurus"], { "translated": [], "untranslated": [] })
+ th["untranslated"].append(term)
+ for nt in Term.objects.filter(noticeterm__notice=notice, dbpedia_fields__language_code=lang).select_related('thesaurus,dbpedia_fields').order_by('dbpedia_fields__label').distinct():
+ term = {
+ "thesaurus": nt.thesaurus.label,
+ "dbpedia_uri": nt.dbpedia_uri,
+ "translated": True,
+ "label": nt.dbpedia_fields.get(language_code = lang).label
+ }
+ th = termsbythesaurus.setdefault(term["thesaurus"], { "translated": [], "untranslated": [] })
+ th["translated"].append(term)
+ return termsbythesaurus
+
class SearchView(TemplateView):
# This view is used for
@@ -99,18 +121,8 @@
context["page_count"] = paginator.num_pages
notices = []
- thesauruscache = {th.id: th.label for th in Thesaurus.objects.all()}
for n in ns:
- terms = [{
- "label": t.dbpedia_fields.get(language_code=lang).label,
- "thesaurus": thesauruscache[t.thesaurus_id],
- "dbpedia_uri": t.dbpedia_uri
- } for t in Term.objects.filter(noticeterm__notice=n,dbpedia_fields__language_code=lang).order_by('dbpedia_fields__label').distinct()]
- termsbythesaurus = {}
- for term in terms:
- if term['label'] is not None:
- th = termsbythesaurus.setdefault(term["thesaurus"], [])
- th.append(term)
+ termsbythesaurus = get_terms_by_thesaurus(n, lang)
noticedict = {
"id": n.id,
"title": n.titr,
@@ -118,7 +130,7 @@
"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",[])
+ "datation": termsbythesaurus.get("PERI",{}).get("translated",[]) + termsbythesaurus.get("EPOQ",{}).get("translated",[])
}
noticedict['image_title'] = noticedict['title'] if noticedict['title'] else noticedict['designation']
if show_years and n.years.exists():
@@ -153,27 +165,7 @@
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 = {}
- for nt in Term.objects.filter(noticeterm__notice=self.object, dbpedia_fields=None).select_related('thesaurus').order_by('label').distinct():
- term = {
- "thesaurus": nt.thesaurus.label,
- "dbpedia_uri": nt.dbpedia_uri,
- "translated": False,
- "label": nt.label
- }
- th = termsbythesaurus.setdefault(term["thesaurus"], { "translated": [], "untranslated": [] })
- th["untranslated"].append(term)
- for nt in Term.objects.filter(noticeterm__notice=self.object, dbpedia_fields__language_code=lang).select_related('thesaurus,dbpedia_fields').order_by('dbpedia_fields__label').distinct():
- term = {
- "thesaurus": nt.thesaurus.label,
- "dbpedia_uri": nt.dbpedia_uri,
- "translated": True,
- "label": nt.dbpedia_fields.get(language_code = lang).label
- }
- th = termsbythesaurus.setdefault(term["thesaurus"], { "translated": [], "untranslated": [] })
- th["translated"].append(term)
- context["terms_by_thesaurus"] = termsbythesaurus
+ context["terms_by_thesaurus"] = get_terms_by_thesaurus(self.object, lang)
if self.show_contributions:
cqs = self.object.contribution_set.select_related('term__dbpedia_fields')