From c4eb3b0a2786fe169947fa10f24b9f35874e6653 Mon Sep 17 00:00:00 2001 From: Adolfo Fitoria Date: Fri, 7 Oct 2011 13:55:40 -0300 Subject: temporal --- askbot/skins/default/templates/macros.html | 4 ++-- askbot/skins/default/templates/main_page/javascript.html | 12 ++++++++++++ askbot/urls.py | 5 +++++ askbot/views/readers.py | 8 ++++++++ 4 files changed, 27 insertions(+), 2 deletions(-) diff --git a/askbot/skins/default/templates/macros.html b/askbot/skins/default/templates/macros.html index 282553e4..b868be38 100644 --- a/askbot/skins/default/templates/macros.html +++ b/askbot/skins/default/templates/macros.html @@ -459,12 +459,12 @@ poor design of the data or methods on data objects #} {% if question.is_anonymous %} {{ question.last_activity_by.get_anonymous_name() }} {% else %} - {{question.last_activity_by.username}}{{ user_country_flag(question.last_activity_by) }} + {{question.last_activity_by.username}}{{ user_country_flag(question.last_activity_by) }} {#{user_score_and_badge_summary(question.last_activity_by)}#} {% endif %} -

{{question.get_question_title()|escape}}

+

{{question.get_question_title()|escape}}

{{ tag_list_widget(question.get_tag_names()) }} {%- endmacro -%} diff --git a/askbot/skins/default/templates/main_page/javascript.html b/askbot/skins/default/templates/main_page/javascript.html index e7479e63..3ae5b55d 100644 --- a/askbot/skins/default/templates/main_page/javascript.html +++ b/askbot/skins/default/templates/main_page/javascript.html @@ -26,6 +26,18 @@ }); } } + + function load_question_body(element, question_id){ + var key = 'question-' + question_id; + if (askbot['data'][key] != null){ + $.getJSON('{% url get_question_body %}?id=' + question_id, function(data){ + element.title = data.text; + askbot['data'][key] = data.text; + }); + } else{ + element.title = askbot['data'][key]; + } + } 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/urls.py b/askbot/urls.py index c79f4f83..8c1e3c3a 100644 --- a/askbot/urls.py +++ b/askbot/urls.py @@ -140,6 +140,11 @@ urlpatterns = patterns('', views.readers.get_comment, name='get_comment' ), + url(#ajax only + r'^question/get_body/$', + views.readers.get_question_body, + name='get_question_body' + ), url( r'^%s$' % _('tags/'), views.readers.tags, diff --git a/askbot/views/readers.py b/askbot/views/readers.py index ab4ab87b..8e4dff95 100644 --- a/askbot/views/readers.py +++ b/askbot/views/readers.py @@ -634,3 +634,11 @@ def get_comment(request): comment = models.Comment.objects.get(id = id) request.user.assert_can_edit_comment(comment) return {'text': comment.comment} + +@ajax_only +@get_only +def get_question_body(request): + from jinja2 import escape + id = int(request.GET['id']) + question = models.Question.objects.get(id = id) + return {'text': escape(question.summary)} -- cgit v1.2.3-1-g7c22 From 1000a45fc2da936523bfcc4744076c6832d754aa Mon Sep 17 00:00:00 2001 From: Adolfo Fitoria Date: Fri, 7 Oct 2011 14:48:56 -0300 Subject: fixed bug produced by form --- askbot/forms.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/askbot/forms.py b/askbot/forms.py index b0517cce..0769f180 100644 --- a/askbot/forms.py +++ b/askbot/forms.py @@ -1092,7 +1092,6 @@ class SimpleEmailSubscribeForm(forms.Form): ) def __init__(self, *args, **kwargs): - self.frequency = kwargs.pop('frequency', 'w') super(SimpleEmailSubscribeForm, self).__init__(*args, **kwargs) def save(self, user=None): @@ -1101,7 +1100,7 @@ class SimpleEmailSubscribeForm(forms.Form): #with the frequency variable - needs to be fixed if self.is_bound and self.cleaned_data['subscribe'] == 'y': email_settings_form = EFF() - email_settings_form.set_frequency(self.frequency) + email_settings_form.set_initial_values(user) logging.debug('%s wants to subscribe' % user.username) else: email_settings_form = EFF(initial=EFF.NO_EMAIL_INITIAL) -- cgit v1.2.3-1-g7c22 From 713d5532da15879f3d2f5fb78a4486e4b1e80e71 Mon Sep 17 00:00:00 2001 From: Adolfo Fitoria Date: Fri, 7 Oct 2011 15:30:51 -0300 Subject: added support for caching question titles --- askbot/skins/default/templates/main_page/javascript.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/askbot/skins/default/templates/main_page/javascript.html b/askbot/skins/default/templates/main_page/javascript.html index 3ae5b55d..c42ac5f7 100644 --- a/askbot/skins/default/templates/main_page/javascript.html +++ b/askbot/skins/default/templates/main_page/javascript.html @@ -29,7 +29,7 @@ function load_question_body(element, question_id){ var key = 'question-' + question_id; - if (askbot['data'][key] != null){ + if (askbot['data'][key] == null){ $.getJSON('{% url get_question_body %}?id=' + question_id, function(data){ element.title = data.text; askbot['data'][key] = data.text; -- cgit v1.2.3-1-g7c22 From cc4bdf3d3338a65ff204e92f9a8d656fa4229d27 Mon Sep 17 00:00:00 2001 From: Adolfo Fitoria Date: Fri, 7 Oct 2011 17:18:21 -0300 Subject: reading all questions at once --- askbot/middleware/view_log.py | 4 ++-- askbot/skins/default/templates/main_page/javascript.html | 13 +++++++------ askbot/views/readers.py | 16 ++++++++++++---- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/askbot/middleware/view_log.py b/askbot/middleware/view_log.py index a1a32010..0880ae1b 100644 --- a/askbot/middleware/view_log.py +++ b/askbot/middleware/view_log.py @@ -12,7 +12,7 @@ from askbot.models import signals from askbot.views.readers import questions as questions_view from askbot.views.commands import vote, get_tag_list from askbot.views.writers import delete_comment, post_comments, retag_question -from askbot.views.readers import revisions +from askbot.views.readers import revisions, get_question_body from askbot.views.meta import media from askbot.search.state_manager import ViewLog @@ -21,7 +21,7 @@ from askbot.search.state_manager import ViewLog IGNORED_VIEWS = ( serve, vote, media, delete_comment, post_comments, retag_question, revisions, javascript_catalog, - get_tag_list + get_tag_list, get_question_body ) diff --git a/askbot/skins/default/templates/main_page/javascript.html b/askbot/skins/default/templates/main_page/javascript.html index c42ac5f7..c46406d9 100644 --- a/askbot/skins/default/templates/main_page/javascript.html +++ b/askbot/skins/default/templates/main_page/javascript.html @@ -29,15 +29,16 @@ function load_question_body(element, question_id){ var key = 'question-' + question_id; - if (askbot['data'][key] == null){ - $.getJSON('{% url get_question_body %}?id=' + question_id, function(data){ - element.title = data.text; - askbot['data'][key] = data.text; + if (askbot['data']['questions-titles'] == null){ + $.getJSON('{% url get_question_body %}', function(data){ + askbot['data']['questions-titles'] = data['questions-titles']; + element.title = askbot['data']['questions-titles'][key];//repeated due to async }); - } else{ - element.title = askbot['data'][key]; + } else { + element.title = askbot['data']['questions-titles'][key]; } } + 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/views/readers.py b/askbot/views/readers.py index 8e4dff95..421dfbc3 100644 --- a/askbot/views/readers.py +++ b/askbot/views/readers.py @@ -638,7 +638,15 @@ def get_comment(request): @ajax_only @get_only def get_question_body(request): - from jinja2 import escape - id = int(request.GET['id']) - question = models.Question.objects.get(id = id) - return {'text': escape(question.summary)} + search_state = request.session.get('search_state', SearchState()) + view_log = request.session['view_log'] + (qs, meta_data, related_tags) = models.Question.objects.run_advanced_search( + request_user = request.user, + search_state = search_state) + paginator = Paginator(qs, search_state.page_size) + page = paginator.page(search_state.page) + questions_dict = {} + for id, summary in page.object_list.values_list('id', 'summary'): + questions_dict['question-%s' % id] = summary + + return {'questions-titles': questions_dict} -- cgit v1.2.3-1-g7c22 From ea88a803b5cdbaff6649926d7f0529c1bcbf24ca Mon Sep 17 00:00:00 2001 From: Adolfo Fitoria Date: Fri, 7 Oct 2011 17:46:45 -0300 Subject: temporal and buggy commit --- askbot/skins/default/media/js/live_search.js | 5 ++--- askbot/skins/default/templates/main_page/javascript.html | 3 ++- askbot/views/readers.py | 1 - 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/askbot/skins/default/media/js/live_search.js b/askbot/skins/default/media/js/live_search.js index f9f03453..37e85fa7 100644 --- a/askbot/skins/default/media/js/live_search.js +++ b/askbot/skins/default/media/js/live_search.js @@ -97,11 +97,10 @@ var liveSearch = function(){ var render_title = function(result){ return '

' + - '' + + '" onmouseover="load_question_body(this,' + result['id'] + ')">' + result['title'] + '' + '

'; diff --git a/askbot/skins/default/templates/main_page/javascript.html b/askbot/skins/default/templates/main_page/javascript.html index c46406d9..eccfe26e 100644 --- a/askbot/skins/default/templates/main_page/javascript.html +++ b/askbot/skins/default/templates/main_page/javascript.html @@ -27,9 +27,10 @@ } } + askbot['data']['questions-titles'] = {}; function load_question_body(element, question_id){ var key = 'question-' + question_id; - if (askbot['data']['questions-titles'] == null){ + if ( askbot['data']['questions-titles'][key] == null){ $.getJSON('{% url get_question_body %}', function(data){ askbot['data']['questions-titles'] = data['questions-titles']; element.title = askbot['data']['questions-titles'][key];//repeated due to async diff --git a/askbot/views/readers.py b/askbot/views/readers.py index 421dfbc3..d4bf6e9f 100644 --- a/askbot/views/readers.py +++ b/askbot/views/readers.py @@ -223,7 +223,6 @@ def questions(request): question_data = { 'title': question.title, - 'summary': question.summary, 'id': question.id, 'tags': question.get_tag_names(), 'tag_list_type': tag_list_type, -- cgit v1.2.3-1-g7c22 From a76a247052c99d074ed45d277a9a3a120f71e9b0 Mon Sep 17 00:00:00 2001 From: Evgeny Fadeev Date: Fri, 7 Oct 2011 18:05:15 -0300 Subject: fixed exception, but still have failure of test case askbot.tests.ManagementCommandTests --- askbot/doc/source/management-commands.rst | 7 ++----- askbot/management/commands/add_askbot_user.py | 19 +++++-------------- 2 files changed, 7 insertions(+), 19 deletions(-) diff --git a/askbot/doc/source/management-commands.rst b/askbot/doc/source/management-commands.rst index bc32dbc2..1da3fdee 100644 --- a/askbot/doc/source/management-commands.rst +++ b/askbot/doc/source/management-commands.rst @@ -29,11 +29,8 @@ The bulk of the management commands fall into this group and will probably be th | | the `add_admin` command | +---------------------------------+-------------------------------------------------------------+ | `add_askbot_user --user-name | Create a user account. If password is not given, an | -| --email [--password] | unusable password will be set. Possible values for the | -| [--email-frequency]` | --email-frequency are: **i**, **d**, **w**, **n** | -| | that stand for | -| | instant, daily, weekly and never - respectively. The default| -| | value is w. The command does not create associations with | +| --email [--password] | unusable password will be set. | +| | The command does not create associations with | | | any of the external login providers. | +---------------------------------+-------------------------------------------------------------+ | `dump_forum [--dump-name | Save forum contents into a file. `--dump-name` parameter is | diff --git a/askbot/management/commands/add_askbot_user.py b/askbot/management/commands/add_askbot_user.py index bac18a58..ed6e2b8b 100644 --- a/askbot/management/commands/add_askbot_user.py +++ b/askbot/management/commands/add_askbot_user.py @@ -67,17 +67,8 @@ class Command(BaseCommand): user.set_password(password) user.save() subscription = {'subscribe': 'y'} - if frequency in ('i', 'd', 'w', 'n'): - email_feeds_form = forms.SimpleEmailSubscribeForm( - subscription, - frequency = frequency - ) - if email_feeds_form.is_valid(): - email_feeds_form.save(user) - else: - raise CommandError('\n'.join(email_feeds_form.errors)) - elif frequency is not None: - raise CommandError( - 'value of --frequency must be one of: ' - 'i, d, w, n' - ) + email_feeds_form = forms.SimpleEmailSubscribeForm(subscription) + if email_feeds_form.is_valid(): + email_feeds_form.save(user) + else: + raise CommandError('\n'.join(email_feeds_form.errors)) -- cgit v1.2.3-1-g7c22 From c509135b0bc5a4dffb514ded92c4b3d463a630b6 Mon Sep 17 00:00:00 2001 From: Adolfo Fitoria Date: Tue, 11 Oct 2011 11:14:22 -0300 Subject: Fixes: feature 76 http://bugs.askbot.org/issues/76 --- askbot/skins/default/templates/main_page/javascript.html | 1 + askbot/views/readers.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/askbot/skins/default/templates/main_page/javascript.html b/askbot/skins/default/templates/main_page/javascript.html index eccfe26e..420dbb99 100644 --- a/askbot/skins/default/templates/main_page/javascript.html +++ b/askbot/skins/default/templates/main_page/javascript.html @@ -33,6 +33,7 @@ if ( askbot['data']['questions-titles'][key] == null){ $.getJSON('{% url get_question_body %}', function(data){ askbot['data']['questions-titles'] = data['questions-titles']; + console.debug(data); element.title = askbot['data']['questions-titles'][key];//repeated due to async }); } else { diff --git a/askbot/views/readers.py b/askbot/views/readers.py index d4bf6e9f..1739a4ef 100644 --- a/askbot/views/readers.py +++ b/askbot/views/readers.py @@ -645,7 +645,7 @@ def get_question_body(request): paginator = Paginator(qs, search_state.page_size) page = paginator.page(search_state.page) questions_dict = {} - for id, summary in page.object_list.values_list('id', 'summary'): - questions_dict['question-%s' % id] = summary + for question in page.object_list: + questions_dict['question-%s' % question.id] = question.summary return {'questions-titles': questions_dict} -- cgit v1.2.3-1-g7c22 From 03fa3dbdff9c72e2b5b537548b3ef9716447b7c6 Mon Sep 17 00:00:00 2001 From: Adolfo Fitoria Date: Tue, 11 Oct 2011 11:38:08 -0300 Subject: fixed management_command_test according to changes in feature73 --- askbot/tests/management_command_tests.py | 1 - 1 file changed, 1 deletion(-) diff --git a/askbot/tests/management_command_tests.py b/askbot/tests/management_command_tests.py index 41a42a91..9eb41cdf 100644 --- a/askbot/tests/management_command_tests.py +++ b/askbot/tests/management_command_tests.py @@ -21,7 +21,6 @@ class ManagementCommandTests(AskbotTestCase): #check thath subscrptions are correct subs = models.EmailFeedSetting.objects.filter( subscriber = user, - frequency = 'd' ) self.assertEquals(subs.count(), 5) #try to log in -- cgit v1.2.3-1-g7c22 From 5fc69cc2dfc49ef0ab8b776a99ee3f3baf840b58 Mon Sep 17 00:00:00 2001 From: Evgeny Fadeev Date: Wed, 12 Oct 2011 10:42:56 -0300 Subject: updated changelog with new features --- askbot/doc/source/changelog.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/askbot/doc/source/changelog.rst b/askbot/doc/source/changelog.rst index f5013742..f9ec387a 100644 --- a/askbot/doc/source/changelog.rst +++ b/askbot/doc/source/changelog.rst @@ -1,6 +1,13 @@ Changes in Askbot ================= +Development version (not released yet) +-------------------------------------- +* Added settings for email subscription defaults (Adolfo) +* Resolved `bug #102`_ - duplicate notifications on posts with mentions +* Added color-animated transitions when urls with hash tags are visited +* Repository tags will be `automatically added `_ to new releases + 0.7.25 (Current Version) ------------------------ * RSS feed for individual question (Sayan Chowdhury) -- cgit v1.2.3-1-g7c22 From a00d53673994c74dd58efa8fd1bae97182bdaf04 Mon Sep 17 00:00:00 2001 From: Evgeny Fadeev Date: Wed, 12 Oct 2011 10:56:14 -0300 Subject: removed outdated reference to animate hash handler --- askbot/skins/default/templates/main_page/javascript.html | 1 - 1 file changed, 1 deletion(-) diff --git a/askbot/skins/default/templates/main_page/javascript.html b/askbot/skins/default/templates/main_page/javascript.html index 3faa0f7a..deef318c 100644 --- a/askbot/skins/default/templates/main_page/javascript.html +++ b/askbot/skins/default/templates/main_page/javascript.html @@ -14,7 +14,6 @@ $.getJSON('{% url user_update_has_custom_avatar %}?t=' + today.getTime()); {% endif %} }); - $(window).bind('hashchange', animate_hashes); askbot['data']['questions-titles'] = {}; function load_question_body(element, question_id){ -- cgit v1.2.3-1-g7c22 From 8174c1d6e912ef0c4d9b1f72b9522339a09ce083 Mon Sep 17 00:00:00 2001 From: Evgeny Fadeev Date: Wed, 12 Oct 2011 11:03:55 -0300 Subject: updated changelog --- askbot/doc/source/changelog.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/askbot/doc/source/changelog.rst b/askbot/doc/source/changelog.rst index f9ec387a..3e1349e8 100644 --- a/askbot/doc/source/changelog.rst +++ b/askbot/doc/source/changelog.rst @@ -4,9 +4,9 @@ Changes in Askbot Development version (not released yet) -------------------------------------- * Added settings for email subscription defaults (Adolfo) -* Resolved `bug #102`_ - duplicate notifications on posts with mentions -* Added color-animated transitions when urls with hash tags are visited -* Repository tags will be `automatically added `_ to new releases +* Resolved `bug #102`_ - duplicate notifications on posts with mentions (Evegeny) +* Added color-animated transitions when urls with hash tags are visited (Adolfo) +* Repository tags will be `automatically added `_ to new releases (Evgeny) 0.7.25 (Current Version) ------------------------ -- cgit v1.2.3-1-g7c22 From 0981786d90d34f35ef52f0a3eb5adc60533b7e76 Mon Sep 17 00:00:00 2001 From: Evgeny Fadeev Date: Wed, 12 Oct 2011 11:33:19 -0300 Subject: changed a message in startup procedures and .tx configuration --- .tx/config | 4 ++-- askbot/startup_procedures.py | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.tx/config b/.tx/config index 97c5769c..1c3967b6 100644 --- a/.tx/config +++ b/.tx/config @@ -1,12 +1,12 @@ [main] host = https://www.transifex.net -[askbot.askbot-translation-part1] +[askbot.askbot-translation-part1-main] file_filter = askbot/locale//LC_MESSAGES/django.po source_file = askbot/locale/en/LC_MESSAGES/django.po source_lang = en -[askbot.askbot-translation-part2] +[askbot.askbot-translation-part2-js] file_filter = askbot/locale//LC_MESSAGES/djangojs.po source_file = askbot/locale/en/LC_MESSAGES/djangojs.po source_lang = en diff --git a/askbot/startup_procedures.py b/askbot/startup_procedures.py index e8dec45f..94d9b852 100644 --- a/askbot/startup_procedures.py +++ b/askbot/startup_procedures.py @@ -177,12 +177,12 @@ def test_template_loader(): loader that used to send a warning""" old_template_loader = 'askbot.skins.loaders.load_template_source' if old_template_loader in django_settings.TEMPLATE_LOADERS: - askbot_warning( - 'In TEMPLATE_LOADERS settings you have an old style ' - 'template loader that throws a Warning on logs ' - 'please change: askbot.skins.loaders.load_template_source ' - 'for: askbot.skins.loaders.filesystem_load_template_source' - ) + raise ImproperlyConfigured(PREAMBLE + \ + "\nPlease change: \n" + "'askbot.skins.loaders.load_template_source', to\n" + "'askbot.skins.loaders.filesystem_load_template_source',\n" + "in the TEMPLATE_LOADERS of your settings.py file" + ) def run_startup_tests(): """function that runs -- cgit v1.2.3-1-g7c22