From 2845ecd6ca20eb3d62709b221dbd1146ef7e268a Mon Sep 17 00:00:00 2001 From: "Turkesh Patel (Open ERP)" Date: Wed, 9 Apr 2014 17:39:56 +0530 Subject: [PATCH] [IMP] improved code to add link at footer to show all forums, improved serch and then filtering, dont allow user to post comment if dont have 50 karama bzr revid: tpa@tinyerp.com-20140409120956-9yf4z2x1cxclk0f8 --- addons/website_forum/controllers/main.py | 4 +- .../static/src/js/website_forum.editor.js | 2 +- .../static/src/xml/website_forum.xml | 2 +- addons/website_forum/views/website_forum.xml | 50 ++++++++++--------- 4 files changed, 31 insertions(+), 27 deletions(-) diff --git a/addons/website_forum/controllers/main.py b/addons/website_forum/controllers/main.py index 403d54dc6d1..d2d44f9944f 100644 --- a/addons/website_forum/controllers/main.py +++ b/addons/website_forum/controllers/main.py @@ -60,14 +60,13 @@ class website_forum(http.Controller): '/forum//tag//questions' ], type='http', auth="public", website=True, multilang=True) - def questions(self, forum, tag='', page=1, filters='', sorting='', **searches): + def questions(self, forum, tag='', page=1, filters='', sorting='', search='', **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), @@ -112,6 +111,7 @@ class website_forum(http.Controller): 'tag': tag, 'filters': filters, 'sorting': sorting, + 'search': search, 'searches': searches, } diff --git a/addons/website_forum/static/src/js/website_forum.editor.js b/addons/website_forum/static/src/js/website_forum.editor.js index 4c4887f6b38..11b22d5f1fc 100644 --- a/addons/website_forum/static/src/js/website_forum.editor.js +++ b/addons/website_forum/static/src/js/website_forum.editor.js @@ -14,7 +14,7 @@ return res; }, events: _.extend({}, website.EditorBar.prototype.events, { - 'click a[data-action=new_question]': function (ev) { + 'click a[data-action=new_forum]': function (ev) { ev.preventDefault(); website.prompt({ id: "editor_new_forum", diff --git a/addons/website_forum/static/src/xml/website_forum.xml b/addons/website_forum/static/src/xml/website_forum.xml index 220f39447bb..f2298b80f44 100644 --- a/addons/website_forum/static/src/xml/website_forum.xml +++ b/addons/website_forum/static/src/xml/website_forum.xml @@ -1,7 +1,7 @@ -
  • New Forum
  • +
  • New Forum
  • \ No newline at end of file diff --git a/addons/website_forum/views/website_forum.xml b/addons/website_forum/views/website_forum.xml index ce0bd921ca4..3d8bad7b64e 100644 --- a/addons/website_forum/views/website_forum.xml +++ b/addons/website_forum/views/website_forum.xml @@ -17,7 +17,10 @@ name="Footer Questions Link">
  • - Q&A + Q&A +
  • +
  • + Forums
  • @@ -109,7 +112,7 @@
    + t-att-value="search or ''"/>
    @@ -188,11 +191,12 @@ -