diff options
| author | Romain Derie <rde@odoo.com> | 2019-09-02 09:09:16 +0000 |
|---|---|---|
| committer | Romain Derie <rde@odoo.com> | 2019-10-02 07:13:26 +0000 |
| commit | 9b38bcec1269f0e72606e774f5e1f5f4a78baa89 (patch) | |
| tree | a87ff8144fb1a26e3d0887a4f886557775b8f4b5 /addons/website_forum | |
| parent | c8c8413e3e86e2abc51ade48f11320de961e5e50 (diff) | |
[IMP] website, website_*: improve edit in backend feature
*base, website_blog, website_event, website_forum, website_slides
With this commit:
1. It is now possible to add the 'Edit in backend' entry in the frontend navbar
for any desired model, not only the ones which have the published mixin.
It will simply redirect to the main_object form view.
This commit add it to Forum and Blog.
2. When clicking on 'Edit in backend', it is now possible to land on another
module than Website.
That's especially useful for events and slides which are not directly
related to the website module as they have their own module.
3. Remove the custom Edit in backend from the forum homepage (fa-cog).
Opportunity was also taken to remove the 'edit welcome message'.
It will now be editable through the editor (welcome message will appear in
edit mode). Thus we got rid of the custom edit welcome message controller
and views.
Closes #36325
Diffstat (limited to 'addons/website_forum')
| -rw-r--r-- | addons/website_forum/controllers/main.py | 5 | ||||
| -rw-r--r-- | addons/website_forum/views/website_forum.xml | 31 |
2 files changed, 2 insertions, 34 deletions
diff --git a/addons/website_forum/controllers/main.py b/addons/website_forum/controllers/main.py index 435e894db58..cd647d394bc 100644 --- a/addons/website_forum/controllers/main.py +++ b/addons/website_forum/controllers/main.py @@ -136,6 +136,7 @@ class WebsiteForum(WebsiteProfile): values = self._prepare_user_values(forum=forum, searches=post, header={'ask_hide': not forum.active}) values.update({ 'main_object': tag or forum, + 'edit_in_backend': not tag, 'question_ids': question_ids, 'question_count': question_count, 'pager': pager, @@ -187,10 +188,6 @@ class WebsiteForum(WebsiteProfile): }) return request.render("website_forum.tag", values) - @http.route('/forum/<model("forum.forum"):forum>/edit_welcome_message', auth="user", website=True) - def edit_welcome_message(self, forum, **kw): - return request.render("website_forum.edit_welcome_message", {'forum': forum}) - # Questions # -------------------------------------------------- diff --git a/addons/website_forum/views/website_forum.xml b/addons/website_forum/views/website_forum.xml index c6f6f1e27e5..20d464c86c5 100644 --- a/addons/website_forum/views/website_forum.xml +++ b/addons/website_forum/views/website_forum.xml @@ -58,7 +58,7 @@ <h1 class="s_title_thin o_default_snippet_text text-center"><t t-esc="forum.name"></t></h1> </div> </div> - <div t-if="is_public_user and not forum_welcome_message" class="forum_intro"> + <div t-if="editable or (is_public_user and not forum_welcome_message)" t-att-class="'css_non_editable_mode_hidden' if editable else 'forum_intro'"> <div t-field="forum.welcome_message"/> </div> </div> @@ -150,16 +150,6 @@ <li class="nav-item"> <a t-attf-href="/forum/#{ slug(forum) }/faq" t-attf-class="nav-link #{header.get('is_guidelines') and 'active'}">About</a> </li> - <span class="navbar-text" groups="base.group_erp_manager">|</span> - <li class="nav-item dropdown mx-auto" groups="base.group_erp_manager"> - <a class="nav-link dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown"> - <i class="fa fa-cog" role="img"/> Settings - </a> - <div class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu1"> - <a role="menuitem" tabindex="-1" t-attf-href="/forum/#{slug(forum)}/edit_welcome_message?enable_editor=1" class="dropdown-item">Design Welcome Message</a> - <a role="menuitem" tabindex="-1" t-attf-href="/web#id=#{forum.id}&view_type=form&model=forum.forum" class="dropdown-item">Edit Forum in the backend</a> - </div> - </li> </ul> <!-- Mobile --> @@ -231,25 +221,6 @@ </div> </template> -<!-- Template use to edit the welcome_message --> -<template id="edit_welcome_message"> - <t t-call="website.layout"> - <section t-attf-class="s_cover parallax s_parallax_is_fixed py-3 #{forum.image_1920 and 'bg-black-50' or 'o_wforum_forum_card_bg text-white'}" data-scroll-background-ratio="1"> - <span t-if="forum.image_1920" class="s_parallax_bg oe_img_bg oe_custom_bg" t-attf-style="background-image: url('#{website.image_url(forum, 'image_1920')}'); background-position: center;"/> - <div class="container"> - <div class="row s_nb_column_fixed"> - <div class="col-lg-12 s_title" data-name="Title"> - <h1 class="s_title_thin o_default_snippet_text text-center"><t t-esc="forum.name"></t></h1> - </div> - </div> - <div class="forum_intro"> - <div t-field="forum.welcome_message"/> - </div> - </div> - </section> - </t> -</template> - <!-- Display a post --> <template id="display_post_question_block"> <div class="o_wforum_index_entry_title"> |
