]> git.openstreetmap.org Git - osqa.git/commitdiff
Set the faq page to be markdown and added the markdown tips the the side bar of the...
authorqw3rty <qw3rty@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Fri, 30 Apr 2010 20:10:23 +0000 (20:10 +0000)
committerqw3rty <qw3rty@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Fri, 30 Apr 2010 20:10:23 +0000 (20:10 +0000)
git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@107 0cfe37f9-358a-4d5e-be75-b63607b5c754

forum/settings/__init__.py
forum/settings/about.py [moved from forum/settings/pages.py with 91% similarity]
forum/settings/base.py
forum/settings/faq.py [new file with mode: 0644]
forum/skins/default/templates/faq.html
forum/skins/default/templates/osqaadmin/base.html
forum/skins/default/templates/question_edit_tips.html
forum/skins/default/templates/users/edit.html
forum/views/admin.py
forum/views/meta.py

index 6132f6d743bcafaee8698d3b060251935e53f677..58ed460ce1f948356f3dcdce41ea3c7d3947a13d 100644 (file)
@@ -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)
similarity index 91%
rename from forum/settings/pages.py
rename to forum/settings/about.py
index 0dc474583caa9893db88f6a2cbc2636e08073204..45c88579a637a83338c2e96d104e5edf68c39ba9 100644 (file)
@@ -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',
 """
index 4987bc07d2901a610fc384a4798cb3215c5d7a41..dc0157718e7a0c7d9b58ec19847f3839b2fac88d 100644 (file)
@@ -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 (file)
index 0000000..a5daa56
--- /dev/null
@@ -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
index c5dd284fedbb881c14f910d210c6373bcc5c64fb..aff901f70e0b1535d69748fac0ce2111e1c1ca2a 100644 (file)
 {% extends "base_content.html" %}
 <!-- template faq.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 %}
 <div class="headNormal">
-    {% trans "Frequently Asked Questions " %}(FAQ)
+{% trans "FAQ" %}
 </div>
-<div id="main-body" class="about" style="width:100%">
-
-        <div class="first">
-            <h3 class="subtitle">{% trans "What kinds of questions can I ask here?" %}</h3>
-            <p>{% trans "Most importantly - questions should be <strong>relevant</strong> to this community." %}
-            {% trans "Before asking the question - please make sure to use search to see whether your question has alredy been answered."%}
-            </p>
-            
-                <h3 class="subtitle">{% trans "What questions should I avoid asking?" %}</h3>
-            <p>{% trans "Please avoid asking questions that are not relevant to this community, too subjective and argumentative." %}
-            </p>
-        </div>
-    
-        <div>
-            <h3 class="subtitle">{% trans "What should I avoid in my answers?" %}</h3>
-            <p>{{ 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." %}</p>
-        </div>
-    
-        <div>
-            <h3 class="subtitle">{% trans "Who moderates this community?" %}</h3>
-            <p>{% trans "The short answer is: <strong>you</strong>." %}
-            {% trans "This website is moderated by the users." %}
-            {% trans "The reputation system allows users earn the authorization to perform a variety of moderation tasks." %} 
-            </p>
-        </div>
-
-        <div>
-            <h3 class="subtitle">{% trans "How does reputation system work?" %}</h3>
-            <p>{% trans "Rep system summary" %}</p>
-            <p>{% 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 <strong>10</strong> points, each vote against will subtract <strong>2</strong> points. There is a limit of <strong>200</strong> points that can be accumulated per question or answer. The table below explains reputation point requirements for each type of moderation task.{% endblocktrans %}
-            </p>
-
-            <table style="font-family:arial;" cellspacing="3" cellpadding="3">
-                <tr>
-                    <th width="40px" style="text-align:right"></th>
-                    <th width="300px"></th>
-                </tr>
-                <!--
-                <tr>
-                    <td style="text-align:right;padding-right:5px"><strong>15</strong></td>
-                    <td>{% trans "upvote" %}</td>
-                </tr>
-                <tr>
-                    <td style="text-align:right;padding-right:5px"><strong>15</strong></td>
-                    <td>{% trans "use tags" %}</td>
-                </tr>
-                -->
-                <tr>
-                    <td style="text-align:right;padding-right:5px"><strong>{{ settings.REP_TO_COMMENT }}</strong></td>
-                    <td>{% trans "add comments" %}</td>
-                </tr>
-                <tr>
-                    <td style="text-align:right;padding-right:5px"><strong>{{ settings.REP_TO_VOTE_DOWN }}</strong></td>
-                    <td>{% trans "downvote" %}</td>
-                </tr>
-                <tr>
-                    <td style="text-align:right;padding-right:5px"><strong>{{ settings.REP_TO_CLOSE_OWN }}</strong></td>
-                    <td>{% trans "close own questions" %}</td>
-                </tr>
-                <tr>
-                    <td style="text-align:right;padding-right:5px"><strong>{{ settings.REP_TO_REOPEN_OWN }}</strong></td>
-                    <td>{% trans "reopen own questions" %}</td>
-                </tr>
-                <tr>
-                    <td style="text-align:right;padding-right:5px"><strong>{{ settings.REP_TO_RETAG }}</strong></td>
-                    <td>{% trans "retag questions" %}</td>
-                </tr>
-                {% if settings.WIKI_ON %}
-                <tr>
-                    <td style="text-align:right;padding-right:5px"><strong>{{ settings.REP_TO_EDIT_WIKI }}</strong></td>
-                    <td>{% trans "edit community wiki questions" %}</td>
-                </tr>
-                {% endif %}
-                <tr>
-                    <td style="text-align:right;padding-right:5px"><strong>{{ settings.REP_TO_EDIT_OTHERS }}</strong></td>
-                    <td>{% trans "edit any answer" %}</td>
-                </tr>
-                <tr>
-                    <td style="text-align:right;padding-right:5px"><strong>{{ settings.REP_TO_CLOSE_OTHERS }}</strong></td>
-                    <td>{% trans "open any closed question" %}</td>
-                </tr>
-                <tr>
-                    <td style="text-align:right;padding-right:5px"><strong>{{ settings.REP_TO_DELETE_COMMENTS }}</strong></td>
-                    <td>{% trans "delete any comment" %}</td>
-                </tr>
-
-            </table>
-        </div>
-        {% comment %}
-        {% ifequal settings.EMAIL_VALIDATION 'on' %}
-        <div>
-            <a id='validate'></a><h3 class="subtitle">{% trans "how to validate email title" %}</h3>
-            <!--special case here message must contain paragraphs-->
-            {% blocktrans %}how to validate email info with {{send_email_key_url}} {{gravatar_faq_url}}{% endblocktrans %}
-        </div>
-        {% endifequal %}
-        {% endcomment %}
-        <div>
-            <a id='gravatar'></a><h3 class="subtitle">{% trans "what is gravatar" %}</h3>
-            <p>{% trans "gravatar faq info" %}</p>
-        </div>
-        <div>
-            <h3 class="subtitle">{% trans "To register, do I need to create new password?" %}</h3>
-            <p>{% trans "No, you don't have to. You can login through any service that supports OpenID, e.g. Google, Yahoo, AOL, etc." %}
-            <strong><a href="{% url auth_signin %}">{% trans "Login now!" %}</a> »</strong> 
-            </p>
-        </div>
-    
-        <div>
-            <h3 class="subtitle">{% trans "Why other people can edit my questions/answers?" %}</h3>
-            <p> {% 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." %}
-            </p>
-        </div>
-        <div>
-            <h3 class="subtitle">{% trans "Still have questions?" %}</h3>
-            <p>{% blocktrans %}Please ask your question at {{ask_question_url}}, help make our community better!{% endblocktrans %} 
-            <!--
-            <a href="{% url tags %}faq" class="big">{{ settings.APP_TITLE }} {% trans "questions" %}</a>{% trans "." %}
-            -->
-            </p>
-        </div>
+<div class="content">
+{{ text|markdown }}
 </div>
-<script type="text/javascript">
-    //highlihts section if url has matching #anchor_name
-    $(document).ready(function (){
-        var hash = window.location.hash;
-        if (hash.length > 1){
-            $(hash).parent().addClass('highlight');
-            window.location.hash = hash;
-        }
-    })
-</script>
 {% endblock %}
 <!-- end template faq.html -->
index f3a55aeeaf411cb99f89a23004daec9a417e17bc..e35a70575f30e33296eda71cb4102c84a4ae4826 100644 (file)
 \r
 {% block sidebar %}\r
     <div class="boxC">\r
-        <h3 class="subtitle">{% trans "Administration menu" %}</h3>\r
-        <ul>\r
-        {% for set in sets %}\r
-            <li><a href="{% url admin_set set.name %}">{{ set.title }}</a></li>\r
-        {% endfor %}\r
-        </ul>\r
+      <h3 class="subtitle">{% trans "Administration menu" %}</h3>\r
+      <ul>\r
+      {% for set in sets %}\r
+          <li><a href="{% url admin_set set.name %}">{{ set.title }}</a></li>\r
+      {% endfor %}\r
+      </ul>\r
     </div>\r
+    {% if markdown %}\r
+\r
+        <div class="boxC">\r
+            <p class="subtitle">{% trans "Markdown tips" %}</p>\r
+            <ul class="list-item">\r
+                <li>\r
+                    {% trans "*italic* or __italic__" %}\r
+                </li>\r
+                <li>\r
+                    {% trans "**bold** or __bold__" %}\r
+                </li>\r
+                <li>\r
+                    <b>{% trans "link" %}</b>:[{% trans "text" %}](http://url.com/ "{% trans "title" %}")\r
+\r
+                </li>\r
+\r
+                <li>\r
+                    <b>{% trans "image" %}</b>?![alt {% trans "text" %}](/path/img.jpg "{% trans "title" %}")\r
+\r
+                </li>\r
+                <li>\r
+                    {% trans "numbered list:" %}\r
+                    1.  Foo\r
+                    2.  Bar\r
+                </li>\r
+                <li>\r
+                    {% trans "basic HTML tags are also supported" %}\r
+                </li>\r
+            </ul>            <p class='info-box-follow-up-links'>\r
+                <a href="http://en.wikipedia.org/wiki/Markdown" target="_blank">{% trans "learn more about Markdown" %} </a>\r
+            </p>\r
+        </div>\r
+    {% endif %}\r
 {% endblock %}\r
 \r
-                \r
+\r
+\r
index ae876a2968fdf1d5ca108eb518410d04764e24c2..f98cbe9b28bce2b333b2bf6e92710c5916cfbea8 100644 (file)
@@ -52,7 +52,7 @@
         </li>
     </ul>
     <p class='info-box-follow-up-links'>
-        <a href="http://en.wikipedia.org/wiki/Markdown" target="_blank">{% trans "learn more about Markdown" %} »</a>
+        <a href="http://en.wikipedia.org/wiki/Markdown" target="_blank">{% trans "learn more about Markdown" %} </a>
     </p>
 </div>
 <!-- end question_edit_tips.html -->
index 416891c293ae979f1a0cd166c772c4b32a6e924f..4227fceca7cb0f95b3f73d521fd44b4a7f6e4dc4 100644 (file)
@@ -22,7 +22,7 @@
                     dateFormat: 'yy-mm-dd',\r
                     minDate: null,\r
                     maxDate: '0M 0D',\r
-                    yearRange: '1900:2000'\r
+                    yearRange: '1920:2010'\r
                 });\r
 \r
                 $("#nav_profile").attr('className',"on");\r
index 7a299221f7f1f6e276b7653eac92ec65539b7b3e..421fbc94a66a8a8634948f62f61fcf7deabeac8c 100644 (file)
@@ -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))
 
index b11c538d294a5fbb215ab336d6ae4120e595771a..63ff65723c24c2fb05c24f2bd6ab0a3f5773d035 100644 (file)
@@ -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)