New doc for icon list

This commit is contained in:
John BOTELLA 2024-11-23 09:15:34 +01:00
parent 2b264ae5d0
commit 0cb35d5b03
5 changed files with 148 additions and 2 deletions

View File

@ -126,6 +126,12 @@ class Documentation
'DocButtonSubmenu' => '#buttonsection-submenu',
),
),
'Icons' => array(
'url' => dol_buildpath($baseUrl.'/components/icons.php', 1),
'icon' => 'far fa-flag pictofixedwidth',
'submenu' => array(),
'summary' => array(),
),
'Progress' => array(
'url' => dol_buildpath($baseUrl.'/components/progress-bars.php', 1),
'icon' => 'fas fa-battery-half pictofixedwidth',

View File

@ -104,7 +104,7 @@ $documentation->showSidebar(); ?>
$lines = array(
'<?php',
'/**',
'* Function dolGetButtonAction',
'* Function setEventMessages',
'*',
'* Set event messages in dol_events session object. Will be output by calling dol_htmloutput_events',
'* Note: Calling dol_htmloutput_events is done into pages by standard llxFooter() function',

View File

@ -0,0 +1,131 @@
<?php
/*
* Copyright (C) 2024 Anthony Damhet <a.damhet@progiseize.fr>
*
* This program and files/directory inner it is free software: you can
* redistribute it and/or modify it under the terms of the
* GNU Affero General Public License (AGPL) as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AGPL for more details.
*
* You should have received a copy of the GNU AGPL
* along with this program. If not, see <https://www.gnu.org/licenses/agpl-3.0.html>.
*/
$res=0;
if (! $res && file_exists("../../main.inc.php")) : $res=@include '../../main.inc.php';
endif;
if (! $res && file_exists("../../../main.inc.php")) : $res=@include '../../../main.inc.php';
endif;
if (! $res && file_exists("../../../../main.inc.php")) : $res=@include '../../../../main.inc.php';
endif;
// Protection if external user
if ($user->socid > 0) : accessforbidden();
endif;
// Includes
dol_include_once('admin/tools/ui/class/documentation.class.php');
// Load documentation translations
$langs->load('uxdocumentation');
//
$documentation = new Documentation($db);
// Output html head + body - Param is Title
$documentation->docHeader('Icons');
// Set view for menu and breadcrumb
// Menu must be set in constructor of documentation class
$documentation->view = array('Components','Icons');
// Output sidebar
$documentation->showSidebar(); ?>
<div class="doc-wrapper">
<?php $documentation->showBreadCrumb(); ?>
<div class="doc-content-wrapper">
<h1 class="documentation-title"><?php echo $langs->trans('DocIconsTitle'); ?></h1>
<p class="documentation-text"><?php echo $langs->trans('DocIconsMainDescription'); ?></p>
<!-- Summary -->
<?php $documentation->showSummary(); ?>
<!-- Basic usage -->
<div class="documentation-section" id="icon-section-list">
<?php
$iconFileName = 'shims.json';
$iconFilePath = DOL_DOCUMENT_ROOT . '/theme/common/fontawesome-5/metadata';
$fontAwesomeIconRaw = file_get_contents($iconFilePath. '/' .$iconFileName);
if ($fontAwesomeIconRaw === false) {
dol_print_error($db, 'Error missing file '. $iconFilePath . '/' . $iconFileName);
}
$fontAwesomeIcons = json_decode($fontAwesomeIconRaw);
if ($fontAwesomeIcons === null) {
dol_print_error($db, 'Error decoding '. $iconFilePath . '/' . $iconFileName);
}
?>
<h2 class="documentation-title"><?php echo $langs->trans('DocIconsList'); ?></h2>
<?php /* <p class="documentation-text"><?php echo $langs->trans('DocDocIconsListDescription'); ?></p>*/ ?>
<div class="documentation-example">
<div class="documentation-fontawesome-icon-list">
<?php
if ($fontAwesomeIcons && is_array($fontAwesomeIcons)) {
foreach ($fontAwesomeIcons as $iconData) {
$class= $iconData[1]??'fa';
if (!empty($iconData[2])) {
$class.= ' fa-'.$iconData[2]??'';
} else {
$class.= ' fa-'.$iconData[0]??'';
}
$iconCode = '<span class="'.$class.'" ></span>';
print '<div class="info-box ">
<span class="info-box-icon bg-infobox-expensereport">
'.$iconCode.'
</span>
<div class="info-box-content">
<div class="info-box-title" >'. ($iconData[2]??($iconData[0]??'')) .'</div>
<div class="info-box-lines">
<div class="info-box-line spanoverflow nowrap">
<div class="inline-block nowraponall">
<div class="documentation-code"><pre>'.dol_htmlentities($iconCode).'</pre></div>
</div>
</div>
</div><!-- /.info-box-lines -->
</div><!-- /.info-box-content -->
</div>';
}
}
?>
</div>
</div>
</div>
<!-- -->
</div>
</div>
<?php
// Output close body + html
$documentation->docFooter();
?>

View File

@ -78,8 +78,12 @@ body.dolibarr-doc {
.doc-wrapper .doc-content-wrapper .documentation-section h2.documentation-title {margin: 0;margin-bottom:16px;padding: 0;color: rgb(38,60,92);}
.doc-wrapper .doc-content-wrapper .documentation-section .documentation-example {border:1px dashed #ccc;box-sizing: border-box;padding: 16px;margin-bottom: 16px;}
.doc-wrapper .doc-content-wrapper .documentation-section .documentation-code {background: var(--colorbacklinepairchecked);border:1px dashed #ccc;box-sizing: border-box;padding: 16px;margin-bottom: 16px;overflow: auto;}
.doc-wrapper .doc-content-wrapper .documentation-section .info-box .documentation-code {padding: 3px 16px; margin-bottom: 5px;}
.doc-wrapper .doc-content-wrapper .documentation-section .documentation-code pre {margin: 0;padding: 0;tab-size: 24px;}
/* Documentation scroll indicator */
#documentation-scrollwrapper {height: 5px;position: fixed;bottom: 0;left: 260px;right:0;z-index: 99;}
#documentation-scroll {background: rgb(0, 123, 140);height: 5px;position: absolute;top: 0;left:0}
#documentation-scroll {background: rgb(0, 123, 140);height: 5px;position: absolute;top: 0;left:0}
/* component icons */
.documentation-fontawesome-icon-list span{ color: #333; }

View File

@ -79,3 +79,8 @@ DocSetEventMessage = Message #%s
DocButtonIconsLowEmphasis = Low emphasis icon buttons
DocButtonIconsDescriptionLowEmphasis = An icon button with low emphasis is typically a button that includes only an icon (no accompanying text) and has minimal styling to make it unobtrusive. Icon buttons with low emphasis are ideal for secondary or tertiary actions, like clear field, fill field, bookmarking, or sharing, especially in interfaces that have more prominent primary actions (like "Submit" or "Continue").
DocButtonIconsForTitle = Buttons for list title
# Fontawesome icons
DocIconsTitle = Icons used by Dolibarr
DocIconsMainDescription = Dolibarr use a part of fontawesome 5 icons
DocIconsList = List of usable font icons