162 lines
3.8 KiB
Markdown
162 lines
3.8 KiB
Markdown
# Café Bach Email Generator
|
|
|
|
A Flask-based web application that generates beautifully formatted HTML invitation emails for internal events at Café Bach (Aidshilfe). Users fill out a simple form and the app renders a clean, minimalist HTML email template.
|
|
|
|
## Features
|
|
|
|
- Generate HTML email invitations with customizable fields
|
|
- Real-time preview of email template
|
|
- Client-side form validation
|
|
- Copy-to-clipboard functionality
|
|
- Responsive design with accessibility support
|
|
- Minimalist, ADHD-friendly interface
|
|
|
|
## Tech Stack
|
|
|
|
- **Backend:** Python 3.10+, Flask
|
|
- **Templating:** Jinja2
|
|
- **Frontend:** Vanilla HTML/CSS/JS
|
|
- **Testing:** pytest
|
|
- **CI/CD:** GitHub Actions
|
|
|
|
## Installation
|
|
|
|
1. Clone the repository:
|
|
```bash
|
|
git clone <repository-url>
|
|
cd 07_email_template_generator
|
|
```
|
|
|
|
2. Set up the virtual environment:
|
|
```bash
|
|
python -m venv venv
|
|
source venv/bin/activate
|
|
```
|
|
|
|
3. Install dependencies:
|
|
```bash
|
|
pip install -r requirements.txt
|
|
```
|
|
|
|
4. Set up environment variables:
|
|
```bash
|
|
cp .env.example .env
|
|
# Edit .env with your configuration
|
|
```
|
|
|
|
5. Run the application:
|
|
```bash
|
|
flask run
|
|
```
|
|
|
|
The application will be available at `http://localhost:5000`.
|
|
|
|
## Project Structure
|
|
|
|
```
|
|
cafe-bach-email-generator/
|
|
├── app/
|
|
│ ├── __init__.py # Flask app factory
|
|
│ ├── config.py # Configuration classes
|
|
│ ├── forms.py # WTForms for email generation
|
|
│ ├── views.py # Route definitions
|
|
│ ├── templates/
|
|
│ │ ├── base.html # Layout wrapper
|
|
│ │ ├── generate.html # Main form view
|
|
│ │ └── preview.html # Rendered email preview
|
|
│ └── static/
|
|
│ ├── css/
|
|
│ │ └── style.css # Minimalist styling
|
|
│ └── js/
|
|
│ └── main.js # Form handling & preview logic
|
|
├── tests/
|
|
│ ├── test_app.py # Route tests
|
|
│ └── test_forms.py # Form validation tests
|
|
├── .github/
|
|
│ └── workflows/
|
|
│ └── ci-cd.yml # GitHub Actions pipeline
|
|
├── .env.example # Environment variables template
|
|
├── requirements.txt # Python dependencies
|
|
├── instructions.md # Project instructions
|
|
└── README.md # This file
|
|
```
|
|
|
|
## Usage
|
|
|
|
1. Navigate to the generate page
|
|
2. Fill out the form with event details:
|
|
- Event Title (required)
|
|
- Date & Time (required)
|
|
- Location (required)
|
|
- Description (required)
|
|
- Image URL (optional)
|
|
- Button Text (required)
|
|
- Button URL (required)
|
|
- Next Event Text (optional)
|
|
- Next Event URL (optional)
|
|
3. Click "Preview" to see a preview of the email
|
|
4. Click "Generate Email" to submit the form
|
|
5. Use "Copy HTML to Clipboard" to copy the generated HTML
|
|
|
|
## Testing
|
|
|
|
Run the tests with pytest:
|
|
|
|
```bash
|
|
pytest
|
|
```
|
|
|
|
Run tests with coverage:
|
|
|
|
```bash
|
|
pytest --cov=app
|
|
```
|
|
|
|
## Code Quality
|
|
|
|
Lint with flake8:
|
|
|
|
```bash
|
|
flake8 app/ --count --select=E9,F63,F7,F82 --show-source --statistics
|
|
```
|
|
|
|
Format with black:
|
|
|
|
```bash
|
|
black app/
|
|
```
|
|
|
|
Sort imports with isort:
|
|
|
|
```bash
|
|
isort app/
|
|
```
|
|
|
|
## CI/CD Pipeline
|
|
|
|
The project uses GitHub Actions for continuous integration and deployment:
|
|
|
|
1. Trigger: Push to `main` or `develop`, or pull requests
|
|
2. Environment: Python 3.10+ on Ubuntu latest
|
|
3. Steps:
|
|
- Checkout repository
|
|
- Set up Python environment
|
|
- Install dependencies
|
|
- Run linting (flake8, black, isort)
|
|
- Execute tests (pytest)
|
|
- Build & deploy to staging (optional)
|
|
- Notify via Slack/Discord on success/failure
|
|
|
|
## Accessibility
|
|
|
|
The application is designed with ADHD-friendly principles:
|
|
|
|
- High contrast mode support
|
|
- Clear visual hierarchy
|
|
- Minimal distractions
|
|
- Clear feedback on actions
|
|
- Keyboard navigation support
|
|
|
|
## License
|
|
|
|
© 2024 Café Bach - Aidshilfe
|