Merging benjaomings work on team guides.

This commit is contained in:
Víðir Valberg Guðmundsson 2019-03-12 11:13:13 +01:00
parent c51771be6b
commit 0a3c71337e
7 changed files with 42 additions and 25 deletions

View file

@ -1,6 +1,4 @@
# -*- coding: utf-8 -*- # Generated by Django 2.1.5 on 2019-03-12 10:00
# Generated by Django 1.10.5 on 2017-11-25 21:32
from __future__ import unicode_literals
from django.db import migrations, models from django.db import migrations, models
@ -8,7 +6,7 @@ from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):
dependencies = [ dependencies = [
('teams', '0018_auto_20171122_2204'), ('teams', '0049_auto_20180815_1119'),
] ]
operations = [ operations = [

View file

@ -15,23 +15,23 @@ logger = logging.getLogger("bornhack.%s" % __name__)
TEAM_GUIDE_TEMPLATE=""" TEAM_GUIDE_TEMPLATE="""
# Preparations ## Preparations
... ...
# Camp setup ## Camp setup
... ...
# During camp ## During camp
... ...
# Takedown ## Takedown
... ...
# Notes for next year ## Notes for next year
1. Remember to take notes 1. Remember to take notes
1. ... 1. ...

View file

@ -1,24 +1,36 @@
{% extends 'base.html' %} {% extends 'team_base.html' %}
{% load commonmark %} {% load commonmark %}
{% block title %} {% block title %}
Guide for: {{ team.name }} | {{ block.super }} Guide for: {{ team.name }} | {{ block.super }}
{% endblock %} {% endblock %}
{% block content %} {% block team_content %}
<h1 class="page-header">Guide / Howto for {{ team.name }}</h1>
<div class="panel panel-default">
<div class="panel-heading clearfix">
<h4 class="pull-left">
Guide / Howto for {{ team.name }}
</h4>
<a href="{% url 'teams:guide_print' camp_slug=camp.slug team_slug=team.slug %}"
class="btn btn-default pull-right"
target="_blank">
Print
</a>
</div>
<div class="panel-body">
<p> <p>
<a href="{% url 'teams:guide_print' camp_slug=camp.slug team_slug=team.slug %}" class="btn btn-default" target="_blank">Print</a>
{% if request.user in team.responsible.all %} {% if request.user in team.responsible.all %}
<a href="{% url 'teams:manage' camp_slug=camp.slug team_slug=team.slug %}" class="btn btn-warning">Edit</a> <a href="{% url 'teams:manage' camp_slug=camp.slug team_slug=team.slug %}" class="btn btn-warning">Edit</a>
{% endif %} {% endif %}
</p> </p>
<div class="team-guide-markdown"> <div class="team-guide-markdown">
{{ team.guide|unsafecommonmark }} {{ team.guide|untrustedcommonmark }}
</div> </div>
</div>
</div>
{% endblock %} {% endblock %}

View file

@ -1,10 +1,11 @@
<html>{% load commonmark %} {% load commonmark %}
<html>
<head> <head>
<title>{{ team.name }}</title> <title>{{ team.name }}</title>
</head> </head>
<body onload="window.print()"> <body onload="window.print()">
{{ team.guide|unsafecommonmark }} {{ team.guide|untrustedcommonmark }}
</body> </body>
</html> </html>

View file

@ -40,6 +40,11 @@ from teams.views.shifts import (
UserShifts, UserShifts,
) )
from teams.views.guide import (
TeamGuideView,
TeamGuidePrintView
)
app_name = 'teams' app_name = 'teams'
urlpatterns = [ urlpatterns = [

View file

@ -46,7 +46,7 @@ class TeamManageView(CampViewMixin, EnsureTeamResponsibleMixin, UpdateView):
fields = ['description', 'needs_members', 'public_irc_channel_name', fields = ['description', 'needs_members', 'public_irc_channel_name',
'public_irc_channel_bot', 'public_irc_channel_managed', 'public_irc_channel_bot', 'public_irc_channel_managed',
'private_irc_channel_name', 'private_irc_channel_bot', 'private_irc_channel_name', 'private_irc_channel_bot',
'private_irc_channel_managed'] 'private_irc_channel_managed', 'guide']
slug_url_kwarg = 'team_slug' slug_url_kwarg = 'team_slug'
def get_success_url(self): def get_success_url(self):

View file

@ -3,7 +3,7 @@ from django.views.generic import ListView, DetailView
from camps.mixins import CampViewMixin from camps.mixins import CampViewMixin
from .models import Team from ..models import Team
class TeamGuideView(LoginRequiredMixin, CampViewMixin, DetailView): class TeamGuideView(LoginRequiredMixin, CampViewMixin, DetailView):
@ -11,6 +11,7 @@ class TeamGuideView(LoginRequiredMixin, CampViewMixin, DetailView):
context_object_name = 'team' context_object_name = 'team'
model = Team model = Team
slug_url_kwarg = 'team_slug' slug_url_kwarg = 'team_slug'
active_menu = 'guide'
def get_queryset(self): def get_queryset(self):
qs = CampViewMixin.get_queryset(self) qs = CampViewMixin.get_queryset(self)