Create team sub-pages to separate a summary, full events list, and about page info

This commit is contained in:
Michael Hall 2018-07-15 12:48:27 -04:00
parent bd1fb3e222
commit ad27342d97
7 changed files with 179 additions and 152 deletions

View file

@ -110,4 +110,35 @@ ul.errorlist li {
font-size: 2em;
font-weight: bold;
text-shadow: 2px 2px #444;
}
}
.btn-default {
color: #fff;
background-color: #848484;
border-color: #757575;
}
.btn-default:hover {
color: #292b2c;
background-color: #e6e6e6;
border-color: #adadad;
}
.btn-default:focus, .btn-default.focus {
-webkit-box-shadow: 0 0 0 2px rgba(204, 204, 204, 0.5);
box-shadow: 0 0 0 2px rgba(204, 204, 204, 0.5);
}
.btn-default.disabled, .btn-default:disabled {
color: #e6e6e6;
background-color: #b3b3b3;
border-color: #adadad;
}
.btn-secondary:active, .btn-secondary.active,
.show > .btn-secondary.dropdown-toggle {
color: #292b2c;
background-color: #e6e6e6;
background-image: none;
border-color: #adadad;
}

View file

@ -1,91 +1,12 @@
{% extends "get_together/base.html" %}
{% extends "get_together/teams/team_page_base.html" %}
{% load static markup tz %}
{% block add_to_title %} | {{team.name}}{% endblock %}
{% block about-button %}btn-default{% endblock %}
{% block styles %}
<style>
.gt-profile {
position: relative;
}
.gt-profile .gt-profile-badges {
position: absolute;
top: 16px;
left: 6px;
}
</style>
{% endblock %}
{% block content %}
<div class="fluid-container">
<div class="row">
<div class="col-sm-9">
{% if team.banner_img %}
<div class="team-banner">
<img class="card-img-top" src="{{ team.banner_img.url }}" alt="{{team.name}}'s cover image" height="200px" width="825px">
<h2 class="team-title">Welcome to {{ team.name }}</h2>
</div>
{% else %}
<h2>About {{ team.name }}</h2>
{% endif %}
{% if can_edit_team %}
<a href="{% url 'edit-team' team.id %}" class="btn btn-secondary btn-sm"><i class="fa fa-pencil"></i> Edit Team</a>
<a href="{% url 'manage-members' team.id %}" class="btn btn-secondary btn-sm"><i class="fa fa-users"></i> Manage Members</a>
{% endif %}
{% if is_member %}
{% if not team.owner_profile == request.user.profile %}<a href="{% url 'leave-team' team.id %}" class="btn btn-danger btn-sm">Leave Team</a>{% endif %}
{% else %}
<a href="{% url 'join-team' team.id %}" class="btn btn-success btn-sm">Join Team</a>
{% endif %}
<hr/>
<table >
{% if team.description %}
<tr>
<td colspan="2"><p>{{ team.description|markdown }}</p></td>
</tr>
{% endif %}
{% if team.organization %}
<tr>
<td width="120px"><b>Organization:</b></td><td><a href="{% url 'show-org' team.organization.slug %}">{{ team.organization.name }}</a></td>
</tr>
{% endif %}
{% if team.web_url %}
<tr>
<td width="120px"><b>Website:</b></td><td><a href="{{ team.web_url }}" target="_blank">{{ team.web_url }}</a></td>
</tr>
{% endif %}
<tr>
<td width="120px"><b>Events:</b></td><td><a href="{% url 'show-team-by-slug' team.slug %}">Return to Events</a></td>
</tr>
</table>
<hr/>
{% block page_content %}
<div class="container">
{{ team.about_page|markdown }}
</div>
<br/>
</div>
<div class="col-sm-3">
<div class="container">
<h4>Members</h4><hr/>
{% for member in member_list %}
<div class="row mb-3">
<div class="col media gt-profile">
<img class="mr-1 gt-profile-avatar" src="{{member.user.avatar_url}}" width="32px" height="32px">
<span class="gt-profile-badges">{% for badge in member.user.user.account.badges.all %}<img class="mr-0 gt-profile-badge" src="{{badge.img_url}}" title="{{badge.name}}" width="16px" height="16px">{% endfor %}</span>
<div class="media-body">
<h6 class="mt-0 mb-0"><a href="{% url 'show-profile' member.user.id %}" title="{{member.user}}'s profile">{{member.user}}</a></h6>
{% if member.role > 0 %}<small class="text-muted">{{ member.role_name }}</small>{% endif %}
</div>
</div>
</div>
{% endfor %}
</div>
</div>
</div>
</div>
{% endblock %}

View file

@ -1,47 +1,9 @@
{% extends "get_together/base.html" %}
{% extends "get_together/teams/team_page_base.html" %}
{% load static markup tz %}
{% block add_to_title %} | {{team.name}}{% endblock %}
{% block summary-button %}btn-default{% endblock %}
{% block styles %}
<style>
.gt-profile {
position: relative;
}
.gt-profile .gt-profile-badges {
position: absolute;
top: 16px;
left: 6px;
}
</style>
{% endblock %}
{% block content %}
<div class="fluid-container">
<div class="row">
<div class="col-md-9">
{% if team.banner_img %}
<div class="team-banner">
<img class="card-img-top" src="{{ team.banner_img.url }}" alt="{{team.name}}'s cover image" height="200px" width="825px">
<h2 class="team-title">Welcome to {{ team.name }}</h2>
</div>
{% else %}
<h2>Welcome to {{ team.name }}</h2>
{% endif %}
{% if can_edit_team %}
<a href="{% url 'edit-team' team.id %}" class="btn btn-secondary btn-sm"><i class="fa fa-pencil"></i> Edit Team</a>
<a href="{% url 'manage-members' team.id %}" class="btn btn-secondary btn-sm"><i class="fa fa-users"></i> Manage Members</a>
{% endif %}
{% if is_member %}
{% if not team.owner_profile == request.user.profile %}<a href="{% url 'leave-team' team.id %}?csrftoken={{csrf_token}}" class="btn btn-danger btn-sm">Leave Team</a>{% endif %}
{% else %}
<a href="{% url 'join-team' team.id %}?csrftoken={{csrf_token}}" class="btn btn-success btn-sm">Join Team</a>
{% endif %}
<hr/>
<div class="container">
{% block page_content %}
{% if team.description %}
<div class="row">
<div class="col-md-9"><p>{{ team.description|markdown }}</p></div>
@ -57,12 +19,7 @@
<div class="col-md-3"><b>Website:</b></div><div class="col-md-6"><a href="{{ team.web_url }}" target="_blank">{{ team.web_url }}</a></div>
</div>
{% endif %}
{% if team.about_page %}
<div class="row">
<div class="col-md-3"><b>About:</b></div><div class="col-md-6"><a href="{% url 'show-team-about-by-slug' team.slug %}">Learn More about {{ team.name }}</a></div>
</div>
{% endif %}
</div>
<hr/>
<h4>Upcoming Events
@ -79,7 +36,7 @@
{% if can_create_event %}
<div class="row">
<div class="col">
<br/><a href="{% url 'create-event' team.id %}" class="btn btn-success"><i class="fa fa-calendar-plus-o"></i> Plan a Get Together</a>
<br/><a href="{% url 'create-event' team.id %}" class="btn btn-success"><i class="fa fa-calendar-plus-o"></i> Host a Get Together</a>
</div>
</div>
{% endif %}
@ -99,26 +56,5 @@
</div>
<br/>
{% endif %}
</div>
<div class="col-sm-3">
<div class="container">
<h4>Members</h4><hr/>
{% for member in member_list %}
<div class="row mb-3">
<div class="col media gt-profile">
<img class="mr-1 gt-profile-avatar" src="{{member.user.avatar_url}}" width="32px" height="32px">
<span class="gt-profile-badges">{% for badge in member.user.user.account.badges.all %}<img class="mr-0 gt-profile-badge" src="{{badge.img_url}}" title="{{badge.name}}" width="16px" height="16px">{% endfor %}</span>
<div class="media-body">
<h6 class="mt-0 mb-0"><a href="{% url 'show-profile' member.user.id %}" title="{{member.user}}'s profile">{{member.user}}</a></h6>
{% if member.role > 0 %}<small class="text-muted">{{ member.role_name }}</small>{% endif %}
</div>
</div>
</div>
{% endfor %}
</div>
</div>
</div>
</div>
{% endblock %}

View file

@ -0,0 +1,42 @@
{% extends "get_together/teams/team_page_base.html" %}
{% load static markup tz %}
{% block events-button %}btn-default{% endblock %}
{% block page_content %}
{% if can_create_event %}
<div class="row mt-3 mb-3">
<div class="col">
<a href="{% url 'create-event' team.id %}" class="btn btn-success"><i class="fa fa-calendar-plus-o"></i> Host a Get Together</a>
</div>
</div>
{% endif %}
<h4>Upcoming Events
<small><a href="{% url 'team-event-ical' team.id %}" class="fa fa-calendar" title="iCal"></a></small>
</h4>
<div class="container">
{% for event in upcoming_events %}
<div class="row{% if event.status == event.CANCELED %} text-muted{% endif %}">
<div class="col">{% if event.status == event.CANCELED %}<del>{% endif %}<a href="{{ event.get_absolute_url }}">{{event.name}}</a>{% if event.status == event.CANCELED %}</del> (Canceled){% endif %}</div>
<div class="col">{{ event.place }}</div>
<div class="col">{{ event.local_start_time }}</div>
</div>
{% endfor %}
</div>
<br/>
{% if recent_events %}
<h4>Past Events</h4>
<div class="container">
{% for event in recent_events %}
<div class="row">
<div class="col"><a href="{{ event.get_absolute_url }}">{{event.name}}</a></div>
<div class="col">{{ event.place }}</div>
<div class="col">{{ event.local_start_time }}</div>
</div>
{% endfor %}
</div>
<br/>
{% endif %}
{% endblock %}

View file

@ -0,0 +1,80 @@
{% extends "get_together/base.html" %}
{% load static markup tz %}
{% block add_to_title %} | {{team.name}}{% endblock %}
{% block styles %}
<style>
.gt-profile {
position: relative;
}
.gt-profile .gt-profile-badges {
position: absolute;
top: 16px;
left: 6px;
}
</style>
{% endblock %}
{% block content %}
<div class="fluid-container">
<div class="row">
<div class="col-md-9">
{% if can_edit_team %}
<div id="admin_buttons" class="mb-2">
<a href="{% url 'edit-team' team.id %}" class="btn btn-secondary btn-sm"><i class="fa fa-pencil"></i> Edit Team</a>
<a href="{% url 'manage-members' team.id %}" class="btn btn-secondary btn-sm"><i class="fa fa-users"></i> Manage Members</a>
</div>
{% endif %}
{% if team.banner_img %}
<div class="team-banner">
<img class="card-img-top" src="{{ team.banner_img.url }}" alt="{{team.name}}'s cover image" height="200px" width="825px">
<h2 class="team-title">Welcome to {{ team.name }}</h2>
</div>
{% else %}
<h2>Welcome to {{ team.name }}</h2>
{% endif %}
<div class="mb-2">
<div id="team_buttons" class="btn-group" role="group">
<a href="{% url 'show-team-by-slug' team.slug %}" class="btn {% block summary-button %}btn-secondary{% endblock %} btn-sm">Summary</a>
<a href="{% url 'show-team-events-by-slug' team.slug %}" class="btn {% block events-button %}btn-secondary{% endblock %} btn-sm">Events</a>
{% if team.about_page %}
<a class="btn {% block about-button %}btn-secondary{% endblock %} btn-sm" href="{% url 'show-team-about-by-slug' team.slug %}">About</a>
{% endif %}
</div>
{% if is_member %}
{% if not team.owner_profile == request.user.profile %}<a href="{% url 'leave-team' team.id %}?csrftoken={{csrf_token}}" class="btn btn-danger btn-sm">Leave Team</a>{% endif %}
{% else %}
<a href="{% url 'join-team' team.id %}?csrftoken={{csrf_token}}" class="btn btn-success btn-sm">Join Team</a>
{% endif %}
</div>
<div class="container">
{% block page_content %}{% endblock %}
</div>
</div>
<div class="col-sm-3">
<div class="container">
<h4>Members</h4><hr/>
{% for member in member_list %}
<div class="row mb-3">
<div class="col media gt-profile">
<img class="mr-1 gt-profile-avatar" src="{{member.user.avatar_url}}" width="32px" height="32px">
<span class="gt-profile-badges">{% for badge in member.user.user.account.badges.all %}<img class="mr-0 gt-profile-badge" src="{{badge.img_url}}" title="{{badge.name}}" width="16px" height="16px">{% endfor %}</span>
<div class="media-body">
<h6 class="mt-0 mb-0"><a href="{% url 'show-profile' member.user.id %}" title="{{member.user}}'s profile">{{member.user}}</a></h6>
{% if member.role > 0 %}<small class="text-muted">{{ member.role_name }}</small>{% endif %}
</div>
</div>
</div>
{% endfor %}
</div>
</div>
</div>
</div>
{% endblock %}

View file

@ -116,6 +116,7 @@ urlpatterns = [
path('<str:team_slug>/', views.show_team_by_slug, name='show-team-by-slug'),
path('<str:team_slug>/about/', views.show_team_about_by_slug, name='show-team-about-by-slug'),
path('<str:team_slug>/events/', views.show_team_events_by_slug, name='show-team-events-by-slug'),
]
if settings.DEBUG:
urlpatterns = urlpatterns + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)

View file

@ -67,6 +67,22 @@ def show_team(request, team):
}
return render(request, 'get_together/teams/show_team.html', context)
def show_team_events_by_slug(request, team_slug):
team = get_object_or_404(Team, slug=team_slug)
upcoming_events = Event.objects.filter(team=team, end_time__gt=datetime.datetime.now()).order_by('start_time')
recent_events = Event.objects.filter(team=team, end_time__lte=datetime.datetime.now()).order_by('-start_time')
context = {
'team': team,
'upcoming_events': upcoming_events,
'recent_events': recent_events,
'is_member': request.user.profile in team.members.all(),
'member_list': Member.objects.filter(team=team).order_by('-role', 'joined_date'),
'can_create_event': request.user.profile.can_create_event(team),
'can_edit_team': request.user.profile.can_edit_team(team),
}
return render(request, 'get_together/teams/team_events.html', context)
def show_team_about_by_slug(request, team_slug):
team = get_object_or_404(Team, slug=team_slug)
if team.about_page: