diff options
| author | rde <rde@odoo.com> | 2017-09-15 12:36:59 +0200 |
|---|---|---|
| committer | Jeremy Kersten <jke@odoo.com> | 2017-09-15 15:29:37 +0200 |
| commit | 4ecbacaf59576a22ff45615a5aa5c67244e4fb93 (patch) | |
| tree | b1d38321d2838579ccb8adc2f3fcdd0765351fcc /addons/website_crm | |
| parent | 13a44d33bda1d7ff21e3de5de8b3c84f6a482a0d (diff) | |
[ADD] website: add new page management
website.page = old ir.ui.view with page=True
website.redirect is a new mechanism to replace in the futur the ir.attachment
mechanism of redirect.
From now, we don't have a specific /page controller to serve 'page'.
We use a new model website.page which is rendered if none route matches the url
and that the field 'url' on website.page matches the request.httprequest.path.
The order to serve a path is:
- Routes defines in controllers (/shop, /blog, ...)
- ir.attachment with name matching the path
- website.page with url matching the path
- website.redirect with url_from matching the path
- 404
To improve:
- allow regexp in website.redirect model
- allow to edit the view_arch from the page.management via redirect backend
(needed when traceback in the page, or when modifying a js/css/less/...)
Diffstat (limited to 'addons/website_crm')
4 files changed, 44 insertions, 32 deletions
diff --git a/addons/website_crm/data/website_crm_data.xml b/addons/website_crm/data/website_crm_data.xml index 8104f803ca1..c4672a1a267 100644 --- a/addons/website_crm/data/website_crm_data.xml +++ b/addons/website_crm/data/website_crm_data.xml @@ -22,7 +22,7 @@ <record id="action_open_website" model="ir.actions.act_url"> <field name="name">Website Contact Form</field> <field name="target">self</field> - <field name="url">/page/contactus</field> + <field name="url">/contactus</field> </record> <record id="base.open_menu" model="ir.actions.todo"> diff --git a/addons/website_crm/static/src/js/website_crm_tour.js b/addons/website_crm/static/src/js/website_crm_tour.js index e035111df0d..9d72e2a46b3 100644 --- a/addons/website_crm/static/src/js/website_crm_tour.js +++ b/addons/website_crm/static/src/js/website_crm_tour.js @@ -6,7 +6,7 @@ odoo.define('website_crm.tour', function(require) { tour.register('website_crm_tour', { test: true, - url: '/page/contactus', + url: '/contactus', wait_for: base.ready(), }, [{ content: "Complete name", diff --git a/addons/website_crm/views/res_config_settings_views.xml b/addons/website_crm/views/res_config_settings_views.xml index fd0c6da4fc1..2e91c4d2844 100644 --- a/addons/website_crm/views/res_config_settings_views.xml +++ b/addons/website_crm/views/res_config_settings_views.xml @@ -12,7 +12,7 @@ <div class="o_setting_right_pane"> <label for="id" string="Contact Form"/> <div class="text-muted" id="msg_contact_form_install_setting"> - Add a contact form in the <a href="/page/website.contactus">Contact Us</a> page + Add a contact form in the <a href="/contactus">Contact Us</a> page </div> <div class="row"> <label class="col-md-3 o_light_label" string="Sales Channel" for="crm_default_team_id"/> diff --git a/addons/website_crm/views/website_crm_templates.xml b/addons/website_crm/views/website_crm_templates.xml index f3c657ed3a3..f8e79eccee3 100644 --- a/addons/website_crm/views/website_crm_templates.xml +++ b/addons/website_crm/views/website_crm_templates.xml @@ -3,7 +3,7 @@ <template id="contactus_form" name="Contact Form" inherit_id="website.contactus" customize_show="True"> <xpath expr="//div[@name='mail_button']" position="replace"> <div> - <form action="/website_form/" method="post" data-model_name="crm.lead" data-success_page="/page/website_crm.contactus_thanks" class="s_website_form form-horizontal container-fluid mt32" enctype="multipart/form-data" data-editable-form="false"> + <form action="/website_form/" method="post" data-model_name="crm.lead" data-success_page="/contactus-thank-you" class="s_website_form form-horizontal container-fluid mt32" enctype="multipart/form-data" data-editable-form="false"> <div class="form-group form-field o_website_form_required_custom"> <label class="col-md-3 col-sm-4 control-label" for="contact_name">Your Name</label> <div class="col-md-7 col-sm-8"> @@ -50,38 +50,50 @@ </div> </xpath> </template> - - <template id="contactus_thanks" name="Contact us"> - <t t-call="website.layout"> - <div id="wrap"> - <div class="oe_structure"/> - <div class="container"> - <h1>Thanks!</h1> - <div class="row"> - <div class="col-md-8"> - <div class="alert alert-success"> - Your message has been sent successfully. - <button type="button" class="close" data-dismiss="alert">&times;</button> + <record id="contactus_thanks" model="ir.ui.view"> + <field name="name">Thanks (Contact us)</field> + <field name="type">qweb</field> + <field name="key">website_crm.contactus_thanks</field> + <field name="arch" type="xml"> + <t name="Thanks (Contact us)" t-name="website_crm.contactus_thanks"> + <t t-call="website.layout"> + <div id="wrap"> + <div class="oe_structure"/> + <div class="container"> + <h1>Thanks!</h1> + <div class="row"> + <div class="col-md-8"> + <div class="alert alert-success"> + Your message has been sent successfully. + <button type="button" class="close" data-dismiss="alert">&times;</button> + </div> + <p> + We will get back to you shortly. + </p><p class="mt64"> + If you have an emergency, do not hesitate to contact us by phone: + </p> + <ul class="list-unstyled"> + <li><i class="fa fa-phone"></i> : <span t-field="res_company.phone"/></li> + <li><i class="fa fa-envelope"></i> : <span t-field="res_company.email"/></li> + </ul> + </div> + <div class="col-md-4"> + <t t-call="website.company_description"/> </div> - <p> - We will get back to you shortly. - </p><p class="mt64"> - If you have an emergency, do not hesitate to contact us by phone: - </p> - <ul class="list-unstyled"> - <li><i class="fa fa-phone"></i> : <span t-field="res_company.phone"/></li> - <li><i class="fa fa-envelope"></i> : <span t-field="res_company.email"/></li> - </ul> - </div> - <div class="col-md-4"> - <t t-call="website.company_description"/> </div> </div> - </div> - <div class="oe_structure"/> - </div> + <div class="oe_structure"/> + </div> + </t> </t> - </template> + </field> + </record> + <record id="contactus_thanks_page" model="website.page"> + <field name="name">Thanks (Contact us)</field> + <field name="url">/contactus-thank-you</field> + <field name="website_published">True</field> + <field name="ir_ui_view_id" ref="contactus_thanks" /> + </record> <template id="website_crm_tests" name="Website CRM Tests" inherit_id="web.assets_common"> <xpath expr="." position="inside"> |
