Files
odoo_source/addons/website_form/views/snippets.xml
T
qsm-odoo 4f27e52cab [IMP] web_editor, *: introduce and restore new web_editor UI
* mass_mailing, note, website, website_blog, website_form,
website_mass_mailing, website_sale

This commit, unfortunately, mixes three things:

- Restoring as much as possible the scss organisation to allow styling
the web_editor UI properly.

- Fixing some bugs like a border around the page once the editor is
loaded, no ability to scroll the snippets, etc

- Introducing a whole new UI for snippet options: a left panel instead
of the old dropdown & button overlay.

Note: this commit also do some linting and ES6 convertion even though
some of it has been done in the parent commit.

Note 2: some elements that were removed are still styled in the POS apps
but this is because part of a feature was removed while leaving dead
code behind, this is handled in another PR which is to be merged
(https://github.com/odoo/odoo/pull/36136).

Part of https://github.com/odoo/odoo/pull/36068
task-1942370

closes odoo/odoo#36068

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2019-08-28 09:04:55 +00:00

89 lines
5.6 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="s_website_form" name="Form Builder">
<form action="/website_form/" method="post" class="s_website_form container-fluid mt32" enctype="multipart/form-data">
<div class="container">
<div class="form-group row">
<div class="offset-lg-3 offset-md-4 col-md-8 col-lg-7">
<button class="btn btn-primary btn-lg o_website_form_send">Send</button>
<span id="o_website_form_result"></span>
</div>
</div>
</div>
</form>
</template>
<template id="remove_external_snippets" inherit_id="website.external_snippets">
<xpath expr="//t[@t-install='website_form']" position="replace"/>
</template>
<template id="register_s_website_form" inherit_id="website.snippets" name="Snippet Form Builder">
<xpath expr="//div[@id='snippet_feature']//t[@t-snippet][last()]" position="after">
<t t-snippet="website_form.s_website_form" t-thumbnail="/website/static/src/img/s_website_form.png"/>
</xpath>
</template>
<template id="snippet_options" inherit_id="website.snippet_options">
<xpath expr="//*[@id='so_snippet_addition']" position="attributes">
<attribute name="data-selector" add=".s_website_form" separator=","/>
</xpath>
<xpath expr="//div" position="after">
<!-- Form -->
<div data-js="website_form_editor" data-selector=".s_website_form">
<we-button data-website_form_model_modal="" data-no-preview="true">Change Form Parameters</we-button>
<we-button data-website_form_field_modal="" data-no-preview="true">Add an existing field</we-button>
<we-collapse-area>
<we-toggler>Add a custom field</we-toggler>
<we-collapse data-no-preview="true">
<we-button data-website_form_custom_field="char">Text</we-button>
<we-button data-website_form_custom_field="text">Long Text</we-button>
<we-button data-website_form_custom_field="integer">Number</we-button>
<we-button data-website_form_custom_field="float">Decimal Number</we-button>
<we-button data-website_form_custom_field="boolean">Checkbox</we-button>
<we-button data-website_form_custom_field="selection">Radio Buttons</we-button>
<we-button data-website_form_custom_field="many2one">Selection</we-button>
<we-button data-website_form_custom_field="one2many">Multiple Checkboxes</we-button>
<we-button data-website_form_custom_field="date">Date</we-button>
<we-button data-website_form_custom_field="datetime">Date &amp; Time</we-button>
<we-button data-website_form_custom_field="binary">File Upload</we-button>
</we-collapse>
</we-collapse-area>
</div>
<!-- Field -->
<div data-js='website_form_editor' data-selector=".form-field" data-drop-near=".form-field">
<we-button data-toggle-class="o_website_form_field_hidden" data-no-preview="true">Hidden</we-button>
</div>
<!-- Add move, duplicate and remove controllers to checkboxes and radio buttons -->
<div data-selector=".o_website_form_flex_item" data-drop-near=".o_website_form_flex_item"/>
<!-- Add move and remove controllers to select items -->
<div data-selector=".s_website_form .form-field.o_website_form_custom .o_website_form_select_item" data-drop-near=".o_website_form_select_item"/>
<!-- Required option for fields that are not required fields of the model -->
<div data-js='website_form_editor_field' data-selector=".form-field:not(.o_website_form_required)">
<we-button data-website_form_field_require="" data-toggle-class="o_website_form_required_custom" data-no-preview="true">Required</we-button>
</div>
<!-- Remove the duplicate options of model fields -->
<div data-js="website_form_editor_field_model" data-selector=".s_website_form .form-field:not(.o_website_form_custom)"/>
<!-- Remove the delete options of model required fields -->
<div data-js="website_form_editor_field_required" data-selector=".s_website_form .o_website_form_required"/>
<!-- Remove the duplicate options of radio and checkboxes of model fields -->
<div data-js="website_form_editor_field_x2many" data-selector=".s_website_form .form-field:not(.o_website_form_custom) .o_website_form_flex_item"/>
<!-- Transform the select inputs into editable constructs -->
<div data-js="website_form_editor_field_select" data-selector=".s_website_form .form-field:has(select)"/>
<!-- Remove the duplicate option of model select items -->
<div data-js="website_form_editor_field_x2many" data-selector=".s_website_form .form-field:not(.o_website_form_custom) .o_website_form_select_item" data-drop-near=".o_website_form_select_item"/>
<!-- Remove the delete options of the Submit button -->
<div data-js="website_form_editor_field_required" data-selector=".s_website_form .o_website_form_send"/>
</xpath>
</template>
</odoo>