diff options
-rw-r--r-- | askbot/conf/minimum_reputation.py | 296 | ||||
-rw-r--r-- | askbot/locale/en/LC_MESSAGES/django.mo | bin | 21726 -> 21718 bytes | |||
-rw-r--r-- | askbot/locale/en/LC_MESSAGES/django.po | 2 | ||||
-rw-r--r-- | askbot/models/__init__.py | 6 | ||||
-rwxr-xr-x | askbot/skins/default/media/style/style.css | 10 | ||||
-rw-r--r-- | askbot/skins/default/templates/macros.html | 28 | ||||
-rw-r--r-- | askbot/skins/default/templates/user_profile/user_info.html | 2 |
7 files changed, 190 insertions, 154 deletions
diff --git a/askbot/conf/minimum_reputation.py b/askbot/conf/minimum_reputation.py index bb8d7754..6b00766e 100644 --- a/askbot/conf/minimum_reputation.py +++ b/askbot/conf/minimum_reputation.py @@ -3,146 +3,160 @@ Settings for minimum reputation required for a variety of actions on the askbot askbot """ from askbot.conf.settings_wrapper import settings -from askbot.deps.livesettings import ConfigurationGroup, IntegerValue +from askbot.deps import livesettings from django.utils.translation import ugettext as _ -MIN_REP = ConfigurationGroup( - 'MIN_REP', - _('Minimum reputation required to perform actions'), - ordering=0 - ) - -settings.register( - IntegerValue( - MIN_REP, - 'MIN_REP_TO_VOTE_UP', - default=15, - description=_('Upvote') - ) - ) - -settings.register( - IntegerValue( - MIN_REP, - 'MIN_REP_TO_VOTE_DOWN', - default=100, - description=_('Downvote') - ) - ) - -settings.register( - IntegerValue( - MIN_REP, - 'MIN_REP_TO_FLAG_OFFENSIVE', - default=15, - description=_('Flag offensive') - ) - ) - -settings.register( - IntegerValue( - MIN_REP, - 'MIN_REP_TO_LEAVE_COMMENTS', - default=50, - description=_('Leave comments') - ) - ) - -settings.register( - IntegerValue( - MIN_REP, - 'MIN_REP_TO_DELETE_OTHERS_COMMENTS', - default=2000, - description=_('Delete comments posted by others') - ) - ) - -settings.register( - IntegerValue( - MIN_REP, - 'MIN_REP_TO_DELETE_OTHERS_POSTS', - default=5000, - description=_('Delete questions and answers posted by others') - ) - ) - -settings.register( - IntegerValue( - MIN_REP, - 'MIN_REP_TO_UPLOAD_FILES', - default=60, - description=_('Upload files') - ) - ) - -settings.register( - IntegerValue( - MIN_REP, - 'MIN_REP_TO_CLOSE_OWN_QUESTIONS', - default=250, - description=_('Close own questions'), - ) - ) - -settings.register( - IntegerValue( - MIN_REP, - 'MIN_REP_TO_RETAG_OTHERS_QUESTIONS', - default=500, - description=_('Retag questions posted by other people') - ) - ) - -settings.register( - IntegerValue( - MIN_REP, - 'MIN_REP_TO_REOPEN_OWN_QUESTIONS', - default=500, - description=_('Reopen own questions') - ) - ) - -settings.register( - IntegerValue( - MIN_REP, - 'MIN_REP_TO_EDIT_WIKI', - default=750, - description=_('Edit community wiki posts') - ) - ) - -settings.register( - IntegerValue( - MIN_REP, - 'MIN_REP_TO_EDIT_OTHERS_POSTS', - default=2000, - description=_('Edit posts authored by other people') - ) - ) - -settings.register( - IntegerValue( - MIN_REP, - 'MIN_REP_TO_VIEW_OFFENSIVE_FLAGS', - default=2000, - description=_('View offensive flags') - ) - ) - -settings.register( - IntegerValue( - MIN_REP, - 'MIN_REP_TO_CLOSE_OTHERS_QUESTIONS', - default=2000, - description=_('Close questions asked by others') - ) - ) - -settings.register( - IntegerValue( - MIN_REP, - 'MIN_REP_TO_LOCK_POSTS', - default=4000, - description=_('Lock posts') - ) - ) +MIN_REP = livesettings.ConfigurationGroup( + 'MIN_REP', + _('Minimum reputation required to perform actions'), + ordering=0 +) + +settings.register( + livesettings.IntegerValue( + MIN_REP, + 'MIN_REP_TO_VOTE_UP', + default=15, + description=_('Upvote') + ) +) + +settings.register( + livesettings.IntegerValue( + MIN_REP, + 'MIN_REP_TO_VOTE_DOWN', + default=100, + description=_('Downvote') + ) +) + +settings.register( + livesettings.IntegerValue( + MIN_REP, + 'MIN_REP_TO_FLAG_OFFENSIVE', + default=15, + description=_('Flag offensive') + ) +) + +settings.register( + livesettings.IntegerValue( + MIN_REP, + 'MIN_REP_TO_LEAVE_COMMENTS', + default=50, + description=_('Leave comments') + ) +) + +settings.register( + livesettings.IntegerValue( + MIN_REP, + 'MIN_REP_TO_DELETE_OTHERS_COMMENTS', + default=2000, + description=_('Delete comments posted by others') + ) +) + +settings.register( + livesettings.IntegerValue( + MIN_REP, + 'MIN_REP_TO_DELETE_OTHERS_POSTS', + default=5000, + description=_('Delete questions and answers posted by others') + ) +) + +settings.register( + livesettings.IntegerValue( + MIN_REP, + 'MIN_REP_TO_UPLOAD_FILES', + default=60, + description=_('Upload files') + ) +) + +settings.register( + livesettings.IntegerValue( + MIN_REP, + 'MIN_REP_TO_CLOSE_OWN_QUESTIONS', + default=250, + description=_('Close own questions'), + ) +) + +settings.register( + livesettings.IntegerValue( + MIN_REP, + 'MIN_REP_TO_RETAG_OTHERS_QUESTIONS', + default=500, + description=_('Retag questions posted by other people') + ) +) + +settings.register( + livesettings.IntegerValue( + MIN_REP, + 'MIN_REP_TO_REOPEN_OWN_QUESTIONS', + default=500, + description=_('Reopen own questions') + ) +) + +settings.register( + livesettings.IntegerValue( + MIN_REP, + 'MIN_REP_TO_EDIT_WIKI', + default=750, + description=_('Edit community wiki posts') + ) +) + +settings.register( + livesettings.IntegerValue( + MIN_REP, + 'MIN_REP_TO_EDIT_OTHERS_POSTS', + default=2000, + description=_('Edit posts authored by other people') + ) +) + +settings.register( + livesettings.IntegerValue( + MIN_REP, + 'MIN_REP_TO_VIEW_OFFENSIVE_FLAGS', + default=2000, + description=_('View offensive flags') + ) +) + +settings.register( + livesettings.IntegerValue( + MIN_REP, + 'MIN_REP_TO_CLOSE_OTHERS_QUESTIONS', + default=2000, + description=_('Close questions asked by others') + ) +) + +settings.register( + livesettings.IntegerValue( + MIN_REP, + 'MIN_REP_TO_LOCK_POSTS', + default=4000, + description=_('Lock posts') + ) +) + +settings.register( + livesettings.IntegerValue( + MIN_REP, + 'MIN_REP_TO_HAVE_STRONG_URL', + default=250, + description=_('Remove rel=nofollow from own homepage'), + help_text=_( + 'When a search engine crawler will see a rel=nofollow ' + 'attribute on a link - the link will not count towards ' + 'the rank of the users personal site.' + ) + ) +) diff --git a/askbot/locale/en/LC_MESSAGES/django.mo b/askbot/locale/en/LC_MESSAGES/django.mo Binary files differindex 004dd9e5..c76592aa 100644 --- a/askbot/locale/en/LC_MESSAGES/django.mo +++ b/askbot/locale/en/LC_MESSAGES/django.mo diff --git a/askbot/locale/en/LC_MESSAGES/django.po b/askbot/locale/en/LC_MESSAGES/django.po index a4334deb..1de218f7 100644 --- a/askbot/locale/en/LC_MESSAGES/django.po +++ b/askbot/locale/en/LC_MESSAGES/django.po @@ -5074,7 +5074,7 @@ msgstr "Graph of user karma" #: skins/default/templates/user_profile/user_tabs.html:14 msgid "reputation history" -msgstr "karma history" +msgstr "karma" #: skins/default/templates/user_profile/user_tabs.html:16 msgid "questions that user selected as his/her favorite" diff --git a/askbot/models/__init__.py b/askbot/models/__init__.py index 40c2f7cb..b88f47f2 100644 --- a/askbot/models/__init__.py +++ b/askbot/models/__init__.py @@ -106,6 +106,10 @@ def user_get_old_vote_for_post(self, post): return old_votes[0] +def user_can_have_strong_url(self): + """True if user's homepage url can be + followed by the search engine crawlers""" + return (self.reputation >= askbot_settings.MIN_REP_TO_HAVE_STRONG_URL) def _assert_user_can( user = None, @@ -318,7 +322,6 @@ def user_assert_can_edit_comment(self, comment = None): raise django_exceptions.PermissionDenied(error_message) - def user_assert_can_post_comment(self, parent_post = None): """raises exceptions.PermissionDenied if user cannot post comment @@ -1591,6 +1594,7 @@ User.add_to_class('is_following', user_is_following) User.add_to_class('decrement_response_count', user_decrement_response_count) User.add_to_class('increment_response_count', user_increment_response_count) User.add_to_class('clean_response_counts', user_clean_response_counts) +User.add_to_class('can_have_strong_url', user_can_have_strong_url) User.add_to_class('is_administrator', user_is_administrator) User.add_to_class('set_admin_status', user_set_admin_status) User.add_to_class('remove_admin_status', user_remove_admin_status) diff --git a/askbot/skins/default/media/style/style.css b/askbot/skins/default/media/style/style.css index 5e5f8c27..c9d98d03 100755 --- a/askbot/skins/default/media/style/style.css +++ b/askbot/skins/default/media/style/style.css @@ -1782,20 +1782,22 @@ ul.form-horizontal-rows li input { .post-update-info { display: inline-block; float: right; + font-size: 11px; width: 190px; margin-bottom: 5px; + line-height: 14px } .post-update-info p { + line-height: 13px; font-size: 11px; - line-height: 15px; - margin: 0 0 4px 0; + margin: 0 0 2px 1px; padding: 0; } -.post-update-info img { +.post-update-info .gravatar { float: left; - margin: 4px 8px 0 0; + margin-right: 4px; } diff --git a/askbot/skins/default/templates/macros.html b/askbot/skins/default/templates/macros.html index fd6eac50..a9b4c252 100644 --- a/askbot/skins/default/templates/macros.html +++ b/askbot/skins/default/templates/macros.html @@ -121,13 +121,27 @@ {% endspaceless %} {%- endmacro -%} +{%- macro user_website_link(user, max_display_length=25) -%} + {% if user.website %} + <a + href="{{user.website}}" + title="{% trans username=user.username|escape, url=user.website %}{{username}}'s website is {{url}}{% endtrans %}" + {% if user.can_have_strong_url() == False %} + rel="nofollow" + {% endif %} + > + {{user.website|truncate(length=max_display_length, killwords=True, end='...')}} + </a> + {% endif %} +{%- endmacro -%} + {%- macro post_contributor_info(post, contributor_type, is_wiki, wiki_min_rep) -%} <div class='post-update-info'> {# there is a whole bunch of trickery here, probably indicative of poor design of the data or methods on data objects #} {% if contributor_type=="original_author" %} {% if is_wiki %} - <p style="line-height:12px"> + <p> {%- if post.__class__.__name__ == 'Question' -%} {%- trans %}asked{% endtrans %} {% elif post.__class__.__name__ == 'Answer' %} @@ -161,10 +175,11 @@ poor design of the data or methods on data objects #} {% endif %} </p> {{ gravatar(post.author, 32) }} - <p>{{post.author.get_profile_link()}}<br/> - {{ user_score_and_badge_summary(post.author) }}</p> + {{post.author.get_profile_link()}}{% if not post.author.website %}<br/>{% endif %} + {{ user_score_and_badge_summary(post.author) }}<br/> + {{ user_website_link(post.author) }} {% endif %} -{% else %} +{% elif contributor_type=="last_updater" %} {% if post.__class__.__name__ in ('Question', 'Answer') %} {% set last_edited_at = post.last_edited_at %} {% set original_author = post.author %} @@ -186,8 +201,9 @@ poor design of the data or methods on data objects #} </p> {% if original_author != update_author or is_wiki %} {{ gravatar(update_author, 32) }} - <p style="float:left">{{update_author.get_profile_link()}}<br/> - {{ user_score_and_badge_summary(update_author) }}</p> + {{update_author.get_profile_link()}}{% if not update_author.website %}<br/>{% endif %} + {{ user_score_and_badge_summary(update_author) }}<br/> + {{ user_website_link(update_author) }} {% endif %} {% endif %} {% endif %} diff --git a/askbot/skins/default/templates/user_profile/user_info.html b/askbot/skins/default/templates/user_profile/user_info.html index e52eab64..d332c235 100644 --- a/askbot/skins/default/templates/user_profile/user_info.html +++ b/askbot/skins/default/templates/user_profile/user_info.html @@ -52,7 +52,7 @@ {% if view_user.website %} <tr> <td>{% trans %}user website{% endtrans %}</td> - <td><a rel="nofollow" target="_blank" href="{{view_user.website}}">{{view_user.website}}</a></td> + <td>{{ macros.user_website_link(view_user, max_display_length = 30) }}</td> </tr> {% endif %} {% if view_user.location %} |