Skip to content

Commit 5c31b19

Browse files
committed
cms_delete_content: readme fragment + towncrier changelog
1 parent 52ba398 commit 5c31b19

File tree

6 files changed

+127
-7
lines changed

6 files changed

+127
-7
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* Simone Orsi <simone.orsi@camptocamp.com>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
A "status message" is an important message that you want to show to
2+
users.
3+
4+
For instance: a user submit a form or does a specific action and you
5+
want to report the status of this action like "your profile has been
6+
updated" or "Your upgrade has been successful.".
7+
8+
This module allows to easily display this kind of messages to your
9+
users.
10+
11+
Messages are displayed using Twitter bootstrap alerts.
12+
13+
You can add several messages: they will be displayed one after another.
Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
=========
2-
CHANGELOG
3-
=========
4-
51
11.0.1.0.2 (2018-04-27)
6-
=======================
2+
~~~~~~~~~~~~~~~~~~~~~~~
73

84
**Fixes**
95

@@ -16,14 +12,14 @@ CHANGELOG
1612

1713

1814
11.0.1.0.1 (2018-04-24)
19-
=======================
15+
~~~~~~~~~~~~~~~~~~~~~~~
2016

2117
**Fixes**
2218

2319
* Update JS according to `cms_status_message` updates
2420

2521

2622
11.0.1.0.0 (2018-01-18)
27-
=======================
23+
~~~~~~~~~~~~~~~~~~~~~~~
2824

2925
* Initial release
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
Get rid of `website` dependency and move `website.published.mixin` integration
3+
to a glue module.
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
Python code
2+
-----------
3+
4+
Set a message:
5+
6+
.. code:: python
7+
8+
msg = _('My important message.')
9+
if request.website:
10+
request.website.add_status_message(msg)
11+
12+
By default the message type is ``info``. The title (the label at the
13+
beginning of the message) matches the message type:
14+
15+
- 'info': 'Info'
16+
- 'success': 'Success'
17+
- 'danger': 'Error'
18+
- 'warning': 'Warning'
19+
20+
You can change message parameters:
21+
22+
.. code:: python
23+
24+
msg = _('Watch out!')
25+
if request.website:
26+
request.website.add_status_message(msg, type_='warning', title='Oh no')
27+
28+
Messages will be displayed like this:
29+
30+
.. image:: ./images/preview.png
31+
32+
Autodismiss
33+
-----------
34+
35+
By default messages will be auto-dismissed after 8 seconds.
36+
You can turn this off by setting an ir.config_param like::
37+
38+
cms_status_message.autodismiss = 0
39+
40+
You can customize the timeout by setting the key::
41+
42+
cms_status_message.autodismiss_timeout = 3000 # milliseconds
43+
44+
45+
You can also customize this on demand when you create the message:
46+
47+
48+
.. code:: python
49+
50+
msg = _('I will disappear more slowly')
51+
options = {'autodismissTimeout': 10000}
52+
if request.website:
53+
request.website.add_status_message(msg, dismiss_options=options)
54+
55+
56+
Javascript code
57+
---------------
58+
59+
Dependencies:
60+
61+
.. code:: javascript
62+
63+
64+
var msg_tool = require('cms_status_message.tool');
65+
var core = require('web.core');
66+
var _t = core._t;
67+
68+
Inject a custom message on the fly:
69+
70+
.. code:: javascript
71+
72+
msg = {
73+
'msg': _t('Item unpublished.'),
74+
'title': _t('Warning'),
75+
'type': 'warning'
76+
}
77+
msg_tool.render_messages(msg).then(function(html) {
78+
// wipe existing
79+
$('.status_message').remove();
80+
// inject new
81+
$(html).hide().prependTo('#wrap').fadeIn('slow');
82+
});
83+
84+
85+
Add a status message to the session, useful if you want to show the
86+
message only after a redirect:
87+
88+
.. code:: javascript
89+
90+
var msg = _t('Contratulations! You made it!.');
91+
var options = {'title': _('My title'), 'dismissible': false};
92+
msg_tool.add_message(msg, options);
93+
94+
Customize appereance
95+
--------------------
96+
97+
By default the alert box is added on top of ``<main />`` content. If you
98+
want to customize this behavior just override or disable
99+
``cms_status_message.add_status_message`` template.
100+
101+
102+
Test your theme look and feel
103+
-----------------------------
104+
105+
Go to `/cms/status-message/display-test` to see how messages will look like
106+
when your theme is applied.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Migration to v13

0 commit comments

Comments
 (0)