summaryrefslogtreecommitdiff
path: root/addons/website_forum/controllers/main.py
diff options
context:
space:
mode:
authorOkan SUMER (osu) <osu@odoo.com>2020-03-19 09:42:59 +0000
committerJeremy Kersten <jke@odoo.com>2020-05-14 18:27:00 +0000
commit645056554ee38b5b96aeb53b6ed59cdb8e41b74c (patch)
treefd3da254310ab1051a54d0376b5773b78bca3b85 /addons/website_forum/controllers/main.py
parentb86902040169c612544cd710c6b0025c8b43ddbe (diff)
[IMP] website_forum: frontend improvements and corrections
This commit adds new features and corrects some others in the frontend of website_forum app. - In the "about" section of a forum, use the s_accordion instead of a custom one for the first 3 elements, the last one is on a new page accessible from a link below the accordion - Cut the description after a specific amount of characters in the page where all forum are listed - In that same view, create options that show the number of post and the last post a forum has. Create an option to render forums in list view - Allow the user to cancel his vote (down or up) - Hide the answer box in the post view. Make it appear when the user click on the "answer" button - Use a JS public widget to validate a Post form (new, save, comment) - Enable the modification of a forum's image from the frontend - Hide Solved/Unsolved categories in "Discussion" forums - Disable the possibility to add snippets to an answer - Corrections of tours that broke after these modifications Part of https://github.com/odoo/odoo/pull/46634 task-2201708
Diffstat (limited to 'addons/website_forum/controllers/main.py')
-rw-r--r--addons/website_forum/controllers/main.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/addons/website_forum/controllers/main.py b/addons/website_forum/controllers/main.py
index b309a644be0..51a4c00b0c1 100644
--- a/addons/website_forum/controllers/main.py
+++ b/addons/website_forum/controllers/main.py
@@ -45,7 +45,10 @@ class WebsiteForum(WebsiteProfile):
forums = request.env['forum.forum'].search(domain)
if len(forums) == 1:
return werkzeug.utils.redirect('/forum/%s' % slug(forums[0]), code=302)
- return request.render("website_forum.forum_all", {'forums': forums})
+
+ return request.render("website_forum.forum_all", {
+ 'forums': forums
+ })
@http.route('/forum/new', type='json', auth="user", methods=['POST'], website=True)
def forum_create(self, forum_name="New Forum", forum_mode="questions", forum_privacy="public", forum_privacy_group=False, add_menu=False):
@@ -164,6 +167,11 @@ class WebsiteForum(WebsiteProfile):
values = self._prepare_user_values(forum=forum, searches=dict(), header={'is_guidelines': True}, **post)
return request.render("website_forum.faq", values)
+ @http.route(['/forum/<model("forum.forum"):forum>/faq/karma'], type='http', auth="public", website=True, sitemap=False)
+ def forum_faq_karma(self, forum, **post):
+ values = self._prepare_user_values(forum=forum, header={'is_guidelines': True, 'is_karma': True}, **post)
+ return request.render("website_forum.faq_karma", values)
+
@http.route('/forum/get_tags', type='http', auth="public", methods=['GET'], website=True, sitemap=False)
def tag_read(self, query='', limit=25, **post):
data = request.env['forum.tag'].search_read(