Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
TYPO3.CMS
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Analyze
Contributor 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
TYPO3
TYPO3.CMS
Commits
5e0258c2
Commit
5e0258c2
authored
1 year ago
by
Christian Kuhn
Committed by
GitHub
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
[BUGFIX] styleguide: Modal example works with CSP
https://github.com/TYPO3-CMS/styleguide/pull/459
parent
076bd010
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
typo3/sysext/styleguide/Resources/Private/Templates/Backend/Modal.html
+17
-88
17 additions, 88 deletions
...styleguide/Resources/Private/Templates/Backend/Modal.html
with
17 additions
and
88 deletions
typo3/sysext/styleguide/Resources/Private/Templates/Backend/Modal.html
+
17
−
88
View file @
5e0258c2
...
...
@@ -15,126 +15,55 @@
<h1><f:translate
key=
"LLL:EXT:styleguide/Resources/Private/Language/locallang.xlf:modal"
/></h1>
<script>
function
openModal
(
title
,
message
,
type
,
btns
){
title
=
title
||
'
Modal title
'
;
message
=
message
||
'
Modal message
'
;
type
=
type
||
1
;
btnClass
=
[
''
,
'
btn-warning
'
,
'
btn-danger
'
,
'
btn-primary
'
];
btns
=
btns
||
[{
text
:
'
Cancel
'
,
active
:
true
,
btnClass
:
'
btn-default
'
,
name
:
'
cancel
'
},
{
text
:
'
OK
'
,
btnClass
:
btnClass
[
type
],
name
:
'
ok
'
}];
top
.
TYPO3
.
Modal
.
confirm
(
title
,
message
,
type
,
btns
);
}
</script>
<p>
Modals on buttons can be triggered using t3js-modal-trigger class. There are various
data attributes to customize text and behavior. Not all of them are shown here.
</p>
<h2>
Simple Modal
</h2>
<div
class=
"example"
>
<a
href=
"javascript:openModal();"
class=
"btn btn-primary"
>
<a
class=
"btn btn-primary
t3js-modal-trigger
"
>
Open simple modal
</a>
</div>
<sg:code
language=
"html"
codeonly=
"true"
>
<
script
>
top
.
TYPO3
.
Modal
.
confirm
();
</
script
>
<
a
class=
"btn btn-primary t3js-modal-trigger"
>
Open simple modal
</
a
>
</sg:code>
<h2>
Customize title and message
</h2>
<div
class=
"example"
>
<a
href=
"javascript:openModal('
Modal with custom title
', '
Modal with custom message
');"
class=
"btn btn-primary
"
>
<a
class=
"btn btn-primary t3js-modal-trigger"
data-title=
"
Modal with custom title
"
data-content=
"
Modal with custom message"
>
Open modal
</a>
</div>
<sg:code
language=
"html"
codeonly=
"true"
>
<script>
top
.
TYPO3
.
Modal
.
confirm
(
'
Modal with custom title
'
,
'
Modal with custom message
'
]);
</script>
<a
class=
"btn btn-primary t3js-modal-trigger"
data-title=
"Modal with custom title"
data-content=
"Modal with custom message"
>
Open modal
</a>
</sg:code>
<h2>
Change modal type
</h2>
<div
class=
"example"
>
<a
href=
"javascript:openModal('Modal title', 'Modal message', 1);"
class=
"btn btn-
warning"
>
<a
class=
"btn btn-warning t3js-modal-trigger"
data-severity=
"
warning"
>
Open warning modal
</a>
<a
href=
"javascript:openModal('Modal title', 'Modal message', 2);"
class=
"btn btn-dange
r"
>
<a
class=
"btn btn-danger t3js-modal-trigger"
data-severity=
"erro
r"
>
Open danger modal
</a>
<a
href=
"javascript:openModal('Modal title', 'Modal message', 3);"
class=
"btn btn-primary"
>
Open primary modal
</a>
</div>
<sg:code
language=
"html"
codeonly=
"true"
>
<script>
top
.
TYPO3
.
Modal
.
confirm
(
'
Modal title
'
,
'
Modal message
'
,
1
// warning
]);
top
.
TYPO3
.
Modal
.
confirm
(
'
Modal title
'
,
'
Modal message
'
,
2
// danger
]);
top
.
TYPO3
.
Modal
.
confirm
(
'
Modal title
'
,
'
Modal message
'
,
3
// primary
]);
</script>
</sg:code>
<h2>
Customize submit buttons
</h2>
<div
class=
"example"
>
<a
href=
"javascript:openModal('Modal title', 'Modal message', 2, [{text: 'Custom Cancel',active: true,btnClass: 'btn-default',name: 'cancel'},{text: 'May be',btnClass: 'btn-warning',name: 'may-be'},{text: 'OK',btnClass: 'btn-danger',name: 'ok'}]);"
class=
"btn btn-primary"
>
Open modal
<a
class=
"btn btn-warning t3js-modal-trigger"
data-severity=
"warning"
>
Open warning modal
</a>
<a
class=
"btn btn-danger t3js-modal-trigger"
data-severity=
"error"
>
Open danger modal
</a>
</div>
<sg:code
language=
"html"
codeonly=
"true"
>
<script>
top
.
TYPO3
.
Modal
.
confirm
(
'
Modal title
'
,
'
Modal message
'
,
2
,
[{
text
:
'
Custom Cancel
'
,
active
:
true
,
btnClass
:
'
btn-default
'
,
name
:
'
cancel
'
},{
text
:
'
May be
'
,
btnClass
:
'
btn-warning
'
,
name
:
'
may-be
'
},{
text
:
'
OK
'
,
btnClass
:
'
btn-danger
'
,
name
:
'
ok
'
}]
]);
</script>
</sg:code>
</div>
...
...
This diff is collapsed.
Click to expand it.
Preview
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!
Save comment
Cancel
Please
register
or
sign in
to comment