From c885d2911b59566f7cce62f000e0072ca14612a6 Mon Sep 17 00:00:00 2001 From: j Date: Tue, 11 Oct 2011 17:14:55 +0530 Subject: [PATCH 1/8] remove multilingual dependency, fix broken no has_list tabs --- itf/insidepages/models.py | 6 +++++- itf/settings.py | 2 +- requirements.txt | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/itf/insidepages/models.py b/itf/insidepages/models.py index 1d90a2d..9fa94a8 100755 --- a/itf/insidepages/models.py +++ b/itf/insidepages/models.py @@ -40,13 +40,17 @@ class ModuleTab(models.Model): return self.model_class().get_list(options) def get_dict(self): + if self.model.has_list: + page = self.get_list({}) + else: + page = None return { 'id': self.id, 'slug': self.slug, 'title': self.title, 'text': self.text, 'has_list': self.model.has_list, -# 'page': self.get_list({}), + 'page': self.get_list({}), 'sorts': [s.get_dict() for s in self.model.modelsort_set.all()] } diff --git a/itf/settings.py b/itf/settings.py index 59ac1aa..f6fa048 100755 --- a/itf/settings.py +++ b/itf/settings.py @@ -159,7 +159,7 @@ INSTALLED_APPS = ( # 'boxes', 'frontpage', # 'solango', - 'multilingual', +# 'multilingual', # 'multilingual.flatpages', 'django_extensions', 'debug_toolbar', diff --git a/requirements.txt b/requirements.txt index 5a5a21b..6a24189 100755 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ -e svn+http://code.djangoproject.com/svn/django/branches/releases/1.2.X/#egg=django -e bzr+http://code.0x2620.org/python-ox/#egg=python-ox --e svn+http://django-multilingual.googlecode.com/svn/trunk/#egg=multilingual +#-e svn+http://django-multilingual.googlecode.com/svn/trunk/#egg=multilingual -e bzr+http://firefogg.org/dev/python-firefogg/#egg=python-firefogg -e bzr+http://firefogg.org/dev/django_firefogg/#egg=django_firefogg -e hg+https://django-ajax-filtered-fields.googlecode.com/hg/#egg=django-ajax-filtered-fields From d09ac6b0e5a33a33a3d784c2fb847d9db75425de Mon Sep 17 00:00:00 2001 From: j Date: Tue, 11 Oct 2011 18:12:00 +0530 Subject: [PATCH 2/8] test image captions --- itf/static/js/insidepage.js | 7 +++++-- itf/templates/modules/bestpractices/bestpractice.html | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/itf/static/js/insidepage.js b/itf/static/js/insidepage.js index 4abe1c4..d4338a1 100755 --- a/itf/static/js/insidepage.js +++ b/itf/static/js/insidepage.js @@ -32,9 +32,12 @@ $('#listLeft ul li a').live("click", function() { $('.thumbsDetails').live("click", function(e) { // alert($(this).attr("data-bigimage")); var bigImage = $(this).attr("data-bigimage"); - var $img = $('').attr("src", bigImage); + var $img = $('').attr("src", bigImage); $('#lightbox, #lightboxPanel').fadeIn(400); - $('#lightboxPanel').empty().append($img); + $('#lightboxPanel').empty().append($img); + if ($(this).hasAttr("title")) { + var $caption = $('
').addClass("lightboxCaption").text($(this).attr("title")).appendTo($('#lightBoxPanel')); + } }); diff --git a/itf/templates/modules/bestpractices/bestpractice.html b/itf/templates/modules/bestpractices/bestpractice.html index 2389510..685d3c9 100755 --- a/itf/templates/modules/bestpractices/bestpractice.html +++ b/itf/templates/modules/bestpractices/bestpractice.html @@ -12,7 +12,7 @@
{% for img in images %} {% thumbnail img.image "164x114" crop="center" as im %} - + {% endthumbnail %} {% endfor %}
From de0fb3bc767a223924df37d4062dac50487f074b Mon Sep 17 00:00:00 2001 From: j Date: Tue, 11 Oct 2011 18:13:15 +0530 Subject: [PATCH 3/8] silly --- itf/static/js/insidepage.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/itf/static/js/insidepage.js b/itf/static/js/insidepage.js index d4338a1..df0bb76 100755 --- a/itf/static/js/insidepage.js +++ b/itf/static/js/insidepage.js @@ -36,7 +36,7 @@ $('.thumbsDetails').live("click", function(e) { $('#lightbox, #lightboxPanel').fadeIn(400); $('#lightboxPanel').empty().append($img); if ($(this).hasAttr("title")) { - var $caption = $('
').addClass("lightboxCaption").text($(this).attr("title")).appendTo($('#lightBoxPanel')); + var $caption = $('
').addClass("lightboxCaption").text($(this).attr("title")).appendTo($('#lightboxPanel')); } }); From 0b1ba2ed876c11df8aad70cfc9af52631c667582 Mon Sep 17 00:00:00 2001 From: j Date: Tue, 11 Oct 2011 18:15:41 +0530 Subject: [PATCH 4/8] silly --- itf/static/js/insidepage.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/itf/static/js/insidepage.js b/itf/static/js/insidepage.js index df0bb76..408c855 100755 --- a/itf/static/js/insidepage.js +++ b/itf/static/js/insidepage.js @@ -30,13 +30,15 @@ $('#listLeft ul li a').live("click", function() { $('.thumbsDetails').live("click", function(e) { -// alert($(this).attr("data-bigimage")); +// alert($(this).attr("data-bigimage")); + var that = this; var bigImage = $(this).attr("data-bigimage"); var $img = $('').attr("src", bigImage); $('#lightbox, #lightboxPanel').fadeIn(400); $('#lightboxPanel').empty().append($img); - if ($(this).hasAttr("title")) { - var $caption = $('
').addClass("lightboxCaption").text($(this).attr("title")).appendTo($('#lightboxPanel')); + var title = $(this).hasAttr("title") ? $(this).attr("title") : ''; + if (title != '') { + var $caption = $('
').addClass("lightboxCaption").text(title).appendTo($('#lightboxPanel')); } }); From 6f33e587c6bab03812816dcf6f0e5567be02533a Mon Sep 17 00:00:00 2001 From: j Date: Tue, 11 Oct 2011 18:17:21 +0530 Subject: [PATCH 5/8] hasAttr --- itf/static/js/insidepage.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/itf/static/js/insidepage.js b/itf/static/js/insidepage.js index 408c855..e098bf9 100755 --- a/itf/static/js/insidepage.js +++ b/itf/static/js/insidepage.js @@ -404,3 +404,8 @@ jQuery.fn.selectOption = function(value) { } }); } + +jQuery.fn.hasAttr = function(name) { + return this.attr(name) !== undefined; +}; + From 1b8bcd7000cfedf142e718aea56b865498ca5761 Mon Sep 17 00:00:00 2001 From: j Date: Tue, 11 Oct 2011 18:25:21 +0530 Subject: [PATCH 6/8] bp guidelines link to new site --- itf/bestpractices/templatetags/guidelines.py | 15 +++++++++++++++ .../modules/bestpractices/guideline.html | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/itf/bestpractices/templatetags/guidelines.py b/itf/bestpractices/templatetags/guidelines.py index b7ffde3..ab86ce3 100755 --- a/itf/bestpractices/templatetags/guidelines.py +++ b/itf/bestpractices/templatetags/guidelines.py @@ -18,4 +18,19 @@ def link_bps(value): value = value.replace(match, '', 1) return value +def abs_link_bps(value): + r = r'BP\:[0-9][0-9]?' + matches = re.findall(r, value) + for match in matches: + id = int(match.replace("BP:", "").strip()) + try: + bp = BestPractice.objects.get(pk=id) + title = bp.title + html = "%s" % (bp.get_absolute_url(), title,) + value = value.replace(match, html, 1) + except: + value = value.replace(match, '', 1) + return value + +register.filter("abs_link_bps", abs_link_bps) register.filter("link_bps", link_bps) diff --git a/itf/templates/modules/bestpractices/guideline.html b/itf/templates/modules/bestpractices/guideline.html index 4dbcf0d..476769b 100755 --- a/itf/templates/modules/bestpractices/guideline.html +++ b/itf/templates/modules/bestpractices/guideline.html @@ -17,6 +17,6 @@
{% autoescape off %} - {{ text|linebreaksbr|link_bps }} + {{ text|linebreaksbr|abs_link_bps }} {% endautoescape %}
From 92d50f6e252ff536e139e44d9d9366ef8f17599d Mon Sep 17 00:00:00 2001 From: j Date: Tue, 11 Oct 2011 19:34:30 +0530 Subject: [PATCH 7/8] linebreaksbr on stories --- itf/templates/modules/bestpractices/bestpractice.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/itf/templates/modules/bestpractices/bestpractice.html b/itf/templates/modules/bestpractices/bestpractice.html index 685d3c9..2dd5645 100755 --- a/itf/templates/modules/bestpractices/bestpractice.html +++ b/itf/templates/modules/bestpractices/bestpractice.html @@ -1,7 +1,7 @@ {% load thumbnail %}
{% for s in stories %} - Story: {{ s.text }} + Story: {{ s.text|linebreaksbr }} {% if s.image %} {% thumbnail s.image "164x114" crop="center" as im %} From f191ff55023e5ba94a455e13e6b37962a50d6f81 Mon Sep 17 00:00:00 2001 From: Karen Date: Wed, 12 Oct 2011 17:09:08 +0530 Subject: [PATCH 8/8] multilingual references removed from settings --- .bzrignore | 2 -- itf/settings.py | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) delete mode 100755 .bzrignore diff --git a/.bzrignore b/.bzrignore deleted file mode 100755 index fb38d95..0000000 --- a/.bzrignore +++ /dev/null @@ -1,2 +0,0 @@ -settings.py -.bzrlog diff --git a/itf/settings.py b/itf/settings.py index f6fa048..d4a5bb7 100755 --- a/itf/settings.py +++ b/itf/settings.py @@ -91,7 +91,7 @@ TEMPLATE_CONTEXT_PROCESSORS = ( "django.core.context_processors.debug", "django.core.context_processors.i18n", "django.core.context_processors.media", - "multilingual.context_processors.multilingual", +# "multilingual.context_processors.multilingual", "frontpage.context_processors.menus" ) @@ -120,7 +120,7 @@ MIDDLEWARE_CLASSES = ( 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', - 'multilingual.middleware.DefaultLanguageMiddleware', +# 'multilingual.middleware.DefaultLanguageMiddleware', 'debug_toolbar.middleware.DebugToolbarMiddleware', # 'djangologging.middleware.LoggingMiddleware', )