Skip to content
This repository has been archived by the owner on Dec 17, 2019. It is now read-only.

Visual upgrade of website_support and add personalization from the user #90

Open
wants to merge 1 commit into
base: 12.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions website_support/controllers/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,16 +317,23 @@ def help_page_create(self, group_id, help_page_name, **post):
@http.route('/support/help/<model("website.support.help.group"):help_group>', type='http', auth="public", website=True)
def help_group(self, help_group):
"""Displays help group template"""
if help_group.website_published:
return http.request.render("website_support.help_group", {'help_group':help_group})
else:
return request.render('website.404')

return http.request.render("website_support.help_group", {'help_group':help_group})

@http.route(['''/support/help/<model("website.support.help.group"):help_group>/<model("website.support.help.page", "[('group_id','=',help_group[0])]"):help_page>'''], type='http', auth="public", website=True)
def help_page(self, help_group, help_page, enable_editor=None, **post):
"""Displays help page template"""
if help_group.website_published and help_page.website_published and request.env.user in help_group.sudo().group_ids.users:
return http.request.render("website_support.help_page", {'help_page':help_page})

#List if groups where the user has access
permission_list = []
for perm_group in request.env.user.groups_id:
permission_list.append(perm_group.id)

help_groups = http.request.env['website.support.help.group'].sudo().search(['|', ('group_ids', '=', False ), ('group_ids', 'in', permission_list), ('website_published','=',True)])


if help_group.website_published and help_page.website_published:
return http.request.render("website_support.help_page", {'help_page':help_page, 'help_group': help_group, 'help_groups': help_groups})
else:
return request.render('website.404')

Expand Down Expand Up @@ -598,4 +605,4 @@ def support_help_autocomplete(self, **kw):
return_item = {"label": help_page.name,"value": "/support/help/" + slug(help_page.group_id) + "/" + slug(help_page) }
my_return.append(return_item)

return json.JSONEncoder().encode(my_return)
return json.JSONEncoder().encode(my_return)
Loading