Author: |
Camptocamp,Odoo Community Association (OCA) |
License: |
LGPL-3 |
Branch: |
11.0 |
Repository: |
Change2improve/website-cms |
Dependencies: |
cms_status_message,
and
website |
Languages: |
JavaScript (60, 16.1%),
PO File (38, 10.2%),
Python (171, 46.0%),
XML (32, 8.6%),
and
reStructuredText (71, 19.1%) |
Other branches: |
10.0,
13.0,
and
9.0 |
Other repositories: |
BTETON/website-cms,
CompassionCH/website-cms,
ERPLibre/website-cms,
ForgeFlow/website-cms,
Gabinete-Digital/website-cms,
Guobower/website-cms,
Ingeos/website-cms,
JazziMc/website-cms,
MjAbuz/website-cms,
NL66278/website-cms,
NeatNerdPrime/website-cms,
Nooka10/website-cms,
OCA/website-cms,
PCatinean/website-cms,
SeuMarco/website-cms,
TDu/website-cms,
TelmoSenseFly/website-cms,
VisiionSolucionesTecnologicas/website-cms,
akretion/website-cms,
anhvu-sg/website-cms,
apetbiz/website-cms,
bishalgit/website-cms,
bvkl/website-cms,
caiuka/website-cms,
camptocamp/website-cms,
elvirekemajou/website-cms,
gfcapalbo/website-cms,
grindtildeath/website-cms,
haroldtamo/website-cms,
hbrunn/website-cms,
hinfo506/website-cms,
isoscl/website-cms,
josueBulle/website-cms,
kevin070982/website-cms,
leemannd/website-cms,
lideritjnma/website-cms,
lukehuang/website-cms,
one2pret/website-cms,
ossamagharib/website-cms,
pscloud/website-cms,
py-web/website-cms,
ravishekharco/website-cms,
redcor/website-cms,
rsullivan2704/website-cms,
sanube/website-cms,
simahawk/website-cms,
steingabelgaard/website-cms,
wahello/website-cms,
and
x0rzkov/odoo-website-cms |
<a class="reference external image-reference" href="http://www.gnu.org/licenses/LGPL-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-lgpl--3-blue.svg">
</a>
<a name="cms-delete-content"></a>
<h2>CMS delete content</h2>
<p>Basic features for deleting content via frontend.</p>
<a name="features"></a>
<h3>Features</h3>
<ul class="simple">
<li>register your own custom delete confirmation view per-model</li>
<li>use <code>cms_status_message</code> to show confirmation message for deletion</li>
<li>generic template for asking delete confirmation</li>
<li>new fields and parameters on <code>website.published.mixin</code> to handle
delete links and redirects</li>
</ul>
<a name="usage"></a>
<h3 class="with-subtitle">Usage</h3>
<h3 class="section-subtitle" id="delete-button-and-behavior"><span class="section-subtitle">Delete button and behavior</span></h3>
<p>To add a delete button:</p>
<pre>
<code lang="html"><a class="btn btn-danger cms_delete_confirm" t-att-href="object.cms_delete_confirm_url">Delete</a></code>
</pre>
<p>When you click on a confirmation dialog pops up.</p>
<p>If you hit <code>cancel</code> the popup is closed. If you hit submit the item is
deleted and you get redirected to your model's <code>cms_after_delete_url</code>.
By default is <code>/</code>.</p>
<a name="customization"></a>
<h3>Customization</h3>
<a name="custom-per-model-delete-messge"></a>
<h4>Custom per-model delete messge</h4>
<pre>
<code lang="python">class MyModel(models.Model):
_inherit = "my.model"
@api.multi
def msg_content_delete_confirm(self):
self.ensure_one()
return _('Are you sure you want to delete "%s"?.') % self.name</code>
</pre>
<a name="custom-after-delete-url"></a>
<h4>Custom "after delete URL"</h4>
<p>When you are viewing a content and you delete it you want to be
redirected to some other place.</p>
<p>By default you get redirected to the root of the website.</p>
<p>To change this behavior just override the attribute in your model
declaration:</p>
<pre>
<code lang="python">class MyModel(models.Model):
_inherit = "my.model"
cms_after_delete_url = '/foo'</code>
</pre>
<p>Note: if you want to customize it on demand for particular pages, or you
are deleting an item from another page (like a management page) you can
pass <code>?redirect=</code> in the url, like:</p>
<pre>
<code lang="html"><a class="btn btn-danger cms_delete_confirm" t-attf-href="#{object.cms_delete_confirm_url}?redirect=">Delete</a></code>
</pre>
<a name="custom-global-delete-confirm-message-appeareance"></a>
<h4>Custom global delete confirm message appeareance</h4>
<pre>
<code lang="xml"><template id="delete_confirm" inherit_id="cms_delete_content.delete_confirm">
<xpath expr="//h4[@id='delete_confirm']" position="replace">
<h1 t-esc="main_object.msg_content_delete_confirm()">I want it bigger!</h1>
</xpath>
</template></code>
</pre>
<a name="bug-tracker"></a>
<h5>Bug Tracker</h5>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/website-cms/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smash it
by providing detailed and welcomed feedback.</p>
<a name="credits"></a>
<h5>Credits</h5>
<a name="contributors"></a>
<h3>Contributors</h3>
<ul class="simple">
<li>Simone Orsi <a class="reference external" href="mailto:simone.orsi@camptocamp.com">simone.orsi@camptocamp.com</a></li>
</ul>
<a name="maintainer"></a>
<h3>Maintainer</h3>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<p>This module is maintained by the OCA.</p>
<p>OCA, or the Odoo Community Association, is a nonprofit organization
whose mission is to support the collaborative development of Odoo
features and promote its widespread use.</p>
<p>To contribute to this module, please visit <a class="reference external" href="https://odoo-community.org">https://odoo-community.org</a>.</p>