summaryrefslogtreecommitdiff
path: root/addons/web_editor
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2016-10-19 18:16:14 +0200
committerChristophe Simonis <chs@odoo.com>2016-10-19 18:16:14 +0200
commit938ffb92da1ea898f661aec04745f7630e2f378c (patch)
tree7faeed8433101836cd0239cf6c23629ef1f1289d /addons/web_editor
parent1f9e92dfef325b6727e1bee3de55bff095ec6cf2 (diff)
parent6466aa499fc37bba5f4feeeecac99448ef88e62e (diff)
[MERGE] forward port branch 10.0 up to 6466aa4
Diffstat (limited to 'addons/web_editor')
-rw-r--r--addons/web_editor/controllers/main.py2
-rw-r--r--addons/web_editor/models/ir_ui_view.py49
-rw-r--r--addons/web_editor/static/src/js/ace.js2
-rw-r--r--addons/web_editor/static/src/js/widgets.js2
-rw-r--r--addons/web_editor/static/src/less/web_editor.ui.components.less62
-rw-r--r--addons/web_editor/static/src/less/web_editor.variables.less119
-rw-r--r--addons/web_editor/static/src/xml/editor.xml22
7 files changed, 192 insertions, 66 deletions
diff --git a/addons/web_editor/controllers/main.py b/addons/web_editor/controllers/main.py
index 923b78492b3..5ea843bcaae 100644
--- a/addons/web_editor/controllers/main.py
+++ b/addons/web_editor/controllers/main.py
@@ -226,7 +226,7 @@ class Web_Editor(http.Controller):
@http.route('/web_editor/customize_template_get', type='json', auth='user', website=True)
def customize_template_get(self, key, full=False, bundles=False):
""" Get inherit view's informations of the template ``key``.
- returns templates (which can be active or not)
+ returns templates info (which can be active or not)
``bundles=True`` returns also the asset bundles
"""
return request.env["ir.ui.view"].customize_template_get(key, full=full, bundles=bundles)
diff --git a/addons/web_editor/models/ir_ui_view.py b/addons/web_editor/models/ir_ui_view.py
index 64ee45b567d..2b0af052c23 100644
--- a/addons/web_editor/models/ir_ui_view.py
+++ b/addons/web_editor/models/ir_ui_view.py
@@ -175,42 +175,21 @@ class IrUiView(models.Model):
return views_to_return
@api.model
- def customize_template_get(self, key, full=False, bundles=False):
- """ Get inherit view's informations of the template ``key``.
- returns templates (which can be active or not)
+ def _customize_template_get_views(self, key, full=False, bundles=False):
+ """ Get inherit views of the template ``key``.
+ returns views (which can be active or not)
``bundles=True`` returns also the asset bundles
"""
- user = self.env.user
- user_groups = set(user.groups_id)
+ user_groups = set(self.env.user.groups_id)
views = self.with_context(active_test=False)._views_get(key, bundles=bundles)
+ views = views.filtered(lambda v: user_groups.issuperset(v.groups_id))
+ return views
- view_theme_id = self.env['ir.model.data'].xmlid_to_res_id('website.theme')
- done = set()
- result = []
- for view in views:
- if full or (view.customize_show and view.inherit_id.id != view_theme_id):
- if not user_groups.issuperset(view.groups_id):
- continue
- if view.inherit_id not in done:
- result.append({
- 'name': view.inherit_id.name,
- 'id': view.id,
- 'key': view.key,
- 'xml_id': view.xml_id,
- 'arch': view.arch,
- 'inherit_id': view.inherit_id.id,
- 'header': True,
- 'active': False
- })
- done.add(view.inherit_id)
- result.append({
- 'name': view.name,
- 'id': view.id,
- 'key': view.key,
- 'xml_id': view.xml_id,
- 'arch': view.arch,
- 'inherit_id': view.inherit_id.id,
- 'header': False,
- 'active': view.active,
- })
- return result
+ @api.model
+ def customize_template_get(self, key, full=False, bundles=False):
+ """ Get inherit view's informations of the template ``key``.
+ returns templates info (which can be active or not)
+ ``bundles=True`` returns also the asset bundles
+ """
+ views = self._customize_template_get_views(key, full=full, bundles=bundles)
+ return views.read(['name', 'id', 'key', 'xml_id', 'arch', 'active', 'inherit_id'])
diff --git a/addons/web_editor/static/src/js/ace.js b/addons/web_editor/static/src/js/ace.js
index 5fbe7589265..56500383851 100644
--- a/addons/web_editor/static/src/js/ace.js
+++ b/addons/web_editor/static/src/js/ace.js
@@ -149,7 +149,7 @@ var ViewEditor = Widget.extend({
view.children = [];
});
_.each(index, function (view) {
- var parentId = view.inherit_id;
+ var parentId = view.inherit_id[0];
if (parentId && index[parentId]) {
index[parentId].children.push(view);
} else {
diff --git a/addons/web_editor/static/src/js/widgets.js b/addons/web_editor/static/src/js/widgets.js
index 7a3ab09dd76..61ec1564ac5 100644
--- a/addons/web_editor/static/src/js/widgets.js
+++ b/addons/web_editor/static/src/js/widgets.js
@@ -1145,7 +1145,7 @@ var LinkDialog = Dialog.extend({
$preview.attr("target", new_window ? '_blank' : "")
.attr("href", url && url.length ? url : "#")
.html((label && label.length ? label : url))
- .attr("class", classes.replace(/pull-\w+/, ''));
+ .attr("class", classes.replace(/pull-\w+/, '') + " o_btn_preview");
});
}
});
diff --git a/addons/web_editor/static/src/less/web_editor.ui.components.less b/addons/web_editor/static/src/less/web_editor.ui.components.less
index 7dd882ffbd0..44f3923c35e 100644
--- a/addons/web_editor/static/src/less/web_editor.ui.components.less
+++ b/addons/web_editor/static/src/less/web_editor.ui.components.less
@@ -189,7 +189,7 @@ body .modal {
ul.pager {
margin: 0;
> li > a {
- border-radius: 3px;
+ border-radius: 0px;
margin-left: 2px;
padding: 6px 14px;
}
@@ -206,20 +206,34 @@ body .modal {
}
}
}
- .dropdown-toggle {
- line-height: 0;
- height: 34px;
+
+ .well {
+ border-top-width: 0;
+
+ label {
+ margin: auto 10px;
+ }
+
+ .btn-group {
+ margin-right: 10px;
+ }
}
+
.o_existing_attachment_cell {
@odoo-border-image: 1px;
.o_existing_attachment_remove {
.o-position-absolute(@odoo-border-image, 15px + @odoo-border-image);
- padding: 3px 3px 12px 12px;
- background-color: white;
- border-bottom: 1px solid black;
- border-left: 1px solid black;
- border-radius: 0 0 0 100%;
- opacity: 0.8;
+ padding: 3px 5px 5px 5px;
+ background-color: fade(white, 80%);
+ text-shadow: 0 0 1px white;
+ border-radius: 0 0 0 2px;
+ opacity: 0;
+ cursor: pointer;
+
+ &:hover {
+ background-color: white;
+ color: @o-we-color-danger;
+ }
}
.o_image {
border: @odoo-border-image solid transparent;
@@ -235,15 +249,29 @@ body .modal {
border-color: @odoo-brand-primary;
box-shadow: 0px 0px 2px 2px @odoo-brand-secondary;
}
+ &:hover {
+ .o_existing_attachment_remove {
+ opacity: 1;
+ }
+ }
}
- .font-icons-icons > span {
- font-size: 30px;
- margin: 5px;
- padding: 3px;
- cursor: pointer;
+ .font-icons-icons {
+ padding: 20px 0;
- &.o_selected {
- box-shadow: 0px 0px 2px 2px @odoo-brand-secondary;
+ > span {
+ text-align: center;
+ font-size: 22px;
+ margin: 5px;
+ width: 50px;
+ height: 50px;
+ padding: 15px;
+ cursor: pointer;
+
+ &.o_selected {
+ cursor: auto;
+ background-color: @o-we-color-paper;
+ box-shadow: 0px 0px 0px 1px @o-we-color-success;
+ }
}
}
}
diff --git a/addons/web_editor/static/src/less/web_editor.variables.less b/addons/web_editor/static/src/less/web_editor.variables.less
index 9e0c7a2a014..37e219302a0 100644
--- a/addons/web_editor/static/src/less/web_editor.variables.less
+++ b/addons/web_editor/static/src/less/web_editor.variables.less
@@ -9,6 +9,9 @@
@o-we-color-text-normal: #999999;
@o-we-color-text-light: #d4d5d7;
@o-we-color-danger: #e6586c;
+@o-we-color-warning: #f0ad4e;
+@o-we-color-success: #40ad67;
+@o-we-color-info: #6999a8;
@o-we-sidebar-width: 210px;
@@ -76,3 +79,119 @@
from { background: @odoo-brand-optional; }
to { width: 0; background: transparent; }
}
+
+
+// ============ Preservetion mixins ===============
+// Used to preserve web_editor and website UI from themes customizations
+
+.o-w-preserve-base() {
+ font-family: @o-we-font-family;
+ line-height: 1.42857143;
+ color: @o-we-color-divider;
+
+ .text-muted {
+ color: @o-we-color-text-normal;
+ }
+}
+
+.o-w-preserve-headings() {
+ h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
+ font-family: @o-we-font-family;
+ line-height: 1.42857143;
+ color: @o-we-color-dark;
+ font-weight: bold;
+ }
+}
+
+.o-w-preserve-links() {
+ a:not(.o_btn_preview) {
+ color: @odoo-brand-optional;
+
+ &:focus, &:active, &:focus:active {
+ outline: none!important;
+ }
+ }
+}
+
+.o-w-preserve-forms() {
+ .form-control {
+ height: 34px;
+ padding: 6px 12px;
+ font-size: 14px;
+ line-height: 1.42857143;
+ border: 1px solid @o-we-color-text-light;
+ color: #555;
+ background-color: #fff;
+ border-radius: 0;
+ }
+}
+
+.o-w-preserve-modals() {
+ background: 0;
+
+ .modal-content {
+ border-radius: 0;
+ background-color: @o-we-color-paper;
+
+ .modal-body {
+ background-color: white;
+ }
+ .modal-footer {
+ text-align: left;
+ }
+ }
+}
+
+.o-w-preserve-btn() {
+ .btn:not(.o_btn_preview) {
+ border-width: 1px;
+ border-radius: 0;
+ font-weight: normal;
+ .button-size(6px; 12px; 14px; 1.42857143; 0);
+
+ &.btn-primary {
+ .button-variant(white, @odoo-brand-optional, darken(@odoo-brand-optional,5%));
+ text-transform: uppercase;
+ }
+ &.btn-default {
+ .button-variant(@odoo-brand-optional, white, @o-we-color-text-light);
+ text-transform: uppercase;
+ }
+ &.btn-link {
+ .button-variant(@odoo-brand-optional, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0));
+ }
+ &.btn-success {
+ .button-variant(white; @o-we-color-success; darken(@o-we-color-success, 5%));
+ }
+ &.btn-info {
+ .button-variant(white; @o-we-color-info; darken(@o-we-color-info, 5%));
+ }
+ &.btn-warning {
+ .button-variant(white; @o-we-color-warning; darken(@o-we-color-warning, 5%));
+ }
+ &.btn-danger {
+ .button-variant(white; @o-we-color-danger; darken(@o-we-color-danger, 5%));
+ }
+
+ &.btn-lg {
+ .button-size(10px; 16px; 18px; 1.3333333; 0);
+ }
+ &.btn-sm {
+ .button-size(5px; 10px; 12px; 1.5; 0);
+ }
+ &.btn-xs {
+ .button-size(1px; 5px; 12px; 1.5; 0);
+ }
+ }
+}
+
+.o-w-preserve-wells() {
+ .well {
+ padding: 19px;
+ margin-bottom: 20px;
+ background-color: @o-we-color-paper;
+ border: 1px solid darken(@o-we-color-paper,5%);
+ border-radius: 0;
+ .box-shadow(none);
+ }
+}
diff --git a/addons/web_editor/static/src/xml/editor.xml b/addons/web_editor/static/src/xml/editor.xml
index 27213d7fdd8..2ad47703700 100644
--- a/addons/web_editor/static/src/xml/editor.xml
+++ b/addons/web_editor/static/src/xml/editor.xml
@@ -251,31 +251,31 @@
<span class="caret"/></a>
<ul aria-labelledby="dLabel" class="dropdown-menu" role="menu">
<li>
- <label class="btn btn-link">Link
+ <label class="btn btn-link o_btn_preview">Link
<input checked="checked" class="link-style" name="link-style-type" type="radio" value=""/></label>
</li>
<li>
- <label class="btn btn-default">Basic
+ <label class="btn btn-default o_btn_preview">Basic
<input class="link-style" name="link-style-type" type="radio" value="btn-default"/></label>
</li>
<li>
- <label class="btn btn-success">Success
+ <label class="btn btn-success o_btn_preview">Success
<input class="link-style" name="link-style-type" type="radio" value="btn-success"/></label>
</li>
<li>
- <label class="btn btn-primary">Primary
+ <label class="btn btn-primary o_btn_preview">Primary
<input class="link-style" name="link-style-type" type="radio" value="btn-primary"/></label>
</li>
<li>
- <label class="btn btn-info">Info
+ <label class="btn btn-info o_btn_preview">Info
<input class="link-style" name="link-style-type" type="radio" value="btn-info"/></label>
</li>
<li>
- <label class="btn btn-warning">Warning
+ <label class="btn btn-warning o_btn_preview">Warning
<input class="link-style" name="link-style-type" type="radio" value="btn-warning"/></label>
</li>
<li>
- <label class="btn btn-danger">Danger
+ <label class="btn btn-danger o_btn_preview">Danger
<input class="link-style" name="link-style-type" type="radio" value="btn-danger"/></label>
</li>
</ul>
@@ -287,19 +287,19 @@
<span class="caret"/></a>
<ul aria-labelledby="dLabel" class="dropdown-menu" role="menu">
<li>
- <label class="btn btn-default btn-xs">Extra Small
+ <label class="btn btn-default btn-xs o_btn_preview">Extra Small
<input class="link-style" name="link-style-size" type="radio" value="btn-xs"/></label>
</li>
<li>
- <label class="btn btn-default btn-sm">Small
+ <label class="btn btn-default btn-sm o_btn_preview">Small
<input class="link-style" name="link-style-size" type="radio" value="btn-sm"/></label>
</li>
<li>
- <label class="btn btn-default">Default
+ <label class="btn btn-default o_btn_preview">Default
<input checked="checked" class="link-style" name="link-style-size" type="radio" value=""/></label>
</li>
<li>
- <label class="btn btn-default btn-lg">Large
+ <label class="btn btn-default btn-lg o_btn_preview">Large
<input class="link-style" name="link-style-size" type="radio" value="btn-lg"/></label>
</li>
</ul>