diff options
| author | rde <rde@odoo.com> | 2017-10-09 17:13:39 +0200 |
|---|---|---|
| committer | Jeremy Kersten <jke@odoo.com> | 2017-10-12 16:20:42 +0200 |
| commit | a91a3a563338e746d6d23cd57551af30e322e367 (patch) | |
| tree | f99ded9d67805b67243b73a698370c6bf1579407 /addons/website/static/src/xml | |
| parent | a8fc544c5ce5a7c1da5c0c0a664a06b12fd0b247 (diff) | |
[IMP] website: warn user about key change when editing special file name
The idea is to warn user if he created a special file (website.page with
supported extension) and he wants to change the file's name, which will at the
end also change the key).
If this special file has been t-called elsewhere, they t-call wont work anymore
This is why warning user is needed.
Note that this is different than the already existing page_search_dependencies
that is just checking if the URL is present in menus, templates, blog or pages.
This is about checking if the key is present somewhere. (we assume that if the
key is present, it is surely about a t-call.
Technically, the flow is:
1. Get supported extension
2. Get key dependencies
3. Check if user modify name
4. If name changed and it is/was a supported extension (special file) and it
has dependencies (surely t-call) then warn user these call wont work anymore
--
search_page_dependencies is also improved by returning links to be clickable
(on delete dialog eg) and splitting template/page results.
it also refactor dependencies warning that was creating HTML in javascript into
using XML template
Diffstat (limited to 'addons/website/static/src/xml')
| -rw-r--r-- | addons/website/static/src/xml/website.pageProperties.xml | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/addons/website/static/src/xml/website.pageProperties.xml b/addons/website/static/src/xml/website.pageProperties.xml index b7b3b337d91..3746e294b0d 100644 --- a/addons/website/static/src/xml/website.pageProperties.xml +++ b/addons/website/static/src/xml/website.pageProperties.xml @@ -1,5 +1,39 @@ <?xml version="1.0" encoding="UTF-8"?> <templates id="template" xml:space="preserve"> + +<!-- Tooltip Dependencies --> + +<t t-name="website.get_tooltip_dependencies"> + <t t-foreach="dependencies" t-as="dep"> + <b><t t-esc="dep"/></b> + <ul class="popover_dep"> + <t t-foreach="dep_value" t-as="item"> + <li><a t-att-href="item_value['link']"><t t-esc="item_value['item']"/></a></li> + </t> + </ul> + </t> +</t> +<t t-name="website.show_page_key_dependencies"> + <div class="col-sm-9 col-sm-offset-3"> + <span class="text-muted" id="warn_about_call_message"> + <t t-set="depTooltip"> + <t t-call="website.get_tooltip_dependencies"/> + </t> + It looks like your file is being called by + <a href="#" data-toggle="popover" t-att-data-content="depTooltip" data-html="true" title="Dependencies"><t t-esc="dep_text" /></a>. + Changing its name will break these calls. + </span> + </div> +</t> +<t t-name="website.show_page_dependencies"> + <t t-set="depTooltip"> + <t t-call="website.get_tooltip_dependencies"/> + </t> + (could be used in <a href="#" data-toggle="popover" t-att-data-content="depTooltip" data-html="true" title="Dependencies"><t t-esc="dep_text" /></a>) +</t> + +<!-- Page Properties --> + <div t-name="website.pagesMenu.page_info" class="o_page_management_info"> <form class="form-horizontal"> <ul class="nav nav-tabs"> @@ -14,6 +48,7 @@ <input type="text" class="form-control input-sm" id="page_name" t-att-value="widget.page.name" /> </div> </div> + <div class="form-group warn_about_call"></div> <div class="form-group"> <label class="control-label col-sm-3" for="page_url">Page URL</label> <div class="col-sm-9"> @@ -24,7 +59,7 @@ </div> </div> <div class="form-group ask_for_redirect"> - <label class="control-label col-sm-3" for="is_homepage">Redirect Old URL</label> + <label class="control-label col-sm-3" for="create_redirect">Redirect Old URL</label> <div class="col-sm-2"> <a> <label class="o_switch" for="create_redirect" > |
