diff --git a/blueprints/community/classifieds/routes.py b/blueprints/community/classifieds/routes.py index 21751df..bcd77fd 100644 --- a/blueprints/community/classifieds/routes.py +++ b/blueprints/community/classifieds/routes.py @@ -93,7 +93,13 @@ def new(): if not listing_type or not category or not title or not description: flash('Wszystkie wymagane pola muszą być wypełnione.', 'error') - return render_template('classifieds/new.html') + return render_template('classifieds/new.html', form_data=request.form, + missing_fields={ + 'listing_type': not listing_type, + 'category': not category, + 'title': not title, + 'description': not description, + }) db = SessionLocal() try: @@ -276,7 +282,11 @@ def edit(classified_id): if not classified.title or not classified.description: flash('Tytuł i opis są wymagane.', 'error') - return render_template('classifieds/edit.html', classified=classified) + return render_template('classifieds/edit.html', classified=classified, + missing_fields={ + 'title': not classified.title, + 'description': not classified.description, + }) # Handle deleted attachments delete_ids = request.form.getlist('delete_attachments[]') diff --git a/templates/classifieds/edit.html b/templates/classifieds/edit.html index 6ac5a4f..39d3147 100644 --- a/templates/classifieds/edit.html +++ b/templates/classifieds/edit.html @@ -51,6 +51,11 @@ .quill-container .ql-toolbar { border-top-left-radius: var(--radius); border-top-right-radius: var(--radius); } .quill-container .ql-container { border-bottom-left-radius: var(--radius); border-bottom-right-radius: var(--radius); font-size: var(--font-size-base); } .quill-container .ql-editor { min-height: 150px; } + .field-error, input.field-error, .quill-container.field-error { + border: 2px solid #dc2626 !important; + box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15); + } + :invalid:not(:focus):not(:placeholder-shown) { border: 2px solid #dc2626; } /* Existing attachments */ .existing-attachment { position: relative; border: 1px solid var(--border); border-radius: var(--radius); padding: var(--spacing-xs); background: var(--surface); } @@ -114,12 +119,12 @@