Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for SVG icons for toggler #661

Merged
merged 1 commit into from
Jan 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 2 additions & 14 deletions src/Resources/public/js/generalDriver.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/Resources/public/js/generalDriver.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 11 additions & 10 deletions src/Resources/public/js/generalDriver_src.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* This file is part of contao-community-alliance/dc-general.
*
* (c) 2013-2017 Contao Community Alliance.
* (c) 2013-2024 Contao Community Alliance.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand All @@ -16,7 +16,8 @@
* @author Stefan Heimes <[email protected]>
* @author Tristan Lins <[email protected]>
* @author Sven Baumann <[email protected]>
* @copyright 2013-2017 Contao Community Alliance.
* @author Ingolf Steinhardt <[email protected]>
* @copyright 2013-2024 Contao Community Alliance.
* @license https://github.com/contao-community-alliance/dc-general/blob/master/LICENSE LGPL-3.0
* @filesource
*/
Expand Down Expand Up @@ -152,9 +153,9 @@ var BackendGeneral =
if (img.nodeName.toLowerCase() == 'img') {
if (img.getParent('ul.tl_listing').hasClass('tl_tree_xtnd')) {
if (publish) {
img.src = img.src.replace(/_1\.(gif|png|jpe?g)/, '.$1');
img.src = img.src.replace(/_1\.(gif|png|jpe?g|svg)/, '.$1');
} else {
img.src = img.src.replace(/\.(gif|png|jpe?g)/, '_1.$1');
img.src = img.src.replace(/\.(gif|png|jpe?g|svg)/, '_1.$1');
}
} else {
if (img.src.match(/folPlus|folMinus/)) {
Expand All @@ -166,11 +167,11 @@ var BackendGeneral =
}
var index;
if (publish) {
index = img.src.replace(/.*_([0-9])\.(gif|png|jpe?g)/, '$1');
img.src = img.src.replace(/_[0-9]\.(gif|png|jpe?g)/, ((index.toInt() == 1) ? '' : '_' + (index.toInt() - 1)) + '.$1');
index = img.src.replace(/.*_([0-9])\.(gif|png|jpe?g|svg)/, '$1');
img.src = img.src.replace(/_[0-9]\.(gif|png|jpe?g|svg)/, ((index.toInt() == 1) ? '' : '_' + (index.toInt() - 1)) + '.$1');
} else {
index = img.src.replace(/.*_([0-9])\.(gif|png|jpe?g)/, '$1');
img.src = img.src.replace(/(_[0-9])?\.(gif|png|jpe?g)/, ((index == img.src) ? '_1' : '_' + (index.toInt() + 1)) + '.$2');
index = img.src.replace(/.*_([0-9])\.(gif|png|jpe?g|svg)/, '$1');
img.src = img.src.replace(/(_[0-9])?\.(gif|png|jpe?g|svg)/, ((index == img.src) ? '_1' : '_' + (index.toInt() + 1)) + '.$2');
}
}
}
Expand All @@ -187,9 +188,9 @@ var BackendGeneral =
// List view
else {
if (publish) {
img.setStyle('background-image', img.getStyle('background-image').replace(/_\.(gif|png|jpe?g)/, '.$1'));
img.setStyle('background-image', img.getStyle('background-image').replace(/_\.(gif|png|jpe?g|svg)/, '.$1'));
} else {
img.setStyle('background-image', img.getStyle('background-image').replace(/\.(gif|png|jpe?g)/, '_.$1'));
img.setStyle('background-image', img.getStyle('background-image').replace(/\.(gif|png|jpe?g|svg)/, '_.$1'));
}
}
}
Expand Down
Loading