Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
integration
prechecker
Commits
368832d5
Commit
368832d5
authored
Oct 24, 2017
by
Ryan Wyllie
Committed by
Andrew Nicols
Oct 30, 2017
Browse files
MDL-59936 javascript: hide modal footer without content
parent
40f1801c
Changes
2
Hide whitespace changes
Inline
Side-by-side
lib/amd/build/modal.min.js
View file @
368832d5
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
lib/amd/src/modal.js
View file @
368832d5
...
...
@@ -358,7 +358,8 @@ define(['jquery', 'core/templates', 'core/notification', 'core/key_codes',
};
/**
* Set the modal footer element.
* Set the modal footer element. The footer element is made visible, if it
* isn't already.
*
* This method is overloaded to take either a string
* value for the body or a jQuery promise that is resolved with HTML and Javascript
...
...
@@ -368,6 +369,9 @@ define(['jquery', 'core/templates', 'core/notification', 'core/key_codes',
* @param {(string|object)} value The footer string or jQuery promise
*/
Modal
.
prototype
.
setFooter
=
function
(
value
)
{
// Make sure the footer is visible.
this
.
showFooter
();
var
footer
=
this
.
getFooter
();
if
(
typeof
value
===
'
string
'
)
{
...
...
@@ -396,6 +400,34 @@ define(['jquery', 'core/templates', 'core/notification', 'core/key_codes',
}
};
/**
* Check if the footer has any content in it.
*
* @method hasFooterContent
* @return {bool}
*/
Modal
.
prototype
.
hasFooterContent
=
function
()
{
return
this
.
getFooter
().
children
().
length
?
true
:
false
;
};
/**
* Hide the footer element.
*
* @method hideFooter
*/
Modal
.
prototype
.
hideFooter
=
function
()
{
this
.
getFooter
().
addClass
(
'
hidden
'
);
};
/**
* Show the footer element.
*
* @method showFooter
*/
Modal
.
prototype
.
showFooter
=
function
()
{
this
.
getFooter
().
removeClass
(
'
hidden
'
);
};
/**
* Mark the modal as a large modal.
*
...
...
@@ -508,6 +540,12 @@ define(['jquery', 'core/templates', 'core/notification', 'core/key_codes',
return
;
}
if
(
this
.
hasFooterContent
())
{
this
.
showFooter
();
}
else
{
this
.
hideFooter
();
}
if
(
!
this
.
isAttached
)
{
this
.
attachToDOM
();
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment