-
Notifications
You must be signed in to change notification settings - Fork 228
feat: add feedback feature for students and teachers #455
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| {% extends "base.html" %} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
All other admin pages (admin_dashboard.html, admin_users.html, etc.) use a self-contained HTML structure with an admin sidebar/nav, not base.html. admin_feedback.html extends base.html, rendering it with the public marketing nav (Student/Teacher login, FAQ, Feedback links) rather than the admin UI chrome. Prompt to fix with AI
|
||
| {% block content %} | ||
|
|
||
| <div style="max-width: 1100px; margin: 40px auto; padding: 0 20px;"> | ||
| <h2 style="font-size:1.8rem; margin-bottom:6px; color:#1a1a2e;">Feedback Submissions</h2> | ||
| <p style="color:#666; margin-bottom:28px;">All feedback submitted by students and teachers.</p> | ||
|
|
||
| {% if feedbacks %} | ||
| <div style="overflow-x:auto;"> | ||
| <table style="width:100%; border-collapse:collapse; background:#fff; border-radius:12px; overflow:hidden; box-shadow:0 2px 12px rgba(0,0,0,0.07);"> | ||
| <thead> | ||
| <tr style="background:linear-gradient(135deg,#4f46e5,#7c3aed); color:#fff;"> | ||
| <th style="padding:14px 16px; text-align:left;">#</th> | ||
| <th style="padding:14px 16px; text-align:left;">Role</th> | ||
| <th style="padding:14px 16px; text-align:left;">Name</th> | ||
| <th style="padding:14px 16px; text-align:left;">Email</th> | ||
| <th style="padding:14px 16px; text-align:left;">Type</th> | ||
| <th style="padding:14px 16px; text-align:left;">Message</th> | ||
| <th style="padding:14px 16px; text-align:left;">Rating</th> | ||
| <th style="padding:14px 16px; text-align:left;">Submitted</th> | ||
| </tr> | ||
| </thead> | ||
| <tbody> | ||
| {% for fb in feedbacks %} | ||
| <tr style="border-bottom:1px solid #f0f0f0; {% if loop.index is odd %}background:#fafafa;{% endif %}"> | ||
| <td style="padding:12px 16px; color:#999;">{{ fb[0] }}</td> | ||
| <td style="padding:12px 16px;"> | ||
| <span style="padding:4px 10px; border-radius:20px; font-size:0.8rem; font-weight:600; background:{{ '#dbeafe' if fb[1] == 'Student' else '#fef9c3' }}; color:{{ '#1d4ed8' if fb[1] == 'Student' else '#854d0e' }};">{{ fb[1] }}</span> | ||
| </td> | ||
| <td style="padding:12px 16px;">{{ fb[2] or '—' }}</td> | ||
| <td style="padding:12px 16px;">{{ fb[3] or '—' }}</td> | ||
| <td style="padding:12px 16px; font-weight:500;">{{ fb[4] }}</td> | ||
| <td style="padding:12px 16px; max-width:280px; color:#444;">{{ fb[5] }}</td> | ||
| <td style="padding:12px 16px; font-size:1.1rem;"> | ||
| {% if fb[6] %}{% for i in range(fb[6]) %}⭐{% endfor %}{% else %}—{% endif %} | ||
| </td> | ||
| <td style="padding:12px 16px; color:#999; font-size:0.85rem;">{{ fb[7][:16] }}</td> | ||
| </tr> | ||
| {% endfor %} | ||
| </tbody> | ||
| </table> | ||
| </div> | ||
| {% else %} | ||
| <div style="text-align:center; padding:60px; background:#fff; border-radius:16px; box-shadow:0 2px 12px rgba(0,0,0,0.07);"> | ||
| <p style="font-size:1.2rem; color:#999;">No feedback submitted yet.</p> | ||
| </div> | ||
| {% endif %} | ||
| </div> | ||
|
|
||
| {% endblock %} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,102 @@ | ||
| {% extends "base.html" %} | ||
| {% block content %} | ||
|
|
||
| <div style="max-width: 680px; margin: 60px auto; padding: 0 20px;"> | ||
|
|
||
| {% with messages = get_flashed_messages(with_categories=true) %} | ||
| {% if messages %} | ||
| {% for category, message in messages %} | ||
| <div style=" | ||
| padding: 14px 18px; | ||
| margin-bottom: 20px; | ||
| border-radius: 10px; | ||
| font-weight: 500; | ||
| background: {{ '#d4edda' if category == 'success' else '#f8d7da' }}; | ||
| color: {{ '#155724' if category == 'success' else '#721c24' }}; | ||
| border: 1px solid {{ '#c3e6cb' if category == 'success' else '#f5c6cb' }}; | ||
| ">{{ message }}</div> | ||
| {% endfor %} | ||
| {% endif %} | ||
| {% endwith %} | ||
|
|
||
| <div style="background:#fff; border-radius:16px; box-shadow:0 4px 24px rgba(0,0,0,0.08); padding:40px;"> | ||
| <h2 style="margin:0 0 6px; font-size:1.8rem; color:#1a1a2e;">Share Your Feedback</h2> | ||
| <p style="margin:0 0 28px; color:#666;">Help us improve the Achievement Management System.</p> | ||
|
|
||
| <form method="POST" action="/feedback"> | ||
|
|
||
| <div style="margin-bottom:20px;"> | ||
| <label style="display:block; font-weight:600; margin-bottom:8px; color:#333;">I am a <span style="color:red">*</span></label> | ||
| <div style="display:flex; gap:12px;"> | ||
| {% for role in ['Student', 'Teacher'] %} | ||
| <label style="flex:1; display:flex; align-items:center; gap:10px; padding:12px 16px; border:2px solid #e0e0e0; border-radius:10px; cursor:pointer; font-weight:500;"> | ||
| <input type="radio" name="role" value="{{ role }}" required style="accent-color:#4f46e5; width:18px; height:18px;"> | ||
| {{ role }} | ||
| </label> | ||
| {% endfor %} | ||
| </div> | ||
| </div> | ||
|
|
||
| <div style="margin-bottom:20px;"> | ||
| <label style="display:block; font-weight:600; margin-bottom:8px; color:#333;">Name <span style="color:#999; font-weight:400;">(optional)</span></label> | ||
| <input type="text" name="name" placeholder="Your name" style="width:100%; padding:12px 14px; border:2px solid #e0e0e0; border-radius:10px; font-size:1rem; box-sizing:border-box; outline:none;" onfocus="this.style.borderColor='#4f46e5'" onblur="this.style.borderColor='#e0e0e0'"> | ||
| </div> | ||
|
|
||
| <div style="margin-bottom:20px;"> | ||
| <label style="display:block; font-weight:600; margin-bottom:8px; color:#333;">Email <span style="color:#999; font-weight:400;">(optional, for follow-up)</span></label> | ||
| <input type="email" name="email" placeholder="your@email.com" style="width:100%; padding:12px 14px; border:2px solid #e0e0e0; border-radius:10px; font-size:1rem; box-sizing:border-box; outline:none;" onfocus="this.style.borderColor='#4f46e5'" onblur="this.style.borderColor='#e0e0e0'"> | ||
| </div> | ||
|
|
||
| <div style="margin-bottom:20px;"> | ||
| <label style="display:block; font-weight:600; margin-bottom:8px; color:#333;">Feedback Type <span style="color:red">*</span></label> | ||
| <select name="feedback_type" required style="width:100%; padding:12px 14px; border:2px solid #e0e0e0; border-radius:10px; font-size:1rem; box-sizing:border-box; background:#fff; outline:none;" onfocus="this.style.borderColor='#4f46e5'" onblur="this.style.borderColor='#e0e0e0'"> | ||
| <option value="" disabled selected>Select a type</option> | ||
| <option value="Bug Report">🐛 Bug Report</option> | ||
| <option value="Feature Request">✨ Feature Request</option> | ||
| <option value="General Feedback">💬 General Feedback</option> | ||
| <option value="Academic Concern">📚 Academic Concern</option> | ||
| </select> | ||
| </div> | ||
|
|
||
| <div style="margin-bottom:20px;"> | ||
| <label style="display:block; font-weight:600; margin-bottom:8px; color:#333;">Message / Suggestion <span style="color:red">*</span></label> | ||
| <textarea name="message" rows="5" placeholder="Describe your feedback in detail..." required style="width:100%; padding:12px 14px; border:2px solid #e0e0e0; border-radius:10px; font-size:1rem; box-sizing:border-box; resize:vertical; outline:none;" onfocus="this.style.borderColor='#4f46e5'" onblur="this.style.borderColor='#e0e0e0'"></textarea> | ||
| </div> | ||
|
|
||
| <div style="margin-bottom:28px;"> | ||
| <label style="display:block; font-weight:600; margin-bottom:8px; color:#333;">Overall Experience (1–5)</label> | ||
| <div style="display:flex; gap:8px;" id="star-rating"> | ||
| {% for i in range(1, 6) %} | ||
| <label style="cursor:pointer; font-size:2rem; color:#ccc;" class="star-label"> | ||
| <input type="radio" name="rating" value="{{ i }}" style="display:none;" class="star-input">★ | ||
| </label> | ||
| {% endfor %} | ||
| </div> | ||
| </div> | ||
|
|
||
| <button type="submit" style="width:100%; padding:14px; background:linear-gradient(135deg,#4f46e5,#7c3aed); color:#fff; border:none; border-radius:10px; font-size:1rem; font-weight:600; cursor:pointer;"> | ||
| Submit Feedback | ||
| </button> | ||
|
|
||
| </form> | ||
| </div> | ||
| </div> | ||
|
|
||
| <script> | ||
| const stars = document.querySelectorAll('.star-label'); | ||
| stars.forEach((star, index) => { | ||
| star.addEventListener('mouseover', () => { | ||
| stars.forEach((s, i) => s.style.color = i <= index ? '#f59e0b' : '#ccc'); | ||
| }); | ||
| star.addEventListener('mouseout', () => { | ||
| const checked = document.querySelector('.star-input:checked'); | ||
| const checkedIndex = checked ? parseInt(checked.value) - 1 : -1; | ||
| stars.forEach((s, i) => s.style.color = i <= checkedIndex ? '#f59e0b' : '#ccc'); | ||
| }); | ||
| star.addEventListener('click', () => { | ||
| stars.forEach((s, i) => s.style.color = i <= index ? '#f59e0b' : '#ccc'); | ||
| }); | ||
| }); | ||
| </script> | ||
|
|
||
| {% endblock %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
app.py's admin login (line 870) sets session["logged_in"] and session["admin_id"], never session["admin_logged_in"]. The admin_feedback route checks session.get("admin_logged_in") != True — a key that is never set — so every admin request is redirected to admin_login, making the page permanently inaccessible.
Prompt to fix with AI