# HG changeset patch # User veltr # Date 1354290552 -3600 # Node ID 32629f6a3b8244bbbd1e566eeff56639edee10d7 # Parent 4857ac3892e3a2ff3f7b56a59c99e8bcf83b1714# Parent 4e0dc6a0e0f35583dc8e5e6eebe50ec63d2c6286 Merge with 4e0dc6a0e0f35583dc8e5e6eebe50ec63d2c6286 diff -r 4857ac3892e3 -r 32629f6a3b82 src/hashcut/static/hashcut/bpi/css/common.css --- a/src/hashcut/static/hashcut/bpi/css/common.css Fri Nov 30 16:48:37 2012 +0100 +++ b/src/hashcut/static/hashcut/bpi/css/common.css Fri Nov 30 16:49:12 2012 +0100 @@ -415,6 +415,7 @@ color: #C81000; } .pagination{ + padding: 0 0 20px; text-align: center; } .pagination a{ diff -r 4857ac3892e3 -r 32629f6a3b82 src/hashcut/static/hashcut/iri/css/common.css --- a/src/hashcut/static/hashcut/iri/css/common.css Fri Nov 30 16:48:37 2012 +0100 +++ b/src/hashcut/static/hashcut/iri/css/common.css Fri Nov 30 16:49:12 2012 +0100 @@ -415,6 +415,7 @@ color: #C81000; } .pagination{ + padding: 0 0 20px; text-align: center; } .pagination a{ diff -r 4857ac3892e3 -r 32629f6a3b82 src/hashcut/templates/bpi_mashup_all_mashups.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/hashcut/templates/bpi_mashup_all_mashups.html Fri Nov 30 16:49:12 2012 +0100 @@ -0,0 +1,61 @@ +{% extends "bpi_mashup_home.html" %} +{% load static %} +{% load i18n %} +{% load analytics %} +{% load thumbnail %} +{% load front_tags %} + {% block title %}Tous les Hashcuts{% endblock %} + {% block css_page %} + + {% endblock %} + +{% block wrap_header %} +
+
+ {% include 'partial/bpi_mashup_popin_user.html' %} + {% include 'partial/bpi_hashcut_logo.html' %} +
+ +
+
+{% endblock %} + +{% block content %} +
+

Tous les Hashcuts

+ + + +
+ {% for m in results.object_list %} + + {% endfor %} +
+
+{% endblock %} + diff -r 4857ac3892e3 -r 32629f6a3b82 src/hashcut/templates/bpi_mashup_home.html --- a/src/hashcut/templates/bpi_mashup_home.html Fri Nov 30 16:48:37 2012 +0100 +++ b/src/hashcut/templates/bpi_mashup_home.html Fri Nov 30 16:49:12 2012 +0100 @@ -2,6 +2,7 @@ {% load i18n %} {% load analytics %} {% load thumbnail %} +{% load front_tags %} @@ -86,7 +87,7 @@ diff -r 4857ac3892e3 -r 32629f6a3b82 src/hashcut/templates/iri_mashup_all_mashups.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/hashcut/templates/iri_mashup_all_mashups.html Fri Nov 30 16:49:12 2012 +0100 @@ -0,0 +1,61 @@ +{% extends "iri_mashup_home.html" %} +{% load static %} +{% load i18n %} +{% load analytics %} +{% load thumbnail %} +{% load front_tags %} + {% block title %}Tous les Hashcuts{% endblock %} + {% block css_page %} + + {% endblock %} + +{% block wrap_header %} +
+
+ {% include 'partial/iri_mashup_popin_user.html' %} + {% include 'partial/iri_hashcut_logo.html' %} +
+ +
+
+{% endblock %} + +{% block content %} +
+

Tous les Hashcuts

+ + + +
+ {% for m in results.object_list %} + + {% endfor %} +
+
+{% endblock %} + diff -r 4857ac3892e3 -r 32629f6a3b82 src/hashcut/templates/iri_mashup_home.html --- a/src/hashcut/templates/iri_mashup_home.html Fri Nov 30 16:48:37 2012 +0100 +++ b/src/hashcut/templates/iri_mashup_home.html Fri Nov 30 16:49:12 2012 +0100 @@ -86,7 +86,7 @@ diff -r 4857ac3892e3 -r 32629f6a3b82 src/hashcut/urls.py --- a/src/hashcut/urls.py Fri Nov 30 16:48:37 2012 +0100 +++ b/src/hashcut/urls.py Fri Nov 30 16:49:12 2012 +0100 @@ -1,5 +1,5 @@ from django.conf.urls.defaults import patterns, url -from hashcut.views import MashupHome, MashupEdit, MashupHashcut, MashupContent, MashupProfile +from hashcut.views import MashupHome, MashupEdit, MashupHashcut, MashupContent, MashupProfile, MashupAllMashups urlpatterns = patterns('', url(r'^(?P.*)/edit/$', MashupEdit.as_view(), name="mashup_edit"), @@ -7,6 +7,7 @@ url(r'^(?P.*)/hashcut/(?P.*)/$', MashupHashcut.as_view(), name="mashup_hashcut"), url(r'^(?P.*)/media/(?P.*)/$', MashupContent.as_view(), name="mashup_content"), url(r'^(?P.*)/profile/(?P.*)/$', MashupProfile.as_view(), name="mashup_profile"), + url(r'^(?P.*)/all/$', MashupAllMashups.as_view(), name="mashup_all"), url(r'^(?P.*)/$', MashupHome.as_view(), name="mashup_home"), url(r'^$', MashupHome.as_view()), ) diff -r 4857ac3892e3 -r 32629f6a3b82 src/hashcut/views.py --- a/src/hashcut/views.py Fri Nov 30 16:48:37 2012 +0100 +++ b/src/hashcut/views.py Fri Nov 30 16:49:12 2012 +0100 @@ -1,4 +1,6 @@ +from django.conf import settings from django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist +from django.core.paginator import Paginator, InvalidPage, EmptyPage from django.http import HttpResponseNotFound from django.views.generic.base import View, TemplateResponseMixin from ldt.api.ldt.resources import ProjectResource @@ -235,5 +237,49 @@ context.update({"username":username, "mashups":mashups}) return self.render_to_response(context) + + +class MashupAllMashups(TemplateResponseMixin, MashupContextView): + + # iri = default brand name + branding = "iri" + template_suffix = "mashup_all_mashups.html" + template_name = "iri_mashup_all_mashups.html" + + def get_template_names(self): + """ + Return a list of template names to be used for the request. Must return + a list. May not be called if get_template is overridden. + """ + try: + names = super(MashupAllMashups, self).get_template_names() + except ImproperlyConfigured: + raise ImproperlyConfigured("Class MashupAllMashups requires either a definition of 'template_name'") + + # the branding template is supposed to override the default template. So we insert instead of append + if self.branding and self.branding != "": + names.insert(0,"%s_%s" % (self.branding, self.template_suffix)) + + return names + + def get(self, request, branding="iri", **kwargs): + page = request.GET.get("page") or 1 + self.branding = branding + brd = Branding.objects.get(name=self.branding) + + mashups = Mashup.objects.filter(branding=brd) + nb = getattr(settings, 'LDT_FRONT_MEDIA_PER_PAGE', 9) + if page=="x": + nb = mashups.count() + + paginator = Paginator(mashups, nb) + try: + results = paginator.page(page) + except (EmptyPage, InvalidPage): + results = paginator.page(paginator.num_pages) + + context = self.get_context_dict(request) + context.update({"results":results}) + return self.render_to_response(context) \ No newline at end of file