Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
qfq
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
typo3
qfq
Commits
5e30cd89
Commit
5e30cd89
authored
7 years ago
by
bbaer
Browse files
Options
Downloads
Patches
Plain Diff
reworked alerts
parent
84fd1a0c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
javascript/src/Alert.js
+44
-30
44 additions, 30 deletions
javascript/src/Alert.js
with
44 additions
and
30 deletions
javascript/src/Alert.js
+
44
−
30
View file @
5e30cd89
...
...
@@ -115,7 +115,7 @@ var QfqNS = QfqNS || {};
n
.
Alert
.
prototype
.
on
=
n
.
EventEmitter
.
onMixin
;
n
.
Alert
.
constants
=
{
alertContainerId
:
"
qfqAlertContainer
"
,
alertContainerId
:
"
alert-interactive
"
,
alertContainerSelector
:
"
#qfqAlertContainer
"
,
jQueryAlertRemoveEventName
:
"
qfqalert.remove:
"
,
NO_TIMEOUT
:
0
...
...
@@ -159,14 +159,14 @@ var QfqNS = QfqNS || {};
n
.
Alert
.
prototype
.
getAlertClassBasedOnMessageType
=
function
()
{
switch
(
this
.
messageType
)
{
case
"
warning
"
:
return
"
al
er
t
-warning
"
;
return
"
bord
er-warning
"
;
case
"
danger
"
:
case
"
error
"
:
return
"
alert-dange
r
"
;
return
"
border-erro
r
"
;
case
"
info
"
:
return
"
al
er
t
-info
"
;
return
"
bord
er-info
"
;
case
"
success
"
:
return
"
al
er
t
-success
"
;
return
"
bord
er-success
"
;
/* jshint -W086 */
default
:
n
.
Log
.
warning
(
"
Message type '
"
+
this
.
messageType
+
"
' unknown. Use default type.
"
);
...
...
@@ -179,7 +179,7 @@ var QfqNS = QfqNS || {};
*/
n
.
Alert
.
prototype
.
getButtons
=
function
()
{
var
$buttons
=
null
;
var
$container
=
$
(
"
<
div
>
"
).
addClass
(
"
alert-
buttons
"
);
var
$container
=
$
(
"
<
p
>
"
).
addClass
(
"
buttons
"
);
var
numberOfButtons
=
this
.
buttons
.
length
;
var
index
;
var
buttonConfiguration
;
...
...
@@ -226,17 +226,25 @@ var QfqNS = QfqNS || {};
$alertContainer
=
this
.
makeAlertContainerSingleton
();
if
(
this
.
modal
)
{
this
.
$modalDiv
=
$
(
"
<div>
"
);
this
.
$modalDiv
.
css
(
'
width
'
,
"
100%
"
);
this
.
$modalDiv
.
css
(
'
height
'
,
Math
.
max
(
document
.
documentElement
.
clientHeight
,
window
.
innerHeight
||
0
));
//
this.$modalDiv.css('width', "100%");
//
this.$modalDiv.css('height', Math.max(document.documentElement.clientHeight, window.innerHeight || 0));
}
this
.
$messageWrap
=
$
(
"
<p>
"
)
.
addClass
(
"
body
"
)
.
append
(
this
.
message
);
this
.
$alertDiv
=
$
(
"
<div>
"
)
.
hide
()
.
addClass
(
"
alert
"
)
.
addClass
(
this
.
getAlertClassBasedOnMessageType
())
.
attr
(
"
role
"
,
"
alert
"
)
.
append
(
this
.
message
);
.
append
(
this
.
$
message
Wrap
);
if
(
this
.
modal
)
{
this
.
$alertDiv
.
addClass
(
"
alert-interactive
"
);
}
else
{
this
.
$alertDiv
.
addClass
(
"
alert-side
"
);
}
var
buttons
=
this
.
getButtons
();
if
(
buttons
)
{
...
...
@@ -250,18 +258,18 @@ var QfqNS = QfqNS || {};
this
.
$alertDiv
.
on
(
n
.
Alert
.
constants
.
jQueryAlertRemoveEventName
,
this
.
removeAlert
.
bind
(
this
));
}
if
(
this
.
modal
)
{
this
.
$modalDiv
.
append
(
this
.
$alertDiv
);
$alertContainer
.
append
(
this
.
$modalDiv
);
$alertContainer
.
append
(
this
.
$alertDiv
);
//this.$alertDiv.slideDown(this.fadeInDuration, this.afterFadeIn.bind(this));
if
(
!
this
.
modal
)
{
this
.
$alertDiv
.
animate
({
width
:
'
show
'
},
this
.
fadeInDuration
,
this
.
afterFadeIn
.
bind
(
this
));
}
else
{
$alert
Container
.
append
(
this
.
$alertDiv
);
this
.
$alert
Div
.
fadeIn
(
this
.
fadeInDuration
);
}
this
.
$alertDiv
.
slideDown
(
this
.
fadeInDuration
,
this
.
afterFadeIn
.
bind
(
this
));
this
.
$alertDiv
.
find
(
"
.wants-focus
"
).
focus
();
this
.
shown
=
true
;
};
/**
...
...
@@ -286,20 +294,26 @@ var QfqNS = QfqNS || {};
}
var
that
=
this
;
this
.
$alertDiv
.
slideUp
(
this
.
fadeOutDuration
,
function
()
{
that
.
$alertDiv
.
remove
();
that
.
$alertDiv
=
null
;
if
(
that
.
modal
)
{
that
.
$modalDiv
.
remove
();
that
.
$modalDiv
=
null
;
}
that
.
shown
=
false
;
if
(
!
this
.
modal
)
{
this
.
$alertDiv
.
animate
({
width
:
'
hide
'
},
this
.
fadeOutDuration
,
function
()
{
that
.
$alertDiv
.
remove
();
that
.
$alertDiv
=
null
;
that
.
shown
=
false
;
// TODO: removeAlert should not have knowledge on how to handle alert container
if
(
that
.
countAlertsInAlertContainer
()
===
0
)
{
that
.
removeAlertContainer
();
}
});
}
else
{
this
.
$alertDiv
.
fadeOut
(
this
.
fadeOutDuration
,
function
(){
this
.
$alertDiv
.
remove
();
this
.
$alertDiv
=
null
;
this
.
shown
=
false
;
});
}
// TODO: removeAlert should not have knowledge on how to handle alert container
if
(
that
.
countAlertsInAlertContainer
()
===
0
)
{
that
.
removeAlertContainer
();
}
});
};
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment