[TASK] Change flashmessages.js for new FlashMessage styling 23/34023/4
authorKai Vogel <kai.vogel@speedprogs.de>
Wed, 12 Nov 2014 17:14:49 +0000 (18:14 +0100)
committerFrank Nägler <typo3@naegler.net>
Wed, 12 Nov 2014 19:21:46 +0000 (20:21 +0100)
Extended previous patch to use correct class names for the message
containers.

Resolves: #62605
Releases: master
Change-Id: I4f99cd9f43dca26439f72553603f14ca190ccf05
Reviewed-on: http://review.typo3.org/34023
Reviewed-by: Frank Nägler <typo3@naegler.net>
Tested-by: Frank Nägler <typo3@naegler.net>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Stefan Froemken <froemken@gmail.com>
Tested-by: Stefan Froemken <froemken@gmail.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/backend/Resources/Public/JavaScript/flashmessages.js

index 790f1f6..7caf3f6 100644 (file)
@@ -39,10 +39,18 @@ TYPO3.Severity = {
  */
 TYPO3.Flashmessage = function() {
        var messageContainer;
-       var severities = ['notice', 'info', 'ok', 'warning', 'danger'];
+       var severities = ['notice', 'information', 'ok', 'warning', 'error'];
+       var classMap = {
+               'notice': 'notice',
+               'information': 'info',
+               'ok': 'success',
+               'warning': 'warning',
+               'error': 'danger'
+       }
 
        function createBox(severity, title, message) {
-               return ['<div class="typo3-messages"><div class="alert alert-', severity, '" style="width: 400px">',
+               var className = (severity !== undefined && severities[severity] ? classMap[severities[severity]] : classMap['information']);
+               return ['<div class="typo3-messages"><div class="alert alert-', className, '" style="width: 400px">',
                                '<div class="pull-right t3-icon fa fa-close t3js-icon-actions-message-close" style="cursor: pointer;"></div>',
                                '<h4>', title, '</h4>',
                                '<div class="alert-body">', message, '</div>',
@@ -68,7 +76,7 @@ TYPO3.Flashmessage = function() {
                        }
 
                        var box = Ext.DomHelper.append(messageContainer, {
-                               html: createBox(severities[severity], title, message)
+                               html: createBox(severity, title, message)
                        }, true);
                        messageContainer.alignTo(document, 't-t');
                        box.child('.t3js-icon-actions-message-close').on('click', function (e, t, o) {