--- a/src/jocondelab/locale/ar/LC_MESSAGES/django.po Mon Nov 18 17:00:19 2013 +0100
+++ b/src/jocondelab/locale/ar/LC_MESSAGES/django.po Thu Nov 21 18:55:22 2013 +0100
@@ -565,7 +565,7 @@
msgstr ""
#: templates/jocondelab/front_termlist.html:22
-msgid "Nuage de mots"
+msgid "Nuage"
msgstr ""
#: templates/jocondelab/front_termlist.html:25
Binary file src/jocondelab/locale/fr/LC_MESSAGES/django.mo has changed
--- a/src/jocondelab/locale/fr/LC_MESSAGES/django.po Mon Nov 18 17:00:19 2013 +0100
+++ b/src/jocondelab/locale/fr/LC_MESSAGES/django.po Thu Nov 21 18:55:22 2013 +0100
@@ -418,7 +418,7 @@
#: templates/jocondelab/front_termlist.html:22
msgid "Nuage"
-msgstr "Nuage"
+msgstr "Nuage de mots"
#: templates/jocondelab/front_termlist.html:25
msgid "Artistes"
--- a/src/jocondelab/static/jocondelab/css/front-common.css Mon Nov 18 17:00:19 2013 +0100
+++ b/src/jocondelab/static/jocondelab/css/front-common.css Thu Nov 21 18:55:22 2013 +0100
@@ -393,6 +393,12 @@
.notice-image {
font-size: 10px;
}
+.visited {
+ opacity: 0.5;
+}
+.visited:hover {
+ opacity: 1;
+}
.notice-item.notice-hover {
overflow: visible;
--- a/src/jocondelab/static/jocondelab/js/front-search.js Mon Nov 18 17:00:19 2013 +0100
+++ b/src/jocondelab/static/jocondelab/js/front-search.js Thu Nov 21 18:55:22 2013 +0100
@@ -8,5 +8,22 @@
if (typeof queryobj === "object" && queryobj) {
scrollLoad(queryobj);
}
+ $(".update-ids").click(function(e){
+ var visited_ids = $("#visited_ids").val();
+ if(visited_ids==""){
+ $("#visited_ids").val(parseInt($(this).attr("data-id")));
+ }
+ else{
+ $("#visited_ids").val( visited_ids + "," + $(this).attr("data-id") );
+ }
+ });
-});
+ var visited_ids = $("#visited_ids").val().split(',');
+ $.each($(".notice-image"), function(i, e){
+ var im = $(e);
+ var a_par = im.parent();
+ if(visited_ids.indexOf(a_par.attr("data-id"))>=0){
+ im.addClass("visited");
+ }
+ });
+});
\ No newline at end of file
--- a/src/jocondelab/templates/jocondelab/front_search.html Mon Nov 18 17:00:19 2013 +0100
+++ b/src/jocondelab/templates/jocondelab/front_search.html Thu Nov 21 18:55:22 2013 +0100
@@ -20,9 +20,10 @@
{% block main %}
- <form class="big-search-form search-form" action="{% url 'front_search' %}">
+ <form class="big-search-form search-form" action="{% url 'front_search' %}" autocomplete="off">
<input class="big-search-input search-input" type="search" name="q" value="{{searchterms_input}}" placeholder="{% trans 'Rechercher' %}" />
</form>
+ <input type="hidden" id="visited_ids" value="{% if request.session.history %}{{ request.session.history|join:',' }}{% endif %}" />
<div class="results">{% include 'jocondelab/partial/wrapped_notice_list.html' %}</div>
--- a/src/jocondelab/templates/jocondelab/front_termlist.html Mon Nov 18 17:00:19 2013 +0100
+++ b/src/jocondelab/templates/jocondelab/front_termlist.html Thu Nov 21 18:55:22 2013 +0100
@@ -19,7 +19,7 @@
<ul class="term-tabs">
<li class="term-tab{% if thesaurus == None %} active{% endif %}">
- <h2><a href="{% url 'front_termlist' %}">{% trans "Nuage de mots" %}</a></h2>
+ <h2><a href="{% url 'front_termlist' %}">{% trans "Nuage" %}</a></h2>
</li>
<li class="term-tab{% if thesaurus == 'AUTR' %} active{% endif %}">
<h2><a href="{% url 'front_termlist' %}?thesaurus=AUTR">{% trans "Artistes" %}</a></h2>
--- a/src/jocondelab/templates/jocondelab/partial/notice_list.html Mon Nov 18 17:00:19 2013 +0100
+++ b/src/jocondelab/templates/jocondelab/partial/notice_list.html Thu Nov 21 18:55:22 2013 +0100
@@ -3,7 +3,7 @@
{% for notice in notices %}
<li class="notice-item" data-notice-id="{{notice.id}}">
<div class="notice-contents">
- <a href="{% url 'front_notice' notice.id %}" title="{{notice.imagetitle}}">
+ <a href="{% url 'front_notice' notice.id %}" class="update-ids" data-id="{{ notice.id }}" title="{{notice.imagetitle}}">
<img class="notice-image" alt="{{notice.imagetitle}}" src="{{notice.image}}" onerror="window.onResultImageError(this);" />
</a>
<div class="notice-metadata">
@@ -26,7 +26,7 @@
{% if notice.title %}
</ul>
<h2>
- <a href="{% url 'front_notice' notice.id %}"><span class="notice-title" dir="ltr">{{notice.title|truncatechars:60}}</span></a>
+ <a href="{% url 'front_notice' notice.id %}" class="update-ids" data-id="{{ notice.id }}"><span class="notice-title" dir="ltr">{{notice.title|truncatechars:60}}</span></a>
</h2>
<ul>
{% endif %}
@@ -61,7 +61,7 @@
{% 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>
+ <a href="{% url 'front_notice' notice.id %}" class="update-ids" data-id="{{ notice.id }}" title="{{notice.imagetitle}}">…</a>
</li>
{% endif %}
</ul>
--- a/src/jocondelab/views/front_office.py Mon Nov 18 17:00:19 2013 +0100
+++ b/src/jocondelab/views/front_office.py Thu Nov 21 18:55:22 2013 +0100
@@ -55,7 +55,7 @@
# - ajax-fetched results
def get(self, request):
-
+
context = {}
lang = request.GET.get('lang',request.LANGUAGE_CODE)[:2]
page = request.GET.get('page',1)
@@ -145,11 +145,14 @@
context["searchterms_label"] = ugettext(u" ET ").join(searchterms)
context["searchterms_input"] = u";".join(searchterms)
context["uri_cache"] = json.dumps(uri_cache)
- qs = qs.order_by('id').distinct()
- paginator = Paginator(qs, npp)
+
+ #TODO: test if paginator has page to avoid error
+ paginator = Paginator(qs.values_list('id', flat=True).order_by('id').distinct(), npp)
+ ids = paginator.page(page)
+ context["page_count"] = paginator.num_pages
context["count"] = paginator.count
- ns = paginator.page(page)
- context["page_count"] = paginator.num_pages
+ # Now that we have the list of ids
+ ns = Notice.objects.filter(pk__in=ids).extra(select={'relative_url': '"core_noticeimage"."relative_url"'}).filter(image=True).filter(images__main=True).order_by('id')
notices = []
termsbythesaurus = get_terms_by_thesaurus(ns, lang)
@@ -168,7 +171,7 @@
noticedict["years"] = [n.years.all()[0].start_year, n.years.all()[0].end_year]
notices.append(noticedict)
context["notices"] = notices
-
+
return self.render_to_response(context)
class GeoView(TemplateView):
@@ -212,7 +215,8 @@
context['wikipedia_urls'] = json.dumps(settings.WIKIPEDIA_URLS)
context['JOCONDE_NOTICE_BASE_URL'] = settings.JOCONDE_NOTICE_BASE_URL
- notice_history = self.request.session.get('notice_history',[])
+ # History for describe view
+ notice_history = self.request.session.get('notice_history',[])
if self.object.id in notice_history:
p = notice_history.index(self.object.id)
if p < len(notice_history) - 1:
@@ -220,6 +224,12 @@
if p > 0:
context['prev_notice'] = notice_history[p - 1]
+ # History for notices
+ h = self.request.session.setdefault('history', [])
+ if self.object.id not in h:
+ h.append(self.object.id)
+ self.request.session['history'] = h
+
return context
def describe_view(request):