[IMP] Documentation
bzr revid: fp@tinyerp.com-20140421204457-4t8lxibu2ml2tnad
This commit is contained in:
parent
1a09a703e4
commit
075115f39c
|
@ -41,6 +41,8 @@ class WebsiteDoc(http.Controller):
|
|||
@http.route('/forum/<model("forum.forum"):forum>/question/<model("forum.post"):post>/promote', type='http', auth="user", multilang=True, website=True)
|
||||
def post_toc(self, forum, post, **kwargs):
|
||||
cr, uid, context, toc_id = request.cr, request.uid, request.context, False
|
||||
user = request.registry['res.users'].browse(cr, uid, uid, context=context)
|
||||
assert user.karma >= 200, 'Not enough karma'
|
||||
toc_obj = request.registry['forum.documentation.toc']
|
||||
obj_ids = toc_obj.search(cr, uid, [], context=context)
|
||||
tocs = toc_obj.browse(cr, uid, obj_ids, context=context)
|
||||
|
@ -55,7 +57,7 @@ class WebsiteDoc(http.Controller):
|
|||
def post_toc_ok(self, forum, post_id, toc_id, **kwargs):
|
||||
cr, uid, context = request.cr, request.uid, request.context
|
||||
user = request.registry['res.users'].browse(cr, uid, uid, context=context)
|
||||
assert user.karma > 10, 'Not enough karma'
|
||||
assert user.karma >= 200, 'Not enough karma'
|
||||
|
||||
toc_obj = request.registry['forum.documentation.toc']
|
||||
stage_ids = toc_obj.search(cr, uid, [], limit=1, context=context)
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
<!-- Stages -->
|
||||
|
||||
<record id="stage_draft" model="forum.documentation.stage">
|
||||
<record id="stage_ideas" model="forum.documentation.stage">
|
||||
<field name="name">Ideas</field>
|
||||
<field name="sequence">1</field>
|
||||
</record>
|
||||
|
@ -32,12 +32,12 @@
|
|||
<field name="sequence">2</field>
|
||||
</record>
|
||||
|
||||
<record id="stage_draft" model="forum.documentation.stage">
|
||||
<record id="stage_review" model="forum.documentation.stage">
|
||||
<field name="name">Review</field>
|
||||
<field name="sequence">3</field>
|
||||
</record>
|
||||
|
||||
<record id="stage_draft" model="forum.documentation.stage">
|
||||
<record id="stage_publish" model="forum.documentation.stage">
|
||||
<field name="name">Publish</field>
|
||||
<field name="sequence">4</field>
|
||||
</record>
|
||||
|
|
|
@ -40,6 +40,7 @@ class Documentation(osv.Model):
|
|||
'post_ids': fields.one2many('forum.post', 'documentation_toc_id', 'Posts'),
|
||||
'forum_id': fields.many2one('forum.forum', 'Forum', required=True),
|
||||
}
|
||||
|
||||
_constraints = [
|
||||
(osv.osv._check_recursion, 'Error ! You cannot create recursive categories.', ['parent_id'])
|
||||
]
|
||||
|
@ -62,4 +63,13 @@ class Post(osv.Model):
|
|||
'documentation_stage_id': fields.many2one('forum.documentation.stage', 'Documentation Stage'),
|
||||
'color': fields.integer('Color Index')
|
||||
}
|
||||
def _read_group_stage_ids(self, cr, uid, ids, domain, read_group_order=None, access_rights_uid=None, context=None):
|
||||
stage_obj = self.pool.get('forum.documentation.stage')
|
||||
stage_ids = stage_obj.search(cr, uid, [], context=context)
|
||||
result = stage_obj.name_get(cr, uid, stage_ids, context=context)
|
||||
return result, {}
|
||||
|
||||
_group_by_full = {
|
||||
'documentation_stage_id': _read_group_stage_ids,
|
||||
}
|
||||
|
||||
|
|
|
@ -69,12 +69,10 @@
|
|||
<li><ul class="oe_kanban_colorpicker" data-field="color"/></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="oe_kanban_content">
|
||||
<div><b><field name="name"/></b></div>
|
||||
<field name="documentation_toc_id"/>
|
||||
<div class="oe_kanban_bottom_right">
|
||||
<img t-att-src="kanban_image('res.users', 'image_small', record.create_id.raw_value)" t-att-title="record.create_uid.value" width="24" height="24" class="oe_kanban_avatar"/>
|
||||
<img t-att-src="kanban_image('res.users', 'image_small', record.create_uid.raw_value)" t-att-title="record.create_uid.value" width="24" height="24" class="oe_kanban_avatar"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="oe_clear"></div>
|
||||
|
|
|
@ -156,12 +156,18 @@
|
|||
<!--TOC ON FORUM POST-->
|
||||
<template id="forum_question_doc" inherit_id="website_forum.post_description_full" name="Forum Post to Doc">
|
||||
<xpath expr="//ul[@id='options']" position="inside">
|
||||
<li t-if="(not question.documentation_stage_id) and user.karma>=10">
|
||||
<li t-if="(not question.documentation_stage_id) and user.karma>=200">
|
||||
<a t-attf-href="/forum/#{ slug(forum) }/question/#{slug(question)}/promote" class="text-muted fa fa-bookmark-o">
|
||||
Promote to Doc
|
||||
</a>
|
||||
</li>
|
||||
</xpath>
|
||||
<xpath expr="//hr" position="before">
|
||||
<div class="alert alert-success alert-dismissable mt16" t-if="question.documentation_toc_id">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
|
||||
This question has been included in the <a href="/forum/how-to">official documentation</a>.
|
||||
</div>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
<template id="promote_question">
|
||||
|
|
Loading…
Reference in New Issue