summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/flash.js
diff options
context:
space:
mode:
authorkushalpandya <kushal@gitlab.com>2017-05-31 12:46:50 +0530
committerJarka Kadlecova <jarka@gitlab.com>2017-06-01 07:47:16 +0200
commit00cc34cc73572c3b700976166e483d79a2ccdaed (patch)
tree24c924475d3984999fd9c5b8ed8e5ff670297892 /app/assets/javascripts/flash.js
parent84c68bb1402528944aa433b7a120d392fd93845b (diff)
downloadgitlab-ce-00cc34cc73572c3b700976166e483d79a2ccdaed.tar.gz
Add doc comment
Diffstat (limited to 'app/assets/javascripts/flash.js')
-rw-r--r--app/assets/javascripts/flash.js17
1 files changed, 15 insertions, 2 deletions
diff --git a/app/assets/javascripts/flash.js b/app/assets/javascripts/flash.js
index 4d00858f7e8..de909946271 100644
--- a/app/assets/javascripts/flash.js
+++ b/app/assets/javascripts/flash.js
@@ -7,6 +7,19 @@ window.Flash = (function() {
return $(this).fadeOut();
};
+ /**
+ * Flash banner supports different types of Flash configurations
+ * along with ability to provide actionConfig which can be used to show
+ * additional action or link on banner next to message
+ *
+ * @param {String} message Flash message
+ * @param {String} type Type of Flash, it can be `notice` or `alert` (default)
+ * @param {Object} parent Reference to Parent element under which Flash needs to appear
+ * @param {Object} actionConfig Map of config to show action on banner
+ * @param {String} href URL to which action link should point (default '#')
+ * @param {String} title Title of action
+ * @param {Function} clickHandler Method to call when action is clicked on
+ */
function Flash(message, type, parent, actionConfig) {
var flash, textDiv, actionLink;
if (type == null) {
@@ -33,8 +46,8 @@ window.Flash = (function() {
if (actionConfig) {
actionLink = $('<a/>', {
- "class": "flash-action",
- "href": "#",
+ class: 'flash-action',
+ href: actionConfig.href || '#',
text: actionConfig.title
});