libreForms / libreForms-flask

Flask implementation of the libreForms API
https://libreforms.readthedocs.io
GNU Affero General Public License v3.0
4 stars 1 forks source link

Clean up the Jinja2 templates #202

Open signebedi opened 1 year ago

signebedi commented 1 year ago

Right now, templates/app/ is a mess. Each template tries to do too much, packing multiple pages into itself. It should have a different approach, where each view gets its own template unless there is significant overlap. We implemented this in the templates/reports/ directory structure.

signebedi commented 1 year ago

We should probably employ an organizational philosophy around how we template things. Currently, it looks like:

app/templates/
├── 404.html
├── base.html
├── app/
│   ├── dashboards.html
│   ├── external_request.html
│   ├── forms.html
│   ├── index.html
│   ├── loading.html
│   ├── privacy.html
│   ├── submissions.html
│   └── tables.html
├── auth/
│   ├── add_users.html
│   ├── forgot_password.html
│   ├── login.html
│   ├── profile.html
│   └── register.html
└── reports/
    ├── create_report.html
    ├── reports_home.html
    └── view_report.html

But maybe we move general templates out of the app/ directory, into the templates/ base directory. We add _home.html views (or maybe just create a general view_home.html template that can be generalized?). And we create a few add'l subdirectories to break up the structure a little bit.

templates/
├── 404.html
├── base.html
├── index.html
├── loading.html
├── privacy.html
├── forms/
│   ├── external_request.html
│   ├── forms.html
│   └── forms_home.html
├── analytics/
│   ├── submissions_home.html
│   ├── submissions.html
│   ├── dashboards_home.html
│   ├── dashboards.html
│   ├── tables_home.html
│   └── tables.html
├── auth/
│   ├── add_users.html
│   ├── forgot_password.html
│   ├── login.html
│   ├── profile.html
│   └── register.html
├── admin/
│   ├── users.html
│   ├── forms.html
│   ├── signing.html
│   ├── settings.html
│   └── logs.html
└── reports/
    ├── create_report.html
    ├── reports_home.html
    └── view_report.html
signebedi commented 1 year ago

Clean up the forms jinja template The forms jinja template is far from the only problem, but it's the biggest. We should clean it up and find a way to reduce repitition and boilerplate through macros.