From: hernani Date: Thu, 13 May 2010 13:19:20 +0000 (+0000) Subject: New optional admin interface, and closing OSQA 253. X-Git-Tag: live~875 X-Git-Url: https://git.openstreetmap.org./osqa.git/commitdiff_plain/1876ec0c8caf982704410cee305d0cde218421d4?hp=19af2f15e6eb1d0ebae23433a8d2555186d96835 New optional admin interface, and closing OSQA 253. git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@254 0cfe37f9-358a-4d5e-be75-b63607b5c754 --- diff --git a/forum/actions/user.py b/forum/actions/user.py index 0e894ba..74771a6 100644 --- a/forum/actions/user.py +++ b/forum/actions/user.py @@ -3,13 +3,25 @@ from django.db.models import F from forum.models.action import ActionProxy from forum.models import Award from forum import settings +from forum.settings import APP_SHORT_NAME class UserJoinsAction(ActionProxy): def repute_users(self): self.repute(self.user, int(settings.INITIAL_REP)) + def describe(self, viewer=None): + return _("%(user)s as joined the %(app_name)s Q&A community") % { + 'user': self.hyperlink(self.user.get_profile_url(), self.friendly_username(viewer, self.user)), + 'app_name': APP_SHORT_NAME, + } + class EditProfileAction(ActionProxy): - pass + def describe(self, viewer=None): + return _("%(user)s edited %(hes_or_your)s %(profile_link)s") % { + 'user': self.hyperlink(self.user.get_profile_url(), self.friendly_username(viewer, self.user)), + 'hes_or_your': self.viewer_or_user_verb(viewer, self.user, _('your'), _('hes')), + 'profile_link': self.hyperlink(self.user.get_profile_url(), _('profile')), + } class AwardAction(ActionProxy): def process_data(self, badge, trigger): diff --git a/forum/models/action.py b/forum/models/action.py index 9a6f5ae..785ed2d 100644 --- a/forum/models/action.py +++ b/forum/models/action.py @@ -70,7 +70,7 @@ class Action(models.Model): return "" def describe(self, viewer=None): - return "" + return self.__class__.__name__ def get_absolute_url(self): if self.node: diff --git a/forum/settings/__init__.py b/forum/settings/__init__.py index 5306aa7..caf0eaf 100644 --- a/forum/settings/__init__.py +++ b/forum/settings/__init__.py @@ -8,8 +8,11 @@ from django.conf import settings as djsettings from django.utils.version import get_svn_revision OSQA_VERSION = "Development Build" -SVN_REVISION = get_svn_revision(djsettings.SITE_SRC_ROOT) +SVN_REVISION = get_svn_revision(djsettings.SITE_SRC_ROOT) + SETTINGS_PACK = Setting('SETTINGS_PACK', "default") +DJSTYLE_ADMIN_INTERFACE = Setting('DJSTYLE_ADMIN_INTERFACE', True) + APP_URL = djsettings.APP_URL FORUM_SCRIPT_ALIAS = djsettings.FORUM_SCRIPT_ALIAS diff --git a/forum/settings/basic.py b/forum/settings/basic.py index 844947c..a3382b1 100644 --- a/forum/settings/basic.py +++ b/forum/settings/basic.py @@ -35,11 +35,6 @@ label = _("Application description"), help_text = _("The description of your application"), widget=Textarea)) -APP_INTRO = Setting('APP_INTRO', u'

Ask and answer questions, make the world better!

', BASIC_SET, dict( -label = _("Application intro"), -help_text = _("The introductory page that is visible in the sidebar for anonymous users."), -widget=Textarea)) - APP_COPYRIGHT = Setting('APP_COPYRIGHT', u'Copyright OSQA, 2010. Some rights reserved under creative commons license.', BASIC_SET, dict( label = _("Copyright notice"), help_text = _("The copyright notice visible at the footer of your page."))) @@ -49,7 +44,3 @@ label = _("Feedback site url"), help_text = _("If you have a specific place to get feedback from your users, use this field and the fedback link on the footer will point there."), required=False)) -SHOW_WELCOME_BOX = Setting('SHOW_WELCOME_BOX', True, BASIC_SET, dict( -label = _("Show the Welcome box"), -help_text = _("Do you want to show the welcome box when a user first visits your site."), -required=False)) diff --git a/forum/settings/forms.py b/forum/settings/forms.py index 81e5446..15bbef6 100644 --- a/forum/settings/forms.py +++ b/forum/settings/forms.py @@ -22,6 +22,8 @@ class SettingsSetForm(forms.Form): for setting in set: if isinstance(setting, (Setting.emulators.get(str, DummySetting), Setting.emulators.get(unicode, DummySetting))): + if not setting.field_context.get('widget', None): + setting.field_context['widget'] = forms.TextInput(attrs={'class': 'longstring'}) field = forms.CharField(**setting.field_context) elif isinstance(setting, Setting.emulators.get(float, DummySetting)): field = forms.FloatField(**setting.field_context) diff --git a/forum/settings/sidebar.py b/forum/settings/sidebar.py index 031763a..2ff349e 100644 --- a/forum/settings/sidebar.py +++ b/forum/settings/sidebar.py @@ -1,8 +1,20 @@ from base import Setting, SettingSet from django.forms.widgets import Textarea +from django.utils.translation import ugettext_lazy as _ SIDEBAR_SET = SettingSet('sidebar', 'Sidebar content', "Enter contents to display in the sidebar. You can use markdown and some basic html tags.", 10, True) +SHOW_WELCOME_BOX = Setting('SHOW_WELCOME_BOX', True, SIDEBAR_SET, dict( +label = _("Show the Welcome box"), +help_text = _("Do you want to show the welcome box when a user first visits your site."), +required=False)) + +APP_INTRO = Setting('APP_INTRO', u'

Ask and answer questions, make the world better!

', SIDEBAR_SET, dict( +label = _("Application intro"), +help_text = _("The introductory page that is visible in the sidebar for anonymous users."), +widget=Textarea)) + + SIDEBAR_UPPER_SHOW = Setting('SIDEBAR_UPPER_SHOW', True, SIDEBAR_SET, dict( label = "Show Upper Block", help_text = "Check if your pages should display the upper sidebar block.", diff --git a/forum/skins/default/media/style/admin.css b/forum/skins/default/media/style/admin.css index 4fcfad5..51bf919 100644 --- a/forum/skins/default/media/style/admin.css +++ b/forum/skins/default/media/style/admin.css @@ -45,4 +45,10 @@ .string_list_widget_button.add { position: relative; left: 554px; +} + +table caption { + font-size: 120%; + padding: 3px 0; + text-align: left; } \ No newline at end of file diff --git a/forum/skins/default/media/style/djstyle_admin.css b/forum/skins/default/media/style/djstyle_admin.css new file mode 100644 index 0000000..5b2965b --- /dev/null +++ b/forum/skins/default/media/style/djstyle_admin.css @@ -0,0 +1,7 @@ +textarea { + width: 100%; +} + +input.longstring { + width: 100%; +} \ No newline at end of file diff --git a/forum/skins/default/templates/auth/signin.html b/forum/skins/default/templates/auth/signin.html index 6f653f8..e5d8fdb 100644 --- a/forum/skins/default/templates/auth/signin.html +++ b/forum/skins/default/templates/auth/signin.html @@ -24,7 +24,7 @@ {% trans "User login" %} {% if msg %} -

{{ msg }}

+

{{ msg }}

{% endif %} {% for provider in top_stackitem_providers %}
diff --git a/forum/skins/default/templates/auth/signup.html b/forum/skins/default/templates/auth/signup.html deleted file mode 100644 index cb1ebbf..0000000 --- a/forum/skins/default/templates/auth/signup.html +++ /dev/null @@ -1,36 +0,0 @@ -{% extends "base_content.html" %} - -{% load i18n %} -{% block title %}{% spaceless %}{% trans "Signup" %}{% endspaceless %}{% endblock %} - -{% block content %} -
- {% trans "Create login name and password" %} -
-

{% trans "Traditional signup info" %}

- - -

{% trans "receive updates motivational blurb" %}

-
- {{ email_feeds_form.subscribe }} - {% if email_feeds_form.errors %} -

{% trans "please select one of the options above" %}

- {% endif %} -
-
- {% for field in form.anti_spam_fields %} -
{{ field }}
-

{{ field.errors }}

- {% endfor %} -
- -
-{% endblock %} - diff --git a/forum/skins/default/templates/osqaadmin/base.html b/forum/skins/default/templates/osqaadmin/base.html index 2acdc15..e9f654b 100644 --- a/forum/skins/default/templates/osqaadmin/base.html +++ b/forum/skins/default/templates/osqaadmin/base.html @@ -24,6 +24,7 @@ {% block sidebar %}
+ {% trans "Switch to django style interface" %}

{% trans "Administration menu" %}