[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
This commit is contained in:
Aurélien Warnon
2019-02-13 14:32:41 +00:00
parent 752a3a5169
commit 8e2c67005e
4 changed files with 16 additions and 6 deletions
@@ -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:
@@ -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
@@ -42,23 +42,29 @@
-->
<t t-name="website.slide.upload.modal.common">
<div class="form-group row">
<label for="name" class="col-form-label col-md-2">Title</label>
<div class="col-md-10">
<label for="name" class="col-form-label col-md-3">Title</label>
<div class="col-md-9">
<input id="name" name="name" placeholder="Title" class="form-control" required="required"/>
</div>
</div>
<div class="form-group row">
<label for="category_id" class="col-form-label col-md-2">Category</label>
<div class="controls col-md-10">
<label for="category_id" class="col-form-label col-md-3">Category</label>
<div class="controls col-md-9">
<input class="form-control" id="category_id"/>
</div>
</div>
<div class="form-group row">
<label for="tag_ids" class="col-form-label col-md-2">Tags</label>
<div class="controls col-md-10">
<label for="tag_ids" class="col-form-label col-md-3">Tags</label>
<div class="controls col-md-9">
<input id="tag_ids" name="tag_ids" type="hidden"/>
</div>
</div>
<div class="form-group row">
<label for="is_preview" class="col-form-label col-md-3">Always visible</label>
<div class="controls col-md-9 mt8">
<input id="is_preview" name="is_preview" type="checkbox"/>
</div>
</div>
</t>
<!--
@@ -78,6 +78,7 @@
<page string="Website">
<group>
<group>
<field name="is_preview"/>
<field name="download_security"/>
<field name="date_published"/>
<field name="likes"/>