summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdolfo Fitoria <adolfo.fitoria@gmail.com>2011-10-06 11:26:30 -0300
committerAdolfo Fitoria <adolfo.fitoria@gmail.com>2011-10-06 11:26:30 -0300
commit63380501d5a17ed8efabd01ebb4dd450e5452b03 (patch)
tree4e105465ef276f00b8ece3cfebee083ceb1d8dbe
parent064b14586c520c96739fa0d85ce0afa09ee4288a (diff)
downloadaskbot-63380501d5a17ed8efabd01ebb4dd450e5452b03.tar.gz
askbot-63380501d5a17ed8efabd01ebb4dd450e5452b03.tar.bz2
askbot-63380501d5a17ed8efabd01ebb4dd450e5452b03.zip
Changed answers permalink.
Added hash flashing support for questions
-rw-r--r--askbot/models/answer.py2
-rw-r--r--askbot/skins/default/templates/macros.html2
-rw-r--r--askbot/skins/default/templates/main_page/javascript.html10
-rw-r--r--askbot/skins/default/templates/question.html11
4 files changed, 13 insertions, 12 deletions
diff --git a/askbot/models/answer.py b/askbot/models/answer.py
index 6a2cceee..b9b28f89 100644
--- a/askbot/models/answer.py
+++ b/askbot/models/answer.py
@@ -289,7 +289,7 @@ class Answer(content.Content, DeletableContent):
return self.question.title
def get_absolute_url(self):
- return u'%(base)s%(slug)s?answer=%(id)d#%(id)d' % \
+ return u'%(base)s%(slug)s?answer=%(id)d#answer-container-%(id)d' % \
{
'base': reverse('question', args=[self.question.id]),
'slug': django_urlquote(slugify(self.question.title)),
diff --git a/askbot/skins/default/templates/macros.html b/askbot/skins/default/templates/macros.html
index c56d1cc4..282553e4 100644
--- a/askbot/skins/default/templates/macros.html
+++ b/askbot/skins/default/templates/macros.html
@@ -411,7 +411,7 @@ poor design of the data or methods on data objects #}
{%- endmacro -%}
{%- macro question_summary(question, extra_class=None) -%}
- <div class="short-summary{% if extra_class %} {{extra_class}}{% endif %}">
+ <div class="short-summary{% if extra_class %} {{extra_class}}{% endif %}" id="question-{{question.id}}">
<div class="counts">
<div class="views
{% if question.view_count == 0 -%}
diff --git a/askbot/skins/default/templates/main_page/javascript.html b/askbot/skins/default/templates/main_page/javascript.html
index 14dfe3cd..4d39f233 100644
--- a/askbot/skins/default/templates/main_page/javascript.html
+++ b/askbot/skins/default/templates/main_page/javascript.html
@@ -13,7 +13,17 @@
var today = new Date();{#add timestamp to prevent browser caching #}
$.getJSON('{% url user_update_has_custom_avatar %}?t=' + today.getTime());
{% endif %}
+ animate_hashes();
});
+ $(window).bind('hashchange', animate_hashes);
+ function animate_hashes(){
+ var id_value = window.location.hash;
+ if (id_value != ""){
+ var previous_color = $(id_value).css('background-color');
+ $(id_value).animate({ backgroundColor: '#BEDA53' }, 500);
+ $(id_value).animate({backgroundColor: previous_color}, 500);
+ }
+ }
askbot['urls']['mark_interesting_tag'] = scriptUrl + '{% url mark_interesting_tag %}';
askbot['urls']['mark_ignored_tag'] = scriptUrl + '{% url mark_ignored_tag %}';
askbot['urls']['unmark_tag'] = scriptUrl + '{% url unmark_tag %}';
diff --git a/askbot/skins/default/templates/question.html b/askbot/skins/default/templates/question.html
index 7e97a074..3013cc8e 100644
--- a/askbot/skins/default/templates/question.html
+++ b/askbot/skins/default/templates/question.html
@@ -557,16 +557,7 @@
$(window).bind('hashchange', animate_hashes);
function animate_hashes(){
- var queryset = window.location.search.substring(1);
- var element_type = queryset.split('=')[0];
- var hash_value = window.location.hash.substring(1);
-
- if (element_type == 'answer'){
- var id_value = "#answer-container-" + hash_value;
- }else if(element_type == "comment"){
- var id_value = '#' + hash_value;
- }
-
+ var id_value = window.location.hash;
if (id_value != ""){
var previous_color = $(id_value).css('background-color');
$(id_value).animate({ backgroundColor: '#BEDA53' }, 500);