-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
allow students to view activity info, including when an activity is s…
…cheduled by clicking on the name of the activity in the details
- Loading branch information
Showing
5 changed files
with
180 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# -*- coding: utf-8 -*- | ||
from __future__ import unicode_literals | ||
|
||
import logging | ||
from django import http | ||
from django.contrib.auth.decorators import login_required | ||
from django.shortcuts import render, redirect, get_object_or_404 | ||
from ....utils.serialization import safe_json | ||
from ...users.models import User | ||
from ..exceptions import SignupException | ||
from ..models import ( | ||
EighthBlock, EighthSignup, EighthScheduledActivity, EighthActivity | ||
) | ||
from ..serializers import EighthBlockDetailSerializer | ||
|
||
|
||
logger = logging.getLogger(__name__) | ||
|
||
@login_required | ||
def activity_view(request, activity_id=None): | ||
activity = get_object_or_404(EighthActivity, id=activity_id) | ||
|
||
first_block = EighthBlock.objects.get_first_upcoming_block() | ||
|
||
scheduled_activities = EighthScheduledActivity.objects.filter( | ||
activity=activity | ||
) | ||
|
||
if first_block: | ||
scheduled_activities = scheduled_activities.filter(block__date__gte=first_block.date) | ||
|
||
context = { | ||
"activity": activity, | ||
"scheduled_activities": scheduled_activities | ||
} | ||
|
||
return render(request, "eighth/activity.html", context) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
{% extends "page_with_nav.html" %} | ||
{% load phone_numbers %} | ||
{% load staticfiles %} | ||
|
||
{% block title %}{{ block.super }} - Activity: {{ activity }}{% endblock %} | ||
|
||
|
||
{% block css %} | ||
{{ block.super }} | ||
<link rel="stylesheet" type="text/css" href="{% static 'css/eighth.common.css' %}" /> | ||
<link rel="stylesheet" type="text/css" href="{% static 'css/eighth.admin.css' %}" /> | ||
<link rel="stylesheet" type="text/css" href="{% static 'css/profile.css' %}" /> | ||
<link rel="stylesheet" type="text/css" href="{% static 'css/eighth.profile.css' %}" /> | ||
<style type="text/css"> | ||
dl dt, dl dd { | ||
font-size: 15px; | ||
} | ||
|
||
dl dt { | ||
float: left; | ||
padding-right: 5px; | ||
} | ||
</style> | ||
{% endblock %} | ||
|
||
{% block js %} | ||
{{ block.super }} | ||
{% endblock %} | ||
|
||
{% block main %} | ||
<div class="primary-content"> | ||
|
||
{% if request.user.is_eighth_admin %} | ||
<div class="eighth-header" style="width: 200px"> | ||
{% include "eighth/admin/start_date.html" %} | ||
</div> | ||
{% endif %} | ||
|
||
|
||
<a href="{% url 'eighth_signup' %}" class="button"> | ||
<i class="fa fa-arrow-left"></i> Sign Up | ||
</a> | ||
|
||
<h2>Activity: {{ activity }}</h2> | ||
<dl> | ||
{% if activity.description %} | ||
<dt>Description:</dt> | ||
<dd style="width: 400px">{{ scheduled_activity.activity.description }}</dd> | ||
{% endif %} | ||
<dd>{{ activity.description }}</dd> | ||
<dt>Default Sponsors:</dt> | ||
<dd>{% for sponsor in activity.sponsors.all %} | ||
{{ sponsor.name }}{% if not forloop.last %}, {% endif %} | ||
{% empty %} | ||
None | ||
{% endfor %}</dd> | ||
|
||
<dt>Default Rooms:</dt> | ||
<dd>{% for sponsor in activity.rooms.all %} | ||
{{ room }}{% if not forloop.last %}, {% endif %} | ||
{% empty %} | ||
None | ||
{% endfor %}</dd> | ||
|
||
</dl> | ||
|
||
<section class="user-info-eighth sponsor"> | ||
<h3>Scheduled on:</h3> | ||
<table class="fancy-table"> | ||
<thead> | ||
<tr> | ||
<th>Block</th> | ||
<th>Name</th> | ||
<th>Sponsors</th> | ||
<th>Rooms</th> | ||
<th></th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{% for sch in scheduled_activities %} | ||
<tr> | ||
<th> | ||
<a href="{% url 'eighth_signup' sch.block.id %}"> | ||
{{ sch.block }} | ||
</a> | ||
</th> | ||
<td> | ||
{{ sch.full_title }} | ||
</td> | ||
<td> | ||
{% for sponsor in sch.get_true_sponsors %} | ||
{{ sponsor.name }}{% if not forloop.last %}, {% endif %} | ||
{% empty %} | ||
None | ||
{% endfor %} | ||
</td> | ||
|
||
<td> | ||
{% for room in sch.get_true_rooms %} | ||
{{ room }}{% if not forloop.last %}, {% endif %} | ||
{% empty %} | ||
None | ||
{% endfor %} | ||
</td> | ||
<td> | ||
<a class="button" href="{% url 'eighth_signup' sch.block.id %}?activity={{ sch.activity.id }}"> | ||
Sign Up | ||
</a> | ||
</td> | ||
</tr> | ||
{% empty %} | ||
<tr> | ||
<td> | ||
This activity is not scheduled over the next two months. | ||
</td> | ||
</tr> | ||
{% endfor %} | ||
</tbody> | ||
</table> | ||
</section> | ||
|
||
|
||
</div> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters