[IMP] website_forum: make forum;forum inherit from mail.thread. This way we
add the possibility to users to follow a forum and be automatically followers of new questions, using some new subtypes on the forum.forum model that do the auto subscription. Also added a profile link on the forum, when logged. Also added a subscribe button on the forum.
This commit is contained in:
parent
7adfaf786d
commit
2649beba97
|
@ -53,6 +53,23 @@
|
|||
<field name="default" eval="False"/>
|
||||
<field name="description">Question Edited</field>
|
||||
</record>
|
||||
<!-- Forum subtypes, to follow all answers or questions -->
|
||||
<record id="mt_forum_answer_new" model="mail.message.subtype">
|
||||
<field name="name">New Answer</field>
|
||||
<field name="res_model">forum.forum</field>
|
||||
<field name="default" eval="False"/>
|
||||
<field name="hidden" eval="False"/>
|
||||
<field name="parent_id" eval="ref('mt_answer_new')"/>
|
||||
<field name="relation_field">forum_id</field>
|
||||
</record>
|
||||
<record id="mt_forum_question_new" model="mail.message.subtype">
|
||||
<field name="name">New Question</field>
|
||||
<field name="res_model">forum.forum</field>
|
||||
<field name="default" eval="True"/>
|
||||
<field name="hidden" eval="False"/>
|
||||
<field name="parent_id" eval="ref('mt_question_new')"/>
|
||||
<field name="relation_field">forum_id</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
<data noupdate="1">
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from urlparse import urljoin
|
||||
|
||||
import openerp
|
||||
from openerp import SUPERUSER_ID
|
||||
from openerp.addons.website.models.website import slug
|
||||
|
@ -13,7 +11,7 @@ class Forum(osv.Model):
|
|||
"""TDE TODO: set karma values for actions dynamic for a given forum"""
|
||||
_name = 'forum.forum'
|
||||
_description = 'Forums'
|
||||
_inherit = ['website.seo.metadata']
|
||||
_inherit = ['mail.thread', 'website.seo.metadata']
|
||||
# karma values
|
||||
_karma_upvote = 5 # done
|
||||
_karma_downvote = 50 # done
|
||||
|
|
|
@ -27,6 +27,10 @@
|
|||
<field name="description"/>
|
||||
</group>
|
||||
</sheet>
|
||||
<div class="oe_chatter">
|
||||
<field name="message_follower_ids" widget="mail_followers" groups="base.group_user"/>
|
||||
<field name="message_ids" widget="mail_thread" options='{"thread_level": 1}' placeholder="Send a message to the group"/>
|
||||
</div>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
|
|
@ -71,6 +71,9 @@
|
|||
<li t-att-class="searches.get('badges') and 'active' or '' ">
|
||||
<a t-attf-href="/forum/#{ slug(forum) }/badge">Badges</a>
|
||||
</li>
|
||||
<li t-if="not is_public_user" t-att-class="searches.get('my_profile') and 'active' or '' ">
|
||||
<a t-attf-href="/forum/#{ slug(forum) }/user/#{user.id}">My Profile</a>
|
||||
</li>
|
||||
</ul>
|
||||
<form class="navbar-form navbar-right" role="search" t-attf-action="/forum/#{ slug(forum) }" method="get">
|
||||
<div class="form-group">
|
||||
|
@ -96,12 +99,23 @@
|
|||
</div>
|
||||
<div class="col-sm-3" id="right-column">
|
||||
<a t-if="not header.get('ask_hide')" class="btn btn-primary btn-lg btn-block mb16" t-attf-href="/forum/#{slug(forum)}/ask">Ask a Question</a>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">Keep Informed</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<t t-call="website_mail.follow">
|
||||
<t t-set="email" t-value="user.email"/>
|
||||
<t t-set="object" t-value="forum"/>
|
||||
</t>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel panel-default" id="about_forum">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">About This Forum</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<t t-raw="forum.description"/><br/>
|
||||
<t t-raw="forum.description"/>
|
||||
<a t-if="not header.get('is_guidelines')" t-attf-href="/forum/#{slug(forum)}/faq" class="fa fa-arrow-right"> Read Guidelines</a>
|
||||
<a t-if="header.get('is_guidelines')" t-attf-href="/forum/#{slug(forum)}" class="fa fa-arrow-right"> Back to <span t-field="forum.name"/></a>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue