Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
typo3
qfq
Commits
3b77b79f
Commit
3b77b79f
authored
Apr 12, 2016
by
Rafael Ostertag
Browse files
Hooks into the new form button and displays message if changes are pending.
parent
1da3644f
Changes
1
Hide whitespace changes
Inline
Side-by-side
javascript/src/QfqForm.js
View file @
3b77b79f
...
...
@@ -179,8 +179,23 @@ var QfqNS = QfqNS || {};
/**
* @private
*/
n
.
QfqForm
.
prototype
.
handleNewClick
=
function
()
{
n
.
QfqForm
.
prototype
.
handleNewClick
=
function
(
event
)
{
event
.
preventDefault
();
var
anchorTarget
=
event
.
target
.
getAttribute
(
"
href
"
);
this
.
lastButtonPress
=
"
new
"
;
if
(
this
.
form
.
getFormChanged
())
{
var
alert
=
new
n
.
Alert
(
"
You have unsaved changes. Do you want to close?
"
,
"
warning
"
,
"
yesnosave
"
);
var
that
=
this
;
alert
.
on
(
'
alert.save
'
,
function
()
{
that
.
form
.
submitTo
(
that
.
submitTo
);
window
.
location
=
anchorTarget
;
});
alert
.
on
(
'
alert.ok
'
,
function
()
{
window
.
location
=
anchorTarget
;
});
alert
.
show
();
}
n
.
Log
.
debug
(
"
new click
"
);
};
...
...
@@ -330,7 +345,7 @@ var QfqNS = QfqNS || {};
* @private
*/
n
.
QfqForm
.
prototype
.
getNewButton
=
function
()
{
return
$
(
"
#new-button
"
);
return
$
(
"
#
form-
new-button
"
);
};
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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