@http.route('/forum/<model("website.forum"):forum>/edit/question/<model("website.forum.post"):post>', type='http', auth="user", multilang=True, website=True)
def edit_question(self, forum, post, **kwarg):
+ post_history_obj = request.registry['website.forum.post.history'];
tags = ""
for tag_name in post.tags:
tags += tag_name.name + ","
+
+ ids = post_history_obj.search(request.cr, request.uid, [('post_id','=', post.id)], context=request.context)
+ post_history = post_history_obj.browse(request.cr, request.uid, ids, context=request.context)
values = {
'post': post,
'forum': forum,
'searches': kwarg,
'notifications': self._get_notifications(),
+ 'history': post_history,
}
return request.website.render("website_forum.edit_question", values)
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))
+
+ @http.route('/forum/change_question/', type='json', auth="user", multilang=True, methods=['POST'], website=True)
+ def correct_answer(self, **kwarg):
+ cr, uid, context = request.cr, request.uid, request.context
+ return True
+
return post_id
def write(self, cr, uid, ids, vals, context=None):
- self.create_history(cr, uid, ids, vals, context=context)
#NOTE: to avoid message post on write of last comment time
if not vals.get('message_last_post'):
+ self.create_history(cr, uid, ids, vals, context=context)
for post in self.browse(cr, uid, ids, context=context):
body, subtype = "Edited question", "website_forum.mt_question_edit"
if post.parent_id:
});
};
+ $('.change_question').change(function (ev) {
+ var $option = $(ev.currentTarget);
+ openerp.jsonRpc("/forum/change_question/", 'call', {
+ 'option': $option.attr("id")})
+ .then(function (data) {
+ })
+ return true;
+ });
+
});
\ No newline at end of file
<t t-call="website_forum.header">
<h3>Edit question</h3>
<form t-attf-action="/forum/#{ slug(forum) }/question/savequestion/" method="post" role="form" class="tag_text">
+ <select class="form-control change_question" id="change_que">
+ <t t-foreach="history" t-as="history_post">
+ <option t-att-value="history_post.id"><t t-esc="history_post.name"/></option>
+ </t>
+ </select>
<input type="text" name="question_name" required="True" t-attf-value="#{post.name or ''}"
class="form-control" placeholder="Edit your Question"/>
<h5 class="mt20">Please enter a descriptive question (should finish by a '?')</h5>