From 8e2c67005e0d0fc2414df9b3d5f9ecb573f67bf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Warnon?= Date: Wed, 13 Feb 2019 14:32:41 +0000 Subject: [PATCH] [IMP] website_slides: add is_preview management in backend/frontend Task #1902304 Purpose ======= The 'is_preview' field implied some functional behavior but it was not manageable from back-end nor front-end. It can now be configured on the slide upload form (front-end view) and on the slide form (back-end view). closes odoo/odoo#31073 --- addons/website_slides/controllers/main.py | 2 ++ .../static/src/js/slides_upload.js | 1 + .../static/src/xml/website_slides_upload.xml | 18 ++++++++++++------ .../website_slides/views/slide_slide_views.xml | 1 + 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/addons/website_slides/controllers/main.py b/addons/website_slides/controllers/main.py index 6771919c95a..2739d9d7d57 100644 --- a/addons/website_slides/controllers/main.py +++ b/addons/website_slides/controllers/main.py @@ -313,6 +313,8 @@ class WebsiteSlides(http.Controller): else: values['category_id'] = post['category_id'][0] + values['is_preview'] = post.get('is_preview') == 'true' + # handle exception during creation of slide and sent error notification to the client # otherwise client slide create dialog box continue processing even server fail to create a slide try: diff --git a/addons/website_slides/static/src/js/slides_upload.js b/addons/website_slides/static/src/js/slides_upload.js index 3fbc7b94ab4..cdb37ff47cd 100644 --- a/addons/website_slides/static/src/js/slides_upload.js +++ b/addons/website_slides/static/src/js/slides_upload.js @@ -128,6 +128,7 @@ var SlideUploadDialog = Dialog.extend({ 'url': this._formGetFieldValue('url'), 'description': this._formGetFieldValue('description'), 'index_content': this._formGetFieldValue('index_content'), + 'is_preview': this.$('#is_preview').is(':checked'), 'website_published': forcePublished, }, this._getSelect2DropdownValues()); // add tags and category diff --git a/addons/website_slides/static/src/xml/website_slides_upload.xml b/addons/website_slides/static/src/xml/website_slides_upload.xml index c43616638f1..b427446e28f 100644 --- a/addons/website_slides/static/src/xml/website_slides_upload.xml +++ b/addons/website_slides/static/src/xml/website_slides_upload.xml @@ -42,23 +42,29 @@ -->
- -
+ +
- -
+ +
- -
+ +
+
+ +
+ +
+