This commit is contained in:
Sanj 2011-10-12 20:40:44 +05:30
commit c109c02d58
8 changed files with 40 additions and 13 deletions

View File

@ -1,2 +0,0 @@
settings.py
.bzrlog

View File

@ -18,4 +18,19 @@ def link_bps(value):
value = value.replace(match, '', 1) value = value.replace(match, '', 1)
return value 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 = "<a class='bpRelated' href='%s' title='View related Best Practice story'>%s</a>" % (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) register.filter("link_bps", link_bps)

View File

@ -40,13 +40,17 @@ class ModuleTab(models.Model):
return self.model_class().get_list(options) return self.model_class().get_list(options)
def get_dict(self): def get_dict(self):
if self.model.has_list:
page = self.get_list({})
else:
page = None
return { return {
'id': self.id, 'id': self.id,
'slug': self.slug, 'slug': self.slug,
'title': self.title, 'title': self.title,
'text': self.text, 'text': self.text,
'has_list': self.model.has_list, '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()] 'sorts': [s.get_dict() for s in self.model.modelsort_set.all()]
} }

View File

@ -91,7 +91,7 @@ TEMPLATE_CONTEXT_PROCESSORS = (
"django.core.context_processors.debug", "django.core.context_processors.debug",
"django.core.context_processors.i18n", "django.core.context_processors.i18n",
"django.core.context_processors.media", "django.core.context_processors.media",
"multilingual.context_processors.multilingual", # "multilingual.context_processors.multilingual",
"frontpage.context_processors.menus" "frontpage.context_processors.menus"
) )
@ -120,7 +120,7 @@ MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware', 'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware',
'multilingual.middleware.DefaultLanguageMiddleware', # 'multilingual.middleware.DefaultLanguageMiddleware',
'debug_toolbar.middleware.DebugToolbarMiddleware', 'debug_toolbar.middleware.DebugToolbarMiddleware',
# 'djangologging.middleware.LoggingMiddleware', # 'djangologging.middleware.LoggingMiddleware',
) )
@ -159,7 +159,7 @@ INSTALLED_APPS = (
# 'boxes', # 'boxes',
'frontpage', 'frontpage',
# 'solango', # 'solango',
'multilingual', # 'multilingual',
# 'multilingual.flatpages', # 'multilingual.flatpages',
'django_extensions', 'django_extensions',
'debug_toolbar', 'debug_toolbar',

View File

@ -30,11 +30,16 @@ $('#listLeft ul li a').live("click", function() {
$('.thumbsDetails').live("click", function(e) { $('.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 bigImage = $(this).attr("data-bigimage");
var $img = $('<img />').attr("src", bigImage); var $img = $('<img />').attr("src", bigImage);
$('#lightbox, #lightboxPanel').fadeIn(400); $('#lightbox, #lightboxPanel').fadeIn(400);
$('#lightboxPanel').empty().append($img); $('#lightboxPanel').empty().append($img);
var title = $(this).hasAttr("title") ? $(this).attr("title") : '';
if (title != '') {
var $caption = $('<div />').addClass("lightboxCaption").text(title).appendTo($('#lightboxPanel'));
}
}); });
@ -399,3 +404,8 @@ jQuery.fn.selectOption = function(value) {
} }
}); });
} }
jQuery.fn.hasAttr = function(name) {
return this.attr(name) !== undefined;
};

View File

@ -1,7 +1,7 @@
{% load thumbnail %} {% load thumbnail %}
<div class="itfInfo"> <div class="itfInfo">
{% for s in stories %} {% for s in stories %}
<span class="orange">Story: </span><span class="ifInfoInfo">{{ s.text }}</span> <span class="orange">Story: </span><span class="ifInfoInfo">{{ s.text|linebreaksbr }}</span>
{% if s.image %} {% if s.image %}
{% thumbnail s.image "164x114" crop="center" as im %} {% thumbnail s.image "164x114" crop="center" as im %}
<img class="itfInfoImg" src="{{ im.url }}" /> <img class="itfInfoImg" src="{{ im.url }}" />
@ -12,7 +12,7 @@
<div class="thumbsGallery"> <div class="thumbsGallery">
{% for img in images %} {% for img in images %}
{% thumbnail img.image "164x114" crop="center" as im %} {% thumbnail img.image "164x114" crop="center" as im %}
<img src="{{ im.url }}" class="thumbsDetails" data-bigimage="{{ img.image.url }}"/> <img title="{{ img.caption }}" src="{{ im.url }}" class="thumbsDetails" data-bigimage="{{ img.image.url }}"/>
{% endthumbnail %} {% endthumbnail %}
{% endfor %} {% endfor %}
</div> </div>

View File

@ -17,6 +17,6 @@
</div> </div>
<div class=""> <div class="">
{% autoescape off %} {% autoescape off %}
{{ text|linebreaksbr|link_bps }} {{ text|linebreaksbr|abs_link_bps }}
{% endautoescape %} {% endautoescape %}
</div> </div>

View File

@ -1,6 +1,6 @@
-e svn+http://code.djangoproject.com/svn/django/branches/releases/1.2.X/#egg=django -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 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/python-firefogg/#egg=python-firefogg
-e bzr+http://firefogg.org/dev/django_firefogg/#egg=django_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 -e hg+https://django-ajax-filtered-fields.googlecode.com/hg/#egg=django-ajax-filtered-fields