Merge branch 'fossdb'

This commit is contained in:
Kristofers Solo 2023-06-30 01:15:40 +00:00
commit b63983cf67
18 changed files with 149 additions and 63 deletions

View File

@ -35,19 +35,19 @@ DEBUG = config["DEBUG"]
# Application definition
INSTALLED_APPS = [
"fossdb",
"account",
"main",
"search_views",
"tailwind",
"tokyonight_night",
"fontawesomefree",
"django.contrib.admin",
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sessions",
"django.contrib.messages",
"django.contrib.staticfiles",
"account",
"main",
"fossdb",
"search_views",
"tailwind",
"tokyonight_night",
"fontawesomefree",
]
TAILWIND_APP_NAME = "tokyonight_night"

View File

@ -2,7 +2,7 @@
{% load static %}
{% block title %}{{ title }}{% endblock %}
{% block meta %}
<script src="{% static 'js/buttons.js' %}" defer></script>
<script src="{% static "js/buttons.js" %}" defer></script>
{% endblock meta %}
{% block content %}
<form method="post"
@ -14,7 +14,7 @@
class="button submit-button-disabled text-lightsteelblue-100 bg-slategray-200">Login</button>
<p>
Don't have an account? Create one <a class="underline text-skyblue-300 hover:text-cadetblue-300 transform duration-300 ease-linear"
href="{% url 'signup' %}">Here</a>!
href="{% url "signup" %}">Here</a>!
</p>
</form>
{% endblock %}

View File

@ -5,10 +5,10 @@
{% block content %}
<div class="py-8 px-32">
<div class="flex justify-end gap-4">
<a href="{% url 'logout' %}">
<a href="{% url "logout" %}">
<i class="fa-solid fa-right-from-bracket fa-2xl"></i>
</a>
<a href="{% url 'settings' %}">
<a href="{% url "settings" %}">
<i class="fa-solid fa-gear fa-2xl"></i>
</a>
</div>

View File

@ -5,7 +5,7 @@
{% block content %}
<div class="py-8 px-32">
<div class="flex justify-end">
<a href="{% url 'change_password' %}">
<a href="{% url "change_password" %}">
<i class="fa-solid fa-shield fa-2xl"></i>
</a>
</div>

View File

@ -2,7 +2,7 @@
{% load static %}
{% block title %}{{ title }}{% endblock %}
{% block meta %}
<script src="{% static 'js/buttons.js' %}" defer></script>
<script src="{% static "js/buttons.js" %}" defer></script>
{% endblock meta %}
{% block content %}
<form method="post"
@ -12,32 +12,32 @@
<input type="text"
placeholder="Username"
name="username"
value="{{ form.username.value|default:'' }}"
value="{{ form.username.value|default:"" }}"
class="verify form-field submit-form" />
{% if form.username.errors %}<p class="text-indianred-100 text-xs italic">{{ form.username.errors }}</p>{% endif %}
<input type="email"
placeholder="Email (optional)"
name="email"
value="{{ form.email.value|default:'' }}"
value="{{ form.email.value|default:"" }}"
class="form-field submit-form" />
{% if form.email.errors %}<p class="text-indianred-100 text-xs italic">{{ form.email.errors }}</p>{% endif %}
<input type="password"
placeholder="Password"
name="password1"
value="{{ form.password1.value|default:'' }}"
value="{{ form.password1.value|default:"" }}"
class="verify form-field submit-form" />
{% if form.password1.errors %}<p class="text-indianred-100 text-xs italic">{{ form.password1.errors }}</p>{% endif %}
<input type="password"
placeholder="Confirm password"
name="password2"
value="{{ form.password2.value|default:'' }}"
value="{{ form.password2.value|default:"" }}"
class="verify form-field submit-form" />
{% if form.password2.errors %}<p class="text-indianred-100 text-xs italic">{{ form.password2.errors }}</p>{% endif %}
<button type="submit"
id="submit-button"
class="button submit-button-disabled text-lightsteelblue-100 bg-slategray-200" />Sign Up</button>
<p>
Have an account? Login <a class="underline text-skyblue-300" href="{% url 'login' %}">Here</a>!
Have an account? Login <a class="underline text-skyblue-300" href="{% url "login" %}">Here</a>!
</p>
</form>
{% endblock %}

View File

@ -3,6 +3,7 @@ from django.contrib.auth import authenticate, login, logout, update_session_auth
from django.contrib.auth.forms import PasswordChangeForm
from django.contrib.auth.mixins import LoginRequiredMixin
from django.shortcuts import redirect, render
from django.urls import reverse_lazy
from django.views.generic import ListView, TemplateView, View
from fossdb.models import Project
@ -12,7 +13,7 @@ from .forms import LoginForm, SignUpForm, UserChangeForm
class ProfileUpdateView(LoginRequiredMixin, TemplateView):
template_name = "setting.html"
login_url = "/login/"
login_url = reverse_lazy("login")
redirect_field_name = "redirect_to"
def get(self, request):
@ -67,7 +68,7 @@ class ProfileProjectListView(LoginRequiredMixin, ListView):
model = Project
template_name = "profile.html"
context_object_name = "projects"
login_url = "/login/"
login_url = reverse_lazy("login")
redirect_field_name = "redirect_to"
def get_queryset(self):

View File

@ -1,15 +1,15 @@
{% extends "base.html" %}
{% load static %}
{% load static custom_filters %}
{% block title %}{{ project.owner }}/{{ project.name }}{% endblock %}
{% block meta %}
<script src="{% static 'js/buttons.js' %}" defer></script>
<script src="{% static "js/buttons.js" %}" defer></script>
{% endblock meta %}
{% block content %}
<div class="mx-auto font-condensed max-w-[60%] min-w-[32rem]">
<div class="p-8">
<h1 class="text-center text-4xl font-abel">{{ project.name }}</h1>
<h2 class="text-center text-2xl font-abel">
<a href="{% url 'profile' project.owner.username %}">By <span class="underline">{{ project.owner }}</span></a>
<a href="{% url "profile" project.owner.username %}">By <span class="underline">{{ project.owner }}</span></a>
</h2>
<!-- os platform icons -->
<div class="my-4 flex justify-center items-center gap-x-4">
@ -77,7 +77,7 @@
<!-- tags -->
<div class="my-8 flex flex-wrap justify-center items-start gap-2">
{% for tag in project.tag.all|dictsort:"name" %}
<a href="/search/?q={{ tag.name }}">
<a href="/search/?q={{ tag.name|remove_spaces }}">
<span title="{{ tag.description }}"
class="bg-opacity-0 border rounded-xl border-slategray-200 px-3 text-xs min-w-16 hover:bg-steelblue-400 hover:bg-opacity-60 transform duration-200 ease-linear">
{{ tag }}
@ -88,7 +88,7 @@
<!-- programming languages -->
<div class="my-8 flex flex-wrap justify-center items-start gap-2">
{% for language in project.projectprogramminglanguage_set.all|dictsortreversed:"percentage" %}
<a href="/search/?q={{ language.name }}">
<a href="/search/?q={{ language.name|remove_spaces }}">
<span title="{{ language.percentage }}%"
class="bg-opacity-0 border rounded-xl border-slategray-200 px-3 text-xs min-w-16 hover:bg-steelblue-400 hover:bg-opacity-60 transform duration-200 ease-linear">
{{ language.programming_language }}
@ -139,10 +139,10 @@
</div>
{% if user == project.owner %}
<div class="flex justify-between mt-8 mx-16">
<a href="{% url 'project-update' project.owner project.name %}">
<a href="{% url "project-update" project.owner project.name %}">
<button class="button hover:bg-opacity-60 bg-mediumpurple-100 text-gray-500">Update</button>
</a>
<a href="{% url 'project-delete' project.owner project.name %}">
<a href="{% url "project-delete" project.owner project.name %}">
<button class="button hover:bg-opacity-60 bg-lightcoral text-gray-500">Delete</button>
</a>
</div>

View File

@ -4,13 +4,13 @@
{% block meta %}{% endblock %}
{% block content %}
<div class="py-8 px-16">
<h1 class="font-abel text-4xl mb-8">Projects</h1>
<h1 class="font-abel text-4xl mb-8 font-bold">Projects</h1>
<div class="grid grid-cols-2 gap-4">
{% for project in projects %}
<div class="border border-steelblue-100 p-8 flex flex-row gap-4 justify-between">
<a href="{{ project.get_absolute_url }}"
class="hover:text-steelblue-100 transition duration-300 ease-linear">
<h2 class="font-abel text-2xl">{{ project.name }}</h2>
<h2 class="font-abel text-3xl font-semibold">{{ project.name }}</h2>
</a>
<p class="max-w-xs text-justify">{{ project.description|slice:500 }}</p>
</div>

View File

@ -0,0 +1,8 @@
from django import template
register = template.Library()
@register.filter
def remove_spaces(value):
return value.replace(" ", "+")

View File

@ -2,5 +2,5 @@ from django.apps import AppConfig
class MainConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'main'
default_auto_field = "django.db.models.BigAutoField"
name = "main"

View File

@ -2,4 +2,8 @@
{% load static %}
{% block title %}{{ title }}{% endblock %}
{% block meta %}{% endblock %}
{% block content %}{% endblock %}
{% block content %}
<div class="py-16 px-32">
<h1 class="font-abel text-4xl mb-8 font-bold">Dashboard</h1>
</div>
{% endblock %}

View File

@ -2,4 +2,8 @@
{% load static %}
{% block title %}{{ title }}{% endblock %}
{% block meta %}{% endblock %}
{% block content %}{% endblock %}
{% block content %}
<div class="py-16 px-32">
<h1 class="font-abel text-4xl mb-8 font-bold">Help</h1>
</div>
{% endblock %}

View File

@ -2,4 +2,8 @@
{% load static %}
{% block title %}{{ title }}{% endblock %}
{% block meta %}{% endblock %}
{% block content %}{% endblock %}
{% block content %}
<div class="flex justify-center my-auto">
<h1 class="font-rationale text-8xl font-bold">Welcome to FOSSDB!</h1>
</div>
{% endblock %}

View File

@ -2,4 +2,8 @@
{% load static %}
{% block title %}{{ title }}{% endblock %}
{% block meta %}{% endblock %}
{% block content %}{% endblock %}
{% block content %}
<div class="py-16 px-32">
<h1 class="font-abel text-4xl mb-8 font-bold">News</h1>
</div>
{% endblock %}

View File

@ -123,14 +123,6 @@ module.exports = {
],
roboto: ["Roboto", "Helvetica", "Arial", "sans-serif"],
},
fontSize: {
base: "1rem",
xl: "1.25rem",
"2xl": "1.5rem",
"3xl": "2rem",
"4xl": "4rem",
xs: "0.75rem",
},
extend: {},
},
plugins: [

View File

@ -2,7 +2,7 @@
<!DOCTYPE html>
<html lang="en" data-theme="dark">
<head>
<link rel="icon" href="{% static 'img/icons/logo.svg' %}" />
<link rel="icon" href="{% static "img/icons/logo.svg" %}" />
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="preconnect" href="https://fonts.googleapis.com" />
@ -16,8 +16,7 @@
<link href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap"
rel="stylesheet" />
{% tailwind_css %}
<link href="{% static 'fontawesomefree/css/all.min.css' %}"
rel="stylesheet" />
<link href="{% static "fontawesomefree/css/all.min.css" %}" rel="stylesheet" />
{% block meta %}{% endblock %}
<title>
{% block title %}{% endblock %}
@ -27,16 +26,13 @@
<header class="flex justify-between items-center px-6 py-2 font-abel text-xl">
<div class="flex justify-between">
<!-- logo -->
<div class="flex items-center text-4xl font-rationale">
<img class=""
width="40"
src="{% static 'img/icons/logo.svg' %}"
alt="logo" />
<div class="flex items-center text-5xl font-rationale font-bold">
<img class="" width="40" src="{% static "img/icons/logo.svg" %}" alt="logo" />
<a class="hover:text-skyblue-300 transform duration-300 ease-linear"
href="{% url 'homepage' %}">foss<span class="text-skyblue-300">db</span></a>
href="{% url "homepage" %}">foss<span class="text-skyblue-300">db</span></a>
</div>
<!-- search -->
<form action="{% url 'search' %}"
<form action="{% url "search" %}"
method="get"
class="relative items-center flex">
<input type="text"
@ -46,15 +42,15 @@
</form>
<!-- navbar -->
<nav class="uppercase flex gap-x-6 items-center">
<a href="{% url 'explore' %}"
<a href="{% url "explore" %}"
class="hover:text-skyblue-300 transform duration-200 ease-linear">explore</a>
<a href="{% url 'contribute' %}"
<a href="{% url "contribute" %}"
class="hover:text-skyblue-300 transform duration-200 ease-linear">contribute</a>
<a href="{% url 'news' %}"
<a href="{% url "news" %}"
class="hover:text-skyblue-300 transform duration-200 ease-linear">news</a>
<a href="{% url 'dashboard' %}"
<a href="{% url "dashboard" %}"
class="hover:text-skyblue-300 transform duration-200 ease-linear">dashboard</a>
<a href="{% url 'help' %}"
<a href="{% url "help" %}"
class="hover:text-skyblue-300 transform duration-200 ease-linear">help</a>
</nav>
</div>
@ -63,12 +59,12 @@
{% if user.is_authenticated %}
<div class="flex items-center justify-between">
<p class="mx-4">{{ user.username }}</p>
<a href="{% url 'profile' user.username %}">
<a href="{% url "profile" user.username %}">
<img src="{{ user.profile.picture.url }}" class="w-[2rem]" alt="pic" />
</a>
</div>
{% else %}
<a href="{% url 'login' %}"
<a href="{% url "login" %}"
class="hover:text-skyblue-300 transition duration-300 ease-linear"><i class="fa-solid fa-user fa-lg ml-4 "></i></a>
{% endif %}
</div>
@ -76,8 +72,8 @@
<main class="flex flex-col flex-grow">
{% block content %}{% endblock %}
</main>
<footer class="w-full h-32 flex items-center text-slategray-200 bg-gray-500 mt-32 font-condensed border-gradient-horizontal">
<div class="p-8">
<footer class="w-full h-auto flex text-slategray-200 bg-gray-500 mt-32 font-condensed border-gradient-horizontal mb-2">
<div class="p-8 w-full flex justify-between">
<div class="space-y-4 text-left">
<p>
FOSSDB is a passion project of <a class="underline"
@ -86,8 +82,22 @@
</p>
<!-- TODO: finish these sentences -->
<p>This site has no affiliation with GitHub or any other hosting platform.</p>
<p>
P. S. All users with "_bot" are generated by the site owner. If you are the original owner, please contact the administrator.
</p>
</div>
<div class="">
<div class="flex items-center justify-center gap-4">
<p>Have some feedback? Come chat with us!</p>
<a href="">
<img class="w-10" src="{% static "img/icons/discord.svg" %}" alt="discord" />
</a>
<a href="">
<img class="w-10" src="{% static "img/icons/irc.svg" %}" alt="matrix" />
</a>
<div class="flex justify-center gap-4"></div>
</div>
</div>
<div></div>
</div>
</footer>
</body>

View File

@ -0,0 +1 @@
<svg id="Layer_1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 245 240"><style>.st0{fill:#FFFFFF;}</style><path class="st0" d="M104.4 103.9c-5.7 0-10.2 5-10.2 11.1s4.6 11.1 10.2 11.1c5.7 0 10.2-5 10.2-11.1.1-6.1-4.5-11.1-10.2-11.1zM140.9 103.9c-5.7 0-10.2 5-10.2 11.1s4.6 11.1 10.2 11.1c5.7 0 10.2-5 10.2-11.1s-4.5-11.1-10.2-11.1z"/><path class="st0" d="M189.5 20h-134C44.2 20 35 29.2 35 40.6v135.2c0 11.4 9.2 20.6 20.5 20.6h113.4l-5.3-18.5 12.8 11.9 12.1 11.2 21.5 19V40.6c0-11.4-9.2-20.6-20.5-20.6zm-38.6 130.6s-3.6-4.3-6.6-8.1c13.1-3.7 18.1-11.9 18.1-11.9-4.1 2.7-8 4.6-11.5 5.9-5 2.1-9.8 3.5-14.5 4.3-9.6 1.8-18.4 1.3-25.9-.1-5.7-1.1-10.6-2.7-14.7-4.3-2.3-.9-4.8-2-7.3-3.4-.3-.2-.6-.3-.9-.5-.2-.1-.3-.2-.4-.3-1.8-1-2.8-1.7-2.8-1.7s4.8 8 17.5 11.8c-3 3.8-6.7 8.3-6.7 8.3-22.1-.7-30.5-15.2-30.5-15.2 0-32.2 14.4-58.3 14.4-58.3 14.4-10.8 28.1-10.5 28.1-10.5l1 1.2c-18 5.2-26.3 13.1-26.3 13.1s2.2-1.2 5.9-2.9c10.7-4.7 19.2-6 22.7-6.3.6-.1 1.1-.2 1.7-.2 6.1-.8 13-1 20.2-.2 9.5 1.1 19.7 3.9 30.1 9.6 0 0-7.9-7.5-24.9-12.7l1.4-1.6s13.7-.3 28.1 10.5c0 0 14.4 26.1 14.4 58.3 0 0-8.5 14.5-30.6 15.2z"/></svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
id="Layer_1"
viewBox="0 0 245 240"
version="1.1"
sodipodi:docname="discord_white.svg"
inkscape:version="1.1.1 (3bf5ae0d25, 2021-09-20, custom)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<defs
id="defs11">
<rect
x="65"
y="45"
width="125"
height="125"
id="rect9079" />
</defs>
<sodipodi:namedview
id="namedview9"
pagecolor="#505050"
bordercolor="#eeeeee"
borderopacity="1"
inkscape:pageshadow="0"
inkscape:pageopacity="0"
inkscape:pagecheckerboard="0"
showgrid="true"
inkscape:zoom="3.7417734"
inkscape:cx="122.26823"
inkscape:cy="118.79394"
inkscape:window-width="1920"
inkscape:window-height="1022"
inkscape:window-x="1920"
inkscape:window-y="32"
inkscape:window-maximized="1"
inkscape:current-layer="Layer_1">
<inkscape:grid
type="xygrid"
id="grid1075" />
</sodipodi:namedview>
<style
id="style2">.st0{fill:#FFFFFF;}</style>
<path
id="path1364"
style="fill:#ffffff;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 55.5 20 C 44.2 20 35 29.199609 35 40.599609 L 35 175.80078 C 35 187.20078 44.2 196.40039 55.5 196.40039 L 168.90039 196.40039 L 163.59961 177.90039 L 176.40039 189.80078 L 188.5 201 L 210 220 L 210 40.599609 C 210 29.199609 200.8 20 189.5 20 L 55.5 20 z M 110.75586 37.820312 L 125.94336 37.820312 L 116.19336 76.726562 L 143.56836 76.726562 L 153.41211 37.820312 L 168.41211 37.820312 L 158.75586 76.726562 L 188.00586 76.726562 L 188.00586 91.164062 L 155.09961 91.164062 L 147.41211 122.47656 L 177.22461 122.47656 L 177.22461 136.82031 L 143.75586 136.82031 L 134.00586 175.63281 L 119.00586 175.63281 L 128.66211 136.82031 L 101.19336 136.82031 L 91.537109 175.63281 L 76.443359 175.63281 L 86.193359 136.82031 L 56.662109 136.82031 L 56.662109 122.47656 L 89.662109 122.47656 L 97.537109 91.164062 L 67.349609 91.164062 L 67.349609 76.726562 L 101.19336 76.726562 L 110.75586 37.820312 z M 112.72461 91.164062 L 104.84961 122.47656 L 132.31836 122.47656 L 140.00586 91.164062 L 112.72461 91.164062 z " />
<text
xml:space="preserve"
id="text9077"
style="font-style:normal;font-weight:normal;font-size:192px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;white-space:pre;shape-inside:url(#rect9079);fill:#000000;fill-opacity:1;stroke:none"><tspan
x="65"
y="339.875"
id="tspan51300"><tspan
style="font-size:96px;font-family:Inconsolata;-inkscape-font-specification:Inconsolata"
id="tspan51298">#</tspan></tspan></text>
</svg>

After

Width:  |  Height:  |  Size: 2.8 KiB