summaryrefslogtreecommitdiff
path: root/addons/website
diff options
context:
space:
mode:
authorChristophe Matthieu <chm@openerp.com>2013-12-11 15:59:30 +0100
committerChristophe Matthieu <chm@openerp.com>2013-12-11 15:59:30 +0100
commit2257e8d431cdf166eeb2a74702ee02e52af6bbbf (patch)
tree6d20f78faddeca8cf38424871073014e99d03252 /addons/website
parent5217c8ebe8c0a2cfe4b2e6b8c6da635748eb3ef4 (diff)
[IMP] website: change editable and use groups
bzr revid: chm@openerp.com-20131211145930-r0izxh9t0efjwhxh
Diffstat (limited to 'addons/website')
-rw-r--r--addons/website/models/website.py7
-rw-r--r--addons/website/views/themes.xml2
-rw-r--r--addons/website/views/website_templates.xml20
3 files changed, 12 insertions, 17 deletions
diff --git a/addons/website/models/website.py b/addons/website/models/website.py
index 611b582d9ce..c3495e771e1 100644
--- a/addons/website/models/website.py
+++ b/addons/website/models/website.py
@@ -201,20 +201,15 @@ class website(osv.osv):
return self.pool['website'].browse(cr, uid, 1, context=context)
def preprocess_request(self, cr, uid, ids, request, context=None):
- # TODO FP: is_website_publisher and editable in context should be removed
# for performance reasons (1 query per image to load) but also to be cleaner
# I propose to replace this by a group 'base.group_website_publisher' on the
# view that requires it.
- Access = request.registry['ir.model.access']
- is_website_publisher = Access.check(cr, uid, 'ir.ui.view', 'write', False, context)
-
lang = request.context['lang']
is_master_lang = lang == request.website.default_lang_code
request.redirect = lambda url: werkzeug.utils.redirect(url_for(url))
request.context.update(
is_master_lang=is_master_lang,
- editable=is_website_publisher,
translatable=not is_master_lang,
)
@@ -250,7 +245,7 @@ class website(osv.osv):
)
context.update(
- inherit_branding=qweb_context.setdefault('editable', False),
+ inherit_branding=qweb_context,
)
view = self.get_template(cr, uid, ids, template)
diff --git a/addons/website/views/themes.xml b/addons/website/views/themes.xml
index 815c2ff57c7..b5cfa6ed4f2 100644
--- a/addons/website/views/themes.xml
+++ b/addons/website/views/themes.xml
@@ -8,7 +8,7 @@
<template id="website.themes" name="Themes">
<t t-call="website.layout">
- <div id="wrap" t-if="editable">
+ <div id="wrap" groups="base.group_website_publisher">
<div class="container">
<div class="alert alert-info mt32" t-if="theme_changed">
diff --git a/addons/website/views/website_templates.xml b/addons/website/views/website_templates.xml
index c18eceb3134..8cb80f6558f 100644
--- a/addons/website/views/website_templates.xml
+++ b/addons/website/views/website_templates.xml
@@ -54,13 +54,8 @@
<!-- Load stylesheets before scripts to avoid blocking -->
<link rel='stylesheet' href='/web/static/lib/fontawesome/css/font-awesome.css'/>
- <t t-if="editable">
- <link rel='stylesheet' href='/website/static/src/css/snippets.css'/>
- <link rel='stylesheet' href='/website/static/src/css/editor.css'/>
- <link rel='stylesheet' href='/website/static/lib/bootstrap-tour/bootstrap-tour.css'/>
- </t>
- <t t-call="website.theme"/>
+ <t t-call="website.theme"/>
<script type="text/javascript" src="/web/static/lib/es5-shim/es5-shim.min.js"></script>
<script type="text/javascript" src="/web/static/lib/underscore/underscore.js"></script>
@@ -170,7 +165,7 @@
<t t-esc="lg[1].split('/').pop()"/>
</a>
</li>
- <li t-if="editable">
+ <li groups="base.group_website_publisher">
<t t-set="url_return" t-value="url_for(request.httprequest.path, '[lang]', keep_query='*')"/>
<a t-attf-href="/web#action=base.action_view_base_language_install&amp;website_id=#{website.id}&amp;url_return=#{url_return}">
<i class="fa fa-plus-circle"/>
@@ -196,8 +191,13 @@
</html>
</template>
- <template id="editor_head" inherit_id="website.layout" name="Editor" groups="base.group_website_designer">
+ <template id="editor_head" inherit_id="website.layout" name="Editor" groups="base.group_website_publisher">
<xpath expr="//head" position="inside">
+ <link rel='stylesheet' href='/website/static/src/css/snippets.css'/>
+ <link rel='stylesheet' href='/website/static/src/css/editor.css'/>
+ <link rel='stylesheet' href='/website/static/lib/bootstrap-tour/bootstrap-tour.css'/>
+
+
<link rel="stylesheet" href="/select2/static/lib/select2/select2.css"/>
<link rel="stylesheet" href="/website/static/lib/select2-bootstrap-css/select2-bootstrap.css"/>
<link rel='stylesheet' href="/web/static/lib/jquery.ui/css/smoothness/jquery-ui-1.9.1.custom.css"/>
@@ -273,7 +273,7 @@
</template>
<template id="publish_management">
- <div t-if="editable" t-ignore="true" class="pull-right css_editable_mode_hidden" t-att-style="style or ''">
+ <div groups="base.group_website_publisher" t-ignore="true" class="pull-right css_editable_mode_hidden" t-att-style="style or ''">
<div t-attf-class="btn-group js_publish_management #{object.website_published and 'css_published' or 'css_unpublished'}" t-att-data-id="object.id" t-att-data-object="object._name" t-att-data-controller="publish_controller">
<button class="btn btn-danger js_publish_btn">Not Published</button>
<button class="btn btn-success js_publish_btn">Published</button>
@@ -298,7 +298,7 @@
</template>
<template id="publish_short">
- <t t-if="editable" t-ignore="true">
+ <t groups="base.group_website_publisher" t-ignore="true">
<div t-attf-class="btn-group pull-right js_publish_management #{object.website_published and 'css_published' or 'css_unpublished'}" t-att-data-id="object.id" t-att-data-object="object._name" t-att-data-controller="publish_controller">
<button t-attf-class="btn btn-sm btn-#{object.website_published and 'success' or 'danger'} js_publish_btn">
<span class="css_publish">Not Published</span>