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)
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)

View File

@ -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()]
}

View File

@ -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',
)
@ -159,7 +159,7 @@ INSTALLED_APPS = (
# 'boxes',
'frontpage',
# 'solango',
'multilingual',
# 'multilingual',
# 'multilingual.flatpages',
'django_extensions',
'debug_toolbar',

View File

@ -30,11 +30,16 @@ $('#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 = $('<img />').attr("src", bigImage);
var $img = $('<img />').attr("src", bigImage);
$('#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 %}
<div class="itfInfo">
{% 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 %}
{% thumbnail s.image "164x114" crop="center" as im %}
<img class="itfInfoImg" src="{{ im.url }}" />
@ -12,7 +12,7 @@
<div class="thumbsGallery">
{% for img in images %}
{% 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 %}
{% endfor %}
</div>

View File

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

View File

@ -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