[IMP] better XML views
authorFabien Pinckaers <fp@tinyerp.com>
Sat, 8 Mar 2014 12:01:43 +0000 (13:01 +0100)
committerFabien Pinckaers <fp@tinyerp.com>
Sat, 8 Mar 2014 12:01:43 +0000 (13:01 +0100)
bzr revid: fp@tinyerp.com-20140308120143-5lbz2e93aglwuchi

addons/website_forum/models/website_forum.py
addons/website_forum/views/website_forum.xml

index b693935..89b583e 100644 (file)
@@ -235,12 +235,12 @@ class Vote(osv.Model):
 class Badge(osv.Model):
     _inherit = 'gamification.badge'
     _columns = {
-        'forum': fields.boolean('Is Forum Badge'),
-        #NOTE: we can create new BadgeLevel object instead of selection
-        'level': fields.selection([('gold', 'gold'), ('silver', 'silver'), ('bronze', 'bronze')], 'Badge Level'),
+        'forum': fields.boolean('Is a Forum Badge'),
+        'level': fields.selection([('bronze', 'bronze'), ('silver', 'silver'), ('gold', 'gold')], 'Badge Level'),
     }
     _defaults = {
-        'forum': False
+        'forum': False,
+        'level': 'bronze'
     }
 
 class ForumActivity(osv.Model):
index 63a89ff..153e564 100644 (file)
 
         <template id="faq">
             <t t-call="website_forum.header">
-                <!--TODO: Improve template -->
-                <div>
-                    <h1>F.A.Q</h1>
-                </div>
+                <h1>Guidelines</h1>
+
+                <h2><a id="good_questions">What kinds of questions can I ask here?</a></h2>
+                <p>
+                    This community is for professional and enthusiast users,
+                    partners and programmers. You can ask questions about:
+                </p>
+                <ul>
+                    <li>how to install OpenERP on a specific infrastructure,</li>
+                    <li>how to configure or customize OpenERP to specific business needs,</li>
+                    <li>what's the best way to use OpenERP for a specific business need,</li>
+                    <li>how to develop modules for your own need,</li>
+                    <li>specific questions about OpenERP service offers, etc.</li>
+                </ul>
+                <p>
+                    <b>Before you ask - please make sure to search for a similar question.</b> You can
+                    search questions by their title or tags.  It’s also OK to
+                    answer your own question.
+                </p><p>
+                    <b>Please avoid asking questions that are too subjective
+                    and argumentative</b> or not relevant to this community.
+                </p>
+                <h2><a name="bad_questions">What should I avoid in my questions?</a></h2>
+                <p>
+                    You should only ask practical, answerable questions based
+                    on actual problems that you face. Chatty, open-ended
+                    questions diminish the usefulness of this site and push
+                    other questions off the front page.
+                </p><p>
+                    To prevent your question from being flagged and possibly removed, avoid asking
+                    subjective questions where …
+                </p>
+                <ul>
+                    <li>every answer is equally valid: “What’s your favorite ______?”</li>
+                    <li>your answer is provided along with the question, and you expect more answers: “I use ______ for ______, what do you use?”</li>
+                    <li>there is no actual problem to be solved: “I’m curious if other people feel like I do.”</li>
+                    <li>we are being asked an open-ended, hypothetical question: “What if ______ happened?”</li>
+                    <li>it is a rant disguised as a question: “______ sucks, am I right?”</li>
+                </ul>
+                <p>
+                    If you fit in one of these example or if your motivation for asking the
+                    question is “I would like to participate in a discussion about ______”, then
+                    you should not be asking here but on our mailing lists.
+                    However, if your motivation is “I would like others to explain ______ to me”,
+                    then you are probably OK.
+                </p><p>
+                    (The above section was adapted from Stackoverflow’s FAQ.)
+                </p><p>
+                    More over:
+                </p>
+                <ul>
+                    <li><b>Answers should not add or expand questions</b>. Instead either edit the question edit or add a question comment.</li>
+                    <li><b>Answers should not comment other answers</b>. Instead add a comment on the other answers.</li>
+                    <li><b>Answers shouldn't just point to other Questions</b>. Instead add a question comment indication "Possible duplicate of...". However, it's ok to include links to other questions or answers providing relevant additional information.</li>
+                    <li><b>Answers shouldn't just provide a link a solution</b>. Instead provide the solution description text in your answer, even if it's just a copy/paste. Links are welcome, but should complementary to answer, referring sources or additional reading.</li>
+                </ul>
+                
+                <h2><a name="bad_answers">What should I avoid in my answers?</a></h2>
+                <p>
+                    <b>Answers should not add or expand questions</b>. Instead
+                    either edit the question or add a comment.
+                </p><p>
+                    <b>Answers should not comment other answers</b>. Instead
+                    add a comment on the other answers.
+                </p><p>
+                    <b>Answers shouldn't just point to other questions</b>.
+                    Instead add a comment indicating <i>"Possible duplicate
+                    of..."</i>. However, it's fine to include links to other
+                    questions or answers providing relevant additional
+                    information. </p> <p> <b>Answers shouldn't just provide a
+                    link a solution</b>. Instead provide the solution
+                    description text in your answer, even if it's just a
+                    copy/paste. Links are welcome, but should complementary to
+                    answer, referring sources or additional reading.
+                </p><p>
+                    <b>Answers should not start debates</b>
+                    This community Q&amp;A is not a discussion group. Please avoid holding debates in
+                    your answers as they tend to dilute the essence of questions and answers. For
+                    brief discussions please use commenting facility.
+                </p> <p>
+                    When a question or answer is upvoted, the user who posted them will gain some
+                    points, which are called "karma points". These points serve as a rough
+                    measure of the community trust to him/her. Various moderation tasks are
+                    gradually assigned to the users based on those points.
+                </p> <p>
+                    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 10 points. There is a limit of 200 points that can be accumulated
+                    for a question or answer per day. The table below explains reputation point
+                    requirements for each type of moderation task.
+                </p>
+                
+                <table class="table table-striped">
+                <tbody>
+                    <tr>
+                        <td class="faq-rep-item"><strong>1</strong></td>
+                        <td>upvote, add comments</td>
+                    </tr><tr>
+                        <td class="faq-rep-item"><strong>10</strong></td>
+                        <td>downvote</td>
+                    </tr><tr>
+                        <td class="faq-rep-item"><strong>30</strong></td>
+                        <td>insert text link, upload files</td>
+                    </tr><tr>
+                        <td class="faq-rep-item"><strong>50</strong></td>
+                        <td>insert clickable link, answer own question immediately</td>
+                    </tr><tr>
+                        <td class="faq-rep-item"><strong>75</strong></td>
+                        <td>retag, edit wiki questions and answers</td>
+                    </tr><tr>
+                        <td class="faq-rep-item"><strong>100</strong></td>
+                        <td>flag offensive, close own questions</td>
+                    </tr><tr>
+                        <td class="faq-rep-item"><strong>200</strong></td>
+                        <td>answer/comment by email</td>
+                    </tr><tr>
+                        <td class="faq-rep-item"><strong>300</strong></td>
+                        <td>edit any post, view offensive flags</td>
+                    </tr><tr>
+                        <td class="faq-rep-item"><strong>400</strong></td>
+                        <td>delete any comment</td>
+                    </tr><tr>
+                        <td class="faq-rep-item"><strong>500</strong></td>
+                        <td>accept any answer (after 1 week)</td>
+                    </tr><tr>
+                        <td class="faq-rep-item"><strong>750</strong></td>
+                        <td>delete any comment</td>
+                    </tr><tr>
+                        <td class="faq-rep-item"><strong>900</strong></td>
+                        <td>lock posts</td>
+                    </tr><tr>
+                        <td class="faq-rep-item"><strong>1000</strong></td>
+                        <td>delete any question or answer</td>
+                    </tr>
+                </tbody>
+                </table>
+
+                <h2><a name="community_edit">Why can other people edit my questions/answers?</a></h2>
+                <p>
+                    The goal of this site is create a relevant knowledge base that would answer
+                    questions related to OpenERP.
+                </p><p>
+                    Therefore questions and answers can be edited like wiki pages by experienced users of
+                    this site in order to improve the overall quality of the knowledge base content.
+                    Such privileges are granted based on user karma level: you will be able to do the same
+                    once your karma gets high enough.
+                </p><p>
+                    If this approach is not for you, please respect the community and use Google+
+                    communities instead.
+                </p>
             </t>
         </template>
 
         <template id="tag">
             <t t-call="website_forum.header">
                 <h1 class="mt0">
-                    Question by Tags
+                    Tags
                 </h1>
+                <p class="text-muted">
+                    A tag is a label that categorizes your question with other,
+                    similar questions. Using the right tags makes it easier for
+                    others to find and answer your question.
+                </p>
                 <div class="row">
                     <div class="col-sm-3 mt16" t-foreach="tags" t-as="tag">
                         <a t-attf-href="/forum/#{ slug(forum) }/tag/#{ slug(tag) }" class="badge">
                 <h1 class="mt0">
                     Users with Badges
                 </h1>
-                <div class="mt16" t-foreach="badges" t-as="badge">
-                    <a t-attf-href="/forum/#{ slug(forum) }/badge/#{ slug(badge) }" class="badge pull-left">
-                        <span t-if="badge.level == 'gold'" class="fa fa-circle badge-gold"/>
-                        <span t-if="badge.level == 'silver'" class="fa fa-circle badge-silver"/>
-                        <span t-if="badge.level == 'bronze'" class="fa fa-circle badge-bronze"/>
-                        <span t-field="badge.name" />
-                    </a>
-                    <span style="margin-left:5px">
-                        X <t t-esc="len(badge.owner_ids)"/>
-                    </span>
-                    <span t-field="badge.description" style="margin-left:20px"/>
-                </div>
+                <p>
+                    Besides gaining reputation with your questions and answers,
+                    you receive badges for being especially helpful. Badges
+                    appear on your profile page, and your posts.
+                </p>
+                <table class="table mt32 mb64">
+                    <tr t-foreach="badges" t-as="badge">
+                        <td>
+                            <a t-attf-href="/forum/#{ slug(forum) }/badge/#{ slug(badge) }" class="badge pull-left">
+                                <span t-if="badge.level == 'gold'" class="fa fa-circle badge-gold"/>
+                                <span t-if="badge.level == 'silver'" class="fa fa-circle badge-silver"/>
+                                <span t-if="badge.level == 'bronze'" class="fa fa-circle badge-bronze"/>
+                                <span t-field="badge.name" />
+                            </a>
+                        </td><td>
+                            <b t-esc="len(badge.owner_ids)"/>
+                            <i class="text-muted">awarded users</i>
+                        </td><td>
+                            <span t-field="badge.description"/>
+                        </td>
+                    </tr>
+                </table>
             </t>
         </template>
 
                         <span t-field="user.image"
                             t-field-options='{"widget": "image", "class": "img img-responsive img-circle"}'/>
                     </div>
+                    <div class="col-sm-5">
+                        <table class="table table-condensed">
+                        <tr>
+                            <td rowspan="2" valign="top"><span class="text-muted">contributions</span></td>
+                            <td>member since</td>
+                            <td><span t-field="user.create_date"/></td>
+                        </tr><tr>
+                            <td>last connection</td>
+                            <td><span t-field="user.login_date"/></td>
+                        </tr>
+                        </table>
+                    </div><div class="col-sm-5">
+                        <table class="table table-condensed">
+                        <tr>
+                            <td rowspan="3" valign="top"><span class="text-muted">stats</span></td>
+                            <td>karma</td>
+                            <td><span t-field="user.karma"/></td>
+                        </tr><tr>
+                            <td>up votes</td>
+                            <td>
+                                <span class="glyphicon glyphicon-thumbs-up"/>
+                                <span t-esc="up_votes"/>
+                            </td>
+                        </tr><tr>
+                            <td>down votes</td>
+                            <td>
+                                <span class="glyphicon glyphicon-thumbs-down"/>
+                                <span t-esc="down_votes"/>
+                            </td>
+                        </tr>
+                        </table>
+                    </div>
                     <div class="col-sm-10">
-                        <div class="row">
-                            <div class="col-sm-6">
-                                Karma :
-                            </div>
-                            <div class="col-sm-6">
-                                <b t-field="user.karma" />
-                            </div>
-                            <div class="col-sm-6">
-                                Member since :
-                            </div>
-                            <div class="col-sm-6">
-                                <b>
-                                    <t t-esc="user.create_date" />
-                                    3
-                                </b>
-                            </div>
-                            <div class="col-sm-6">
-                                Last Seen :
-                            </div>
-                            <div class="col-sm-6">
-                                <b>Feb 15'14</b>
-                            </div>
-                            <div class="col-sm-12">
-                                Todays unused votes 30 votes left
-                            </div>
+                        <div class="well well-sm">
+                            <!-- add website description here -->
+                            <a href="#" class="fa fa-arrow-right"> Edit Your Bio</a>
                         </div>
-                        <h2>
-                            <t t-esc="total_votes"/>
-                            <span>Votes</span>
-                        </h2>
-                        <h3>
-                            <span class="glyphicon glyphicon-thumbs-up"></span>
-                            <b> <t t-esc="up_votes" /> </b>
-                        </h3>
-                        <h3>
-                            <span class="glyphicon glyphicon-thumbs-down"></span>
-                            <b> <t t-esc="down_votes" /> </b>
-                        </h3>
                     </div>
                 </div>