Search 1.9 billion lines of Odoo code on GitHub

cms_status_message

Author: Camptocamp SA,Odoo Community Association (OCA)
License: AGPL-3
Branch: add-cms_form_10
Repository: leemannd/website-cms
Dependencies: website
Languages: JavaScript (49, 12.2%), PO File (24, 6.0%), Python (160, 40.0%), XML (79, 19.8%), and reStructuredText (88, 22.0%)
Other repositories: BTETON/website-cms, Change2improve/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, aryajimbaran/website-cms, bishalgit/website-cms, bvkl/website-cms, caiuka/website-cms, camptocamp/website-cms, coobyHQ/odoo-saas-tools, don-systems/website-cms, elvirekemajou/website-cms, frankchongli/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, lideritjnma/website-cms, lukehuang/website-cms, one2pret/website-cms, osfp-Pakistan/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/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.svg"> </a> <a name="cms-status-message"></a> <h2>CMS status message</h2> <p>A &quot;status message&quot; is an important message that you want to show to users.</p> <p>For instance: a user submit a form or does a specific action and you want to report the status of this action like &quot;your profile has been updated&quot; or &quot;Your upgrade has been successful.&quot;.</p> <p>This module allows to easily display this kind of messages to your users.</p> <p>Messages are displayed using Twitter bootstrap alerts.</p> <p>You can add several messages: they will be displayed one after another.</p> <a name="usage"></a> <h3>Usage</h3> <a name="python-code"></a> <h4>Python code</h4> <p>Set a message:</p> <p><a href="#id1"><span class="problematic" id="id2">``</span></a><a href="#id3"><span class="problematic" id="id4">`</span></a>python msg = _('My important message.') if request.website:</p> <blockquote> request.website.add_status_message(msg)</blockquote> <p><a href="#id5"><span class="problematic" id="id6">``</span></a><a href="#id7"><span class="problematic" id="id8">`</span></a></p> <p>By default the message type is <cite>info</cite>. The title (the label at the beginning of the message) matches the message type:</p> <ul class="simple"> <li>'info': 'Info'</li> <li>'success': 'Success'</li> <li>'danger': 'Error'</li> <li>'warning': 'Warning'</li> </ul> <p>You can change message parameters:</p> <p><a href="#id9"><span class="problematic" id="id10">``</span></a><a href="#id11"><span class="problematic" id="id12">`</span></a>python msg = _('Watch out!') if request.website:</p> <blockquote> request.website.add_status_message(msg, mtype='warning', mtitle='Oh no')</blockquote> <p><a href="#id13"><span class="problematic" id="id14">``</span></a><a href="#id15"><span class="problematic" id="id16">`</span></a></p> <p>Messages will be displayed like this:</p> <p><img alt="preview" src="./images/preview.png" /></p> <a name="javascript-code"></a> <h4>Javascript code</h4> <p>Dependencies:</p> <p><a href="#id17"><span class="problematic" id="id18">``</span></a><a href="#id19"><span class="problematic" id="id20">`</span></a>javascript</p> <p>var msg_tool = require('cms_status_message.tool'); var core = require('web.core'); var _t = core._t; <a href="#id21"><span class="problematic" id="id22">``</span></a><a href="#id23"><span class="problematic" id="id24">`</span></a></p> <p>Inject a custom message on the fly:</p> <p><a href="#id25"><span class="problematic" id="id26">``</span></a><a href="#id27"><span class="problematic" id="id28">`</span></a>javascript msg = {</p> <blockquote> 'msg': _t('Item unpublished.'), 'title': _t('Warning'), 'type': 'warning'</blockquote> <p>} // wipe existing $('.status_message').remove();</p> <p>// inject new $(msg_tool.render_messages(msg))</p> <blockquote> .hide() .prependTo('main') .fadeIn('slow');</blockquote> <p><a href="#id29"><span class="problematic" id="id30">``</span></a><a href="#id31"><span class="problematic" id="id32">`</span></a></p> <p>Add a status message to the session, useful if you want to show the message only after a redirect:</p> <p><code>`javascript var msg = _t('Contratulations! You made it!.'); var options = {'title': _('My title'), 'dismissible': false}; msg_tool.add_message(msg, options); `</code></p> <a name="customize-appereance"></a> <h4>Customize appereance</h4> <p>By default the alert box is added on top of <cite>&lt;main /&gt;</cite> content. If you want to customize this behavior just override or disable <cite>cms_status_message.add_status_message</cite> template.</p> <a name="bug-tracker"></a> <h3>Bug Tracker</h3> <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 smashing it by providing a detailed and welcomed feedback.</p> <a name="credits"></a> <h3>Credits</h3> <a name="images"></a> <h4>Images</h4> <ul class="simple"> <li>Odoo Community Association: <a class="reference external" href="https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg">Icon</a>.</li> </ul> <a name="contributors"></a> <h4>Contributors</h4> <ul class="simple"> <li>Simone Orsi &lt;<a class="reference external" href="mailto:simone.orsi&#64;camptocamp.com">simone.orsi&#64;camptocamp.com</a>&gt;</li> </ul> <a name="maintainer"></a> <h4>Maintainer</h4> <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>