diff options
| author | Xavier Morel <xmo@openerp.com> | 2014-03-04 12:07:16 +0100 |
|---|---|---|
| committer | Xavier Morel <xmo@openerp.com> | 2014-03-04 12:07:16 +0100 |
| commit | e78a3b18cc6c049a712d594ab70287c486447f0a (patch) | |
| tree | f7bc1bd00c6c1407497eaf0c66de58eb105a3b17 /addons/website/static/src/xml | |
| parent | f3638567738cdc242fa43dc0a1770ea7bd4b4b6e (diff) | |
[ADD] tentative removal of attachments
Attachments ought be removed only if they are not used in an existing page/web
view.
Theoretically this could be set directly in unlink(), but:
* that would make a nice error message significantly harder
* the expenses of performing a text search in all view archs would be a bit expensive
Notes:
* the views set could be reduced to only "web" views
* the search is likely sensible to false negatives e.g. different order of
query parameters. It *will* remove images still being used.
bzr revid: xmo@openerp.com-20140304110716-u14w6uo8fbkfa42i
Diffstat (limited to 'addons/website/static/src/xml')
| -rw-r--r-- | addons/website/static/src/xml/website.editor.xml | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/addons/website/static/src/xml/website.editor.xml b/addons/website/static/src/xml/website.editor.xml index 6c1e387c958..1010ec05127 100644 --- a/addons/website/static/src/xml/website.editor.xml +++ b/addons/website/static/src/xml/website.editor.xml @@ -140,8 +140,9 @@ <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h3 class="modal-title">Select a Picture</h3> </div> - <div class="modal-body"> + <div class="modal-body has-error"> <div class="existing-attachments"/> + <div class="help-block"/> </div> <div class="modal-footer"> <a href="#" data-dismiss="modal" aria-hidden="true">Discard</a> @@ -157,12 +158,27 @@ <li class="next disabled"><a href="#">Next →</a></li> </ul> <div class="row mt16" t-foreach="rows" t-as="row"> - <div class="col-sm-2" t-foreach="row" t-as="attachment"> + <div class="col-sm-2 existing-attachment-cell" + t-foreach="row" t-as="attachment"> + <i class="fa fa-times existing-attachment-remove" t-att-data-id="attachment.id"/> <img t-att-src="attachment.website_url" t-att-alt="attachment.name" class="img img-responsive"/> </div> </div> </div> </t> + <t t-name="website.editor.dialog.image.existing.error"> + <div class="help-block"> + <p>The image could not be deleted because it is used in the + following pages or views:</p> + <ul t-foreach="views" t-as="view"> + <li> + <a t-attf-href="/web#model=ir.ui.view&id=#{view.id}"> + <t t-esc="view.name"/> + </a> (id <t t-esc="view.id"/>) + </li> + </ul> + </div> + </t> <t t-name="website.editor.table.panel"> <table class="editorbar-panel"> <tr t-foreach="rows"><td t-foreach="cols">​</td></tr> |
