Improve folder icon display
Some checks failed
DokuWiki Default Tasks / all (push) Has been cancelled
Some checks failed
DokuWiki Default Tasks / all (push) Has been cancelled
This commit is contained in:
22
Output.php
22
Output.php
@@ -276,6 +276,8 @@ class Output
|
|||||||
'name' => $this->getLang('openlocation'),
|
'name' => $this->getLang('openlocation'),
|
||||||
'path' => $params['openlocation'],
|
'path' => $params['openlocation'],
|
||||||
'isdir' => true,
|
'isdir' => true,
|
||||||
|
// Render without an icon (no mf_* class).
|
||||||
|
'noicon' => true,
|
||||||
];
|
];
|
||||||
|
|
||||||
/** @var \Doku_Renderer_xhtml $renderer */
|
/** @var \Doku_Renderer_xhtml $renderer */
|
||||||
@@ -439,7 +441,8 @@ class Output
|
|||||||
$serviceUrl = $syntax ? trim((string)$syntax->getConf('open_service_url')) : '';
|
$serviceUrl = $syntax ? trim((string)$syntax->getConf('open_service_url')) : '';
|
||||||
$serviceToken = $syntax ? trim((string)$syntax->getConf('open_service_token')) : '';
|
$serviceToken = $syntax ? trim((string)$syntax->getConf('open_service_token')) : '';
|
||||||
|
|
||||||
// Prepare a DokuWiki-style media link with a folder icon class.
|
// Prepare a DokuWiki-style link.
|
||||||
|
// Use the same icon mechanism as normal media links (via $link['class']).
|
||||||
$link = [
|
$link = [
|
||||||
'target' => $conf['target']['extern'],
|
'target' => $conf['target']['extern'],
|
||||||
'style' => '',
|
'style' => '',
|
||||||
@@ -448,15 +451,18 @@ class Output
|
|||||||
'name' => $caption,
|
'name' => $caption,
|
||||||
'url' => '#',
|
'url' => '#',
|
||||||
'title' => $renderer->_xmlEntities($path),
|
'title' => $renderer->_xmlEntities($path),
|
||||||
'more' => ' class="filetools-open media mediafile mf_folder" data-path="' . hsc($path) . '"',
|
'more' => '',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
$noIcon = !empty($item['noicon']);
|
||||||
|
$link['class'] = $noIcon
|
||||||
|
? 'filetools-open'
|
||||||
|
: 'filetools-open media mediafile mf_folder';
|
||||||
|
|
||||||
|
$link['more'] .= ' data-path="' . hsc($path) . '"';
|
||||||
if ($conf['relnofollow']) $link['more'] .= ' rel="nofollow"';
|
if ($conf['relnofollow']) $link['more'] .= ' rel="nofollow"';
|
||||||
if ($serviceUrl !== '') {
|
if ($serviceUrl !== '') $link['more'] .= ' data-service-url="' . hsc($serviceUrl) . '"';
|
||||||
$link['more'] .= ' data-service-url="' . hsc($serviceUrl) . '"';
|
if ($serviceToken !== '') $link['more'] .= ' data-service-token="' . hsc($serviceToken) . '"';
|
||||||
}
|
|
||||||
if ($serviceToken !== '') {
|
|
||||||
$link['more'] .= ' data-service-token="' . hsc($serviceToken) . '"';
|
|
||||||
}
|
|
||||||
$renderer->doc .= $renderer->_formatLink($link);
|
$renderer->doc .= $renderer->_formatLink($link);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
12
style.css
12
style.css
@@ -17,3 +17,15 @@ div.filetools-plugin table thead tr.luxtools-openlocation-row td {
|
|||||||
div.filetools-plugin table thead tr.luxtools-openlocation-row:hover td {
|
div.filetools-plugin table thead tr.luxtools-openlocation-row:hover td {
|
||||||
background-color: @ini_background !important;
|
background-color: @ini_background !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Ensure directories use a dedicated folder icon.
|
||||||
|
* DokuWiki's icon CSS is generated primarily for file extensions; a custom
|
||||||
|
* mf_folder class may otherwise fall back to the generic file icon.
|
||||||
|
*
|
||||||
|
* The relative URL is resolved against the plugin directory by DokuWiki's CSS
|
||||||
|
* aggregator, resulting in lib/images/fileicons/svg/folder.svg.
|
||||||
|
*/
|
||||||
|
div.filetools-plugin a.media.mediafile.mf_folder,
|
||||||
|
div.filetools-plugin a.mediafile.mf_folder {
|
||||||
|
background-image: url(../../images/fileicons/svg/folder.svg) !important;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user