From 74aabb9c601ba54a61e741bde00200eeaeadfba1 Mon Sep 17 00:00:00 2001 From: psychobunny Date: Sat, 10 May 2014 16:16:35 -0400 Subject: [PATCH] modules documentation - alerts --- docs/index.rst | 1 + docs/modules/index.rst | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 docs/modules/index.rst diff --git a/docs/index.rst b/docs/index.rst index c48eb05adc..c086e5b737 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -64,6 +64,7 @@ Contributing to NodeBB :maxdepth: 2 contributing/style-guide + modules/index Plugin System ------------- diff --git a/docs/modules/index.rst b/docs/modules/index.rst new file mode 100644 index 0000000000..843548ee00 --- /dev/null +++ b/docs/modules/index.rst @@ -0,0 +1,42 @@ +Core Modules +================ + +.. note:: + + This section is under construction. Have a look at the modules folder for more information, located at: + + .. code:: bash + + public/src/modules + +Alerts +------- + +The alert module is a toaster notification that can be called via the following syntax: + +.. code:: javascript + + app.alert({ + title: 'Success!', + message: 'Here\'s an example of an alert!', + location: 'left-bottom', + timeout: 2500, + type: 'success', + image: 'https://i.imgur.com/dJBzcGT.jpg' + }); + +The above code will result in this notification (default styling): + +.. image:: http://i.imgur.com/jRD5GAI.png + +To style this, have a look at the vanilla theme's ``modules/alert.less`` and ``templates/alert.tpl``. + +**Parameters**: + +1. ``title`` - string, which can be a language string as well. Some core language strings that you can use here include: ``[[global:alert.success]]`` and ``[[global:alert.error]]`` +2. ``message`` - string, which can be a language string as well. +3. ``location`` (optional) - ``right-top`` (default), ``left-top``, ``right-bottom``, ``left-bottom`` +4. ``timeout`` (optional) - integer in milliseconds, default is permanent until closed. +5. ``type`` - error, success, info, warning/notify +6. ``image`` (optional) - string, URL to image. +