[IMP] improved code and view, fixed some issue to view commnet, show acceped answer...
authorTurkesh Patel (Open ERP) <tpa@tinyerp.com>
Fri, 4 Apr 2014 07:10:43 +0000 (12:40 +0530)
committerTurkesh Patel (Open ERP) <tpa@tinyerp.com>
Fri, 4 Apr 2014 07:10:43 +0000 (12:40 +0530)
bzr revid: tpa@tinyerp.com-20140404071043-n6x0wv6qyi1pdmav

1  2 
addons/website_forum/controllers/main.py
addons/website_forum/data/forum_default_faq.html
addons/website_forum/static/src/css/Makefile
addons/website_forum/static/src/css/website_forum.css
addons/website_forum/static/src/js/website_forum.js
addons/website_forum/views/website_forum.xml

index cc63e1f,0000000..f6cabb4
mode 100644,000000..100644
--- /dev/null
@@@ -1,647 -1,0 +1,648 @@@
 +# -*- coding: utf-8 -*-
 +##############################################################################
 +#
 +#    OpenERP, Open Source Management Solution
 +#    Copyright (C) 2013-Today OpenERP SA (<http://www.openerp.com>).
 +#
 +#    This program is free software: you can redistribute it and/or modify
 +#    it under the terms of the GNU Affero General Public License as
 +#    published by the Free Software Foundation, either version 3 of the
 +#    License, or (at your option) any later version.
 +#
 +#    This program is distributed in the hope that it will be useful,
 +#    but WITHOUT ANY WARRANTY; without even the implied warranty of
 +#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 +#    GNU Affero General Public License for more details.
 +#
 +#    You should have received a copy of the GNU Affero General Public License
 +#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 +#
 +##############################################################################
 +
 +import werkzeug.urls
 +import simplejson
 +
 +from openerp import tools
 +from openerp import SUPERUSER_ID
 +from openerp.addons.web import http
 +from openerp.tools import html2plaintext
 +
 +from openerp.tools.translate import _
 +from datetime import datetime, timedelta
 +from openerp.addons.web.http import request
 +
 +from dateutil.relativedelta import relativedelta
 +from openerp.addons.website.controllers.main import Website as controllers
 +from openerp.addons.website.models.website import slug
 +from openerp.addons.web.controllers.main import login_redirect
 +
 +controllers = controllers()
 +
 +class website_forum(http.Controller):
 +
-     @http.route(['/forum/'], type='http', auth="public", website=True, multilang=True)
++    @http.route(['/forum'], type='http', auth="public", website=True, multilang=True)
 +    def forum(self, **searches):
 +        cr, uid, context = request.cr, request.uid, request.context
 +        Forum = request.registry['website.forum']
 +        obj_ids = Forum.search(cr, uid, [], context=context)
 +        forums = Forum.browse(cr, uid, obj_ids, context=context)
 +        return request.website.render("website_forum.forum_index", { 'forums': forums })
 +
-     @http.route('/forum/add_forum/', type='http', auth="user", multilang=True, website=True)
++    @http.route('/forum/add_forum', type='http', auth="user", multilang=True, website=True)
 +    def add_forum(self, forum_name="New Forum", **kwargs):
 +        forum_id = request.registry['website.forum'].create(request.cr, request.uid, {
 +            'name': forum_name,
 +        }, context=request.context)
 +        return request.redirect("/forum/%s" % forum_id)
 +
 +    @http.route(['/forum/<model("website.forum"):forum>', 
 +                 '/forum/<model("website.forum"):forum>/page/<int:page>',
 +                 '/forum/<model("website.forum"):forum>/tag/<model("website.forum.tag"):tag>/questions'
 +        ], type='http', auth="public", website=True, multilang=True)
 +
 +    def questions(self, forum, tag='', page=1, filters='', sorting='', **searches):
 +        cr, uid, context = request.cr, request.uid, request.context
 +        Forum = request.registry['website.forum.post']
 +        user = request.registry['res.users'].browse(cr, uid, uid, context=context)
 +        domain = [('forum_id', '=', forum.id), ('parent_id', '=', False)]
 +        order = "id desc"
 +
 +        search = searches.get('search',False)
 +        if search:
 +            domain += ['|',
 +                ('name', 'ilike', search),
 +                ('content', 'ilike', search)]
 +
 +        #filter questions for tag.
 +        if tag:
 +            if not filters:
 +                filters = 'tag'
 +            domain += [ ('tags', '=', tag.id) ]
 +
 +        if not filters:
 +            filters = 'all'
 +        if filters == 'unanswered':
 +            domain += [ ('child_ids', '=', False) ]
 +        if filters == 'followed':
 +            domain += [ ('message_follower_ids', '=', user.partner_id.id) ]
 +
 +        # Note: default sorting should be based on last activity
 +        if not sorting or sorting == 'date':
 +            sorting = 'date'
 +            order = 'write_date desc'
 +        if sorting == 'answered':
 +            order = 'child_count desc'
 +        if sorting == 'vote':
 +            order = 'vote_count desc'
 +
 +        step = 10
 +        question_count = Forum.search(cr, uid, domain, count=True, context=context)
 +        pager = request.website.pager(url="/forum/%s" % slug(forum), total=question_count, page=page, step=step, scope=10)
 +
 +        obj_ids = Forum.search(cr, uid, domain, limit=step, offset=pager['offset'], order=order, context=context)
 +        question_ids = Forum.browse(cr, uid, obj_ids, context=context)
 +
 +        values = {
 +            'uid': request.session.uid,
 +            'total_questions': question_count,
 +            'question_ids': question_ids,
 +            'notifications': self._get_notifications(),
 +            'forum': forum,
 +            'pager': pager,
 +            'tag': tag,
 +            'filters': filters,
 +            'sorting': sorting,
 +            'searches': searches,
 +        }
 +
 +        return request.website.render("website_forum.index", values)
 +
 +    def _get_notifications(self, **kwargs):
 +        cr, uid, context = request.cr, request.uid, request.context
 +        Message = request.registry['mail.message']
 +        BadgeUser = request.registry['gamification.badge.user']
 +        #notification to user.
 +        badgeuser_ids = BadgeUser.search(cr, uid, [('user_id', '=', uid)], context=context)
 +        notification_ids = Message.search(cr, uid, [('res_id', 'in', badgeuser_ids), ('model', '=', 'gamification.badge.user'), ('to_read', '=', True)], context=context)
 +        notifications = Message.browse(cr, uid, notification_ids, context=context)
 +        user = request.registry['res.users'].browse(cr, uid, uid, context=context)
 +        return {"user": user, "notifications": notifications}
 +
-     @http.route('/forum/notification_read/', type='json', auth="user", multilang=True, methods=['POST'], website=True)
++    @http.route('/forum/notification_read', type='json', auth="user", multilang=True, methods=['POST'], website=True)
 +    def notification_read(self, **kwarg):
 +        request.registry['mail.message'].set_message_read(request.cr, request.uid, [int(kwarg.get('notification_id'))], read=True, context=request.context)
 +        return True
 +
 +    @http.route(['/forum/<model("website.forum"):forum>/faq'], type='http', auth="public", website=True, multilang=True)
 +    def faq(self, forum, **post):
 +        values = { 
 +            'searches': {},
 +            'forum':forum,
 +            'notifications': self._get_notifications(),
 +        }
 +        return request.website.render("website_forum.faq", values)
 +
 +    @http.route(['/forum/<model("website.forum"):forum>/question/<model("website.forum.post"):question>'], type='http', auth="public", website=True, multilang=True)
 +    def question(self, forum, question, **post):
 +        cr, uid, context = request.cr, request.uid, request.context
 +
 +        #maintain total views on post.
 +        Statistics = request.registry['website.forum.post.statistics']
 +        post_obj = request.registry['website.forum.post']
 +        if request.session.uid:
 +            view_ids = Statistics.search(cr, uid, [('user_id', '=', request.session.uid), ('post_id', '=', question.id)], context=context)
 +            if not view_ids:
 +                Statistics.create(cr, SUPERUSER_ID, {'user_id': request.session.uid, 'post_id': question.id }, context=context)
 +        else:
 +            request.session[request.session_id] = request.session.get(request.session_id, [])
 +            if not (question.id in request.session[request.session_id]):
 +                request.session[request.session_id].append(question.id)
 +                post_obj._set_view_count(cr, SUPERUSER_ID, [question.id], 'views', 1, {}, context=context)
 +
 +        #Check that user have answered question or not.
 +        answer_done = False
 +        for answer in question.child_ids:
 +            if answer.user_id.id == request.uid:
 +                answer_done = True
 +
 +        #Check that user is following question or not
 +        partner_id = request.registry['res.users'].browse(cr, uid, request.uid, context=context).partner_id.id
 +        message_follower_ids = [follower.id for follower in question.message_follower_ids]
 +        following = True if partner_id in message_follower_ids else False
 +
 +        filters = 'question'
 +        user = request.registry['res.users'].browse(cr, uid, uid, context=None)
 +        values = {
 +            'question': question,
 +            'question_data': True,
 +            'notifications': self._get_notifications(),
 +            'searches': post,
 +            'filters': filters,
 +            'following': following,
 +            'answer_done': answer_done,
 +            'reversed': reversed,
 +            'forum': forum,
 +            'user': user,
 +        }
 +        return request.website.render("website_forum.post_description_full", values)
 +
 +    @http.route(['/forum/<model("website.forum"):forum>/comment'], type='http', auth="public", methods=['POST'], website=True)
 +    def post_comment(self, forum, post_id, **kwargs):
 +        if not request.session.uid:
 +            return login_redirect()
 +        cr, uid, context = request.cr, request.uid, request.context
 +        if kwargs.get('comment'):
 +            user = request.registry['res.users'].browse(cr, SUPERUSER_ID, uid, context=context)
 +            group_ids = user.groups_id
 +            group_id = request.registry["ir.model.data"].get_object_reference(cr, uid, 'website_mail', 'group_comment')[1]
 +            if group_id in [group.id for group in group_ids]:
 +                Post = request.registry['website.forum.post']
 +                Post.message_post(
 +                    cr, uid, int(post_id),
 +                    body=kwargs.get('comment'),
 +                    type='comment',
 +                    subtype='mt_comment',
 +                    content_subtype='plaintext',
 +                    author_id=user.partner_id.id,
 +                    context=dict(context, mail_create_nosubcribe=True))
 +
 +        post = request.registry['website.forum.post'].browse(cr, uid, int(post_id), context=context)
 +        question_id = post.parent_id.id if post.parent_id else post.id
 +        return werkzeug.utils.redirect("/forum/%s/question/%s" % (slug(forum),question_id))
 +
 +    @http.route(['/forum/<model("website.forum"):forum>/user/<model("res.users"):user>'], type='http', auth="public", website=True, multilang=True)
 +    def open_user(self, forum, user, **post):
 +        cr, uid, context = request.cr, request.uid, request.context
 +        User = request.registry['res.users']
 +        Post = request.registry['website.forum.post']
 +        Vote = request.registry['website.forum.post.vote']
 +        Activity = request.registry['mail.message']
 +        Followers = request.registry['mail.followers']
 +        Data = request.registry["ir.model.data"]
 +
 +        #questions and answers by user.
 +        user_questions, user_answers = [], []
 +        user_post_ids = Post.search(cr, uid, [('forum_id', '=', forum.id), ('user_id', '=', user.id),
 +                                             '|', ('active', '=', False), ('active', '=', True)], context=context)
 +        user_posts = Post.browse(cr, uid, user_post_ids, context=context)
 +        for record in user_posts:
 +            if record.parent_id:
 +                user_answers.append(record)
 +            else:
 +                user_questions.append(record)
 +
 +        #showing questions which user following
 +        obj_ids = Followers.search(cr, SUPERUSER_ID, [('res_model', '=', 'website.forum.post'),('partner_id' , '=' , user.partner_id.id)], context=context)
 +        post_ids = [follower.res_id for follower in Followers.browse(cr, SUPERUSER_ID, obj_ids, context=context)]
 +        que_ids = Post.search(cr, uid, [('id', 'in', post_ids), ('forum_id', '=', forum.id), ('parent_id', '=', False)], context=context)
 +        followed = Post.browse(cr, uid, que_ids, context=context)
 +
 +        #votes which given on users questions and answers.
 +        data = Vote.read_group(cr, uid, [('post_id.forum_id', '=', forum.id), ('post_id.user_id', '=', user.id)], ["vote"], groupby=["vote"], context=context)
 +        up_votes, down_votes = 0, 0
 +        for rec in data:
 +            if rec['vote'] == '1':
 +                up_votes = rec['vote_count']
 +            elif rec['vote'] == '-1':
 +                down_votes = rec['vote_count']
 +        total_votes = up_votes + down_votes
 +
 +        #Votes which given by users on others questions and answers.
 +        post_votes = Vote.search(cr, uid, [('user_id', '=', user.id)], context=context)
 +        vote_ids = Vote.browse(cr, uid, post_votes, context=context)
 +
 +        #activity by user.
 +        model, comment = Data.get_object_reference(cr, uid, 'mail', 'mt_comment')
 +        activity_ids = Activity.search(cr, uid, [('res_id', 'in', user_post_ids), ('model', '=', 'website.forum.post'), '|', ('subtype_id', '!=', comment), ('subtype_id', '=', False)], context=context)
 +        activities = Activity.browse(cr, uid, activity_ids, context=context)
 +
 +        posts = {}
 +        for act in activities:
 +            posts[act.res_id] = True
 +        posts_ids = Post.browse(cr, uid, posts.keys(), context=context)
 +        posts = dict(map(lambda x: (x.id, (x.parent_id or x, x.parent_id and x or False)), posts_ids))
 +
 +        post['users'] = 'True'
 +
 +        values = {
 +            'uid': uid,
 +            'user': user,
 +            'main_object': user,
 +            'searches': post,
 +            'forum': forum,
 +            'questions': user_questions,
 +            'answers': user_answers,
 +            'followed': followed,
 +            'total_votes': total_votes,
 +            'up_votes': up_votes,
 +            'down_votes': down_votes,
 +            'activities': activities,
 +            'posts': posts,
 +            'vote_post': vote_ids,
 +            'notifications': self._get_notifications(),
 +        }
 +        return request.website.render("website_forum.user_detail_full", values)
 +
 +    @http.route(['/forum/<model("website.forum"):forum>/ask'], type='http', auth="public", website=True, multilang=True)
 +    def question_ask(self, forum, **post):
 +        if not request.session.uid:
 +            return login_redirect()
 +        user = request.registry['res.users'].browse(request.cr, request.uid, request.uid, context=request.context)
 +        values = {
 +            'searches': {},
 +            'forum': forum,
 +            'user': user,
++            'ask_question': True,
 +            'notifications': self._get_notifications(),
 +        }
 +        return request.website.render("website_forum.ask_question", values)
 +
-     @http.route('/forum/<model("website.forum"):forum>/question/ask/', type='http', auth="user", multilang=True, methods=['POST'], website=True)
++    @http.route('/forum/<model("website.forum"):forum>/question/ask', type='http', auth="user", multilang=True, methods=['POST'], website=True)
 +    def register_question(self, forum, **question):
 +        cr, uid, context = request.cr, request.uid, request.context
 +        create_context = dict(context)
 +
 +        Tag = request.registry['website.forum.tag']
 +        tags = question.get('question_tags').strip('[]').replace('"','').split(",")
 +        question_tags = []
 +        for tag in tags:
-             tag_ids = Tag.search(cr, uid, [('name', 'like', tag)], context=context)
++            tag_ids = Tag.search(cr, uid, [('name', '=', tag)], context=context)
 +            if tag_ids:
 +                question_tags.append((4,tag_ids[0]))
 +            else:
 +                question_tags.append((0,0,{'name' : tag,'forum_id' : forum.id}))
 +
 +        new_question_id = request.registry['website.forum.post'].create(
 +            request.cr, request.uid, {
 +                'user_id': uid,
 +                'forum_id': forum.id,
 +                'name': question.get('question_name'),
 +                'content': question.get('content'),
 +                'tags' : question_tags,
 +                'state': 'active',
 +                'active': True,
 +            }, context=create_context)
 +        return werkzeug.utils.redirect("/forum/%s/question/%s" % (slug(forum),new_question_id))
 +
-     @http.route('/forum/<model("website.forum"):forum>/question/postanswer/', type='http', auth="public", multilang=True, methods=['POST'], website=True)
++    @http.route('/forum/<model("website.forum"):forum>/question/postanswer', type='http', auth="public", multilang=True, methods=['POST'], website=True)
 +    def post_answer(self, forum , post_id, **question):
 +        if not request.session.uid:
 +            return login_redirect()
 +
 +        cr, uid, context = request.cr, request.uid, request.context
 +        request.registry['res.users'].write(cr, SUPERUSER_ID, uid, {'forum': True}, context=context)
 +
 +        create_context = dict(context)
 +        new_question_id = request.registry['website.forum.post'].create(
 +            cr, uid, {
 +                'forum_id': forum.id,
 +                'user_id': uid,
 +                'parent_id': post_id,
 +                'content': question.get('content'),
 +                'state': 'active',
 +                'active': True,
 +            }, context=create_context)
 +        return werkzeug.utils.redirect("/forum/%s/question/%s" % (slug(forum),post_id))
 +
 +    @http.route(['/forum/<model("website.forum"):forum>/question/<model("website.forum.post"):question>/editanswer']
 +                , type='http', auth="user", website=True, multilang=True)
 +    def edit_answer(self, forum, question, **kwargs):
 +        for record in question.child_ids:
 +            if record.user_id.id == request.uid:
 +                answer = record
 +        return werkzeug.utils.redirect("/forum/%s/question/%s/edit/%s" % (slug(forum), question.id, answer.id))
 + 
 +    @http.route(['/forum/<model("website.forum"):forum>/edit/question/<model("website.forum.post"):question>',
 +                 '/forum/<model("website.forum"):forum>/question/<model("website.forum.post"):question>/edit/<model("website.forum.post"):answer>']
 +                , type='http', auth="user", website=True, multilang=True)
 +    def edit_post(self, forum, question, answer=None, **kwargs):
 +        cr, uid, context = request.cr, request.uid, request.context
 +
 +        history_obj = request.registry['website.forum.post.history']
 +        User = request.registry['res.users']
 +        User.write(cr, SUPERUSER_ID, uid, {'forum': True}, context=context)
 +        user = User.browse(cr, uid, uid, context=context)
 +
 +        post_id = answer.id if answer else question.id
 +        history_ids = history_obj.search(cr, uid, [('post_id', '=', post_id)], order = "id desc", context=context)
 +        post_history = history_obj.browse(cr, uid, history_ids, context=context)
 +
 +        tags = ""
 +        for tag_name in question.tags:
 +            tags += tag_name.name + ","
 +
 +        values = {
 +            'question': question,
 +            'user': user,
 +            'tags': tags,
 +            'answer': answer,
 +            'is_answer': True if answer else False,
 +            'notifications': self._get_notifications(),
 +            'forum': forum,
 +            'post_history': post_history,
 +            'searches': kwargs
 +        }
 +        return request.website.render("website_forum.edit_post", values)
 +
 +    @http.route('/forum/<model("website.forum"):forum>/post/save', type='http', auth="user", multilang=True, methods=['POST'], website=True)
 +    def save_edited_post(self, forum, **post):
 +        cr, uid, context = request.cr, request.uid, request.context
 +        request.registry['res.users'].write(cr, SUPERUSER_ID, uid, {'forum': True}, context=context)
 +        vals = {
 +            'content': post.get('content'),
 +        }
 +        if post.get('question_tag'):
 +            Tag = request.registry['website.forum.tag']
 +            tags = post.get('question_tag').strip('[]').replace('"','').split(",")
 +            question_tags = []
 +            for tag in tags:
-                 tag_ids = Tag.search(cr, uid, [('name', 'like', tag)], context=context)
++                tag_ids = Tag.search(cr, uid, [('name', '=', tag)], context=context)
 +                if tag_ids:
-                     question_tags.append((6, 0, tag_ids))
++                    question_tags += tag_ids
 +                else:
-                     question_tags.append((0,0,{'name' : tag,'forum_id' : forum.id}))
-             vals.update({'tags': question_tags, 'name': post.get('question_name')})
++                    new_tag = Tag.create(cr, uid, {'name' : tag,'forum_id' : forum.id}, context=context)
++                    question_tags.append(new_tag)
++            vals.update({'tags': [(6, 0, question_tags)], 'name': post.get('question_name')})
 +
 +        post_id = post.get('answer_id') if post.get('answer_id') else post.get('question_id')
 +        new_question_id = request.registry['website.forum.post'].write( cr, uid, [int(post_id)], vals, context=context)
 +        return werkzeug.utils.redirect("/forum/%s/question/%s" % (slug(forum),post.get('question_id')))
 +
 +    @http.route(['/forum/<model("website.forum"):forum>/tag'], type='http', auth="public", website=True, multilang=True)
 +    def tags(self, forum, page=1, **searches):
 +        cr, uid, context = request.cr, request.uid, request.context
 +        Tag = request.registry['website.forum.tag']
 +        obj_ids = Tag.search(cr, uid, [('forum_id', '=', forum.id)], limit=None, context=context)
 +        tags = Tag.browse(cr, uid, obj_ids, context=context)
 +        values = {
 +            'tags': tags,
 +            'notifications': self._get_notifications(),
 +            'forum': forum,
 +            'searches': {'tags': True}
 +        }
 +        return request.website.render("website_forum.tag", values)
 +
 +    @http.route(['/forum/<model("website.forum"):forum>/badge'], type='http', auth="public", website=True, multilang=True)
 +    def badges(self, forum, **searches):
 +        cr, uid, context = request.cr, request.uid, request.context
 +        Badge = request.registry['gamification.badge']
 +        badge_ids = Badge.search(cr, uid, [('level', '!=', False)], context=context)
 +        badges = Badge.browse(cr, uid, badge_ids, context=context)
 +        values = {
 +            'badges': badges,
 +            'notifications': {},
 +            'forum': forum,
 +            'searches': {'badges': True}
 +        }
 +        return request.website.render("website_forum.badge", values)
 +
 +    @http.route(['/forum/<model("website.forum"):forum>/badge/<model("gamification.badge"):badge>'], type='http', auth="public", website=True, multilang=True)
 +    def badge_users(self, forum, badge, **kwargs):
 +        users = [badge_user.user_id for badge_user in badge.owner_ids]
 +        kwargs['badges'] = 'True'
 +
 +        values = {
 +            'badge': badge,
 +            'notifications': {},
 +            'users': users,
 +            'forum': forum,
 +            'searches': kwargs
 +        }
 +        return request.website.render("website_forum.badge_user", values)
 +
 +    @http.route(['/forum/<model("website.forum"):forum>/users', '/forum/users/page/<int:page>'], type='http', auth="public", website=True, multilang=True)
 +    def users(self, forum, page=1, **searches):
 +        cr, uid, context = request.cr, request.uid, request.context
 +        User = request.registry['res.users']
 +
 +        step = 30
 +        tag_count = User.search(cr, uid, [('forum','=',True)], count=True, context=context)
 +        pager = request.website.pager(url="/forum/users", total=tag_count, page=page, step=step, scope=30)
 +
 +        obj_ids = User.search(cr, uid, [('forum','=',True)], limit=step, offset=pager['offset'], context=context)
 +        users = User.browse(cr, uid, obj_ids, context=context)
 +        searches['users'] = 'True'
 +
 +        values = {
 +            'users': users,
 +            'notifications': self._get_notifications(),
 +            'pager': pager,
 +            'forum': forum,
 +            'searches': searches,
 +        }
 +
 +        return request.website.render("website_forum.users", values)
 +
-     @http.route('/forum/post_vote/', type='json', auth="public", multilang=True, methods=['POST'], website=True)
++    @http.route('/forum/post_vote', type='json', auth="public", multilang=True, methods=['POST'], website=True)
 +    def post_vote(self, **post):
 +        if not request.session.uid:
 +            return {'error': 'anonymous_user'}
 +        cr, uid, context, post_id = request.cr, request.uid, request.context, int(post.get('post_id'))
 +        Vote = request.registry['website.forum.post.vote']
 +        return Vote.vote(cr, uid, post_id, post.get('vote'), context)
 +
-     @http.route('/forum/post_delete/', type='json', auth="user", multilang=True, methods=['POST'], website=True)
++    @http.route('/forum/post_delete', type='json', auth="user", multilang=True, methods=['POST'], website=True)
 +    def delete_answer(self, **kwarg):
 +        request.registry['website.forum.post'].unlink(request.cr, request.uid, [int(kwarg.get('post_id'))], context=request.context)
 +        return True
 +
 +    @http.route('/forum/<model("website.forum"):forum>/delete/question/<model("website.forum.post"):post>', type='http', auth="user", multilang=True, website=True)
 +    def delete_question(self, forum, post, **kwarg):
 +        #instead of unlink record just change 'active' to false so user can undelete it.
 +        request.registry['website.forum.post'].write( request.cr, request.uid, [post.id], {
 +            'active': False,
 +        }, context=request.context)
 +        return werkzeug.utils.redirect("/forum/%s/question/%s" % (slug(forum),post.id))
 +
 +    @http.route('/forum/<model("website.forum"):forum>/undelete/question/<model("website.forum.post"):post>', type='http', auth="user", multilang=True, website=True)
 +    def undelete_question(self, forum, post, **kwarg):
 +        request.registry['website.forum.post'].write( request.cr, request.uid, [post.id], {
 +            'active': True,
 +        }, context=request.context)
 +        return werkzeug.utils.redirect("/forum/%s/question/%s" % (slug(forum),post.id))
 +
-     @http.route('/forum/message_delete/', type='json', auth="user", multilang=True, methods=['POST'], website=True)
++    @http.route('/forum/message_delete', type='json', auth="user", multilang=True, methods=['POST'], website=True)
 +    def delete_comment(self, **kwarg):
 +        request.registry['mail.message'].unlink(request.cr, SUPERUSER_ID, [int(kwarg.get('message_id'))], context=request.context)
 +        return True
 +
 +    @http.route('/forum/selecthistory', type='json', auth="user", multilang=True, methods=['POST'], website=True)
 +    def post_history(self, **kwarg):
 +        cr, uid, context = request.cr, request.uid, request.context
 +        post_history = request.registry['website.forum.post.history'].browse(cr, uid, int(kwarg.get('history_id')), context=context)
 +        tags = ""
 +        for tag_name in post_history.tags:
 +            tags += tag_name.name + ","
 +        data = {
 +            'name': post_history.post_name,
 +            'content': post_history.content,
 +            'tags': tags,
 +        }
 +        return data
 +
-     @http.route('/forum/correct_answer/', type='json', auth="public", multilang=True, methods=['POST'], website=True)
++    @http.route('/forum/correct_answer', type='json', auth="public", multilang=True, methods=['POST'], website=True)
 +    def correct_answer(self, **kwarg):
 +        cr, uid, context = request.cr, request.uid, request.context
 +        if not request.session.uid:
 +            return {'error': 'anonymous_user'}
 +
 +        Post = request.registry['website.forum.post']
 +        post = Post.browse(cr, uid, int(kwarg.get('post_id')), context=context)
 +        user = request.registry['res.users'].browse(cr, uid, uid, context=None)
 +
 +        #if user have not access to accept answer then reise warning
 +        if not (post.parent_id.user_id.id == uid or user.karma >= 500):
 +            return {'error': 'user'}
 +
 +        #Note: only one answer can be right.
 +        correct = False if post.correct else True
 +        for child in post.parent_id.child_ids:
 +            if child.correct and child.id != post.id:
 +                Post.write( cr, uid, [child.id], { 'correct': False }, context=context)
 +        Post.write( cr, uid, [post.id, post.parent_id.id], { 'correct': correct }, context=context)
 +        return correct
 +
 +    @http.route('/forum/<model("website.forum"):forum>/close/question/<model("website.forum.post"):post>', type='http', auth="user", multilang=True, website=True)
 +    def close_question(self, forum, post, **kwarg):
 +        cr, uid, context = request.cr, request.uid, request.context
 +        Reason = request.registry['website.forum.post.reason']
 +        reason_ids = Reason.search(cr, uid, [], context=context)
 +        reasons = Reason.browse(cr, uid, reason_ids, context)
 +
 +        values = {
 +            'post': post,
 +            'forum': forum,
 +            'searches': kwarg,
 +            'reasons': reasons,
 +            'notifications': self._get_notifications(),
 +        }
 +        return request.website.render("website_forum.close_question", values)
 +
-     @http.route('/forum/<model("website.forum"):forum>/question/close/', type='http', auth="user", multilang=True, methods=['POST'], website=True)
++    @http.route('/forum/<model("website.forum"):forum>/question/close', type='http', auth="user", multilang=True, methods=['POST'], website=True)
 +    def close(self, forum, **post):
 +        request.registry['website.forum.post'].write( request.cr, request.uid, [int(post.get('post_id'))], {
 +            'state': 'close',
 +            'closed_by': request.uid,
 +            'closed_date': datetime.today().strftime(tools.DEFAULT_SERVER_DATETIME_FORMAT),
 +            'reason_id': post.get('reason'),
 +        }, context=request.context)
 +        return werkzeug.utils.redirect("/forum/%s/question/%s" % (slug(forum),post.get('post_id')))
 +
 +    @http.route('/forum/<model("website.forum"):forum>/reopen/question/<model("website.forum.post"):post>', type='http', auth="user", multilang=True, website=True)
 +    def reopen(self, forum, post, **kwarg):
 +        request.registry['website.forum.post'].write( request.cr, request.uid, [post.id], {
 +            'state': 'active',
 +        }, context=request.context)
 +        return werkzeug.utils.redirect("/forum/%s/question/%s" % (slug(forum),post.id))
 +
 +    @http.route('/forum/<model("website.forum"):forum>/edit/profile/<model("res.users"):user>', type='http', auth="user", multilang=True, website=True)
 +    def edit_profile(self, forum, user, **kwarg):
 +        cr,context = request.cr, request.context
 +        country = request.registry['res.country']
 +        country_ids = country.search(cr, SUPERUSER_ID, [], context=context)
 +        countries = country.browse(cr, SUPERUSER_ID, country_ids, context)
 +        values = {
 +            'user': user,
 +            'forum': forum,
 +            'searches': kwarg,
 +            'countries': countries,
 +            'notifications': self._get_notifications(),
 +        }
 +        return request.website.render("website_forum.edit_profile", values)
 +
-     @http.route('/forum/<model("website.forum"):forum>/save/profile/', type='http', auth="user", multilang=True, website=True)
++    @http.route('/forum/<model("website.forum"):forum>/save/profile', type='http', auth="user", multilang=True, website=True)
 +    def save_edited_profile(self, forum, **post):
 +        cr, uid, context = request.cr, request.uid, request.context
 +        user = request.registry['res.users'].browse(cr, uid, int(post.get('user_id')),context=context)
 +        request.registry['res.partner'].write( cr, uid, [user.partner_id.id], {
 +            'name': post.get('name'),
 +            'website': post.get('website'),
 +            'email': post.get('email'),
 +            'city': post.get('city'),
 +            'country_id': post.get('country'),
 +            'website_description': post.get('description'), 
 +        }, context=context)
 +        return werkzeug.utils.redirect("/forum/%s/user/%s" % (slug(forum),post.get('user_id')))
 +
 +    @http.route('/forum/<model("website.forum"):forum>/post/<model("website.forum.post"):post>/commet/<model("mail.message"):comment>/converttoanswer', type='http', auth="public", multilang=True, website=True)
 +    def convert_to_answer(self, forum, post, comment, **kwarg):
 +        values = {
-             'answer_content': comment.body,
++            'content': comment.body,
 +        }
 +        request.registry['mail.message'].unlink(request.cr, request.uid, [comment.id], context=request.context)
 +        return self.post_answer(forum, post.parent_id and post.parent_id.id or post.id, **values)
 +
 +    @http.route('/forum/<model("website.forum"):forum>/post/<model("website.forum.post"):post>/converttocomment', type='http', auth="user", multilang=True, website=True)
 +    def convert_to_comment(self, forum, post, **kwarg):
 +        values = {
 +            'comment': html2plaintext(post.content),
 +        }
 +        question = post.parent_id.id
 +        request.registry['website.forum.post'].unlink(request.cr, SUPERUSER_ID, [post.id], context=request.context)
 +        return self.post_comment(forum, question, **values)
 +
 +    @http.route('/forum/get_tags', type='http', auth="public", multilang=True, methods=['GET'], website=True)
 +    def tag_read(self, **kwarg):
 +        tags = request.registry['website.forum.tag'].search_read(request.cr, request.uid, [], ['name'], context=request.context)
 +        data = [tag['name'] for tag in tags]
 +        return simplejson.dumps(data)
 +
 +    @http.route('/forum/<model("website.forum"):forum>/question/<model("website.forum.post"):post>/subscribe', type='http', auth="public", multilang=True, website=True)
 +    def subscribe(self, forum, post, **kwarg):
 +        cr, uid, context = request.cr, request.uid, request.context
 +        if not request.session.uid:
 +            return login_redirect()
 +        partner_id = request.registry['res.users'].browse(cr, uid, request.uid, context=context).partner_id.id
 +        post_ids = [child.id for child in post.child_ids]
 +        post_ids.append(post.id)
 +        request.registry['website.forum.post'].message_subscribe( cr, uid, post_ids, [partner_id], context=context)
 +        return werkzeug.utils.redirect("/forum/%s/question/%s" % (slug(forum),post.id))
 +
 +    @http.route('/forum/<model("website.forum"):forum>/question/<model("website.forum.post"):post>/unsubscribe', type='http', auth="user", multilang=True, website=True)
 +    def unsubscribe(self, forum, post, **kwarg):
 +        cr, uid, context = request.cr, request.uid, request.context
 +        partner_id = request.registry['res.users'].browse(cr, uid, request.uid, context=context).partner_id.id
 +        post_ids = [child.id for child in post.child_ids]
 +        post_ids.append(post.id)
 +        request.registry['website.forum.post'].message_unsubscribe( cr, uid, post_ids, [partner_id], context=context)
 +        return werkzeug.utils.redirect("/forum/%s/question/%s" % (slug(forum),post.id))
index 591417f,0000000..8c6d32e
mode 100644,000000..100644
--- /dev/null
@@@ -1,147 -1,0 +1,147 @@@
 +<h1>Guidelines</h1>
- <h2><a id="good_questions">What kinds of questions can I ask here?</a></h2>
++<h2><a class="faq-question">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>
++<h2><a class="faq-question">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>
++<h2><a class="faq-question">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>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>
++<h2><a class="faq-question">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>
index 8d2edfb,0000000..867a1fe
mode 100644,000000..100644
--- /dev/null
@@@ -1,2 -1,0 +1,2 @@@
 +sass:
-       sass --compass --unix-newlines -t expanded website_forum.sass:website_forum.css
++    sass --compass --unix-newlines -t expanded website_forum.sass:website_forum.css
index b4c6e23,0000000..e8f0978
mode 100644,000000..100644
--- /dev/null
@@@ -1,66 -1,0 +1,77 @@@
 +.box {
 +  padding-left: 8px;
 +  padding-right: 8px;
 +  border-radius: 4px;
 +}
 +.box span {
 +  font-size: 200%;
 +  font-weight: bold;
 +}
 +
 +.question div.pull-left {
 +  margin-right: 14px;
 +  min-width: 80px;
 +}
 +.question .question-name {
 +  font-size: 150%;
 +}
 +
 +.oe_grey {
 +  background-color: #eeeeee;
 +}
 +
 +.img-avatar {
 +  max-width: 50px;
 +  margin-right: 10px;
 +}
 +
 +.badge-gold {
 +  color: #ffcc00;
 +}
 +
 +.badge-silver {
 +  color: #cccccc;
 +}
 +
 +.badge-bronze {
 +  color: #eea91e;
 +}
 +
 +.oe_answer_true {
 +  color: #428bca;
 +}
 +
 +.oe_answer_false {
 +  color: #999
 +}
 +
++.load_tags{
++  width: 845px !important;
++}
++
++.fa-thumbs-up, .fa-thumbs-down, .oe_answer_true, .oe_answer_false {
++  cursor:pointer;
++}
++
++.faq-question:hover {
++  text-decoration: none !important;
++  color: #428bca;
++}
++
++.oe_comment_grey {
++  -moz-box-shadow: 0px 4px 6px 2px #eeeeee;
++  -webkit-box-shadow: 0px 4px 6px 2px #eeeeee;
++  box-shadow: 0px 4px 6px 2px #eeeeee;
++}
++
 +.tag_text .text-core .text-wrap textarea,
 +.tag_text .text-core .text-wrap input,
 +.tag_text .text-core .text-wrap .text-dropdown,
 +.tag_text .text-core .text-wrap .text-prompt,
 +.tag_text .text-core .text-wrap .text-tags .text-tag .text-button {
 +  font: 1.2em "Helvetica Neue",Helvetica,Arial,sans-serif !important;
 +}
 +
 +.tag_text .text-core .text-wrap .text-tags .text-tag .text-button {
 +  height: 1.2em !important;
- }
- .load_tags{
-   width: 845px !important;
- }
- .fa-thumbs-up, .fa-thumbs-down, .oe_answer_true, .oe_answer_false {
-   cursor:pointer;
 +}
index 2f950b5,0000000..f19d7a5
mode 100644,000000..100644
--- /dev/null
@@@ -1,173 -1,0 +1,173 @@@
 +$(document).ready(function () {
 +
 +    $('.fa-thumbs-up ,.fa-thumbs-down').on('click', function (ev) {
 +        ev.preventDefault();
 +        var $link = $(ev.currentTarget);
 +        var value = $link.attr("value")
 +        
-         openerp.jsonRpc("/forum/post_vote/", 'call', {
++        openerp.jsonRpc("/forum/post_vote", 'call', {
 +                'post_id': $link.attr("id"),
 +                'vote': value})
 +            .then(function (data) {
 +                if (data['error']){
 +                    if (data['error'] == 'own_post'){
 +                        var $warning = $('<div class="alert alert-danger alert-dismissable" id="vote_alert" style="position:absolute; margin-top: -30px; margin-left: 90px;">'+
 +                            '<button type="button" class="close notification_close" data-dismiss="alert" aria-hidden="true">&times;</button>'+
 +                            'Sorry, you cannot vote for your own posts'+
 +                            '</div>');
 +                    } else if (data['error'] == 'anonymous_user'){
 +                        var $warning = $('<div class="alert alert-danger alert-dismissable" id="vote_alert" style="position:absolute; margin-top: -30px; margin-left: 90px;">'+
 +                            '<button type="button" class="close notification_close" data-dismiss="alert" aria-hidden="true">&times;</button>'+
 +                            'Sorry, anonymous users cannot vote'+
 +                            '</div>');
 +                    }
 +                    else if (data['error'] == 'lessthen_10_karma')
 +                    {
 +                        var $warning = $('<div class="alert alert-danger alert-dismissable" id="vote_alert" style="position:absolute; margin-top: -30px; margin-left: 90px;">'+
 +                            '<button type="button" class="close notification_close" data-dismiss="alert" aria-hidden="true">&times;</button>'+
 +                            '10 karma required to downvote'+
 +                            '</div>');
 +                    }
 +                    vote_alert = $link.parent().find("#vote_alert");
 +                    if (vote_alert.length == 0) {
 +                        $link.parent().append($warning);
 +                    }
 +                } else {
 +                    $link.parent().find("#vote_count").html(data['vote_count']);
 +                    if (data == 0) {
 +                        $link.parent().find(".text-success").removeClass("text-success");
 +                        $link.parent().find(".text-warning").removeClass("text-warning");
 +                    } else {
 +                        if (value == 1) {
 +                            $link.addClass("text-success");
 +                        } else {
 +                            $link.addClass("text-warning");
 +                        }
 +                    }
 +                }
 +            });
 +        return true;
 +    });
 +
 +    $('.delete').on('click', function (ev) {
 +        ev.preventDefault();
 +        var $link = $(ev.currentTarget);
-         openerp.jsonRpc("/forum/post_delete/", 'call', {
++        openerp.jsonRpc("/forum/post_delete", 'call', {
 +            'post_id': $link.attr("id")})
 +            .then(function (data) {
 +                $link.parents('#answer').remove();
 +            });
 +        return false;
 +    });
 +
-     $('.fa-check').on('click', function (ev) {
++    $('.fa-check-circle').on('click', function (ev) {
 +        ev.preventDefault();
 +        var $link = $(ev.currentTarget);
-         openerp.jsonRpc("/forum/correct_answer/", 'call', {
++        openerp.jsonRpc("/forum/correct_answer", 'call', {
 +            'post_id': $link.attr("id")})
 +            .then(function (data) {
 +                if (data['error']) {
 +                    if (data['error'] == 'anonymous_user'){
 +                        var $warning = $('<div class="alert alert-danger alert-dismissable" id="correct_answer_alert" style="position:absolute; margin-top: -30px; margin-left: 90px;">'+
 +                            '<button type="button" class="close notification_close" data-dismiss="alert" aria-hidden="true">&times;</button>'+
 +                            'Sorry, anonymous users cannot choose correct answer.'+
 +                            '</div>');
 +                    } else if (data['error'] == 'user'){
 +                        var $warning = $('<div class="alert alert-danger alert-dismissable" id="correct_answer_alert" style="position:absolute; margin-top: -30px; margin-left: 90px;">'+
 +                            '<button type="button" class="close notification_close" data-dismiss="alert" aria-hidden="true">&times;</button>'+
 +                            'Sorry, You cannot choose correct answer.'+
 +                            '</div>');
 +                    }
 +                    correct_answer_alert = $link.parent().find("#correct_answer_alert");
 +                    if (correct_answer_alert.length == 0) {
 +                        $link.parent().append($warning);
 +                    }
 +                } else {
 +                    $link.parents().find(".oe_answer_true").removeClass("oe_answer_true").addClass('oe_answer_false');
 +                    $link.removeClass("oe_answer_false").addClass('oe_answer_true');
 +                }
 +            });
 +        return true;
 +    });
 +
 +    $('.comment_delete').on('click', function (ev) {
 +        ev.preventDefault();
 +        var $link = $(ev.currentTarget);
-         openerp.jsonRpc("/forum/message_delete/", 'call', {
++        openerp.jsonRpc("/forum/message_delete", 'call', {
 +            'message_id': $link.attr("id")})
 +            .then(function (data) {
 +                $link.parents('#comment').remove();
 +            });
 +        return true;
 +    });
 +
 +    $('.notification_close').on('click', function (ev) {
 +        ev.preventDefault();
 +        var $link = $(ev.currentTarget);
-         openerp.jsonRpc("/forum/notification_read/", 'call', {
++        openerp.jsonRpc("/forum/notification_read", 'call', {
 +            'notification_id': $link.attr("id")})
 +        return true;
 +    });
 +
 +    if($('input.load_tags').length){
 +        var tags = $("input.load_tags").val();
 +        $("input.load_tags").val("");
 +        set_tags(tags);
 +    };
 +
 +    function set_tags(tags) {
 +        $("input.load_tags").textext({
 +            plugins: 'tags focus autocomplete ajax',
 +            tagsItems: tags.split(","),
 +            //Note: The following list of keyboard keys is added. All entries are default except {32 : 'whitespace!'}.
 +            keys: {8: 'backspace', 9: 'tab', 13: 'enter!', 27: 'escape!', 37: 'left', 38: 'up!', 39: 'right',
 +                40: 'down!', 46: 'delete', 108: 'numpadEnter', 32: 'whitespace!'},
 +            ajax: {
 +                url: '/forum/get_tags',
 +                dataType: 'json',
 +                cacheResults: true
 +            }
 +        });
 +        // Note: Adding event handler of whitespaceKeyDown event.
 +        $("input.load_tags").bind("whitespaceKeyDown",function () {
 +            $(this).textext()[0].tags().addTags([ $(this).val() ]);
 +            $(this).val("");
 +        });
 +    }
 +
 +    $('.post_history').change(function (ev) {
 +        var $option = $(ev.currentTarget);
 +        openerp.jsonRpc("/forum/selecthistory", 'call', {
 +            'history_id': $option.attr("value")})
 +            .then(function (data) {
 +                var $input = $('<input type="text" name="question_tag" class="form-control col-md-9 load_tags" placeholder="Tags"/>')
 +                $option.parent().find(".text-core").replaceWith($input);
 +                set_tags(data['tags']);
 +                $option.parent().find("#question_name").attr('value', data['name']);
 +                CKEDITOR.instances['content'].setData(data['content'])
 +            })
 +        return true;
 +    });
 +
 +    if ($('textarea.load_editor').length) {
 +        var editor = CKEDITOR.instances['content'];
 +        editor.on('instanceReady', CKEDITORLoadComplete);
 +    }
 +});
 +
 +function IsKarmaValid(eventNumber,minKarma){
 +    "use strict";
 +    if(parseInt($("#karma").val()) >= minKarma){
 +        CKEDITOR.tools.callFunction(eventNumber,this);
 +        return false;
 +    } else {
 +        alert("Sorry you need more than 30 Karma.");
 +    }
 +}
 +
 +function CKEDITORLoadComplete(){
 +    "use strict";
 +    $('.cke_button__link').attr('onclick','IsKarmaValid(33,30)');
 +    $('.cke_button__unlink').attr('onclick','IsKarmaValid(37,30)');
 +    $('.cke_button__image').attr('onclick','IsKarmaValid(41,30)');
 +}
index f270ce3,0000000..86430d4
mode 100644,000000..100644
--- /dev/null
@@@ -1,866 -1,0 +1,867 @@@
 +<?xml version="1.0" encoding="utf-8"?>
 +<openerp>
 +    <data>
 +
 +        <template id="editor_head" inherit_id="website.editor_head"
 +            name="Event Editor">
 +            <xpath expr="//script[@id='website_tour_js']" position="after">
 +                <script type="text/javascript"
 +                    src="/website_forum/static/src/js/website.tour.forum.js"/>
 +                <script type="text/javascript" 
 +                    src="/website_forum/static/src/js/website_forum.editor.js"/>
 +            </xpath>
 +        </template>
 +
 +        <!-- Layout add nav and footer -->
 +        <template id="header_footer_custom" inherit_id="website.layout"
 +            name="Footer Questions Link">
 +            <xpath expr="//footer//ul[@name='products']" position="inside">
 +                <li>
 +                    <a t-attf-href="/forum/%(website_forum.forum_help)d/">Q&amp;A</a>
 +                </li>
 +            </xpath>
 +        </template>
 +
 +        <!-- List of Questions -->
 +        <template id="post_list">
 +            <div class="question clearfix">
 +                <div class="pull-left text-center">
 +                    <div t-attf-class="box #{question.child_count and 'oe_green' or 'oe_grey'}">
 +                        <span t-esc="question.child_count"/>
++                        <span t-if="question.correct" class="fa fa-2x fa-check-circle"/>
 +                        <div t-if="question.child_count&gt;1">Answers</div>
 +                        <div t-if="question.child_count&lt;=1">Answer</div>
 +                    </div>
 +                    <div class="text-muted text-center">
 +                        <span t-field="question.views"/> Views
 +                    </div>
 +                </div>
 +                <div style="margin-left: 95px;">
 +                    <div class="question-name">
 +                        <a t-attf-href="/forum/#{ slug(forum) }/question/#{ slug(question) }" t-field="question.name"/>
 +                            <span t-if="not question.active"><b> [Deleted]</b></span>
 +                            <span t-if="question.state == 'close'"><b> [Closed]</b></span>
 +                    </div>
 +                    <div class="text-muted">
 +                        by <a t-attf-href="/forum/#{ slug(forum) }/user/#{ question.user_id.id }" t-field="question.user_id"/>, 
 +                        on <span t-field="question.write_date" t-field-options='{"format":"short"}'/>
 +                        <div t-if="question.vote_count">
 +                            <strong>with <span t-esc="question.vote_count"/> votes</strong>
 +                        </div>
 +                    </div>
 +                    <t t-foreach="question.tags" t-as="tag">
 +                        <a t-attf-href="/forum/#{ slug(forum) }/tag/#{ tag.id }/questions" class="badge" t-field="tag.name"/>
 +                    </t>
 +                </div>
 +            </div>
 +        </template>
 +
 +        <!-- Page Index -->
 +        <template id="header" name="Forum Index">
 +            <t t-call="website.layout">
 +                <t t-set="head">
 +                    <link rel='stylesheet' href="/web/static/lib/jquery.textext/jquery.textext.css"/>
 +                    <link rel='stylesheet' href='/website_forum/static/src/css/website_forum.css'/>
 +                    <!--
 +                    FP Note: Why do we need this ? Can we remove this code?
 +                    The problem is that you add your script for every page, not only for the forum
 +                    -->
 +                    <script type="text/javascript" src="/website_forum/static/src/js/website_forum.js"/>
 +                    <script type="text/javascript" src="/web/static/lib/jquery.textext/jquery.textext.js"/>
 +                    <script type="text/javascript" src="/web/static/lib/ckeditor/ckeditor.js"/>
 +                    <script type="text/javascript">
 +                        CKEDITOR.config.toolbar = [['Bold','Italic','Underline','Strike'],['NumberedList','BulletedList', 'Blockquote']
 +                        ,['Outdent','Indent','Link','Unlink','Image'],] ;
 +                    </script>
 +                </t>
 +                <div class="container mt16">
 +                    <div class="navbar navbar-default">
 +                        <div class="navbar-header">
 +                            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#oe-help-navbar-collapse">
 +                                <span class="sr-only">Toggle navigation</span>
 +                                <span class="icon-bar"></span>
 +                                <span class="icon-bar"></span>
 +                                <span class="icon-bar"></span>
 +                            </button>
 +                            <a class="navbar-brand" t-attf-href="/forum/#{slug(forum)}">
 +                                <span t-field="forum.name"/>
 +                            </a>
 +                        </div>
 +                        <div class="collapse navbar-collapse" id="oe-help-navbar-collapse">
 +                            <ul class="nav navbar-nav">
 +                                <li t-att-class="filters in ('all', 'unanswered','followed','question','tag') and 'active' or '' ">
 +                                    <a t-attf-href="/forum/#{ slug(forum) }">Questions</a>
 +                                </li>
 +                                <li t-att-class="searches.get('users') and 'active' or '' ">
 +                                    <a t-attf-href="/forum/#{ slug(forum) }/users">People</a>
 +                                </li>
 +                                <li t-att-class="searches.get('tags') and 'active' or '' ">
 +                                    <a t-attf-href="/forum/#{ slug(forum) }/tag">Tags</a>
 +                                </li>
 +                                <li t-att-class="searches.get('badges') and 'active' or '' ">
 +                                    <a t-attf-href="/forum/#{ slug(forum) }/badge">Badges</a>
 +                                </li>
 +                            </ul>
 +                            <form class="navbar-form navbar-right" role="search" t-attf-action="/forum/#{ slug(forum) }" method="get">
 +                                <div class="form-group">
 +                                    <input type="search" class="form-control"
 +                                        name="search" placeholder="Search a question..."
 +                                        t-att-value="searches.get('search') or ''"/>
 +                                    <button type="submit" class="btn btn-default">Search</button>
 +                                </div>
 +                            </form>
 +                        </div>
 +                    </div>
 +                </div>
 +
 +                <div id="wrap" class="container">
 +                    <div class="row">
 +                        <div class="col-sm-9">
 +                            <div t-foreach="notifications.get('notifications') or []" t-as="notification" class="alert alert-success alert-dismissable">
 +                                <button type="button" class="close notification_close" t-att-id="notification.id" data-dismiss="alert" aria-hidden="true">&amp;times;</button>
 +                                <div t-field="notification.body"/>
 +                                <a t-attf-href="/forum/#{ slug(forum) }/user/#{ slug(notifications.get('user')) }#badges" class="fa fa-arrow-right">View Your Badges</a>
 +                            </div>
 +                            <t t-raw="0"/>
 +                        </div>
 +                        <div class="col-sm-3" id="right-column">
-                             <a class="btn btn-primary btn-lg btn-block mb16" t-attf-href="/forum/#{ slug(forum) }/ask">Ask a Question</a>
++                            <a t-if="not ask_question" class="btn btn-primary btn-lg btn-block mb16" t-attf-href="/forum/#{ slug(forum) }/ask">Ask a Question</a>
 +                            <div t-field="forum.right_column"/>
 +                            <div t-if="question_data">
 +                                <div class="panel panel-default">
 +                                    <div class="panel-heading text-center">
 +                                        <h3 class="panel-title">Question tools</h3>
 +                                    </div>
 +                                    <div class="panel-body text-center">
 +                                        <a class="btn btn-block btn-default btn-md" t-if="not following"
 +                                            t-attf-href="/forum/#{ slug(forum) }/question/#{ question.id }/subscribe">Follow</a>
 +                                        <a class="btn btn-block btn-default btn-md" t-if="following"
 +                                            t-attf-href="/forum/#{ slug(forum) }/question/#{ question.id }/unsubscribe">UnFollow</a>
 +                                        <div class="mt8">
 +                                            <strong><t t-raw="len(question.message_follower_ids)"/></strong> follower
 +                                        </div>
 +                                    </div>
 +                                    <div class="panel-heading text-center">
 +                                        <h3 class="panel-title ">Stats</h3>
 +                                    </div>
 +                                    <div class="panel-body"> 
 +                                        <table class="table">
 +                                            <thead><tr><td> Asked: <strong><span t-field="question.create_date" t-field-options='{"format":"short"}'/></strong></td></tr></thead>
 +                                            <tr><td> Seen: <strong><t t-raw="question.views"/></strong>
 +                                                <span t-if="question.views&gt;1">times</span>
 +                                                <span t-if="question.views&lt;=1">time</span>
 +                                            </td></tr>
 +                                            <tr><td> Last updated: <strong><span t-field="question.write_date" t-field-options='{"format":"short"}'/></strong></td></tr>
 +                                        </table>
 +                                    </div>
 +                                </div>
 +                            </div>
 +                        </div>
 +                    </div>
 +                </div>
 +                <div class="oe_structure"/>
 +            </t>
 +        </template>
 +
 +        <template id="faq">
 +            <t t-call="website_forum.header">
 +                <div t-field="forum.faq"/>
 +            </t>
 +        </template>
 +
 +        <template id="forum_index">
 +            <t t-call="website.layout">
 +                <div class="container">
 +                    <h1 class="mb32">Our forums</h1>
 +                    <div class="row">
 +                        <div t-foreach="forums" t-as="forum" class="col-sm-3 text-center mb32">
 +                            <a t-attf-href="/forum/#{ slug(forum) }">
 +                                <div class="fa fa-5x fa-comment mb16"/>
 +                                <div t-field="forum.name"/>
 +                            </a>
 +                        </div>
 +                    </div>
 +                </div>
 +            </t>
 +        </template>
 +
 +        <template id="index">
 +            <t t-call="website_forum.header">
 +                <h1 class="page-header mt0">
 +                    <t t-esc="total_questions"/>
 +                    <span>Questions</span>
 +                    <small class="dropdown" t-if="filters in ('all', 'unanswered','followed', 'tag')">
 +                      <a href="#" class="dropdown-toggle" data-toggle="dropdown">
 +                          <t t-if="filters == 'all'">All</t>
 +                          <t t-if="filters == 'unanswered'">Unanswered</t>
 +                          <t t-if="filters == 'followed'">Followed</t>
 +                          <t t-if="filters == 'tag'">Tag</t>
 +                          <t t-if="sorting == 'date'"> by activity date</t>
 +                          <t t-if="sorting == 'answered'"> by most answered</t>
 +                          <t t-if="sorting == 'vote'"> by most voted</t>
 +                          <b class="caret"/>
 +                      </a>
 +                      <ul class="dropdown-menu">
 +                          <li class="dropdown-header">Filter on</li>
 +                          <li t-att-class="filters == 'all' and 'active' or '' ">
 +                              <a t-att-href="url_for('') + '?' + keep_query( 'sorting', filters='all')">All</a>
 +                          </li>
 +                          <li t-att-class="filters == 'unanswered' and 'active' or '' ">
 +                              <a t-att-href="url_for('') + '?' + keep_query( 'sorting', filters='unanswered')">Unanswered</a>
 +                          </li>
 +                          <li t-if="uid" t-att-class="filters == 'followed' and 'active' or '' ">
 +                              <a t-att-href="url_for('') + '?' + keep_query( 'sorting', filters='followed')">Followed</a>
 +                          </li>
 +                          <li t-if="tag" t-att-class="tag and 'active' or '' ">
 +                              <a href=""><t t-esc="tag.name"/> Tag</a>
 +                          </li>
 +                          <li class="dropdown-header">Sort by</li>
 +                          <li t-att-class="sorting == 'date' and 'active' or '' ">
 +                              <a t-att-href="url_for('') + '?' + keep_query( 'filters', sorting='date')">Last activity date</a>
 +                          </li>
 +                          <li t-att-class="sorting == 'answered' and 'active' or '' ">
 +                              <a t-att-href="url_for('') + '?' + keep_query( 'filters', sorting='answered')">Most answered</a>
 +                          </li>
 +                          <li t-att-class="sorting == 'vote' and 'active' or '' ">
 +                              <a t-att-href="url_for('') + '?' + keep_query( 'filters', sorting='vote')">Most voted</a>
 +                          </li>
 +                      </ul>
 +                    </small>
 +                </h1>
 +                <div t-foreach="question_ids" t-as="question" class="mb16">
 +                    <t t-call="website_forum.post_list"/>
 +                </div>
 +                <t t-call="website.pager"/>
 +            </t>
 +        </template>
 +
 +        <template id="404">
 +            <t t-call="website_forum.header">
 +                <div class="oe_structure oe_empty"/>
 +                <h1 class="mt32">Question not found!</h1>
 +                <p>Sorry, this question is not available anymore.</p>
 +                <p>
 +                    <a t-attf-href="/forum">Return to the question list.</a>
 +                </p>
 +            </t>
 +        </template>
 +
 +        <template id="user_detail">
 +            <div>
 +                <span t-field="user.image" t-field-options='{"widget": "image", "class":"pull-left img img-circle img-avatar"}'/>
 +                <div>
 +                    <a t-attf-href="/forum/#{ slug(forum) }/user/#{ slug(user) }" t-field="user.name"/>
 +                    <t t-raw="separator or ', '"/>
 +                    <t t-esc="user.karma"/>
 +                    <b> badges:</b>
 +                    <span class="fa fa-circle badge-gold"/>
 +                    <t t-esc="user.gold_badge"/>
 +                    <span class="fa fa-circle badge-silver"/>
 +                    <t t-esc="user.silver_badge"/>
 +                    <span class="fa fa-circle badge-bronze"/>
 +                    <t t-esc="user.bronze_badge"/>
 +                    <br/>
 +                    <t t-raw="0"/>
 +                </div>
 +            </div>
 +        </template>
 +
 +        <template id="ask_question">
 +            <t t-call="website_forum.header">
 +                <h1 class="mt0">Ask your Question</h1>
 +                <ul>
 +                    <li> please, try to make your question interesting to others </li>
 +                    <li> provide enough details and, if possible, give an example </li>
 +                    <li> be clear and concise, avoid unnecessary introductions (Hi, ... Thanks...) </li>
 +                </ul>
-                 <form t-attf-action="/forum/#{ slug(forum) }/question/ask/" method="post" role="form" class="tag_text">
++                <form t-attf-action="/forum/#{ slug(forum) }/question/ask" method="post" role="form" class="tag_text">
 +                    <input type="text" name="question_name" required="True" t-attf-value="#{question_name}"
 +                        class="form-control" placeholder="Enter your Question"/>
 +                    <h5 class="mt20">Please enter a descriptive question (should finish by a '?')</h5>
 +                    <input type="hidden" name="karma" t-attf-value="#{user.karma}" id="karma"/>
 +                    <textarea name="content" required="True" class="form-control load_editor">
 +                        <t t-esc="question_content"/>
 +                    </textarea>
 +                    <br/>
 +                    <input type="text" name="question_tags" t-attf-value="#{question_tag or ''}" 
 +                        placeholder="Tags" class="form-control load_tags"/>
 +                    <br/>
 +                    <button class="btn btn-primary" id="btn_ask_your_question">Post Your Question</button>
 +                </form>
 +                <script type="text/javascript">
 +                    CKEDITOR.replace("content");
 +                </script>
 +            </t>
 +        </template>
 +
 +        <template id="edit_post">
 +            <t t-call="website_forum.header">
 +                <h3 t-if="not is_answer">Edit question</h3>
 +                <h3 t-if="is_answer">Edit answer</h3>
 +                <form t-attf-action="/forum/#{ slug(forum) }/post/save" method="post" role="form" class="tag_text">
 +                    <select class="form-control post_history">
 +                        <t t-foreach="post_history" t-as="history">
 +                            <option t-att-value="history.id"><t t-esc="history.name"/></option>
 +                        </t>
 +                    </select>
 +                    <div t-if="not is_answer">
 +                        <input type="text" name="question_name" id="question_name" required="True"
 +                            t-attf-value="#{question.name}" class="form-control" placeholder="Edit your Question"/>
 +                        <h5 class="mt20">Please enter a descriptive question (should finish by a '?')</h5>
 +                        <input type="hidden" name="karma" t-attf-value="#{user.karma}" id="karma"/>
 +                    </div>
 +                    <textarea name="content" required="True" class="form-control load_editor">
 +                        <t t-if="is_answer"> <t t-esc="answer.content"/></t>
 +                        <t t-if="not is_answer"><t t-esc="question.content"/></t>
 +                    </textarea>
 +                    <input name="question_id" t-att-value="question.id" type="hidden"/>
 +                    <div t-if="is_answer">
 +                        <input name="answer_id" t-att-value="answer.id" type="hidden"/>
 +                    </div>
 +                    <div t-if="not is_answer">
 +                        <br/>
 +                        <input type="text" name="question_tag" class="form-control col-md-9 load_tags" placeholder="Tags" t-attf-value="#{tags}"/>
 +                        <br/>
 +                    </div>
 +                    <button class="btn btn-primary btn-lg">Save</button>
 +                </form>
 +                <script type="text/javascript">
 +                    CKEDITOR.replace("content");
 +                </script>
 +            </t>
 +        </template>
 +
 +        <template id="close_question">
 +            <t t-call="website_forum.header">
 +                <h3 class=""><b>Close question</b></h3><br/>
-                 <form t-attf-action="/forum/#{ slug(forum) }/question/close/" method="post" role="form">
++                <form t-attf-action="/forum/#{ slug(forum) }/question/close" method="post" role="form">
 +                    <input name="post_id" t-att-value="post.id" type="hidden"/>
 +                    <span class="pull-left">Close the question:</span>
 +                    <a t-attf-href="/forum/#{ slug(forum) }/question/#{ slug(post) }" t-field="post.name"/>
 +                    <div class="mt16">
 +                        <label class="col-md-2 control-label mb16" for="reason">Reasons:</label>
 +                        <div class="col-md-9 mb16">
 +                            <select class="form-control" name="reason">
 +                                <t t-foreach="reasons or []" t-as="reason">
 +                                    <option t-att-value="reason.id" t-att-selected="reason.id == post.reason_id.id"><t t-esc="reason.name"/></option>
 +                                </t>
 +                            </select>
 +                        </div>
 +                    </div>
 +                    <div>
 +                        <button class="btn btn-primary btn-lg">Close</button>
 +                    </div>
 +                </form>
 +            </t>
 +        </template>
 +
 +        <template id="post_answer">
 +            <h3 class="mt10">Your answer</h3>
 +            <p>
 +                <b>Please try to give a substantial answer.</b> If you wanted to comment on the question or answer, just
 +                <b>use the commenting tool.</b> Please remember that you can always <b>revise your answers</b>
 +                - no need to answer the same question twice. Also, please <b>don't forget to vote</b>
 +                - it really helps to select the best questions and answers!
 +            </p>
-             <form t-attf-action="/forum/#{ slug(forum) }/question/postanswer/" method="post" role="form">
++            <form t-attf-action="/forum/#{ slug(forum) }/question/postanswer" method="post" role="form">
 +                <input type="hidden" name="karma" t-attf-value="#{user.karma}" id="karma"/>
 +                <textarea name="content" class="form-control load_editor" required="True"/>
 +                <input name="post_id" t-att-value="question.id" type="hidden"/>
 +                <button class="btn btn-primary" id="btn_ask_your_question">Post Your Answer</button>
 +            </form>
 +            <script type="text/javascript">
 +                CKEDITOR.replace("content");
 +            </script>
 +        </template>
 +
 +        <template id="vote">
 +            <div t-attf-class="box oe_grey">
 +                <a t-attf-class="fa fa-thumbs-up #{post.user_vote == 1 and 'text-success' or ''}" 
 +                    t-attf-id="#{post.id}" t-attf-value="1"/>
 +                <span id="vote_count" t-esc="post.vote_count"/>
 +                <a t-attf-class="fa fa-thumbs-down #{post.user_vote == -1 and 'text-warning' or ''}" 
 +                    t-attf-id="#{post.id}" t-attf-value="-1"/>
 +                <div>
 +                    votes
 +                </div>
 +            </div>
 +        </template>
 +
 +        <template id="post_description_full" name="Question Navigation">
 +            <t t-call="website_forum.header">
 +
 +                <div t-attf-class="question #{not question.active and 'alert alert-danger' or ''}">
 +                    <div class="text-center pull-left">
 +                        <t t-call="website_forum.vote">
 +                            <t t-set="post" t-value="question"/>
 +                        </t>
 +                        <div class="text-muted">
 +                            <span t-esc="question.child_count"/>
 +                            <span t-if="question.child_count&gt;1">Answers</span>
 +                            <span t-if="question.child_count&lt;=1">Answer</span>
 +                        </div>
 +                    </div>
 +                    <div style="margin-left: 95px;">
 +                        <h1 class="mt0">
 +                            <span t-field="question.name"/>
 +                            <span t-if="not question.active"><b> [Deleted]</b></span>
 +                            <span t-if="question.state == 'close'"><b> [Closed]</b></span>
 +                        </h1>
 +                        <t t-raw="question.content"/>
 +
 +                        <div class="mt16 clearfix">
 +                            <div class="pull-right">
 +                                <div class="text-right">
 +                                    <t t-foreach="question.tags" t-as="tag">
 +                                        <a t-attf-href="/forum/#{ slug(forum) }/tag/#{ tag.id }/questions" class="badge" t-field="tag.name"/>
 +                                    </t>
 +                                </div>
 +                                <ul class="list-inline">
 +                                    <li>
 +                                        <a style="cursor: pointer" data-toggle="collapse" class="text-muted fa fa-comment-o"
 +                                              t-attf-data-target="#comment#{ question._name.replace('.','') + '-' + str(question.id) }">
 +                                            comment
 +                                        </a>
 +                                    </li>
 +                                    <li t-if="question.state != 'close' and (user.id == question.user_id.id or user.karma&gt;=100)">
 +                                        <a class="text-muted fa fa-times" t-attf-href="/forum/#{ slug(forum) }/close/question/#{ question.id }">close</a>
 +                                    </li>
 +                                    <li t-if="question.state == 'close' and user.karma&gt;=500">
 +                                        <a class="text-muted fa fa-undo" t-attf-href="/forum/#{ slug(forum) }/reopen/question/#{ question.id }">reopen</a>
 +                                    </li>
 +                                    <li t-if="user.id == question.user_id.id or user.karma&gt;=300">
 +                                        <a class="text-muted fa fa-edit" t-attf-href="/forum/#{ slug(forum) }/edit/question/#{ question.id }">edit</a>
 +                                    </li>
 +                                    <li t-if="question.active and user.id == question.user_id.id or user.karma&gt;=1000">
 +                                        <a class="text-muted fa fa-trash-o" t-attf-href="/forum/#{ slug(forum) }/delete/question/#{ question.id }">delete</a>
 +                                    </li>
 +                                    <li t-if="uid == question.user_id.id and not question.active">
 +                                        <a class="text-muted fa fa-trash-o" t-attf-href="/forum/#{ slug(forum) }/undelete/question/#{ question.id }">undelete</a>
 +                                    </li>
 +                                    <li><a class="text-muted fa fa-share" href="">share</a></li>
 +                                </ul>
 +                            </div>
 +                            <t t-call="website_forum.user_detail">
 +                                <t t-set="user" t-value="question.user_id"/>
 +                                <span class="text-muted">Asked on <span t-field="question.write_date" t-field-options='{"format":"short"}'/></span>
 +                            </t>
 +                            <div class="alert alert-info" t-if="question.state == 'close'">
 +                                <p class="mt32 mb32 text-center">
 +                                    <b>The question has been closed for the following reason "<span t-field="question.reason_id.name"/>"
 +                                    <i>by <a t-attf-href="/forum/#{ slug(forum) }/user/#{ slug(question.closed_by) }" t-field="question.closed_by.name"/> </i>
 +                                    <br/>close date <span t-field="question.closed_date"/></b>
 +                                </p>
 +                            </div>
 +                        </div>
 +                        <t t-call="website_forum.comments">
 +                            <t t-set="object" t-value="question"/>
 +                        </t>
 +                    </div>
 +                </div>
 +                <hr/>
 +
 +                <div t-foreach="question.child_ids" t-as="answer" class="mt16 mb32" id="answer">
 +                    <a t-attf-id="answer-#{str(answer.id)}"/>
 +                    <div class="text-center pull-left">
 +                        <t t-call="website_forum.vote">
 +                            <t t-set="post" t-value="answer"/>
 +                        </t>
 +                        <div class="text-muted">
-                             <a t-attf-id="#{answer.id}" t-if="answer.correct" class="fa fa-2x fa-check oe_answer_true"/>
-                             <a t-attf-id="#{answer.id}" t-if="not answer.correct" class="fa fa-2x fa-check oe_answer_false"/>
++                            <a t-attf-id="#{answer.id}" t-if="answer.correct" class="fa fa-2x fa-check-circle oe_answer_true"/>
++                            <a t-attf-id="#{answer.id}" t-if="not answer.correct" class="fa fa-2x fa-check-circle oe_answer_false"/>
 +                        </div>
 +                    </div>
 +                    <div style="margin-left: 95px;" class="clearfix">
 +                        <t t-raw="answer.content"/>
 +                        <div class="mt16">
 +                            <ul class="list-inline pull-right">
 +                                <li>
 +                                    <a style="cursor: pointer" data-toggle="collapse" class="text-muted fa fa-comment-o"
 +                                          t-attf-data-target="#comment#{ answer._name.replace('.','') + '-' + str(answer.id) }">comment
 +                                    </a>
 +                                </li>
 +                                <li t-if="user.id == answer.user_id.id or user.karma&gt;=300">
 +                                    <a class="text-muted fa fa-edit" t-attf-href="/forum/#{ slug(forum) }/question/#{ question.id }/edit/#{ answer.id }">edit</a>
 +                                </li>
 +                                <li t-if="user.id == answer.user_id.id or user.karma&gt;=1000">
 +                                    <a class="text-muted delete fa fa-trash-o" href="" t-attf-id="#{answer.id}">delete</a>
 +                                </li>
 +                                <li t-if="uid">
 +                                    <a class="text-muted fa fa-magic" t-attf-href="/forum/#{ slug(forum) }/post/#{ answer.id }/converttocomment">Convert as a comment</a>
 +                                </li>
 +                                <li><a class="text-muted fa fa-share" t-attf-href="/forum/#{ slug(forum) }/question/#{ question.id }/#answer-#{ answer.id }">share</a></li>
 +                            </ul>
 +                            <t t-call="website_forum.user_detail">
 +                                <t t-set="user" t-value="answer.user_id"/>
 +                                <span class="text-muted">Answered on <span t-field="answer.create_date" t-field-options='{"format":"short"}'/></span>
 +                            </t>
 +                        </div>
 +                        <t t-call="website_forum.comments">
 +                            <t t-set="object" t-value="answer"/>
 +                        </t>
 +                    </div>
 +                </div>
 +                <div t-if="not answer_done">
 +                    <t t-call="website_forum.post_answer"/>
 +                </div>
 +                <div t-if="answer_done" class="mb16">
 +                    <a class="btn btn-primary" t-attf-href="/forum/#{ slug(forum) }/question/#{ question.id }/editanswer">Edit Your Previous Answer</a>
 +                    <span class="text-muted">(only one answer per question is allowed)</span>
 +                </div>
 +            </t>
 +        </template>
 +
 +        <template id="comments">
 +            <div class="row clearfix">
 +                <div class="col-sm-10 col-sm-offset-2">
-                     <div t-foreach="reversed(object.website_message_ids)" t-as="message" id="comment" class="oe_grey" style="padding: 4px;">
++                    <div t-foreach="reversed(object.website_message_ids)" t-as="message" id="comment" class="oe_comment_grey" style="padding: 4px;">
 +                        <small class="text-muted">
 +                            <button type="button" t-if="user.id == message.create_uid.id or user.karma&gt;=750" t-att-id="message.id" class="close comment_delete">&amp;times;</button>
 +                            <span t-field="message.body"/>
 +                            <a t-attf-href="/forum/#{ slug(forum) }/user/#{ message.create_uid.id }" t-field="message.create_uid"/>
 +                                on <span t-field="message.date" t-field-options='{"format":"short"}'/>
 +                            <a class="fa fa-magic text-muted pull-right" t-if="uid == message.create_uid.id"
 +                                t-attf-href="/forum/#{ slug(forum) }/post/#{ object.id }/commet/#{ message.id }/converttoanswer">Convert as an answer</a>
 +                        </small>
 +                    </div>
-                     <div class="css_editable_mode_hidden oe_grey">
++                    <div class="css_editable_mode_hidden">
 +                        <form t-attf-id="comment#{ object._name.replace('.','') + '-' + str(object.id) }" class="collapse" t-attf-action="/forum/#{ slug(forum) }/comment" method="POST">
 +                            <input name="post_id" t-att-value="object.id" type="hidden"/>
 +                            <textarea name="comment" class="form-control" placeholder="Comment this post..."/>
 +                            <button type="submit" class="btn btn-primary mt8">Post</button>
 +                        </form>
 +                    </div>
 +                </div>
 +            </div>
 +        </template>
 +
 +        <template id="tag">
 +            <t t-call="website_forum.header">
 +                <h1 class="mt0">
 +                    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) }/questions?{{ keep_query( filters='tag') }}" class="badge">
 +                            <span t-field="tag.name"/>
 +                        </a>
 +                        <span> 
 +                            X <t t-esc="tag.posts_count"/>
 +                        </span>
 +                    </div>
 +                </div>
 +            </t>
 +        </template>
 +
 +        <template id="badge">
 +            <t t-call="website_forum.header">
 +                <h1 class="mt0">
 +                    Badges
 +                </h1>
 +                <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="badge.stat_count_distinct"/>
 +                            <i class="text-muted">awarded users</i>
 +                        </td><td>
 +                            <span t-field="badge.description"/>
 +                        </td>
 +                    </tr>
 +                </table>
 +            </t>
 +        </template>
 +
 +        <template id="badge_user">
 +            <t t-call="website_forum.header">
 +                <h3 class="mt32 mb32"> 
 +                    <b>Badge "<span t-field="badge.name"/>"</b>
 +                </h3>
 +                <div>
 +                    <div class="pull-left badge">
 +                        <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"/>
 +                    </div>
 +                    <span t-field="badge.description" style="margin-left:20px"/>
 +                </div>
 +                <h4 class="mt32">
 +                    <t class="pull-left" t-esc="badge.stat_count_distinct"/>
 +                    <span t-if="badge.stat_count_distinct&gt;1">users</span>
 +                    <span t-if="badge.stat_count_distinct&lt;=1">user</span>
 +                    received this badge:
 +                </h4>
 +                <div class="row">
 +                    <div class="col-sm-3 mt16" t-foreach="users" t-as="user">
 +                        <span t-field="user.image" t-field-options='{"widget": "image", "class":"pull-left img img-circle img-avatar"}'/>
 +                        <div>
 +                            <a t-attf-href="/forum/#{ slug(forum) }/user/#{ slug(user) }" t-field="user.name"/>
 +                        </div>
 +                    </div>
 +                </div>
 +            </t>
 +        </template>
 +
 +        <template id="users">
 +            <t t-call="website_forum.header">
 +                <div class="row">
 +                    <div t-foreach="users" t-as="user" class="col-sm-4">
 +                        <t t-set="separator"><br/></t>
 +                        <t t-call="website_forum.user_detail"/>
 +                        <span class="text-muted">Joined on <span t-field="user.create_date" t-field-options='{"format":"short"}'/></span>
 +                    </div>
 +                </div>
 +                <div class="pull-left">
 +                    <t t-call="website.pager"/>
 +                </div>
 +            </t>
 +        </template>
 +
 +        <template id="edit_profile">
 +            <t t-call="website_forum.header">
 +                <h3>Edit Profile </h3>
 +                    <div class="col-md-2">
 +                        <span t-field="user.image" t-field-options='{"widget": "image", "class": "img img-responsive img-circle"}'/>
 +                    </div>
-                     <form t-attf-action="/forum/#{ slug(forum) }/save/profile/" method="post" role="form" class="form-horizontal">
++                    <form t-attf-action="/forum/#{ slug(forum) }/save/profile" method="post" role="form" class="form-horizontal">
 +                        <input name="user_id" t-att-value="user.id" type="hidden"/>
 +                        <label class="col-md-2 control-label mb16" for="user.name">Real name</label>
 +                        <div class="col-md-7 mb16">
 +                            <input type="text" class="col-md-7 mb16 form-control" name="name" required="True" t-attf-value="#{user.name}"/>
 +                        </div> 
 +                        <label class="col-md-2 control-label mb16" for="user.partner_id.website">Website</label>
 +                        <div class="col-md-7 mb16">
 +                            <input type="text" class="form-control" name="website" t-attf-value="#{user.partner_id.website or ''}"/>
 +                        </div>
 +                        <label class="col-md-4 control-label mb16" for="user.partner_id.email">Email</label>
 +                        <div class="col-md-7 mb16">
 +                            <input type="text" class="form-control" name="email" required="True" t-attf-value="#{user.partner_id.email}"/>
 +                        </div>
 +                        <label class="col-md-4 control-label mb16" for="user.partner_id.city">City</label>
 +                        <div class="col-md-7  mb16">
 +                            <input type="text" class="form-control" name="city" t-attf-value="#{user.partner_id.city or ''}"/>
 +                        </div>
 +                        <label class="col-md-4 control-label mb16" for="contact_name">Country</label>
 +                        <div class="col-md-7 mb16">
 +                            <select class="form-control" name="country">
 +                                <option value="">Country...</option>
 +                                <t t-foreach="countries or []" t-as="country">
 +                                    <option t-att-value="country.id" t-att-selected="country.id == user.partner_id.country.id"><t t-esc="country.name"/></option>
 +                                </t>
 +                             </select>
 +                        </div>
 +                        <!--Note: using website_description fiels instead of using commnt firld of partner-->
 +                        <label class="col-md-4 control-label mb16" for="user.partner_id.website_description">Biography</label>
 +                        <div class="col-md-7 mb16">
 +                            <textarea name="description" style="min-height: 120px" required="True" 
 +                                class="form-control"><t t-esc="user.partner_id.website_description"/></textarea>
 +                        </div>
 +                        <div class="col-sm-offset-4 col-md-4 mb16">
 +                            <button class="btn btn-primary btn-lg">Update</button>
 +                        </div>
 +                    </form>
 +            </t>
 +        </template>
 +
 +        <template id="user_detail_full">
 +            <t t-call="website_forum.header">
 +                <h1 class="mt0 page-header">
 +                    <span t-field="user.name"/>
 +                    <small>profile</small>
 +                </h1>
 +                <div class="row">
 +                    <div class="col-sm-2">
 +                        <span t-field="user.image"
 +                            t-field-options='{"widget": "image", "class": "img img-responsive img-circle"}'/>
 +                    </div>
 +                    <div class="col-sm-10">
 +                        <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" t-field-options='{"format": "short"}'/></td>
 +                        </tr><tr>
 +                            <td>last connection</td>
 +                            <td><span t-field="user.login_date" t-field-options='{"format": "short"}'/></td>
 +                        </tr>
 +                        <tr>
 +                            <td rowspan="2" valign="top"><span class="text-muted">bio</span></td>
 +                            <td>website</td>
 +                            <td>
 +                                <a t-att-href="user.website" t-if="user.website">
 +                                    <span t-field="user.website"/>
 +                                </a>
 +                            </td>
 +                        </tr><tr>
 +                            <td>location</td>
 +                            <td>
 +                                <span t-field="user.city"/>
 +                                <span t-if="user.city and user.country_id">, </span>
 +                                <span t-field="user.country_id"/>
 +                            </td>
 +                        </tr>
 +                        <tr>
 +                            <td rowspan="2" valign="top"><span class="text-muted">stats</span></td>
 +                            <td>karma</td>
 +                            <td><span t-field="user.karma"/></td>
 +                        </tr><tr>
 +                            <td>votes</td>
 +                            <td>
 +                                <span class="fa fa-thumbs-up"/>
 +                                <span t-esc="up_votes"/>
 +
 +                                <span class="fa fa-thumbs-down "/>
 +                                <span t-esc="down_votes"/>
 +                            </td>
 +                        </tr>
 +                        </table>
 +                        <div class="well well-sm">
 +                            <span t-field="user.partner_id.website_description"/>
 +                            <t t-if="uid == user.id">
 +                                <a class="fa fa-arrow-right"  t-attf-href="/forum/#{ slug(forum) }/edit/profile/#{ user.id }"> Edit Your Bio</a>
 +                            </t>
 +                        </div>
 +                    </div>
 +                </div>
 +
 +                <ul class="nav nav-tabs">
 +                    <li class="active">
 +                        <a href="#questions" data-toggle="tab"><t t-esc="len(questions)"/> Questions</a>
 +                    </li>
 +                    <li>
 +                        <a href="#answers" data-toggle="tab"><t t-esc="len(answers)"/> Answers</a>
 +                    </li>
 +                    <li t-if="uid == user.id">
 +                        <a href="#activity" data-toggle="tab">Activity</a>
 +                    </li>
 +                    <li>
 +                        <a href="#badges" data-toggle="tab">Badges</a>
 +                    </li>
 +                    <li t-if="uid == user.id">
 +                        <a href="#followed_question" data-toggle="tab"><t t-esc="len(followed)"/> Followed Question</a>
 +                    </li>
 +                    <li>
 +                        <a href="#votes" data-toggle="tab">Votes</a>
 +                    </li>
 +                </ul>
 +                <div class="tab-content mt16">
 +                    <div class="tab-pane active" id="questions">
 +                        <div class="mb16" t-foreach="questions" t-as="question">
 +                            <t t-call="website_forum.post_list"/>
 +                        </div>
 +                    </div><div class="tab-pane" id="answers">
 +                        <div t-foreach="answers" t-as="answer">
 +                            <t t-call="website_forum.post_list_answer"/>
 +                        </div>
 +                    </div>
 +                    <div class="tab-pane" id="karma">
 +                        <h1>Karma</h1>
 +                    </div>
 +                    <div class="tab-pane" id="badges">
 +                        <t t-call="website_forum.user_badges"/>
 +                    </div>
 +                    <div class="tab-pane" id="followed_question">
 +                        <div t-foreach="followed" t-as="question">
 +                            <t t-call="website_forum.post_list"/>
 +                        </div>
 +                    </div>
 +                    <div class="tab-pane" id="votes">
 +                        <t t-call="website_forum.user_votes"/>
 +                    </div>
 +                    <div class="tab-pane" id="activity">
 +                        <ul class="list-unstyled">
 +                            <li t-foreach="activities" t-as="activity">
 +                                <span t-esc="activity.date"/>
 +                                <span t-esc="activity.subtype_id.name" class="label label-info"/>
 +                                <t t-set="post" t-value="posts[activity.res_id]"/>
 +                                <span t-if="post[1]"> 
 +                                    <a t-attf-href="/forum/#{ slug(forum) }/question/#{ slug(post[0]) }#answer-#{ str(post[1].id) }">
 +                                        Gave an answer
 +                                    </a> on
 +                                </span>
 +                                <a t-attf-href="/forum/#{ slug(forum) }/question/#{ slug(post[0]) }">
 +                                    <span t-esc="post[0].name"/>
 +                                </a>
 +                            </li>
 +                        </ul>
 +                    </div>
 +                </div>
 +            </t>
 +        </template>
 +
 +        <template id="user_badges">
 +            <table class="table mt32 mb64">
 +                <tr t-foreach="user.badges" t-as="badge">
 +                    <td>
 +                        <a t-attf-href="/forum/#{ slug(forum) }/badge/#{ slug(badge.badge_id) }" class="badge pull-left">
 +                            <span t-if="badge.badge_id.level == 'gold'" class="fa fa-circle badge-gold"/>
 +                            <span t-if="badge.badge_id.level == 'silver'" class="fa fa-circle badge-silver"/>
 +                            <span t-if="badge.badge_id.level == 'bronze'" class="fa fa-circle badge-bronze"/>
 +                            <span t-field="badge.badge_id.name"/>
 +                        </a>
 +                    </td><td>
 +                        <b t-esc="badge.badge_id.stat_count_distinct"/>
 +                        <i class="text-muted">awarded users</i>
 +                    </td><td>
 +                        <span t-field="badge.badge_id.description"/>
 +                    </td>
 +                </tr>
 +            </table>
 +            <div class="mb16" t-if="not user.badges">
 +                <b>No badge yet!</b><br/>
 +                <a t-attf-href="/forum/#{ slug(forum) }/badge" class="fa fa-arrow-right"> Check available badges</a>
 +            </div>
 +        </template>
 +
 +        <template id="user_votes">
 +            <div t-foreach="vote_post" t-as="vote">
 +                <t t-esc="vote.post_id.create_date"/>
 +                <span t-if="vote.vote == '1'" class="fa fa-thumbs-up text-success" style="margin-left:30px"/>
 +                <span t-if="vote.vote == '-1'" class="fa fa-thumbs-down text-warning" style="margin-left:30px"/>
 +                <t t-if="vote.post_id.parent_id">
 +                    <a t-attf-href="/forum/#{ slug(forum) }/question/#{ vote.post_id.parent_id.id }/#answer-#{ vote.post_id.id }" t-esc="vote.post_id.parent_id.name" style="margin-left:10px"/>
 +                </t>
 +                <t t-if="not vote.post_id.parent_id">
 +                    <a t-attf-href="/forum/#{ slug(forum) }/question/#{ vote.post_id.id }" style=" color:black;margin-left:10px" t-esc="vote.post_id.name"/>
 +                </t>
 +            </div>
 +            <div class="mb16" t-if="not vote_post">
 +                <b>No vote given by you yet!</b>
 +            </div>
 +        </template>
 +
 +        <template id="post_list_answer">
 +            <div class="clearfix">
 +                <div t-attf-class="pull-left text-center mb16 box #{len(answer.vote_ids) and 'oe_green' or 'oe_grey'}">
 +                    <div t-esc="len(answer.vote_ids)"/>
 +                </div>
 +                <div class="question-name" style="margin-left: 32px;">
 +                    <a style="font-size: 15px;" t-attf-href="/forum/#{ slug(forum) }/question/#{ answer.parent_id.id }/#answer-#{ answer.id }" t-esc="answer.parent_id.name"/>
 +                    <t t-if="len(answer.website_message_ids)&gt;0">
 +                        (<t t-esc="len(answer.website_message_ids)"/>
 +                        <t t-if="len(answer.website_message_ids)&gt;1">Comments</t>
 +                        <t t-if="len(answer.website_message_ids)&lt;=1">Comment</t>)
 +                    </t>
 +                </div>
 +            </div>
 +        </template>
 +
 +    </data>
 +</openerp>