diff --git a/src/Foundation.hs b/src/Foundation.hs index 1e9d7451f..b834b1dab 100644 --- a/src/Foundation.hs +++ b/src/Foundation.hs @@ -1068,8 +1068,8 @@ siteLayout' headingOverride widget = do addScript $ StaticR js_services_utilRegistry_js addScript $ StaticR js_services_httpClient_js addScript $ StaticR js_services_i18n_js - -- addScript $ StaticR js_utils_alerts_js -- JavaScript utils + addScript $ StaticR js_utils_alerts_js addScript $ StaticR js_utils_asidenav_js addScript $ StaticR js_utils_asyncForm_js addScript $ StaticR js_utils_asyncTable_js diff --git a/static/css/utils/alerts.scss b/static/css/utils/alerts.scss index 3256eef96..bd6b55bfd 100644 --- a/static/css/utils/alerts.scss +++ b/static/css/utils/alerts.scss @@ -1,23 +1,3 @@ -/* ALERTS */ -/** - .alert - Regular Info Alert - Disappears automatically after 30 seconds - Disappears after x seconds if explicitly specified via data-decay='x' - Can be told not to disappear with data-decay='0' - - .alert-success - Disappears automatically after 30 seconds - - .alert-warning - Does not disappear - Orange regardless of user's selected theme - - .alert-error - Does not disappear - Red regardless of user's selected theme - - */ .alerts { position: fixed; bottom: 0; diff --git a/static/js/utils/alerts.js b/static/js/utils/alerts.js index b854495a0..8b2ba92fb 100644 --- a/static/js/utils/alerts.js +++ b/static/js/utils/alerts.js @@ -1,68 +1,126 @@ (function() { 'use strict'; - window.utils = window.utils || {}; + /** + * + * Alerts Utility + * makes alerts interactive + * + * Attribute: uw-alerts + * + * Types of alerts: + * [default] + * Regular Info Alert + * Disappears automatically after 30 seconds + * Disappears after x seconds if explicitly specified via data-decay='x' + * Can be told not to disappear with data-decay='0' + * + * [success] + * Currently no special visual appearance + * Disappears automatically after 30 seconds + * + * [warning] + * Will be coloured warning-orange regardless of user's selected theme + * Does not disappear + * + * [error] + * Will be coloured error-red regardless of user's selected theme + * Does not disappear + * + * Example usage: + *