summaryrefslogtreecommitdiff
path: root/addons/website/static/src
diff options
context:
space:
mode:
authorFabien Meghazi <fme@openerp.com>2014-09-08 15:54:38 +0200
committerFabien Meghazi <fme@openerp.com>2014-09-16 19:55:00 +0200
commit0d890ab76e69406dd9bfeeea6802eee14588c591 (patch)
tree155da924715cce4931feac7f3ae22fbb4fad3d0f /addons/website/static/src
parent89362bd6cd3daab7acdd2e1416f594fcf7b3ea59 (diff)
[ADD] Compress uploaded image by default
Added an opt-out option available from the button's dropdown
Diffstat (limited to 'addons/website/static/src')
-rw-r--r--addons/website/static/src/js/website.editor.js4
-rw-r--r--addons/website/static/src/xml/website.editor.xml12
2 files changed, 15 insertions, 1 deletions
diff --git a/addons/website/static/src/js/website.editor.js b/addons/website/static/src/js/website.editor.js
index ab6abed522b..50c939a0803 100644
--- a/addons/website/static/src/js/website.editor.js
+++ b/addons/website/static/src/js/website.editor.js
@@ -1387,6 +1387,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/xml/website.editor.xml b/addons/website/static/src/xml/website.editor.xml
index 24d54ec017e..13b80b1e706 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/*" 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>