From 7c12d5d200141907e5f3b7492e958c3c8c83b6f5 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Mon, 3 Feb 2014 17:03:31 +0100 Subject: [IMP] clearer indication that images are being up/downloaded bzr revid: xmo@openerp.com-20140203160331-04h1erlunelb9kkn --- addons/website/static/src/js/website.editor.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'addons/website/static/src/js/website.editor.js') diff --git a/addons/website/static/src/js/website.editor.js b/addons/website/static/src/js/website.editor.js index ab97ee2bcf9..43b2025e191 100644 --- a/addons/website/static/src/js/website.editor.js +++ b/addons/website/static/src/js/website.editor.js @@ -1265,7 +1265,7 @@ }), start: function () { - this.$('.modal-footer [disabled]').text("Uploading…"); + this.$('button.wait').text("Uploading…"); var $options = this.$('.image-style').children(); this.image_styles = $options.map(function () { return this.value; }).get(); @@ -1327,14 +1327,22 @@ this.set_image(url); }, preview_image: function () { - this.$el.removeClass('nosave'); + var loaded = function () { + this.$el.removeClass('nosave'); + }.bind(this); var image = this.$('input.url').val(); - if (!image) { return; } + if (!image) { loaded(); return; } - this.$('img.image-preview') + var $img = this.$('img.image-preview') .attr('src', image) .removeClass(this.image_styles.join(' ')) .addClass(this.$('select.image-style').val()); + + if ($img.prop('complete')) { + loaded(); + } else { + $img.load(loaded) + } }, browse_existing: function (e) { e.preventDefault(); -- cgit v1.2.3 From 18d9e91394addcebd252623492fba33d5fe6300f Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Tue, 4 Feb 2014 16:36:16 +0100 Subject: [IMP] make editor bar appear faster to avoid impression of slowness and reflow bzr revid: xmo@openerp.com-20140204153616-swho76l8v3s4p1dq --- addons/website/static/src/js/website.editor.js | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'addons/website/static/src/js/website.editor.js') diff --git a/addons/website/static/src/js/website.editor.js b/addons/website/static/src/js/website.editor.js index 43b2025e191..dd8fd42727f 100644 --- a/addons/website/static/src/js/website.editor.js +++ b/addons/website/static/src/js/website.editor.js @@ -10,6 +10,9 @@ if (!is_smartphone) { website.ready().then(website.init_editor); + } else { + // remove padding of fake editor bar + document.body.style.padding = 0; } $(document).on('click', 'a.js_link2post', function (ev) { @@ -437,6 +440,10 @@ }); }, start: function() { + // remove placeholder editor bar + var fakebar = document.getElementById('website-top-navbar-placeholder'); + fakebar.parentNode.removeChild(fakebar); + var self = this; this.saving_mutex = new openerp.Mutex(); -- cgit v1.2.3 From 7d1f7ee10a6a71df6e031547a31dc24bd4494e24 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Tue, 4 Feb 2014 17:58:23 +0100 Subject: [IMP] handling of overly large images in website image upload bzr revid: xmo@openerp.com-20140204165823-q05aoq83q28b2hhg --- addons/website/static/src/js/website.editor.js | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'addons/website/static/src/js/website.editor.js') diff --git a/addons/website/static/src/js/website.editor.js b/addons/website/static/src/js/website.editor.js index dd8fd42727f..edcff1bbc77 100644 --- a/addons/website/static/src/js/website.editor.js +++ b/addons/website/static/src/js/website.editor.js @@ -1305,13 +1305,16 @@ * Sets the provided image url as the dialog's value-to-save and * refreshes the preview element to use it. */ - set_image: function (url) { + set_image: function (url, error) { + this.$('input.url').val( + error ? '' : url); this.$('input.url').val(url); this.preview_image(); }, file_selection: function () { this.$el.addClass('nosave'); + this.$('form').removeClass('has-error').find('.help-block').empty(); this.$('button.filepicker').removeClass('btn-danger btn-success'); var self = this; @@ -1326,12 +1329,15 @@ }, file_selected: function(url, error) { var $button = this.$('button.filepicker'); - if (error) { + if (!error) { + $button.addClass('btn-success'); + } else { + url = null; + this.$('form').addClass('has-error') + .find('.help-block').text(error); $button.addClass('btn-danger'); - return; } - $button.addClass('btn-success'); - this.set_image(url); + this.set_image(url, error); }, preview_image: function () { var loaded = function () { @@ -1353,6 +1359,8 @@ }, browse_existing: function (e) { e.preventDefault(); + this.$('form').removeClass('has-error').find('.help-block').empty(); + this.$('button.filepicker').removeClass('btn-danger btn-success'); new website.editor.ExistingImageDialog(this).appendTo(document.body); }, }); -- cgit v1.2.3 From c68c5837aae1138a58f946d6a83cb1ce71e16fe9 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Wed, 5 Feb 2014 11:36:23 +0100 Subject: [FIX] avoid blowing up editor if run on non-updated editor_head template without a placeholder edition navbar bzr revid: xmo@openerp.com-20140205103623-bk038voq3f8zj9vm --- addons/website/static/src/js/website.editor.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'addons/website/static/src/js/website.editor.js') diff --git a/addons/website/static/src/js/website.editor.js b/addons/website/static/src/js/website.editor.js index edcff1bbc77..e5ba5018316 100644 --- a/addons/website/static/src/js/website.editor.js +++ b/addons/website/static/src/js/website.editor.js @@ -442,7 +442,9 @@ start: function() { // remove placeholder editor bar var fakebar = document.getElementById('website-top-navbar-placeholder'); - fakebar.parentNode.removeChild(fakebar); + if (fakebar) { + fakebar.parentNode.removeChild(fakebar); + } var self = this; this.saving_mutex = new openerp.Mutex(); -- cgit v1.2.3 From d819d494f11d275cdd9ad2a7078ae93d4ef59dc1 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Thu, 6 Feb 2014 14:50:36 +0100 Subject: [IMP] website: add debugger template used to create nex tours/tests (display in customize menu in debug mode) bzr revid: chm@openerp.com-20140206135036-geq8fubtz39pxp20 --- addons/website/static/src/js/website.editor.js | 1 + 1 file changed, 1 insertion(+) (limited to 'addons/website/static/src/js/website.editor.js') diff --git a/addons/website/static/src/js/website.editor.js b/addons/website/static/src/js/website.editor.js index e5ba5018316..e809619a923 100644 --- a/addons/website/static/src/js/website.editor.js +++ b/addons/website/static/src/js/website.editor.js @@ -414,6 +414,7 @@ openerp.jsonRpc('/website/customize_template_get', 'call', { 'xml_id': view_name }).then( function(result) { _.each(result, function (item) { + if (item.xml_id === "website.debugger" && !window.location.search.match(/[&?]debug(&|$)/)) return; if (item.header) { menu.append(''); } else { -- cgit v1.2.3 From 6900662b540f4e92842e4473e177510224f2620f Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Fri, 7 Feb 2014 15:51:49 +0100 Subject: [FIX] page creation broken because what is grep bzr revid: xmo@openerp.com-20140207145149-fem1wnr0t10rcgsn --- addons/website/static/src/js/website.editor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/website/static/src/js/website.editor.js') diff --git a/addons/website/static/src/js/website.editor.js b/addons/website/static/src/js/website.editor.js index e5ba5018316..fab9dbcc4a7 100644 --- a/addons/website/static/src/js/website.editor.js +++ b/addons/website/static/src/js/website.editor.js @@ -1082,7 +1082,7 @@ } else { // Create the page, get the URL back done = $.get(_.str.sprintf( - '/pagenew/%s?noredirect=1', encodeURI(data.id))) + '/website/add/%s?noredirect=1', encodeURI(data.id))) .then(function (response) { self.make_link(response, false, data.id); }); -- cgit v1.2.3 From e95eb140a74487a91a4c657c3616e4ceb10ea9b4 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Mon, 10 Feb 2014 14:05:04 +0100 Subject: [CHG] website: fp wants image 'change' buttons to be btn-sm bzr revid: xmo@openerp.com-20140210130504-hejvay436emh7f36 --- addons/website/static/src/js/website.editor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/website/static/src/js/website.editor.js') diff --git a/addons/website/static/src/js/website.editor.js b/addons/website/static/src/js/website.editor.js index 1e8246366a9..7e867dca685 100644 --- a/addons/website/static/src/js/website.editor.js +++ b/addons/website/static/src/js/website.editor.js @@ -638,7 +638,7 @@ image_dialog(editor, new CKEDITOR.dom.element(previous)); $image_button.hide(); previous = null; - }); + }, 'btn-sm'); // previous is the state of the button-trigger: it's the // currently-ish hovered element which can trigger a button showing. -- cgit v1.2.3