summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdolfo Fitoria <adolfo.fitoria@gmail.com>2011-08-09 10:36:48 -0400
committerAdolfo Fitoria <adolfo.fitoria@gmail.com>2011-08-09 11:27:44 -0400
commit5b4841cf29eb62cbdc1cf86f07aac0a228420bb4 (patch)
treea9977b118cb9adc50ca2aaeb4afc65e53abd5e73
parent80583252e09a325a298a8253ef0f32d9ec6b8dc0 (diff)
downloadaskbot-5b4841cf29eb62cbdc1cf86f07aac0a228420bb4.tar.gz
askbot-5b4841cf29eb62cbdc1cf86f07aac0a228420bb4.tar.bz2
askbot-5b4841cf29eb62cbdc1cf86f07aac0a228420bb4.zip
fixing diff problem, fixing spacing, style details
-rw-r--r--askbot/models/answer.py2
-rw-r--r--askbot/models/base.py10
-rw-r--r--askbot/models/question.py22
-rw-r--r--askbot/skins/default/media/style/style.css13
-rw-r--r--askbot/skins/default/templates/user_profile/user_inbox.html8
5 files changed, 39 insertions, 16 deletions
diff --git a/askbot/models/answer.py b/askbot/models/answer.py
index b07f8d25..6a2cceee 100644
--- a/askbot/models/answer.py
+++ b/askbot/models/answer.py
@@ -310,7 +310,7 @@ class AnswerRevision(ContentRevision):
def get_question_title(self):
return self.answer.question.title
- def as_html(self):
+ def as_html(self, **kwargs):
markdowner = markup.get_parser()
return sanitize_html(markdowner.convert(self.text))
diff --git a/askbot/models/base.py b/askbot/models/base.py
index 3af19318..53d5918b 100644
--- a/askbot/models/base.py
+++ b/askbot/models/base.py
@@ -8,7 +8,7 @@ from django.contrib.contenttypes.models import ContentType
from django.contrib.sitemaps import ping_google
#todo: maybe merge askbot.utils.markup and forum.utils.html
from askbot.utils import markup
-from askbot.utils.diff import textDiff
+from askbot.utils.diff import textDiff as htmldiff
from askbot.utils.html import sanitize_html
from django.utils import html
import logging
@@ -126,10 +126,10 @@ def parse_and_save_post(post, author = None, **kwargs):
#this save must precede saving the mention activity
#because generic relation needs primary key of the related object
if post.post_type != 'comment':
- last_revision = post.get_latest_revision().as_html()
+ last_revision = post.revisions.all().order_by('-revised_at')[1].as_html(include_tags=False)
super(post.__class__, post).save(**kwargs)
- current_revision = post.get_latest_revision().as_html()
- diff = textDiff(current_revision, last_revision)
+ current_revision = post.get_latest_revision().as_html(include_tags=False)
+ diff = htmldiff(last_revision, current_revision)
else:
#we get comments
super(post.__class__, post).save(**kwargs)
@@ -242,7 +242,7 @@ class ContentRevision(models.Model):
abstract = True
app_label = 'askbot'
- def as_html(self):
+ def as_html(self, **kwargs):
"""should return html representation of
the revision
"""
diff --git a/askbot/models/question.py b/askbot/models/question.py
index df1698d3..330d3fdb 100644
--- a/askbot/models/question.py
+++ b/askbot/models/question.py
@@ -965,6 +965,8 @@ class FavoriteQuestion(models.Model):
QUESTION_REVISION_TEMPLATE = ('<h3>%(title)s</h3>\n'
'<div class="text">%(html)s</div>\n'
'<div class="tags">%(tags)s</div>')
+QUESTION_REVISION_TEMPLATE_NO_TAGS = ('<h3>%(title)s</h3>\n'
+ '<div class="text">%(html)s</div>\n')
class QuestionRevision(ContentRevision):
"""A revision of a Question."""
question = models.ForeignKey(Question, related_name='revisions')
@@ -983,14 +985,20 @@ class QuestionRevision(ContentRevision):
#print 'in QuestionRevision.get_absolute_url()'
return reverse('question_revisions', args=[self.question.id])
- def as_html(self):
+ def as_html(self, include_tags=True):
markdowner = markup.get_parser()
- return QUESTION_REVISION_TEMPLATE % {
- 'title': self.title,
- 'html': sanitize_html(markdowner.convert(self.text)),
- 'tags': ' '.join(['<a class="post-tag">%s</a>' % tag
- for tag in self.tagnames.split(' ')]),
- }
+ if include_tags:
+ return QUESTION_REVISION_TEMPLATE % {
+ 'title': self.title,
+ 'html': sanitize_html(markdowner.convert(self.text)),
+ 'tags': ' '.join(['<a class="post-tag">%s</a>' % tag
+ for tag in self.tagnames.split(' ')]),
+ }
+ else:
+ return QUESTION_REVISION_TEMPLATE_NO_TAGS % {
+ 'title': self.title,
+ 'html': sanitize_html(markdowner.convert(self.text))
+ }
def save(self, **kwargs):
"""Looks up the next available revision number."""
diff --git a/askbot/skins/default/media/style/style.css b/askbot/skins/default/media/style/style.css
index 7214d52f..40475ec5 100644
--- a/askbot/skins/default/media/style/style.css
+++ b/askbot/skins/default/media/style/style.css
@@ -1453,6 +1453,10 @@ ins {
background-color: #97ff97;
}
+ins p{
+ background-color: #97ff97;
+}
+
ins .post-tag {
background-color: #97ff97;
}
@@ -2198,9 +2202,18 @@ img.gravatar {
overflow:hidden;
}
+.response-parent {
+ margin-top: 18px;
+}
+
+.response-parent strong{
+ font-size: 20px;
+}
+
.re {
min-height: 57px;
clear: both;
+ margin-top: 10px;
}
#responses input {
diff --git a/askbot/skins/default/templates/user_profile/user_inbox.html b/askbot/skins/default/templates/user_profile/user_inbox.html
index d2b422c3..4743a4c1 100644
--- a/askbot/skins/default/templates/user_profile/user_inbox.html
+++ b/askbot/skins/default/templates/user_profile/user_inbox.html
@@ -58,8 +58,9 @@ inbox_section - forum|flags
{% endif %}
<div id="responses">
{% for response in responses %}
+ <div class="response-parent">
<p class="headline">
- <strong>"{{ response.response_title|escape}}"</strong>
+ <strong>"{{ response.response_title.strip()|escape}}"</strong>
</p>
<div id="re_{{response.id}}" class="re{% if response.is_new %} new highlight{% else %} seen{% endif %}">
{% if inbox_section == 'forum' %}<input type="checkbox" />{% endif %}
@@ -70,7 +71,7 @@ inbox_section - forum|flags
<a style="text-decoration:none;" href="{{ response.response_url }}">
{{ response.response_type }}
({{ response.timestamp|diff_date(3, True) }}):<br/>
- {{ response.response_snippet }}
+ {{ response.response_snippet}}
</a>
</div>
{% if response.nested_responses %}
@@ -84,11 +85,12 @@ inbox_section - forum|flags
<a style="text-decoration:none;" href="{{ nested_response.response_url }}">
{{ nested_response.response_type }}
({{ nested_response.timestamp|diff_date(3, True) }}):<br/>
- {{ nested_response.response_snippet }}
+ {{ nested_response.response_snippet}}
</a>
</div>
{%endfor%}
{%endif%}
+ </div>
{% endfor %}
</div>
</div>