jan-vandenberg / cruddiy

No-code Bootstrap PHP CRUD generator
http://cruddiy.com
GNU Affero General Public License v3.0
253 stars 80 forks source link

No delete previous #18

Closed germain-italic closed 3 years ago

germain-italic commented 3 years ago

Hi @jan-vandenberg here's a list of improvements on the Generate page.

1. Consistent theming on the generate page

The current master version outputs raw HTML to the browser, without HTML structure and any styling.

I've applied the styles from the index/relations/tables/columns pages on the generate page as shown below, and also added a few spacers for better readability.

image

To achieve this, the POST loop has been deported to its own function which is called inside the HTML container.

2. Treat each table of the POST loop independently to make links

The original $start_page is a global variable where each table to be generated is added by string concatenation.

It works well with small databases on localhost, but crashes with large databases on remote servers (tested with 225 tables on an AWS t2.medium EC2 instance).

In my previous PR (commit 83fa685) I found a way to append new links to a previously generated app/index.php page if the checkbox "Keep previously generated startpage" is checked. Today, I moved it to its own append_links_to_startpage function which is now reused when the loop calls generate_start for the second and subsequent times. Therefore there is no need for a global $start_page scope.

3. Tell which table is being parsed during POST loop iterations

Every time generate_start is called by the POST loop, one can now see which table is being generared in the log output.

image

4. Actually deleting previously generated files

Althought it was not a requirement to have the "Keep previously generated startpage" feature working, it makes sense to NOT keep it, and the previously genered CRUD pages, if the checkbox is NOT checked.

Therefore, the label of the checkbox has been updated:

image

And the deleted pages have been added to the output log:

image

I took care of keeping app/config.php safe.

5. Discarded commit: index page back button

Having a back button to Available Pages on the generated index page seemed a good idea to my workflow, because I am both the admin (creator of the generated pages) and the end-user (user of the generated pages).

However I realized that if an admin generates the back-office pages for some end-users (by setting the core/app folder as default root folder), it would create confusion for them. So I made this, but I removed it:

image


I hope that these improvement fit your standards and expectations! Germain

jan-vandenberg commented 3 years ago

Excellent work, thank you very much!