diff --git a/quest/jinja2/quest/quest_homepage.html b/quest/jinja2/quest/quest_homepage.html new file mode 100644 index 0000000..4246f71 --- /dev/null +++ b/quest/jinja2/quest/quest_homepage.html @@ -0,0 +1,89 @@ +{% extends "base.html" %} +{% block title %}{{ quest.title }}: Home{% endblock %} +{% block head %} + +{% endblock %} +{% block header %} +{% if request.user == quest.owner %} + Edit Quest + + + +{% endif %} + + + + {% if quest.live %} + + LIVE + + {% else %} + {% if quest.live_time %} + + Live in: ({{ localtime(quest.live_time).strftime('%Y-%m-%d %H:%M') }}) + + {% endif %} + {% endif %} + {% if request.session.get("hide_chat") == True %}←{% else %}→{% endif %} +{% endblock %} +{% block content %} +
+

Pages

+ + {% if appendices %} +

Appendices

+ + {% endif %} + {% if vars['next_page'] %} +
+ +
+ {% endif %} +
+
+

Chat

+
+ {% autoescape false %} + {% for message in chat_messages %} +
+
+ {{ message.user.username or quest.anon_name }} + {{ localtime(message.timestamp).strftime('%Y-%m-%d %H:%M:%S') }} + No.{{ message.id }} +
+
{{ message.message }}
+
+
+ {% endfor %} + {% endautoescape %} +
+
+
+ +{% endblock %} diff --git a/quest/views.py b/quest/views.py index 7d80ed3..38da6c6 100644 --- a/quest/views.py +++ b/quest/views.py @@ -33,7 +33,7 @@ def quest(request, quest_id, page_num='1'): page = Page.objects.get(quest=quest, page_num=page_num) except Page.DoesNotExist: messages.error(request, "Page not found, redirecting you.") - return redirect('quest:quest', quest_id=quest.id, page_num='1') + return redirect('quest:quest', quest_id=quest.id, page_num='0') posts = quest.post_set.filter(page=page) # TODO: filter by page_num as well dice_rolls = DiceRoll.objects.filter(dicecall__post__quest=quest) @@ -41,7 +41,10 @@ def quest(request, quest_id, page_num='1'): poll_votes = PollVote.objects.filter(option__poll__post__quest=quest) ip_address = request.META['REMOTE_ADDR'] context = locals() - return render(request, 'quest/quest.html', context) + if page_num == '0': + return render(request, 'quest/quest_homepage.html', context) + else: + return render(request, 'quest/quest.html', context) def edit_quest(request, quest_id, page_num=1):