Compare commits
No commits in common. "672e1fff1dd56e8959532847e383374cd61f803a" and "7874151f32827185b4707511213aba5ff6807c83" have entirely different histories.
672e1fff1d
...
7874151f32
|
@ -1,15 +1,12 @@
|
|||
{% 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('quest:index') }}">Advanced</a><br>
|
||||
<a href="{{ url('search:index') }}">Advanced</a><br>
|
||||
<br>
|
||||
<a href="./quest/1">Unga Bunga Quest</a><br />
|
||||
{% if request.user.is_authenticated %}
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
#content {
|
||||
padding-left: 5%;
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
{% 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>
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
{% 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 %}
|
|
@ -47,13 +47,12 @@
|
|||
{% block content %}
|
||||
<div id="questPane" style="width:{% if request.session.get("hide_chat") == True %}100%{% else %}70%{% endif %};">
|
||||
<center><h1>{{ quest.title }}</h1></center>
|
||||
<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>
|
||||
Tags: {% for tag in quest.tags.names() %}<a href="{{ url('search:index') + '?tags=' + tag }}">{{ tag }}</a>{% if not loop.last %}, {% endif %}{% endfor %}
|
||||
{% 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 %}
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
# 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),
|
||||
),
|
||||
]
|
|
@ -11,7 +11,7 @@ class Quest(models.Model):
|
|||
"""
|
||||
The meta quest object. Contains general information about the quest.
|
||||
"""
|
||||
title = models.CharField(max_length=100)
|
||||
title = models.CharField(max_length=200)
|
||||
owner = models.ForeignKey(
|
||||
settings.AUTH_USER_MODEL,
|
||||
on_delete=models.CASCADE)
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
form {
|
||||
padding-left: 10%;
|
||||
}
|
|
@ -26,10 +26,6 @@ h3 {
|
|||
width: 70%;
|
||||
}
|
||||
|
||||
#tags {
|
||||
padding-bottom: 0.25em;
|
||||
}
|
||||
|
||||
.questPost {
|
||||
display: flex;
|
||||
}
|
||||
|
@ -40,6 +36,7 @@ h3 {
|
|||
}
|
||||
|
||||
.questPostData {
|
||||
word-wrap: break-word;
|
||||
min-width: 0;
|
||||
width: 100%;
|
||||
}
|
||||
|
@ -67,6 +64,7 @@ h3 {
|
|||
|
||||
.poll td {
|
||||
padding: 0.5em;
|
||||
word-wrap: break-word;
|
||||
border-bottom: 1px solid #ddd;
|
||||
}
|
||||
|
||||
|
@ -140,6 +138,7 @@ h3 {
|
|||
|
||||
.messageContent {
|
||||
width: 100%;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
.msgSrvHr {
|
||||
|
@ -168,6 +167,7 @@ h3 {
|
|||
display: block;
|
||||
position: fixed;
|
||||
background: white;
|
||||
word-wrap: break-word;
|
||||
border: 1px solid #ccc;
|
||||
padding: 0.25em;
|
||||
}
|
||||
|
@ -178,9 +178,4 @@ h3 {
|
|||
|
||||
.quotelink {
|
||||
color: red;
|
||||
text-decoration: underline;;
|
||||
}
|
||||
|
||||
.quotelink:hover {
|
||||
color: red;
|
||||
}
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
#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%;
|
||||
}
|
|
@ -7,32 +7,17 @@ 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):
|
||||
"""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)
|
||||
"""
|
||||
/quest page index. Possibly not needed.
|
||||
"""
|
||||
return HttpResponse("Hello, world. You're at the quest index.")
|
||||
|
||||
|
||||
def quest(request, quest_id, page_num='0'):
|
||||
|
|
0
search/__init__.py
Normal file
0
search/__init__.py
Normal file
3
search/admin.py
Normal file
3
search/admin.py
Normal file
|
@ -0,0 +1,3 @@
|
|||
from django.contrib import admin
|
||||
|
||||
# Register your models here.
|
5
search/apps.py
Normal file
5
search/apps.py
Normal file
|
@ -0,0 +1,5 @@
|
|||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class SearchConfig(AppConfig):
|
||||
name = 'search'
|
19
search/jinja2/search/index.html
Normal file
19
search/jinja2/search/index.html
Normal file
|
@ -0,0 +1,19 @@
|
|||
{% 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 %}
|
0
search/migrations/__init__.py
Normal file
0
search/migrations/__init__.py
Normal file
3
search/models.py
Normal file
3
search/models.py
Normal file
|
@ -0,0 +1,3 @@
|
|||
from django.db import models
|
||||
|
||||
# Create your models here.
|
3
search/tests.py
Normal file
3
search/tests.py
Normal file
|
@ -0,0 +1,3 @@
|
|||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
12
search/urls.py
Normal file
12
search/urls.py
Normal file
|
@ -0,0 +1,12 @@
|
|||
#!/usr/bin/env python3
|
||||
"""
|
||||
Search URL configuration.
|
||||
"""
|
||||
from django.urls import path
|
||||
|
||||
from . import views
|
||||
|
||||
app_name = 'search'
|
||||
urlpatterns = [
|
||||
path('', views.index, name='index'),
|
||||
]
|
29
search/views.py
Normal file
29
search/views.py
Normal file
|
@ -0,0 +1,29 @@
|
|||
#!/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)
|
|
@ -1,31 +1,5 @@
|
|||
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 {
|
||||
|
@ -37,12 +11,14 @@ a:hover {
|
|||
.header {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
width: 100%;
|
||||
height: 2em;
|
||||
background-color: #FAFAFA;
|
||||
list-style-type: none;
|
||||
background-color: #dddddd;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
border-bottom: 1px solid #ccc;
|
||||
}
|
||||
|
||||
.header span {
|
||||
|
@ -55,9 +31,12 @@ a:hover {
|
|||
padding-left: 0;
|
||||
}
|
||||
|
||||
.header a {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
#headerHidden {
|
||||
width: 1em;
|
||||
border-right: 1px solid #ccc;
|
||||
}
|
||||
|
||||
#alerts {
|
||||
|
@ -67,5 +46,4 @@ a:hover {
|
|||
#content {
|
||||
flex: auto;
|
||||
overflow: auto;
|
||||
overflow-wrap: break-word;
|
||||
}
|
||||
|
|
|
@ -39,6 +39,7 @@ INSTALLED_APPS = [
|
|||
'quest.apps.QuestConfig',
|
||||
'login.apps.LoginConfig',
|
||||
'signup.apps.SignupConfig',
|
||||
'search.apps.SearchConfig',
|
||||
]
|
||||
|
||||
MIDDLEWARE = [
|
||||
|
|
Loading…
Reference in New Issue
Block a user