Skip to content

Commit

Permalink
Updated Styling for better user Experience. (#40)
Browse files Browse the repository at this point in the history
* Updated Styling for better user Experience.

I have added and removed several Bootstrap classes without changing the original HTML code. Just Removed one <br> tag though!

* Added Some Bootstrap Classes for Better UX

In this file, I have added and removed some Bootstrap classes to give this page a new look and better user Interface/experience.

* Added few Bootstrap Classes to change the look
  • Loading branch information
Mayureshp007 authored Jan 28, 2022
1 parent b06293f commit b67ab22
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 88 deletions.
18 changes: 9 additions & 9 deletions core/columns.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">

</head>
<body>
<body class="bg-light">
<section class="py-5">
<div class="container">
<div class="container bg-white shadow py-5">
<div class="row">
<div class="col-md-12 mx-auto">
<div class="text-center">
<h4 class="mb-0">All available columns</h4>
<h4 class="h1 border-bottom pb-2">All Available Columns</h4>
</div>

<div class="col-md-4 offset-md-8">
<div class="col-md-10 mx-atuo text-right pr-5 ml-4">
<input type="checkbox" id="checkall">
<label for="checkall">Check/uncheck all</label>
</div>
Expand Down Expand Up @@ -88,7 +88,7 @@ function get_foreign_keys($table){
if (isset($table['tablecheckbox']) && $table['tablecheckbox'] == 1) {
$tablename = $table['tablename'];
$tabledisplay = $table['tabledisplay'];
echo "<div class='text-center my-4'><b>Table: " . $tabledisplay . " (". $tablename .")</b></div>";
echo "<div class='text-center mb-4'><b>Table: " . $tabledisplay . " (". $tablename .")</b></div>";
$sql = "SHOW columns FROM $tablename";
$primary_keys = get_primary_keys($tablename);
$auto_keys = get_autoincrement_cols($tablename);
Expand Down Expand Up @@ -132,7 +132,7 @@ function get_foreign_keys($table){
<input type="hidden" name="'.$tablename.'columns['.$i.'][tabledisplay]" value="'.$tabledisplay.'"/>
<input type="hidden" name="'.$tablename.'columns['.$i.'][columnname]" value="'.$column[0].'"/>
<input type="hidden" name="'.$tablename.'columns['.$i.'][columntype]" value="'.$column_type.'"/>
<input id="textinput_'.$tablename. '-'.$i.'"name="'. $tablename. 'columns['.$i.'][columndisplay]" type="text" placeholder="Display field name in frontend" class="form-control">
<input id="textinput_'.$tablename. '-'.$i.'"name="'. $tablename. 'columns['.$i.'][columndisplay]" type="text" placeholder="Display field name in frontend" class="form-control rounded-0">
</div>
<div class="col-md-4">
<input type="checkbox" name="'.$tablename.'columns['.$i.'][columnvisible]" id="checkboxes-'.$checked_tables_counter.'-'.$i.'" value="1">
Expand All @@ -147,7 +147,7 @@ function get_foreign_keys($table){
?>

<div class="row">
<div class="col-12 offset-2">
<div class="col-md-8 mx-auto">
<p class="form-check">
<small id="passwordHelpBlock" class="form-text text-muted">
Cruddiy will create a fresh startpage in the app/ sub-folder, with link<?php echo $checked_tables_counter > 1 ? 's' : '' ?> to manage the table<?php echo $checked_tables_counter > 1 ? 's' : '' ?> above.<br>
Expand All @@ -164,8 +164,8 @@ function get_foreign_keys($table){
</label>
</p>
</div>
<div class="col-12 offset-5">
<button type="submit" id="singlebutton" name="singlebutton" class="btn btn-primary">Generate pages</button>
<div class="col-md-8 mx-auto">
<button type="submit" id="singlebutton" name="singlebutton" class="btn btn-success btn-block rounded-0 shadow-sm">Generate Pages</button>
</div>
</div>
</fieldset>
Expand Down
6 changes: 3 additions & 3 deletions core/generate.php
Original file line number Diff line number Diff line change
Expand Up @@ -581,11 +581,11 @@ function generate($postdata) {
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">

</head>
<body>
<body class="bg-light">
<section class="py-5">
<div class="container">
<div class="container bg-white py-5 shadow">
<div class="row">
<div class="col-md-12 mx-auto">
<div class="col-md-12 mx-auto px-5">
<?php generate($_POST); ?>
<hr>
<br>Your app has been created! It is completely self contained in the /app folder. You can move this folder anywhere on your server.<br><br>
Expand Down
150 changes: 74 additions & 76 deletions core/tables.php
Original file line number Diff line number Diff line change
@@ -1,90 +1,88 @@
<?php
include "app/config.php";
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>CRUD generator</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
<?php
include "app/config.php";
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>CRUD generator</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">

</head>
<body>
<section class="pt-5">
<div class="container">
<div class="row">
<div class="col-md-12 mx-auto">
<div class="text-center">
<h4 class="mb-0">All available tables</h4>
</div>
</head>
<body class="bg-light">
<section class="pt-5">
<div class="container bg-white shadow py-5">
<div class="row">
<div class="col-md-12 mx-auto">
<div class="text-center mb-4">
<h4 class="h1 border-bottom pb-2">All Available Tables</h4>
</div>

<div class="row align-items-center mb-1">
<div class="col-md-3 offset-md-9">
<input type="checkbox" id="checkall">
<label for="checkall">Check/uncheck all</label>
<div class="row align-items-center mb-1">
<div class="col-md-11 text-right pr-5 ml-3">
<input type="checkbox" id="checkall">
<label for="checkall">Check/uncheck all</label>
</div>
</div>
</div>


<form class="form-horizontal" action="columns.php" method="post">
<fieldset>
<?php
//Get all tables
$tablelist = array();
$res = mysqli_query($link,"SHOW TABLES");
while($cRow = mysqli_fetch_array($res))
{
$tablelist[] = $cRow[0];
}
<form class="form-horizontal" action="columns.php" method="post">
<fieldset>
<?php
//Get all tables
$tablelist = array();
$res = mysqli_query($link,"SHOW TABLES");
while($cRow = mysqli_fetch_array($res))
{
$tablelist[] = $cRow[0];
}

//Loop trough list of tables
$i = 0;
foreach($tablelist as $table) {
//Loop trough list of tables
$i = 0;
foreach($tablelist as $table) {

echo
'<div class="row align-items-center mb-1">
<div class="col-md-3 text-right">
<label class="control-label" for="table['.$i.'][tablename]">'. $table . ' </label>
</div>
<div class="col-md-6">
<input type="hidden" name="table['.$i.'][tablename]" value="'.$table.'"/>
<input id="textinput_'.$table. '" name="table['.$i.'][tabledisplay]" type="text" placeholder="Display table name in frontend" class="form-control">
</div>
<div class="col-md-3">
<input class="mr-1" type="checkbox" name="table['.$i.'][tablecheckbox]" id="checkboxes-'.$i.'" value="1"><label for="checkboxes-'.$i.'">Generate CRUD</label>
echo
'<div class="row align-items-center">
<div class="col-md-3 text-right">
<label class="control-label" for="table['.$i.'][tablename]">'. $table . ' </label>
</div>
<div class="col-md-6">
<input type="hidden" name="table['.$i.'][tablename]" value="'.$table.'"/>
<input id="textinput_'.$table. '" name="table['.$i.'][tabledisplay]" type="text" placeholder="Display table name in frontend" class="form-control rounded-0 shadow-sm">
</div>
<div class="col-md-3">
<input class="mr-1" type="checkbox" name="table['.$i.'][tablecheckbox]" id="checkboxes-'.$i.'" value="1"><label for="checkboxes-'.$i.'">Generate CRUD</label>
</div>
</div>
</div>
<br>';
';

$i++;
}
?>
<div class="row">
<div class="col-md-12 offset-5">
<label class="control-label" for="singlebutton"></label>
<button type="submit" id="singlebutton" name="singlebutton" class="btn btn-primary">Select columns from tables</button>
$i++;
}
?>
<div class="row">
<div class="col-md-6 mx-auto">
<label class="control-label" for="singlebutton"></label>
<button type="submit" id="singlebutton" name="singlebutton" class="btn btn-success btn-block shadow rounded-0">Select columns from tables</button>
</div>
</div>
</div>
</fieldset>
</form>
</fieldset>
</form>
</div>
</div>
</div>
</div>
</section>
<br>
</section>
<br>

<script src="https://code.jquery.com/jquery-3.5.1.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script>
<script>
$(document).ready(function () {
$('#checkall').click(function(e) {
var chb = $('.form-horizontal').find('input[type="checkbox"]');
chb.prop('checked', !chb.prop('checked'));
<script src="https://code.jquery.com/jquery-3.5.1.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script>
<script>
$(document).ready(function () {
$('#checkall').click(function(e) {
var chb = $('.form-horizontal').find('input[type="checkbox"]');
chb.prop('checked', !chb.prop('checked'));
});
});
});
</script>
</body>
</html>
</script>
</body>
</html>

0 comments on commit b67ab22

Please sign in to comment.