From 70cefda593d242aa754e2f5127f0eab6f5441fb7 Mon Sep 17 00:00:00 2001 From: dignajar Date: Tue, 29 Dec 2020 14:55:55 +0100 Subject: [PATCH] Added floating labels and changed in login form --- bl-kernel/admin/themes/booty/index.php | 49 +++++++++++++------------- bl-kernel/admin/themes/booty/login.php | 8 +++-- bl-kernel/admin/views/login.php | 26 ++++++++------ bl-kernel/helpers/bootstrap.class.php | 26 ++++++++++++++ 4 files changed, 71 insertions(+), 38 deletions(-) diff --git a/bl-kernel/admin/themes/booty/index.php b/bl-kernel/admin/themes/booty/index.php index 614fcd84..346df892 100644 --- a/bl-kernel/admin/themes/booty/index.php +++ b/bl-kernel/admin/themes/booty/index.php @@ -12,39 +12,38 @@ - diff --git a/bl-kernel/admin/themes/booty/login.php b/bl-kernel/admin/themes/booty/login.php index a3963f74..b53f639a 100644 --- a/bl-kernel/admin/themes/booty/login.php +++ b/bl-kernel/admin/themes/booty/login.php @@ -5,14 +5,16 @@ + - + $security->getTokenCSRF() )); - echo ' -
- -
- '; + 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 ' -
- -
- '; + echo Bootstrap::formFloatingLabels(array( + 'id'=>'password', + 'name'=>'password', + 'type'=>'password', + 'value'=>'', + 'class'=>'form-control-lg', + 'placeholder'=>$L->g('Password') + )); echo '
diff --git a/bl-kernel/helpers/bootstrap.class.php b/bl-kernel/helpers/bootstrap.class.php index f4d753dd..4bbb0ae3 100644 --- a/bl-kernel/helpers/bootstrap.class.php +++ b/bl-kernel/helpers/bootstrap.class.php @@ -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; + } + public static function formInputText($args) { $name = $args['name'];