# HG changeset patch # User cavaliet # Date 1385056522 -3600 # Node ID 0b189e9c7b6808e697176ce27f3f415126eaca46 # Parent 0eadf9fd94af208b542a217d1dbd8889acc76f44 optimizations and various debug : 0018148 and 0018217 diff -r 0eadf9fd94af -r 0b189e9c7b68 src/jocondelab/locale/ar/LC_MESSAGES/django.po --- 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 diff -r 0eadf9fd94af -r 0b189e9c7b68 src/jocondelab/locale/fr/LC_MESSAGES/django.mo Binary file src/jocondelab/locale/fr/LC_MESSAGES/django.mo has changed diff -r 0eadf9fd94af -r 0b189e9c7b68 src/jocondelab/locale/fr/LC_MESSAGES/django.po --- 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" diff -r 0eadf9fd94af -r 0b189e9c7b68 src/jocondelab/static/jocondelab/css/front-common.css --- 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; diff -r 0eadf9fd94af -r 0b189e9c7b68 src/jocondelab/static/jocondelab/js/front-search.js --- 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 diff -r 0eadf9fd94af -r 0b189e9c7b68 src/jocondelab/templates/jocondelab/front_search.html --- 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 %} -
+
+
{% include 'jocondelab/partial/wrapped_notice_list.html' %}
diff -r 0eadf9fd94af -r 0b189e9c7b68 src/jocondelab/templates/jocondelab/front_termlist.html --- 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 @@

- {{notice.title|truncatechars:60}} + {{notice.title|truncatechars:60}}

diff -r 0eadf9fd94af -r 0b189e9c7b68 src/jocondelab/views/front_office.py --- 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):