Skip to content

Commit e8345bc

Browse files
Redesign course UI with Tailwind
1 parent 747d609 commit e8345bc

47 files changed

Lines changed: 1695 additions & 5052 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 4 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,4 @@
1-
{% extends 'base.html' %}
2-
3-
{% block title %}Login - Course Management{% endblock %}
4-
5-
{% block content %}
6-
<div class="row justify-content-center">
7-
<div class="col-md-6">
8-
<div class="card">
9-
<div class="card-header text-center">
10-
<h3><i class="fas fa-sign-in-alt"></i> Sign In</h3>
11-
<p class="text-muted">Choose your preferred login method</p>
12-
</div>
13-
<div class="card-body">
14-
{% for provider in providers %}
15-
<a href="{{ provider.login_url }}" class="btn btn-outline-primary btn-block mb-3">
16-
{% if 'Google' in provider.name %}
17-
<i class="fab fa-google text-danger"></i>
18-
{% elif 'GitHub' in provider.name %}
19-
<i class="fab fa-github text-dark"></i>
20-
{% elif 'Slack' in provider.name %}
21-
<i class="fab fa-slack text-info"></i>
22-
{% else %}
23-
<i class="fas fa-sign-in-alt"></i>
24-
{% endif %}
25-
Continue with {{ provider.name }}
26-
</a>
27-
{% empty %}
28-
<div class="alert alert-warning text-center">
29-
<i class="fas fa-exclamation-triangle"></i>
30-
<strong>No login providers configured</strong><br>
31-
Please contact an administrator to set up social login.
32-
</div>
33-
{% endfor %}
34-
</div>
35-
{% if providers %}
36-
<div class="card-footer text-center">
37-
<small class="text-muted">
38-
<i class="fas fa-shield-alt"></i>
39-
Secure login - we never store your social media passwords
40-
</small>
41-
</div>
42-
{% endif %}
43-
</div>
44-
</div>
45-
</div>
46-
{% endblock %}
1+
{% extends 'base.html' %} {% block title %}Login - Course Management{% endblock %} {% block content %}
2+
<section class="mx-auto max-w-md"> <div class="rounded-md border app-border app-surface "> <div class="border-b app-border app-surface-muted px-5 py-4 text-center "> <h1 class="text-2xl font-semibold app-heading"><i class="fas fa-sign-in-alt"></i> Sign In</h1> <p class="mt-1 text-sm app-muted">Choose your preferred login method</p> </div> <div class="space-y-3 px-5 py-5"> {% for provider in providers %} <a href="{{ provider.login_url }}" class="primer-button primer-button-secondary w-full justify-center"> {% if 'Google' in provider.name %} <i class="fab fa-google text-danger"></i> {% elif 'GitHub' in provider.name %} <i class="fab fa-github text-dark"></i> {% elif 'Slack' in provider.name %} <i class="fab fa-slack text-info"></i> {% else %} <i class="fas fa-sign-in-alt"></i> {% endif %} Continue with {{ provider.name }} </a> {% empty %} <div class="rounded-md border app-alert-warning px-4 py-3 text-center text-sm "> <i class="fas fa-exclamation-triangle"></i> <strong>No login providers configured</strong><br> Please contact an administrator to set up social login. </div> <a href="{% url 'course_list' %}" class="primer-button primer-button-secondary w-full justify-center">Back to courses</a> {% endfor %} </div> {% if providers %} <div class="border-t app-border px-5 py-3 text-center text-xs app-muted "> <i class="fas fa-shield-alt"></i> Secure login - we never store your social media passwords </div> {% endif %} </div>
3+
</section>
4+
{% endblock %}

add_more_test_data.py

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,3 +279,53 @@ def create_answers_for_student(submission):
279279

280280
p1.peer_review_due_date = timezone.now()
281281
score_project(p1)
282+
283+
284+
# Create homeworks with varied upcoming deadlines to test "time left" display
285+
upcoming_hw_data = [
286+
("upcoming-hw-urgent", "Upcoming HW: Urgent (6h left)", timedelta(hours=6), HomeworkState.OPEN.value),
287+
("upcoming-hw-soon", "Upcoming HW: Soon (2.5 days left)", timedelta(days=2, hours=12), HomeworkState.OPEN.value),
288+
("upcoming-hw-normal", "Upcoming HW: Normal (7 days left)", timedelta(days=7), HomeworkState.OPEN.value),
289+
("upcoming-hw-later", "Upcoming HW: Later (14 days left)", timedelta(days=14), HomeworkState.OPEN.value),
290+
]
291+
292+
for slug, title, delta, state in upcoming_hw_data:
293+
hw, created = Homework.objects.get_or_create(
294+
course=course,
295+
slug=slug,
296+
defaults={
297+
"title": title,
298+
"description": f"Test homework to verify time-left display.",
299+
"due_date": timezone.now() + delta,
300+
"state": state,
301+
},
302+
)
303+
if created:
304+
Question.objects.create(
305+
homework=hw,
306+
text="Sample question?",
307+
question_type=QuestionTypes.FREE_FORM.value,
308+
answer_type=AnswerTypes.ANY.value,
309+
correct_answer="answer",
310+
)
311+
print(f"Created homework: {title}")
312+
313+
# Create projects with upcoming deadlines
314+
upcoming_proj_data = [
315+
("upcoming-proj-urgent", "Upcoming Project: Urgent (2h left)", timedelta(hours=2), timedelta(days=5)),
316+
("upcoming-proj-normal", "Upcoming Project: Normal (10 days left)", timedelta(days=10), timedelta(days=17)),
317+
]
318+
319+
for slug, title, sub_delta, pr_delta in upcoming_proj_data:
320+
proj, _ = Project.objects.get_or_create(
321+
course=course,
322+
slug=slug,
323+
defaults={
324+
"title": title,
325+
"description": "Test project to verify time-left display.",
326+
"submission_due_date": timezone.now() + sub_delta,
327+
"peer_review_due_date": timezone.now() + pr_delta,
328+
"state": ProjectState.COLLECTING_SUBMISSIONS.value,
329+
},
330+
)
331+
print(f"Created project: {title}")

cadmin/templates/cadmin/base.html

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,9 @@
1-
{% extends 'base.html' %}
2-
3-
{% block content %}
1+
{% extends 'base.html' %} {% block body_class %}cadmin-page{% endblock %} {% block content %}
42
{% if messages %}
5-
<div class="messages">
6-
{% for message in messages %}
7-
<div class="alert {% if message.tags %}alert-{{ message.tags }}{% else %}alert-info{% endif %} alert-dismissible fade show" role="alert">
8-
{{ message }}
9-
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
10-
<span aria-hidden="true">&times;</span>
11-
</button>
12-
</div>
13-
{% endfor %}
3+
<div class="space-y-3"> {% for message in messages %} <div class="rounded-md border app-alert-warning px-4 py-3 text-sm " role="alert"> <div class="flex items-start justify-between gap-3"> <span>{{ message }}</span> <button type="button" class="text-lg leading-none opacity-70 hover:opacity-100" data-dismiss="alert" aria-label="Close">&times;</button> </div> </div> {% endfor %}
144
</div>
15-
{% endif %}
16-
5+
{% endif %} <div class="cadmin-shell">
176
{% block cadmin_content %}
187
{% endblock %}
8+
</div>
199
{% endblock %}

0 commit comments

Comments
 (0)