Browse Source

[UPD] README.rst

pull/1198/head
OCA-git-bot 6 years ago
parent
commit
410b643de5
  1. 28
      web_notify/README.rst
  2. 22
      web_notify/static/description/index.html

28
web_notify/README.rst

@ -30,8 +30,11 @@ Send instant notification messages to the user in live.
This technical module allows you to send instant notification messages from the server to the user in live. This technical module allows you to send instant notification messages from the server to the user in live.
Two kinds of notification are supported. Two kinds of notification are supported.
* Warning: Displayed in a red flying popup div
* Information: Displayed in a light yellow flying popup div
* Success: Displayed in a `success` theme color flying popup div
* Danger: Displayed in a `danger` theme color flying popup div
* Warning: Displayed in a `warning` theme color flying popup div
* Information: Displayed in a `info` theme color flying popup div
* Default: Displayed in a `default` theme color flying popup div
**Table of contents** **Table of contents**
@ -49,6 +52,24 @@ Usage
To send a notification to the user you just need to call one of the new methods defined on res.users: To send a notification to the user you just need to call one of the new methods defined on res.users:
.. code-block:: python
self.env.user.notify_success(message='My success message')
or
.. code-block:: python
self.env.user.notify_danger(message='My danger message')
or
.. code-block:: python
self.env.user.notify_warning(message='My warning message')
or
.. code-block:: python .. code-block:: python
self.env.user.notify_info(message='My information message') self.env.user.notify_info(message='My information message')
@ -57,7 +78,7 @@ or
.. code-block:: python .. code-block:: python
self.env.user.notify_warning(message='My marning message')
self.env.user.notify_default(message='My default message')
.. figure:: https://raw.githubusercontent.com/OCA/web/12.0/web_notify/static/description/notifications_screenshot.png .. figure:: https://raw.githubusercontent.com/OCA/web/12.0/web_notify/static/description/notifications_screenshot.png
:scale: 80 % :scale: 80 %
@ -95,6 +116,7 @@ Contributors
* Laurent Mignon <laurent.mignon@acsone.eu> * Laurent Mignon <laurent.mignon@acsone.eu>
* Serpent Consulting Services Pvt. Ltd.<jay.vora@serpentcs.com> * Serpent Consulting Services Pvt. Ltd.<jay.vora@serpentcs.com>
* Aitor Bouzas <aitor.bouzas@adaptivecity.com> * Aitor Bouzas <aitor.bouzas@adaptivecity.com>
* Shepilov Vladislav <shepilov.v@protonmail.com>
Maintainers Maintainers
~~~~~~~~~~~ ~~~~~~~~~~~

22
web_notify/static/description/index.html

@ -372,8 +372,11 @@ ul.auto-toc {
<p>This technical module allows you to send instant notification messages from the server to the user in live. <p>This technical module allows you to send instant notification messages from the server to the user in live.
Two kinds of notification are supported.</p> Two kinds of notification are supported.</p>
<ul class="simple"> <ul class="simple">
<li>Warning: Displayed in a red flying popup div</li>
<li>Information: Displayed in a light yellow flying popup div</li>
<li>Success: Displayed in a <cite>success</cite> theme color flying popup div</li>
<li>Danger: Displayed in a <cite>danger</cite> theme color flying popup div</li>
<li>Warning: Displayed in a <cite>warning</cite> theme color flying popup div</li>
<li>Information: Displayed in a <cite>info</cite> theme color flying popup div</li>
<li>Default: Displayed in a <cite>default</cite> theme color flying popup div</li>
</ul> </ul>
<p><strong>Table of contents</strong></p> <p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents"> <div class="contents local topic" id="contents">
@ -397,11 +400,23 @@ Two kinds of notification are supported.</p>
<h1><a class="toc-backref" href="#id2">Usage</a></h1> <h1><a class="toc-backref" href="#id2">Usage</a></h1>
<p>To send a notification to the user you just need to call one of the new methods defined on res.users:</p> <p>To send a notification to the user you just need to call one of the new methods defined on res.users:</p>
<pre class="code python literal-block"> <pre class="code python literal-block">
<span class="bp">self</span><span class="o">.</span><span class="n">env</span><span class="o">.</span><span class="n">user</span><span class="o">.</span><span class="n">notify_success</span><span class="p">(</span><span class="n">message</span><span class="o">=</span><span class="s1">'My success message'</span><span class="p">)</span>
</pre>
<p>or</p>
<pre class="code python literal-block">
<span class="bp">self</span><span class="o">.</span><span class="n">env</span><span class="o">.</span><span class="n">user</span><span class="o">.</span><span class="n">notify_danger</span><span class="p">(</span><span class="n">message</span><span class="o">=</span><span class="s1">'My danger message'</span><span class="p">)</span>
</pre>
<p>or</p>
<pre class="code python literal-block">
<span class="bp">self</span><span class="o">.</span><span class="n">env</span><span class="o">.</span><span class="n">user</span><span class="o">.</span><span class="n">notify_warning</span><span class="p">(</span><span class="n">message</span><span class="o">=</span><span class="s1">'My warning message'</span><span class="p">)</span>
</pre>
<p>or</p>
<pre class="code python literal-block">
<span class="bp">self</span><span class="o">.</span><span class="n">env</span><span class="o">.</span><span class="n">user</span><span class="o">.</span><span class="n">notify_info</span><span class="p">(</span><span class="n">message</span><span class="o">=</span><span class="s1">'My information message'</span><span class="p">)</span> <span class="bp">self</span><span class="o">.</span><span class="n">env</span><span class="o">.</span><span class="n">user</span><span class="o">.</span><span class="n">notify_info</span><span class="p">(</span><span class="n">message</span><span class="o">=</span><span class="s1">'My information message'</span><span class="p">)</span>
</pre> </pre>
<p>or</p> <p>or</p>
<pre class="code python literal-block"> <pre class="code python literal-block">
<span class="bp">self</span><span class="o">.</span><span class="n">env</span><span class="o">.</span><span class="n">user</span><span class="o">.</span><span class="n">notify_warning</span><span class="p">(</span><span class="n">message</span><span class="o">=</span><span class="s1">'My marning message'</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">env</span><span class="o">.</span><span class="n">user</span><span class="o">.</span><span class="n">notify_default</span><span class="p">(</span><span class="n">message</span><span class="o">=</span><span class="s1">'My default message'</span><span class="p">)</span>
</pre> </pre>
<div class="figure"> <div class="figure">
<img alt="Sample notifications" src="https://raw.githubusercontent.com/OCA/web/12.0/web_notify/static/description/notifications_screenshot.png" /> <img alt="Sample notifications" src="https://raw.githubusercontent.com/OCA/web/12.0/web_notify/static/description/notifications_screenshot.png" />
@ -435,6 +450,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<li>Laurent Mignon &lt;<a class="reference external" href="mailto:laurent.mignon&#64;acsone.eu">laurent.mignon&#64;acsone.eu</a>&gt;</li> <li>Laurent Mignon &lt;<a class="reference external" href="mailto:laurent.mignon&#64;acsone.eu">laurent.mignon&#64;acsone.eu</a>&gt;</li>
<li>Serpent Consulting Services Pvt. Ltd.&lt;<a class="reference external" href="mailto:jay.vora&#64;serpentcs.com">jay.vora&#64;serpentcs.com</a>&gt;</li> <li>Serpent Consulting Services Pvt. Ltd.&lt;<a class="reference external" href="mailto:jay.vora&#64;serpentcs.com">jay.vora&#64;serpentcs.com</a>&gt;</li>
<li>Aitor Bouzas &lt;<a class="reference external" href="mailto:aitor.bouzas&#64;adaptivecity.com">aitor.bouzas&#64;adaptivecity.com</a>&gt;</li> <li>Aitor Bouzas &lt;<a class="reference external" href="mailto:aitor.bouzas&#64;adaptivecity.com">aitor.bouzas&#64;adaptivecity.com</a>&gt;</li>
<li>Shepilov Vladislav &lt;<a class="reference external" href="mailto:shepilov.v&#64;protonmail.com">shepilov.v&#64;protonmail.com</a>&gt;</li>
</ul> </ul>
</div> </div>
<div class="section" id="maintainers"> <div class="section" id="maintainers">

Loading…
Cancel
Save