From: qw3rty Date: Fri, 30 Apr 2010 20:10:23 +0000 (+0000) Subject: Set the faq page to be markdown and added the markdown tips the the side bar of the... X-Git-Tag: live~982 X-Git-Url: https://git.openstreetmap.org./osqa.git/commitdiff_plain/b80d47e7da6ac90a56b9705089f246a8050ee364 Set the faq page to be markdown and added the markdown tips the the side bar of the admin's faq and about pages. git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@107 0cfe37f9-358a-4d5e-be75-b63607b5c754 --- diff --git a/forum/settings/__init__.py b/forum/settings/__init__.py index 6132f6d..58ed460 100644 --- a/forum/settings/__init__.py +++ b/forum/settings/__init__.py @@ -15,7 +15,8 @@ from minrep import * from repgain import * from voting import * from upload import * -from pages import * +from about import * +from faq import * from form import * BADGES_SET = SettingSet('badges', _('Badges config'), _("Configure badges on your OSQA site."), 500) diff --git a/forum/settings/pages.py b/forum/settings/about.py similarity index 91% rename from forum/settings/pages.py rename to forum/settings/about.py index 0dc4745..45c8857 100644 --- a/forum/settings/pages.py +++ b/forum/settings/about.py @@ -1,7 +1,7 @@ from base import Setting, SettingSet from django.forms.widgets import Textarea -PAGES_SET = SettingSet('pages', 'About page', "Define the text in the about page. You can use markdown and some basic html tags.", 2000) +PAGES_SET = SettingSet('about', 'About page', "Define the text in the about page. You can use markdown and some basic html tags.", 2000, True) ABOUT_PAGE_TEXT = Setting('ABOUT_PAGE_TEXT', """ diff --git a/forum/settings/base.py b/forum/settings/base.py index 4987bc0..dc01577 100644 --- a/forum/settings/base.py +++ b/forum/settings/base.py @@ -2,11 +2,12 @@ import django.dispatch from django.utils.encoding import force_unicode class SettingSet(list): - def __init__(self, name, title, description, weight=1000): + def __init__(self, name, title, description, weight=1000, markdown=False): self.name = name self.title = title self.description = description self.weight = weight + self.markdown = markdown class BaseSetting(object): def __init__(self, name, default, field_context): diff --git a/forum/settings/faq.py b/forum/settings/faq.py new file mode 100644 index 0000000..a5daa56 --- /dev/null +++ b/forum/settings/faq.py @@ -0,0 +1,12 @@ +from base import Setting, SettingSet +from django.forms.widgets import Textarea + +FAQ_SET = SettingSet('faq', 'FAQ page', "Define the text in the about page. You can use markdown and some basic html tags.", 2000, True) + +FAQ_PAGE_TEXT = Setting('FAQ_PAGE_TEXT', +""" + +""", FAQ_SET, dict( +label = "FAQ page text", +help_text = " The faq page. ", +widget=Textarea(attrs={'rows': '25'}))) \ No newline at end of file diff --git a/forum/skins/default/templates/faq.html b/forum/skins/default/templates/faq.html index c5dd284..aff901f 100644 --- a/forum/skins/default/templates/faq.html +++ b/forum/skins/default/templates/faq.html @@ -1,147 +1,15 @@ {% extends "base_content.html" %} -{% load extra_tags %} -{% load humanize %} {% load i18n %} -{% block title %}{% spaceless %}FAQ{% endspaceless %}{% endblock %} -{% block forejs %} -{% endblock %} +{% load markup %} +{% block title %}{% spaceless %}{% trans "FAQ" %}{% endspaceless %}{% endblock %} + {% block content %}
- {% trans "Frequently Asked Questions " %}(FAQ) +{% trans "FAQ" %}
-
- -
-

{% trans "What kinds of questions can I ask here?" %}

-

{% trans "Most importantly - questions should be relevant to this community." %} - {% trans "Before asking the question - please make sure to use search to see whether your question has alredy been answered."%} -

- -

{% trans "What questions should I avoid asking?" %}

-

{% trans "Please avoid asking questions that are not relevant to this community, too subjective and argumentative." %} -

-
- -
-

{% trans "What should I avoid in my answers?" %}

-

{{ settings.APP_TITLE }} {% trans "is a Q&A site, not a discussion group. Therefore - please avoid having discussions in your answers, comment facility allows some space for brief discussions." %}

-
- -
-

{% trans "Who moderates this community?" %}

-

{% trans "The short answer is: you." %} - {% trans "This website is moderated by the users." %} - {% trans "The reputation system allows users earn the authorization to perform a variety of moderation tasks." %} -

-
- -
-

{% trans "How does reputation system work?" %}

-

{% trans "Rep system summary" %}

-

{% blocktrans %}For example, if you ask an interesting question or give a helpful answer, your input will be upvoted. On the other hand if the answer is misleading - it will be downvoted. Each vote in favor will generate 10 points, each vote against will subtract 2 points. There is a limit of 200 points that can be accumulated per question or answer. The table below explains reputation point requirements for each type of moderation task.{% endblocktrans %} -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - {% if settings.WIKI_ON %} - - - - - {% endif %} - - - - - - - - - - - - - -
{{ settings.REP_TO_COMMENT }}{% trans "add comments" %}
{{ settings.REP_TO_VOTE_DOWN }}{% trans "downvote" %}
{{ settings.REP_TO_CLOSE_OWN }}{% trans "close own questions" %}
{{ settings.REP_TO_REOPEN_OWN }}{% trans "reopen own questions" %}
{{ settings.REP_TO_RETAG }}{% trans "retag questions" %}
{{ settings.REP_TO_EDIT_WIKI }}{% trans "edit community wiki questions" %}
{{ settings.REP_TO_EDIT_OTHERS }}{% trans "edit any answer" %}
{{ settings.REP_TO_CLOSE_OTHERS }}{% trans "open any closed question" %}
{{ settings.REP_TO_DELETE_COMMENTS }}{% trans "delete any comment" %}
-
- {% comment %} - {% ifequal settings.EMAIL_VALIDATION 'on' %} -
-

{% trans "how to validate email title" %}

- - {% blocktrans %}how to validate email info with {{send_email_key_url}} {{gravatar_faq_url}}{% endblocktrans %} -
- {% endifequal %} - {% endcomment %} -
-

{% trans "what is gravatar" %}

-

{% trans "gravatar faq info" %}

-
-
-

{% trans "To register, do I need to create new password?" %}

-

{% trans "No, you don't have to. You can login through any service that supports OpenID, e.g. Google, Yahoo, AOL, etc." %} - {% trans "Login now!" %} » -

-
- -
-

{% trans "Why other people can edit my questions/answers?" %}

-

{% trans "Goal of this site is..." %} {% trans "So questions and answers can be edited like wiki pages by experienced users of this site and this improves the overall quality of the knowledge base content." %} - {% trans "If this approach is not for you, we respect your choice." %} -

-
-
-

{% trans "Still have questions?" %}

-

{% blocktrans %}Please ask your question at {{ask_question_url}}, help make our community better!{% endblocktrans %} - -

-
+
+{{ text|markdown }}
- {% endblock %} diff --git a/forum/skins/default/templates/osqaadmin/base.html b/forum/skins/default/templates/osqaadmin/base.html index f3a55ae..e35a705 100644 --- a/forum/skins/default/templates/osqaadmin/base.html +++ b/forum/skins/default/templates/osqaadmin/base.html @@ -23,13 +23,47 @@ {% block sidebar %}
-

{% trans "Administration menu" %}

- +

{% trans "Administration menu" %}

+
+ {% if markdown %} + +
+

{% trans "Markdown tips" %}

+
    +
  • + {% trans "*italic* or __italic__" %} +
  • +
  • + {% trans "**bold** or __bold__" %} +
  • +
  • + {% trans "link" %}:[{% trans "text" %}](http://url.com/ "{% trans "title" %}") + +
  • + +
  • + {% trans "image" %}?![alt {% trans "text" %}](/path/img.jpg "{% trans "title" %}") + +
  • +
  • + {% trans "numbered list:" %} + 1. Foo + 2. Bar +
  • +
  • + {% trans "basic HTML tags are also supported" %} +
  • +
+
+ {% endif %} {% endblock %} - + + diff --git a/forum/skins/default/templates/question_edit_tips.html b/forum/skins/default/templates/question_edit_tips.html index ae876a2..f98cbe9 100644 --- a/forum/skins/default/templates/question_edit_tips.html +++ b/forum/skins/default/templates/question_edit_tips.html @@ -52,7 +52,7 @@
diff --git a/forum/skins/default/templates/users/edit.html b/forum/skins/default/templates/users/edit.html index 416891c..4227fce 100644 --- a/forum/skins/default/templates/users/edit.html +++ b/forum/skins/default/templates/users/edit.html @@ -22,7 +22,7 @@ dateFormat: 'yy-mm-dd', minDate: null, maxDate: '0M 0D', - yearRange: '1900:2000' + yearRange: '1920:2010' }); $("#nav_profile").attr('className',"on"); diff --git a/forum/views/admin.py b/forum/views/admin.py index 7a29922..421fbc9 100644 --- a/forum/views/admin.py +++ b/forum/views/admin.py @@ -53,6 +53,7 @@ def settings_set(request, set_name): return render_to_response('osqaadmin/set.html', { 'form': form, + 'markdown': set.markdown, 'sets': get_all_sets(), }, context_instance=RequestContext(request)) diff --git a/forum/views/meta.py b/forum/views/meta.py index b11c538..63ff657 100644 --- a/forum/views/meta.py +++ b/forum/views/meta.py @@ -21,12 +21,7 @@ def about(request): return render_to_response('about.html', {'text': settings.ABOUT_PAGE_TEXT.value }, context_instance=RequestContext(request)) def faq(request): - data = { - 'gravatar_faq_url': reverse('faq') + '#gravatar', - 'ask_question_url': reverse('ask'), - 'settings': settings, - } - return render_to_response('faq.html', data, context_instance=RequestContext(request)) + return render_to_response('faq.html', {'text': settings.FAQ_PAGE_TEXT.value }, context_instance=RequestContext(request)) def feedback(request): if request.method == "POST": @@ -36,6 +31,7 @@ def feedback(request): if not request.user.is_authenticated: context['email'] = form.cleaned_data.get('email',None) + context['message'] = form.cleaned_data['message'] context['name'] = form.cleaned_data.get('name',None)