summaryrefslogtreecommitdiff
path: root/addons/website/static/src
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2014-10-01 19:18:14 +0200
committerChristophe Simonis <chs@odoo.com>2014-10-01 19:18:14 +0200
commit709c9868de7c4ac4985ed4e0055ae3e3e49742ad (patch)
treee90227a947bddf47b3043fcbe8b99529a22aa7dd /addons/website/static/src
parent85f26244a71a0b9a7faa283d6d24fdde6bae899a (diff)
parente8831932464814ed5f9e3a0af33f98891a466417 (diff)
[MERGE] forward port of branch 8.0 up to e883193
Diffstat (limited to 'addons/website/static/src')
-rw-r--r--addons/website/static/src/js/website.editor.js16
-rw-r--r--addons/website/static/src/js/website.js26
-rw-r--r--addons/website/static/src/xml/website.editor.xml12
3 files changed, 41 insertions, 13 deletions
diff --git a/addons/website/static/src/js/website.editor.js b/addons/website/static/src/js/website.editor.js
index fc35b025403..48d8d139aed 100644
--- a/addons/website/static/src/js/website.editor.js
+++ b/addons/website/static/src/js/website.editor.js
@@ -413,7 +413,6 @@
this.$('#website-top-edit').hide();
this.$('#website-top-view').show();
- this.$buttons.edit.show();
var $edit_button = this.$buttons.edit
.prop('disabled', website.no_editor);
@@ -855,6 +854,7 @@
var def = $.Deferred();
var editor = this.editor = CKEDITOR.inline(root, self._config());
editor.on('instanceReady', function () {
+ $("[data-oe-type=selection]").attr("contenteditable",false);
editor.setReadOnly(false);
// ckeditor set root to editable, disable it (only inner
// sections are editable)
@@ -924,15 +924,9 @@
fetch_editables: function (root) {
return $(root).find('[data-oe-model]')
+ .not('[data-oe-type = "selection"]')
.not('link, script')
- .not('.oe_snippet_editor')
- .filter(function () {
- var $this = $(this);
- // keep view sections and fields which are *not* in
- // view sections for top-level editables
- return $this.data('oe-model') === 'ir.ui.view'
- || !$this.closest('[data-oe-model = "ir.ui.view"]').length;
- });
+ .not('.oe_snippet_editor');
},
_current_editor: function () {
@@ -1492,6 +1486,10 @@
'click button.filepicker': function () {
this.$('input[type=file]').click();
},
+ 'click .js_disable_optimization': function () {
+ this.$('input[name="disable_optimization"]').val('1');
+ this.$('button.filepicker').click();
+ },
'change input[type=file]': 'file_selection',
'submit form': 'form_submit',
'change input.url': "change_input",
diff --git a/addons/website/static/src/js/website.js b/addons/website/static/src/js/website.js
index 84d755a4801..48b656cd89d 100644
--- a/addons/website/static/src/js/website.js
+++ b/addons/website/static/src/js/website.js
@@ -256,6 +256,22 @@
if($.fn.placeholder) $('input, textarea').placeholder();
});
+ /**
+ * Execute a function if the dom contains at least one element matched
+ * through the given jQuery selector. Will first wait for the dom to be ready.
+ *
+ * @param {String} selector A jQuery selector used to match the element(s)
+ * @param {Function} fn Callback to execute if at least one element has been matched
+ */
+ website.if_dom_contains = function(selector, fn) {
+ website.dom_ready.then(function () {
+ var elems = $(selector);
+ if (elems.length) {
+ fn(elems);
+ }
+ });
+ };
+
var all_ready = null;
/**
* Returns a deferred resolved when the templates are loaded
@@ -267,8 +283,12 @@
return templates_def;
}).then(function () {
// display button if they are at least one editable zone in the page (check the branding)
- var editable = $('html').data('website-id') && !!$('[data-oe-model]').size();
- $("#oe_editzone").toggle(editable);
+ if (!!$('[data-oe-model]').size()) {
+ $("#oe_editzone").show();
+
+ //backwards compatibility with 8.0RC1 templates - Drop next line in master!
+ $("#oe_editzone button").show();
+ }
if ($('html').data('website-id')) {
website.id = $('html').data('website-id');
@@ -283,7 +303,7 @@
website.inject_tour = function() {
// if a tour is active inject tour js
- }
+ };
website.dom_ready.then(function () {
/* ----- PUBLISHING STUFF ---- */
diff --git a/addons/website/static/src/xml/website.editor.xml b/addons/website/static/src/xml/website.editor.xml
index 607759cb0c2..c413c54bf43 100644
--- a/addons/website/static/src/xml/website.editor.xml
+++ b/addons/website/static/src/xml/website.editor.xml
@@ -204,7 +204,17 @@
<div class="well">
<div class="form-group pull-left">
<input type="file" name="upload" accept="image/*" multiple="multiple" style="position: absolute; opacity: 0; width: 1px; height: 1px;"/>
- <button type="button" class="btn btn-primary filepicker">Upload an image from your computer</button>
+ <input type="hidden" name="disable_optimization" value=""/>
+ <div class="btn-group">
+ <button type="button" class="btn btn-primary filepicker">Upload an image from your computer</button>
+ <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
+ <span class="caret"></span>
+ <span class="sr-only">Alternate Upload</span>
+ </button>
+ <ul class="dropdown-menu" role="menu">
+ <li><a href="#" class="js_disable_optimization">Upload image without optimization</a></li>
+ </ul>
+ </div>
<button type="button" class="btn hidden wait" disabled="disabled">Uploading...</button>
</div>
<div>