Added floating labels and changed in login form

This commit is contained in:
dignajar 2020-12-29 14:55:55 +01:00
parent 5469ce51b1
commit 70cefda593
4 changed files with 71 additions and 38 deletions

View file

@ -12,39 +12,38 @@
<!-- CSS -->
<?php
echo HTML::cssBootstrap();
echo HTML::cssBootstrapIcons();
echo HTML::css(array(
'bludit-bootstrap.css',
'bludit.css'
), DOMAIN_ADMIN_THEME_CSS);
echo HTML::css(array(
'jquery.datetimepicker.min.css',
'jquery-ui.min.css',
'select2.min.css',
'select2-bootstrap4.min.css',
'tagsinput-revisited.min.css'
), DOMAIN_CORE_CSS);
echo HTML::cssBootstrap();
echo HTML::cssBootstrapIcons();
echo HTML::css(array(
'bludit-bootstrap.css',
'bludit.css'
), DOMAIN_ADMIN_THEME_CSS);
echo HTML::css(array(
'jquery.datetimepicker.min.css',
'jquery-ui.min.css',
'select2.min.css',
'select2-bootstrap4.min.css',
'tagsinput-revisited.min.css'
), DOMAIN_CORE_CSS);
?>
<!-- Javascript -->
<?php
echo HTML::jquery();
echo HTML::jsBootstrap();
echo HTML::jsSortable();
echo HTML::js(array(
'jquery.datetimepicker.full.min.js',
'jquery-ui.min.js',
'select2.full.min.js',
'tagsinput-revisited.min.js',
'functions.js',
'api.js'
), DOMAIN_CORE_JS);
echo HTML::jquery();
echo HTML::jsBootstrap();
echo HTML::jsSortable();
echo HTML::js(array(
'jquery.datetimepicker.full.min.js',
'jquery-ui.min.js',
'select2.full.min.js',
'tagsinput-revisited.min.js',
'functions.js',
'api.js'
), DOMAIN_CORE_JS);
?>
<!-- Execute plugins for the admin area inside the HTML <head> tag -->
<?php execPluginsByHook('adminHead') ?>
</head>
<body class="h-100 bg-light">

View file

@ -5,14 +5,16 @@
<meta charset="<?php echo CHARSET ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="noindex,nofollow">
<meta name="generator" content="Bludit">
<!-- Favicon -->
<link rel="shortcut icon" type="image/x-icon" href="<?php echo HTML_PATH_CORE_IMG.'favicon.png?version='.BLUDIT_VERSION ?>">
<link rel="shortcut icon" type="image/x-icon" href="<?php echo HTML_PATH_CORE_IMG . 'favicon.png?version=' . BLUDIT_VERSION ?>">
<!-- CSS -->
<?php
echo Theme::cssBootstrap();
echo Theme::css(array(
echo HTML::cssBootstrap();
echo HTML::cssBootstrapIcons();
echo HTML::css(array(
'bludit-bootstrap.css',
'bludit.css'
), DOMAIN_ADMIN_THEME_CSS);

View file

@ -9,17 +9,23 @@ echo Bootstrap::formOpen(array());
'value'=>$security->getTokenCSRF()
));
echo '
<div class="mb-3">
<input type="text" value="'.(isset($_POST['username'])?Sanitize::html($_POST['username']):'').'" class="form-control form-control-lg" id="username" name="username" placeholder="'.$L->g('Username').'" autofocus>
</div>
';
echo Bootstrap::formFloatingLabels(array(
'id'=>'username',
'name'=>'username',
'type'=>'text',
'value'=>(isset($_POST['username'])?Sanitize::html($_POST['username']):''),
'class'=>'form-control-lg',
'placeholder'=>$L->g('Username')
));
echo '
<div class="mb-3">
<input type="password" class="form-control form-control-lg" id="password" name="password" placeholder="'.$L->g('Password').'">
</div>
';
echo Bootstrap::formFloatingLabels(array(
'id'=>'password',
'name'=>'password',
'type'=>'password',
'value'=>'',
'class'=>'form-control-lg',
'placeholder'=>$L->g('Password')
));
echo '
<div class="form-check">

View file

@ -2,6 +2,32 @@
class Bootstrap {
// Floating Labels
// https://getbootstrap.com/docs/5.0/forms/floating-labels/
public static function formFloatingLabels($args)
{
$name = $args['name'];
$id = isset($args['id'])?$args['id']:$name;
$disabled = empty($args['disabled'])?'':'disabled';
$readonly = empty($args['readonly'])?'':'readonly';
$placeholder = isset($args['placeholder'])?$args['placeholder']:'';
$value = isset($args['value'])?$args['value']:'';
$type = isset($args['type'])?$args['type']:'text';
$label = isset($args['label'])?$args['label']:$placeholder;
$class = 'form-control';
if (isset($args['class'])) {
$class = $class.' '.$args['class'];
}
return <<<EOF
<div class="form-floating mb-3">
<input type="$type" class="$class" id="$id" placeholder="$placeholder">
<label for="$id">$label</label>
</div>
EOF;
}
public static function formInputText($args)
{
$name = $args['name'];