diff options
author | Adolfo Fitoria <adolfo.fitoria@gmail.com> | 2011-10-12 17:22:05 -0300 |
---|---|---|
committer | Adolfo Fitoria <adolfo.fitoria@gmail.com> | 2011-10-12 17:22:05 -0300 |
commit | 2dad823e2b3791da8abc234bba20e66c6e6b5f7b (patch) | |
tree | 1fbd5109f0218a7de94316dd126b9b5085ea2855 | |
parent | b1185bac415c138792601593841795f54f31867e (diff) | |
parent | 0981786d90d34f35ef52f0a3eb5adc60533b7e76 (diff) | |
download | askbot-2dad823e2b3791da8abc234bba20e66c6e6b5f7b.tar.gz askbot-2dad823e2b3791da8abc234bba20e66c6e6b5f7b.tar.bz2 askbot-2dad823e2b3791da8abc234bba20e66c6e6b5f7b.zip |
Merge branch 'master' into new-template-experimental
-rw-r--r-- | .tx/config | 4 | ||||
-rw-r--r-- | askbot/doc/source/changelog.rst | 7 | ||||
-rw-r--r-- | askbot/doc/source/management-commands.rst | 7 | ||||
-rw-r--r-- | askbot/forms.py | 3 | ||||
-rw-r--r-- | askbot/management/commands/add_askbot_user.py | 19 | ||||
-rw-r--r-- | askbot/middleware/view_log.py | 4 | ||||
-rw-r--r-- | askbot/skins/default/media/js/live_search.js | 5 | ||||
-rw-r--r-- | askbot/skins/default/templates/main_page/javascript.html | 16 | ||||
-rw-r--r-- | askbot/skins/old/templates/macros.html | 4 | ||||
-rw-r--r-- | askbot/startup_procedures.py | 12 | ||||
-rw-r--r-- | askbot/tests/management_command_tests.py | 1 | ||||
-rw-r--r-- | askbot/urls.py | 5 | ||||
-rw-r--r-- | askbot/views/readers.py | 17 |
13 files changed, 65 insertions, 39 deletions
@@ -1,12 +1,12 @@ [main] host = https://www.transifex.net -[askbot.askbot-translation-part1] +[askbot.askbot-translation-part1-main] file_filter = askbot/locale/<lang>/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/<lang>/LC_MESSAGES/djangojs.po source_file = askbot/locale/en/LC_MESSAGES/djangojs.po source_lang = en diff --git a/askbot/doc/source/changelog.rst b/askbot/doc/source/changelog.rst index f5013742..3e1349e8 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<http://bugs.askbot.org/issues/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 <http://askbot.org/en/question/345/can-git-tags-be-created-for-each-of-the-releases>`_ to new releases (Evgeny) + 0.7.25 (Current Version) ------------------------ * RSS feed for individual question (Sayan Chowdhury) 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/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) 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)) 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/media/js/live_search.js b/askbot/skins/default/media/js/live_search.js index 1a46e338..473ab56a 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 '<h2>' + - '<a title="' + result['summary'] + '" ' + - 'href="' + + '<a href="' + askbot['urls']['question_url_template'] .replace('{{QuestionID}}', result['id']) + - '">' + + '" onmouseover="load_question_body(this,' + result['id'] + ')">' + result['title'] + '</a>' + '</h2>'; diff --git a/askbot/skins/default/templates/main_page/javascript.html b/askbot/skins/default/templates/main_page/javascript.html index baccefc9..deef318c 100644 --- a/askbot/skins/default/templates/main_page/javascript.html +++ b/askbot/skins/default/templates/main_page/javascript.html @@ -14,7 +14,21 @@ $.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){ + var key = 'question-' + question_id; + 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 { + 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/skins/old/templates/macros.html b/askbot/skins/old/templates/macros.html index afa7b264..26e48373 100644 --- a/askbot/skins/old/templates/macros.html +++ b/askbot/skins/old/templates/macros.html @@ -459,12 +459,12 @@ poor design of the data or methods on data objects #} {% if question.is_anonymous %} <span class="anonymous">{{ question.last_activity_by.get_anonymous_name() }}</span> {% else %} - <a href="{% url user_profile question.last_activity_by.id, question.last_activity_by.username|slugify %}">{{question.last_activity_by.username}}</a>{{ user_country_flag(question.last_activity_by) }} + <a href="{% url user_profile question.last_activity_by.id, question.last_activity_by.username|slugify %}" >{{question.last_activity_by.username}}</a>{{ user_country_flag(question.last_activity_by) }} {#{user_score_and_badge_summary(question.last_activity_by)}#} {% endif %} </div> </div> - <h2><a title="{{question.summary|escape}}" href="{{ question.get_absolute_url() }}">{{question.get_question_title()|escape}}</a></h2> + <h2><a href="{{ question.get_absolute_url() }}" onmouseover="load_question_body(this, {{question.id}})">{{question.get_question_title()|escape}}</a></h2> {{ tag_list_widget(question.get_tag_names()) }} </div> {%- endmacro -%} 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 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 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..1739a4ef 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, @@ -634,3 +633,19 @@ 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): + 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 question in page.object_list: + questions_dict['question-%s' % question.id] = question.summary + + return {'questions-titles': questions_dict} |