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

WIP : Documentation ux #30735

Merged
merged 49 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
eda6198
Move documentation files to new folder
EchoLoGeek Jul 5, 2024
69a8ad5
Merge branch 'Dolibarr:develop' into documentationUX
EchoLoGeek Jul 12, 2024
20b3c78
Merge branch 'Dolibarr:develop' into documentationUX
EchoLoGeek Jul 16, 2024
ddad0d5
Documentation prototype
EchoLoGeek Jul 17, 2024
5a46c8d
Merge branch 'Dolibarr:develop' into documentationUX
EchoLoGeek Aug 23, 2024
3f18548
Remove whitespace and add functions returns
EchoLoGeek Aug 26, 2024
93619fe
Remove Google fonts
EchoLoGeek Aug 26, 2024
49ee83c
Remove return string
EchoLoGeek Aug 26, 2024
f656a42
Merge branch 'Dolibarr:develop' into documentationUX
EchoLoGeek Sep 3, 2024
a478877
Phpcbf corrections
EchoLoGeek Sep 3, 2024
20643a7
Phpcdf with good ruleset
EchoLoGeek Sep 3, 2024
91a8d56
add return null
EchoLoGeek Sep 3, 2024
82ffd3e
resolve conflict with test_arrays.php
EchoLoGeek Sep 26, 2024
bee11f1
Return void for print functions
EchoLoGeek Sep 26, 2024
68e9260
WIP progress bar
thersane-john Sep 27, 2024
c32d473
Merge pull request #1 from thersane-john/documentationUX_progress
EchoLoGeek Sep 27, 2024
1692a14
Add seteventmessage documentation for ui/ux
Oct 22, 2024
8cf13bc
Add translations
Oct 22, 2024
31628f3
Delete is of button
Oct 22, 2024
570cfa3
Clean titles
Oct 22, 2024
b909450
Change name of file event-message.php
Oct 22, 2024
de34e23
Update before moving and rename files
EchoLoGeek Oct 24, 2024
bbf0907
Merge branch 'documentationUX' into NEW_documentationUX_SetEventMessage
EchoLoGeek Oct 25, 2024
ebe80ce
Merge pull request #2 from atm-lena/NEW_documentationUX_SetEventMessage
EchoLoGeek Oct 25, 2024
d3ab9b6
Merge branch 'develop' of https://github.com/Dolibarr/dolibarr into d…
thersane-john Oct 25, 2024
d521de9
Add missing button
thersane-john Oct 25, 2024
7704f26
Add missing button
thersane-john Oct 25, 2024
93ae1ba
move ui doc files
EchoLoGeek Oct 28, 2024
582c8a9
Merge pull request #4 from EchoLoGeek/documentationUXMerge
EchoLoGeek Oct 28, 2024
0712a13
Remove old documentation files
EchoLoGeek Oct 28, 2024
8e329ea
Reupload test_arrays.php
EchoLoGeek Oct 28, 2024
cc6b26b
Merge remote-tracking branch 'origin/documentationUX' into documentat…
EchoLoGeek Oct 28, 2024
36bfe72
Merge branch 'develop' into documentationUX
EchoLoGeek Oct 28, 2024
4a6a718
Merge branch 'documentationUX' of github.com:EchoLoGeek/dolibarr into…
thersane-john Oct 28, 2024
35f4bf1
Merge pull request #3 from thersane-john/documentationUX_btn_update
EchoLoGeek Oct 28, 2024
921a484
Rename lang file
EchoLoGeek Oct 28, 2024
5647e6c
Move lang file
EchoLoGeek Oct 28, 2024
9ed9f08
add htmlhead
thersane-john Oct 28, 2024
aba1935
Merge pull request #5 from thersane-john/documentationUX_use_top_html…
EchoLoGeek Oct 28, 2024
0d21728
Add parameter comment
EchoLoGeek Oct 28, 2024
4ff3bcb
Update tables.php
eldy Nov 13, 2024
b15def0
Update uxdocumentation.lang
eldy Nov 13, 2024
7426f59
Update tables.php
eldy Nov 13, 2024
df81615
Update uxdocumentation.lang
eldy Nov 13, 2024
b4dadf7
Update progress-bars.php
eldy Nov 13, 2024
e0bf736
Merge branch 'develop' into documentationUX
eldy Nov 13, 2024
b14a988
Update tables.php
eldy Nov 13, 2024
db7ea74
Merge branch 'develop' into documentationUX
eldy Nov 13, 2024
730a92b
Merge branch 'develop' into documentationUX
eldy Nov 13, 2024
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
403 changes: 403 additions & 0 deletions htdocs/admin/tools/ui/class/documentation.class.php

Large diffs are not rendered by default.

313 changes: 313 additions & 0 deletions htdocs/admin/tools/ui/components/badges.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,313 @@
<?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('Badges');

// Set view for menu and breadcrumb
// Menu must be set in constructor of documentation class
$documentation->view = array('Components','Badges');

// Output sidebar
$documentation->showSidebar(); ?>

<div class="doc-wrapper">

<?php $documentation->showBreadCrumb(); ?>

<div class="doc-content-wrapper">

<h1 class="documentation-title"><?php echo $langs->trans('DocBadgeTitle'); ?></h1>
<p class="documentation-text"><?php echo $langs->trans('DocBadgeMainDescription'); ?></p>

<!-- Summary -->
<?php $documentation->showSummary(); ?>

<!-- Basic usage -->
<div class="documentation-section" id="badgesection-basicusage">
<h2 class="documentation-title"><?php echo $langs->trans('DocBasicUsage'); ?></h2>
<p class="documentation-text"><?php echo $langs->trans('DocBadgeScaleDescription'); ?></p>
<div class="documentation-example">
<h1>Example heading <span class="badge badge-secondary">New</span></h1>
<h2>Example heading <span class="badge badge-secondary">New</span></h2>
<h3>Example heading <span class="badge badge-secondary">New</span></h3>
<h4>Example heading <span class="badge badge-secondary">New</span></h4>
<h5>Example heading <span class="badge badge-secondary">New</span></h5>
<h6>Example heading <span class="badge badge-secondary">New</span></h6>
</div>

<?php
$lines = array(
'<h1>Example heading <span class="badge badge-secondary">New</span></h1>',
'<h2>Example heading <span class="badge badge-secondary">New</span></h2>',
'<h3>Example heading <span class="badge badge-secondary">New</span></h3>',
'<h4>Example heading <span class="badge badge-secondary">New</span></h4>',
'<h5>Example heading <span class="badge badge-secondary">New</span></h5>',
'<h6>Example heading <span class="badge badge-secondary">New</span></h6>'
);
echo $documentation->showCode($lines); ?>

<p class="documentation-text"><?php echo $langs->trans('DocBadgeUseOnLinksOrButtons'); ?></p>
<div class="documentation-example">
<button type="button" class="button">
<?php echo $langs->trans('Notifications'); ?> <span class="badge badge-primary">4</span>
</button>
</div>

<?php
$lines = array(
'<button type="button" class="button">',
' Notifications <span class="badge badge-primary">4</span>',
'</button>',
);
echo $documentation->showCode($lines); ?>

<div class="warning">
<p class="documentation-text"><?php echo $langs->trans('DocBadgeWarningAriaHidden1'); ?></p>
<p class="documentation-text"><?php echo $langs->trans('DocBadgeWarningAriaHidden2'); ?></p>
<p class="documentation-text"><strong><?php echo $langs->trans('DocBadgeWarningAriaHidden3'); ?></strong></p>
</div>

<div class="documentation-example">
<button type="button" class="button">
Profile <span class="badge badge-primary" aria-label="9 unread messages" >9</span>
<span class="sr-only">unread messages</span>
</button>
</div>

<?php
$lines = array(
'<button type="button" class="button">',
' Profile <span class="badge badge-primary" aria-label="9 unread messages" >9</span>',
' <span class="sr-only">unread messages</span>',
'</button>',
);
echo $documentation->showCode($lines); ?>
</div>

<!-- Contextual variations -->
<div class="documentation-section" id="badgesection-contextvariations">
<h2 class="documentation-title"><?php echo $langs->trans('DocBadgeContextualVariations'); ?></h2>
<p class="documentation-text"><?php echo $langs->trans('DocBadgeContextualVariationsDescription'); ?></p>
<div class="documentation-example">
<span class="badge badge-primary">Primary</span>
<span class="badge badge-secondary">Secondary</span>
<span class="badge badge-success">Success</span>
<span class="badge badge-danger">Danger</span>
<span class="badge badge-warning">Warning</span>
<span class="badge badge-info">Info</span>
<span class="badge badge-light">Light</span>
<span class="badge badge-dark">Dark</span>
</div>
<?php
$lines = array(
'<span class="badge badge-primary">Primary</span>',
'<span class="badge badge-secondary">Secondary</span>',
'<span class="badge badge-success">Success</span>',
'<span class="badge badge-danger">Danger</span>',
'<span class="badge badge-warning">Warning</span>',
'<span class="badge badge-info">Info</span>',
'<span class="badge badge-light">Light</span>',
'<span class="badge badge-dark">Dark</span>',
);
echo $documentation->showCode($lines); ?>
<div class="warning">
<p class="documentation-text"><strong><?php echo $langs->trans('DocBadgeContextualVariationsWarning1'); ?></strong></p>
<p class="documentation-text"><?php echo $langs->trans('DocBadgeContextualVariationsWarning2'); ?></p>
</div>
</div>

<!-- Default status -->
<div class="documentation-section" id="badgesection-defaultstatus">
<h2 class="documentation-title"><?php echo $langs->trans('DocBadgeDefaultStatus'); ?></h2>
<p class="documentation-text"><?php echo $langs->trans('DocBadgeDefaultStatusDescription'); ?></p>
<div class="documentation-example">
<?php for ($i = 0; $i <= 9; $i++) : ?>
<span class="badge badge-status<?php print $i; ?>" >status-<?php print $i; ?></span>
<?php endfor; ?>
</div>
<?php
$lines = array();
for ($i = 0; $i <= 9; $i++) :
$lines[] = '<span class="badge badge-status'.$i.'">status-'.$i.'</span>';
endfor;
echo $documentation->showCode($lines); ?>
</div>

<!-- Pill badges -->
<div class="documentation-section" id="badgesection-pill">
<h2 class="documentation-title"><?php echo $langs->trans('DocBadgePillBadges'); ?></h2>
<p class="documentation-text"><?php echo $langs->trans('DocBadgePillBadgesDescription'); ?></p>
<div class="documentation-example">
<span class="badge badge-pill badge-primary">Primary</span>
<span class="badge badge-pill badge-secondary">Secondary</span>
<span class="badge badge-pill badge-success">Success</span>
<span class="badge badge-pill badge-danger">Danger</span>
<span class="badge badge-pill badge-warning">Warning</span>
<span class="badge badge-pill badge-info">Info</span>
<span class="badge badge-pill badge-light">Light</span>
<span class="badge badge-pill badge-dark">Dark</span>
<?php for ($i = 0; $i <= 9; $i++) : ?>
<span class="badge badge-pill badge-status<?php print $i; ?>">status<?php print $i; ?></span>
<?php endfor; ?>
</div>
<?php
$lines = array(
'<span class="badge badge-pill badge-primary">Primary</span>',
'<span class="badge badge-pill badge-secondary">Secondary</span>',
'<span class="badge badge-pill badge-success">Success</span>',
'<span class="badge badge-pill badge-danger">Danger</span>',
'<span class="badge badge-pill badge-warning">Warning</span>',
'<span class="badge badge-pill badge-info">Info</span>',
'<span class="badge badge-pill badge-light">Light</span>',
'<span class="badge badge-pill badge-dark">Dark</span>',
);
for ($i = 0; $i <= 9; $i++) :
$lines[] = '<span class="badge badge-pill badge-status'.$i.'">status-'.$i.'</span>';
endfor;
echo $documentation->showCode($lines); ?>
</div>

<!-- Dot badges -->
<div class="documentation-section" id="badgesection-dot">
<h2 class="documentation-title"><?php echo $langs->trans('DocBadgeDotBadges'); ?></h2>
<p class="documentation-text"><?php echo $langs->trans('DocBadgeDotBadgesDescription'); ?></p>
<div class="documentation-example">
<span class="badge badge-dot badge-primary"></span>
<span class="badge badge-dot badge-secondary"></span>
<span class="badge badge-dot badge-success"></span>
<span class="badge badge-dot badge-danger"></span>
<span class="badge badge-dot badge-warning"></span>
<span class="badge badge-dot badge-info"></span>
<span class="badge badge-dot badge-light"></span>
<span class="badge badge-dot badge-dark"></span>
<?php for ($i = 0; $i <= 9; $i++) : ?>
<span class="badge badge-dot badge-status<?php print $i; ?>"></span>
<?php endfor; ?>
</div>
<?php
$lines = array(
'<span class="badge badge-dot badge-primary"></span>',
'<span class="badge badge-dot badge-secondary"></span>',
'<span class="badge badge-dot badge-success"></span>',
'<span class="badge badge-dot badge-danger"></span>',
'<span class="badge badge-dot badge-warning"></span>',
'<span class="badge badge-dot badge-info"></span>',
'<span class="badge badge-dot badge-light"></span>',
'<span class="badge badge-dot badge-dark"></span>',
);
for ($i = 0; $i <= 9; $i++) :
$lines[] = '<span class="badge badge-dot badge-status'.$i.'"></span>';
endfor;
echo $documentation->showCode($lines); ?>
</div>

<!-- Links -->
<div class="documentation-section" id="badgesection-links">
<h2 class="documentation-title"><?php echo $langs->trans('DocBadgeLinks'); ?></h2>
<p class="documentation-text"><?php echo $langs->trans('DocBadgeLinksDescription'); ?></p>
<div class="documentation-example">
<a href="#" class="badge badge-primary">Primary</a>
<a href="#" class="badge badge-secondary">Secondary</a>
<a href="#" class="badge badge-success">Success</a>
<a href="#" class="badge badge-danger">Danger</a>
<a href="#" class="badge badge-warning">Warning</a>
<a href="#" class="badge badge-info">Info</a>
<a href="#" class="badge badge-light">Light</a>
<a href="#" class="badge badge-dark">Dark</a>
<?php for ($i = 0; $i <= 9; $i++) : ?>
<a href="#" class="badge badge-status<?php print $i; ?>" >status<?php print $i; ?></a>
<?php endfor; ?>
</div>
<?php
$lines = array(
'<a href="#" class="badge badge-primary">Primary</a>',
'<a href="#" class="badge badge-secondary">Secondary</a>',
'<a href="#" class="badge badge-success">Success</a>',
'<a href="#" class="badge badge-danger">Danger</a>',
'<a href="#" class="badge badge-warning">Warning</a>',
'<a href="#" class="badge badge-info">Info</a>',
'<a href="#" class="badge badge-light">Light</a>',
'<a href="#" class="badge badge-dark">Dark</a>',
);
for ($i = 0; $i <= 9; $i++) :
$lines[] = '<a href="#" class="badge badge-status'.$i.'" >status'.$i.'</a>';
endfor;
echo $documentation->showCode($lines); ?>
</div>

<!-- Use badge helper function -->
<div class="documentation-section" id="badgesection-dolgetbadge">
<h2 class="documentation-title"><?php echo $langs->trans('DocBadgeHelper'); ?></h2>
<p class="documentation-text"><?php echo $langs->trans('DocBadgeHelperDescription'); ?></p>
<div class="documentation-example">
<?php print dolGetBadge('your label for accessibility', 'your label <u>with</u> <em>html</em>', 'primary'); ?>
<?php print dolGetBadge('your label for accessibility', 'your label <u>with</u> <em>html</em>', 'danger', 'pill'); ?>
<?php print dolGetBadge('your label for accessibility', 'your label', 'warning', 'dot'); ?>
</div>
<?php
$lines = array(
"/**",
" * Function dolGetBadge",
" *",
" * @param string \$label label of badge no html : use in alt attribute for accessibility",
" * @param string \$html optional : label of badge with html",
" * @param string \$type type of badge : Primary Secondary Success Danger Warning Info Light Dark status0 status1 status2 status3 status4 status5 status6 status7 status8 status9",
" * @param string \$mode Default '' , 'pill', 'dot'",
" * @param string \$url the url for link",
" * ... See more: core/lib/functions.lib.php ",
"",
"<?php print dolGetBadge('your label for accessibility', 'your label <u>with</u> <em>html</em>', 'primary'); ?>",
"<?php print dolGetBadge('your label for accessibility', 'your label <u>with</u> <em>html</em>', 'danger', 'pill'); ?>",
"<?php print dolGetBadge('your label for accessibility', 'your label', 'warning', 'dot'); ?>",
);
echo $documentation->showCode($lines); ?>
</div>

<!-- -->

</div>

</div>

<?php
// Output close body + html
$documentation->docFooter();
?>
Loading
Loading