Compare commits

...

2 Commits

Author SHA1 Message Date
672e1fff1d merged /search into /quest 2018-10-03 12:41:38 -04:00
ed97ce41fd some style sheet and misc. changes 2018-10-03 12:17:57 -04:00
23 changed files with 139 additions and 97 deletions

View File

@ -1,12 +1,15 @@
{% extends "base.html" %}
{% block title %}Index{% endblock %}
{% block head %}
<link rel="stylesheet" type="text/css" href="{{ static('homepage.css') }}">
{% endblock %}
{% block content %}
<h1>Quests 'n Shiet</h1>
<form method="get" action="{{ url('search:index') }}">
<input type="text" name="title" placeholder="Search">
<input type="submit">
</form>
<a href="{{ url('search:index') }}">Advanced</a><br>
<a href="{{ url('quest:index') }}">Advanced</a><br>
<br>
<a href="./quest/1">Unga Bunga Quest</a><br />
{% if request.user.is_authenticated %}

View File

@ -0,0 +1,3 @@
#content {
padding-left: 5%;
}

View File

@ -1,6 +1,7 @@
{% extends "base.html" %}
{% block title %}Edit {{ quest.title }}{% endblock %}
{% block head %}
<link rel="stylesheet" type="text/css" href="{{ static('edit_quest.css') }}">
<script>
window.onload = function() { document.getElementById('timezone').value = new Date().getTimezoneOffset(); };
</script>

View File

@ -0,0 +1,24 @@
{% extends "base.html" %}
{% block title %}Quest{% endblock %}
{% block head %}
<link rel="stylesheet" type="text/css" href="{{ static('quest_index.css') }}">
{% endblock %}
{% block content %}
<form method="get" action="{{ url('quest:index') }}">
Author: <input type="text" name="author"><br>
Title: <input type="text" name="title"><br>
Tags: <input type="text" name="tags"><br>
<input type="submit">
</form>
{% if results %}
<table id="results">
{% for quest in results %}
<tr>
<td class="title"><a href="{{ url('quest:quest', args=[quest.id, '0']) }}">{{ quest.title }}</a></td>
<td class="summary"></td>
<td class="author"><a href="{{ url('user:profile', args=[quest.owner.id]) }}">{{ quest.owner.username }}</a></td>
</tr>
{% endfor %}
</table>
{% endif %}
{% endblock %}

View File

@ -47,12 +47,13 @@
{% block content %}
<div id="questPane" style="width:{% if request.session.get("hide_chat") == True %}100%{% else %}70%{% endif %};">
<center><h1>{{ quest.title }}</h1></center>
Tags: {% for tag in quest.tags.names() %}<a href="{{ url('search:index') + '?tags=' + tag }}">{{ tag }}</a>{% if not loop.last %}, {% endif %}{% endfor %}
<div id="tags">
Tags: {% for tag in quest.tags.names() %}<a href="{{ url('quest:index') + '?tags=' + tag }}">{{ tag }}</a>{% if not loop.last %}, {% endif %}{% endfor %}
</div>
{% if request.user == quest.owner %}
<form method="post" action="{{ url('quest:new_tag', kwargs={'quest_id': quest_id}) }}">
{{ csrf_input }}
<input type="text" name="tag">
<input type="hidden" name="quest_id" value="{{ quest.id }}">
<input type="submit">
</form>
{% endif %}

View File

@ -0,0 +1,18 @@
# Generated by Django 2.1.1 on 2018-10-03 16:17
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('quest', '0004_quest_tags'),
]
operations = [
migrations.AlterField(
model_name='quest',
name='title',
field=models.CharField(max_length=100),
),
]

View File

@ -11,7 +11,7 @@ class Quest(models.Model):
"""
The meta quest object. Contains general information about the quest.
"""
title = models.CharField(max_length=200)
title = models.CharField(max_length=100)
owner = models.ForeignKey(
settings.AUTH_USER_MODEL,
on_delete=models.CASCADE)

View File

@ -0,0 +1,3 @@
form {
padding-left: 10%;
}

View File

@ -26,6 +26,10 @@ h3 {
width: 70%;
}
#tags {
padding-bottom: 0.25em;
}
.questPost {
display: flex;
}
@ -36,7 +40,6 @@ h3 {
}
.questPostData {
word-wrap: break-word;
min-width: 0;
width: 100%;
}
@ -64,7 +67,6 @@ h3 {
.poll td {
padding: 0.5em;
word-wrap: break-word;
border-bottom: 1px solid #ddd;
}
@ -138,7 +140,6 @@ h3 {
.messageContent {
width: 100%;
word-wrap: break-word;
}
.msgSrvHr {
@ -167,7 +168,6 @@ h3 {
display: block;
position: fixed;
background: white;
word-wrap: break-word;
border: 1px solid #ccc;
padding: 0.25em;
}
@ -178,4 +178,9 @@ h3 {
.quotelink {
color: red;
text-decoration: underline;;
}
.quotelink:hover {
color: red;
}

View File

@ -0,0 +1,23 @@
#content {
padding-left: 5%;
padding-right: 5%;
}
#results {
width: 100%;
table-layout: fixed;
border-collapse: collapse;
border: 1px solid #ccc;
}
tr:nth-child(even) {
background-color: #DDDDDD;
}
.title {
width: 20%;
}
.author {
width: 20%;
}

View File

@ -7,17 +7,32 @@ from datetime import timedelta, datetime, timezone
import bleach
from django.views.decorators.http import require_POST
from django.contrib import messages
from django.http import HttpResponse
from django.shortcuts import render, redirect
from .models import Quest, DiceRoll, PollOption, PollVote, Page, Post
from .forms import EditQuestForm, QuestForm, PostForm
from user.models import User
def index(request):
"""
/quest page index. Possibly not needed.
"""
return HttpResponse("Hello, world. You're at the quest index.")
"""The quest page index."""
if request.GET:
author = request.GET.get('author')
title = request.GET.get('title')
tags = request.GET.get('tags')
if not any((author, title, tags)):
return
results = Quest.objects.all()
if author:
results = results.filter(
owner__username__unaccent__icontains=author)
if title:
results = results.filter(title__unaccent__icontains=title)
if tags:
results = results.filter(tags__name__in=tags.split())
results = results.distinct()
context = locals()
return render(request, 'quest/index.html', context)
def quest(request, quest_id, page_num='0'):

View File

View File

@ -1,3 +0,0 @@
from django.contrib import admin
# Register your models here.

View File

@ -1,5 +0,0 @@
from django.apps import AppConfig
class SearchConfig(AppConfig):
name = 'search'

View File

@ -1,19 +0,0 @@
{% extends "base.html" %}
{% block title %}Search{% endblock %}
{% block content %}
<form method="get" action="{{ url('search:index') }}">
Author: <input type="text" name="author"><br>
Title: <input type="text" name="title"><br>
Tags: <input type="text" name="tags"><br>
<input type="submit">
</form>
{% if results %}
<table>
{% for quest in results %}
<tr>
<td><a href="{{ url('quest:quest', args=[quest.id, '0']) }}">{{ quest.title }}</a></td>
</tr>
{% endfor %}
</table>
{% endif %}
{% endblock %}

View File

@ -1,3 +0,0 @@
from django.db import models
# Create your models here.

View File

@ -1,3 +0,0 @@
from django.test import TestCase
# Create your tests here.

View File

@ -1,12 +0,0 @@
#!/usr/bin/env python3
"""
Search URL configuration.
"""
from django.urls import path
from . import views
app_name = 'search'
urlpatterns = [
path('', views.index, name='index'),
]

View File

@ -1,29 +0,0 @@
#!/usr/bin/env python3
"""
/search app views.
"""
from django.shortcuts import render
from quest.models import Quest
from user.models import User
def index(request):
"""The search page index."""
if request.GET:
author = request.GET.get('author')
title = request.GET.get('title')
tags = request.GET.get('tags')
if not any((author, title, tags)):
return
results = Quest.objects.all()
if author:
results = results.filter(
owner__username__unaccent__icontains=author)
if title:
results = results.filter(title__unaccent__icontains=title)
if tags:
results = results.filter(tags__name__in=tags.split())
results = results.distinct()
context = locals()
return render(request, 'search/index.html', context)

View File

@ -1,5 +1,31 @@
body {
margin: 0;
background-color: #FAFAFA;
color: #111111;
font-family: Tahoma, Helvetica, sans-serif;
}
input {
font-family: Tahoma, Helvetica, sans-serif;
}
select {
font-family: Tahoma, Helvetica, sans-serif;
background-color: #FAFAFA;
}
textarea {
background-color: #FAFAFA;
border-bottom: 1px solid #ccc;
}
a {
text-decoration: none;
color: #004070;
}
a:hover {
color: #B44444;
}
#globalWrapper {
@ -11,14 +37,12 @@ body {
.header {
position: sticky;
top: 0;
margin: 0;
padding: 0;
width: 100%;
height: 2em;
list-style-type: none;
background-color: #dddddd;
background-color: #FAFAFA;
display: flex;
align-items: center;
border-bottom: 1px solid #ccc;
}
.header span {
@ -31,12 +55,9 @@ body {
padding-left: 0;
}
.header a {
text-decoration: none;
}
#headerHidden {
width: 1em;
border-right: 1px solid #ccc;
}
#alerts {
@ -46,4 +67,5 @@ body {
#content {
flex: auto;
overflow: auto;
overflow-wrap: break-word;
}

View File

@ -39,7 +39,6 @@ INSTALLED_APPS = [
'quest.apps.QuestConfig',
'login.apps.LoginConfig',
'signup.apps.SignupConfig',
'search.apps.SearchConfig',
]
MIDDLEWARE = [

1
todo
View File

@ -6,7 +6,6 @@ Webm posting
(you) counter
Account managament
Display profile link in header bar
Tagging system
Quote backlinks
Improvements: