3 Commits

Author SHA1 Message Date
df61af750f created the home page
time to implement...
2021-07-12 02:35:50 +03:00
31447796c9 initial 2021-07-11 23:21:34 +03:00
540c3b56ca Started the process on rewriting the frontend rewrite 2021-07-10 17:53:21 +03:00
30 changed files with 293 additions and 476 deletions

View File

@ -1,5 +0,0 @@
root = true
[*.{js,css}]
indent_style = space
indent_size = 2

4
.gitignore vendored
View File

@ -1,4 +0,0 @@
__django
*/media/*
*.pyc
db.sqlite3

192
assets/css/style.css Normal file
View File

@ -0,0 +1,192 @@
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
#page-wrap {
max-width: 1200px;
margin: 50px auto;
padding: 20px;
background: white;
-moz-box-shadow: 0 0 20px #469330;
-webkit-box-shadow: 0 0 20px #469330;
box-shadow: 0 0 20px #469330;
text-align: center;
border-radius: 25px;
}
header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 30px 10%;
background-color: #469330;
position: sticky;
}
.logo {
cursor: pointer;
}
.nav__links a,
.cta,
.overlay__content a {
font-family: Arial, Helvetica, sans-serif;
font-weight: 500;
font-size:30px;
color: #edf0f1;
text-decoration: none;
}
.nav__links {
list-style: none;
display: flex;
}
.nav__links li {
padding: 0px 20px;
}
.nav__links li a {
transition: color 0.3s ease 0s;
}
.nav__links li a:hover {
color: black;
}
.cta {
padding: 9px 25px;
color: #469330;
background-color: white;
border: none;
border-radius: 50px;
cursor: pointer;
transition: background-color 0.3s ease 0s;
}
.cta:hover {
color: white;
background-color: darkgreen;
}
/* Mobile Nav */
.menu {
display: none;
}
.overlay {
height: 100%;
width: 0;
position: fixed;
z-index: 1;
left: 0;
top: 0;
background-color: #469330;
overflow-x: hidden;
transition: width 0.5s ease 0s;
}
.overlay--active {
width: 100%;
}
.overlay__content {
display: flex;
height: 100%;
flex-direction: column;
align-items: center;
justify-content: center;
}
.overlay a {
padding: 15px;
font-size: 36px;
display: block;
transition: color 0.3s ease 0s;
}
.overlay a:hover,
.overlay a:focus {
color: darkgreen;
}
.overlay .close {
position: absolute;
top: 20px;
right: 45px;
font-size: 60px;
color: #edf0f1;
}
@media screen and (max-height: 450px) {
.overlay a {
font-size: 20px;
}
.overlay .close {
font-size: 40px;
top: 15px;
right: 35px;
}
}
@media only screen and (max-width: 800px) {
.nav__links,
.cta {
display: none;
}
.menu {
display: initial;
}
}
html{
background: linear-gradient(180deg, rgba(70,147,48,1) 33%, rgba(109,126,107,1) 100%) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
font-family: Arial, Helvetica, sans-serif;
}
p {
font-family: Arial, Helvetica, sans-serif;
margin: 0 0 30px 0;
}
h1.heading{
color: white;
font-size: 50px;
text-shadow: -1px 0 black, 0 2px black, 2px 0 black, 0 -1px black;
}
ul.emoji{
list-style-type: "♻️";
}
.question{
color: gray;
font-size:20px;
}
ul.nothing{
list-style-type: none;
}
a.footer{
/* background:radial-gradient(circle, rgba(0,159,12,1) 0%, rgba(8,96,0,1) 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent; */
color:lightgreen;
}
footer{
font-size: small;
text-align: center;
left:50%;
}

BIN
assets/img/Discord-Logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

BIN
assets/img/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 KiB

BIN
assets/img/mail.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

BIN
assets/img/youtube.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

12
assets/js/mobile.js Normal file
View File

@ -0,0 +1,12 @@
const doc = document;
const menuOpen = doc.querySelector(".menu");
const menuClose = doc.querySelector(".close");
const overlay = doc.querySelector(".overlay");
menuOpen.addEventListener("click", () => {
overlay.classList.add("overlay--active");
});
menuClose.addEventListener("click", () => {
overlay.classList.remove("overlay--active");
});

89
index.html Normal file
View File

@ -0,0 +1,89 @@
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Navbar</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="assets/css/style.css">
<link href="https://fonts.googleapis.com/css?family=Montserrat:500&display=swap" rel="stylesheet">
</head>
<body>
<header>
<a class="logo" href="/"><img src="assets/img/logo.png" style="max-height: 100px;" alt="logo"></a>
<nav>
<ul class="nav__links">
<li><a href="#">Класация</a></li>
<li><a href="#">За нас</a></li>
<!-- if logged in: -->
<!-- <li><a href="#">Качи</a></li> -->
<!-- <li><a href="#">Прогрес</a></li> -->
<!-- <li><a href="#">Акаунт</a></li> -->
</ul>
</nav>
<a class="cta" href="#">Влез!</a>
<!-- if logged in log out -->
<p class="menu cta">Меню</p>
</header>
<div class="overlay">
<a class="close">&times;</a>
<div class="overlay__content">
<a href="#">Класация</a>
<a href="#">За нас</a>
<a href="#">Влез!</a>
<!-- if logged in: -->
<!-- <li><a href="#">Качи</a></li> -->
<!-- <li><a href="#">Прогрес</a></li> -->
<!-- <li><a href="#">Акаунт</a></li> -->
</div>
</div>
<!-- navbar end -->
<div id="page-wrap">
<h1 class="heading">reValuate</h1>
<h3>Остават ни още:<br>123232 reVal точки</h3>
<br>
<hr>
<br>
<h1>Нашата цел и основни дейности</h1><br>
<p>
Основната цел на проекта е запознаване с ползите от рециклирането на учениците и подтикването им да започнат да събират разделно боклук.
Това е сайт, в който може да се качват видеа и снимки как ученици изхвърлят разделно боклуци.<br><br> За всеки материал получават конкретен брой точки (ел.валута), която обменят в училище за награди.
За една снимка получават 2 точки, а за едно видео 3 точки.
</p>
<hr><br>
<h1>Защо да участвам?</h1>
<p>
<ul class="emoji" style="text-align: left; padding-left: 5%; margin: auto;">
<li> Награден фонд за участие в проекта.</li><br>
<li> Наградите се разпределят спрямо натрупаните точки в сайта.</li><br>
<li> Сертификат за участие в извънкласни дейности от името на училището при натрупани минимум 30 точки.</li><br>
</p>
</ul>
<!-- <br>
<hr>
<br>
<h1>Често задавани въпроси</h1><br>
<ul class="nothing" style="text-align: left; padding-left: 5%; margin: auto;">
<li class="question"></li>
<p>test</p>
</ul> -->
<br>
<hr>
<br>
<h1>Имате въпроси?<br><h2>Свържете се с нас!</h2></h1><br>
<p>
<a href="https://discord.gg/twDtbKeVXV"><img src="assets/img/Discord-Logo.png" style="max-width:100px;"></a>
<a href="mailto://boyan+revaluate@bobokara.com"><img src="assets/img/mail.png" style="max-width:100px;"></a>
<a href="https://www.youtube.com/channel/UCIWblGtjXAxwbTMUbhZ_PDQ"><img src="assets/img/youtube.png" style="max-width:100px;" ></a>
</p>
</div>
<script type="text/javascript" src="assets/js/mobile.js"></script>
<footer>Frontend, backend and planning:<br> <a class="footer" href="https://yamozha.xyz">Boyan</a></footer>
</body>
</html>

View File

@ -1,22 +0,0 @@
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'reWrite.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
) from exc
execute_from_command_line(sys.argv)
if __name__ == '__main__':
main()

View File

@ -1,7 +0,0 @@
from django.contrib import admin
from .models import Media, Profile, Transaction
admin.site.register(Media)
admin.site.register(Profile)
admin.site.register(Transaction)

View File

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

View File

@ -1,53 +0,0 @@
# Generated by Django 3.1.6 on 2021-09-12 14:14
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import reValuate.models
class Migration(migrations.Migration):
initial = True
dependencies = [
('auth', '0012_alter_user_first_name_max_length'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='Profile',
fields=[
('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, primary_key=True, serialize=False, to='auth.user')),
('is_banned', models.BooleanField(default=False)),
('balance', models.IntegerField(default=0)),
],
),
migrations.CreateModel(
name='Transaction',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('date', models.DateTimeField(auto_now=True)),
('item', models.CharField(blank=True, default=None, max_length=30, null=True)),
('cashier', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='cashier', to=settings.AUTH_USER_MODEL)),
('client', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='client', to=settings.AUTH_USER_MODEL)),
],
),
migrations.CreateModel(
name='Media',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('image', models.FileField(blank=True, null=True, upload_to=reValuate.models.images_path)),
('is_video', models.BooleanField(default=False)),
('is_approved', models.BooleanField(blank=True, default=None, max_length=3, null=True)),
('date', models.DateTimeField(auto_now=True)),
('approved_by', models.CharField(blank=True, default=None, max_length=30, null=True)),
('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
options={
'verbose_name': 'media',
'verbose_name_plural': 'media',
},
),
]

View File

@ -1,44 +0,0 @@
from django.db import models
from django.contrib.auth.models import User
def images_path(instance, filename):
# file will be uploaded to MEDIA_ROOT/user_<id>/<filename>
return '{0}/{1}'.format(instance.user.id, filename)
class Media(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE, blank=True, null=True)
image = models.FileField(upload_to=images_path, blank=True, null=True,)
is_video = models.BooleanField(default=False)
is_approved = models.BooleanField(blank=True, null=True, default=None, max_length=3)
date = models.DateTimeField(auto_now=True)
approved_by = models.CharField(max_length=30, blank=True, null=True, default=None, )
@property
def is_rejected(self) -> bool:
p = Profile.objects.get(user=self.user)
if p.is_banned:
return True
if not self.is_approved:
return True
return False
class Meta:
verbose_name = 'media'
verbose_name_plural = 'media'
class Profile(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE, primary_key=True)
is_banned = models.BooleanField(default=False)
balance = models.IntegerField(default=0)
class Transaction(models.Model):
cashier = models.ForeignKey(User, on_delete=models.CASCADE, related_name="cashier")
client = models.ForeignKey(User, on_delete=models.CASCADE, related_name="client")
date = models.DateTimeField(auto_now=True)
item = models.CharField(max_length=30, blank=True, null=True, default=None, )

View File

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

View File

@ -1,8 +0,0 @@
from django.shortcuts import render
from .models import Media, Profile, Transaction
def home_page(request):
return render(request, "index.html")

View File

@ -1,16 +0,0 @@
"""
ASGI config for reWrite project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'reWrite.settings')
application = get_asgi_application()

View File

@ -1,126 +0,0 @@
"""
Django settings for reWrite project.
Generated by 'django-admin startproject' using Django 3.1.6.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.1/ref/settings/
"""
import os
from pathlib import Path
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'z=mr)w@&x-qryc8*6ci0=jtst#bjwygod029(xjps$!5w%rp%5'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = [
'127.0.0.1',
]
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'reValuate'
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'reWrite.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'templates')],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'reWrite.wsgi.application'
# Database
# https://docs.djangoproject.com/en/3.1/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
}
}
# Password validation
# https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Internationalization
# https://docs.djangoproject.com/en/3.1/topics/i18n/
LANGUAGE_CODE = 'bg-BG'
TIME_ZONE = 'Europe/Sofia'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.1/howto/static-files/
STATIC_URL = '/static/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')

View File

@ -1,23 +0,0 @@
"""reWrite URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.1/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path
from reValuate.views import home_page
urlpatterns = [
path('', home_page),
path('admin/', admin.site.urls),
]

View File

@ -1,16 +0,0 @@
"""
WSGI config for reWrite project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'reWrite.settings')
application = get_wsgi_application()

View File

@ -1,12 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Hello!</title>
</head>
<body>
hi
</body>
</html>

View File

@ -1,45 +0,0 @@
{% extends 'base.html' %}
{% block title %}Login{% endblock %}
{% block optionalParams %}
<style>
html{
background: linear-gradient(180deg, rgba(70,147,48,1) 33%, rgba(109,126,107,1) 100%) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
font-family: Arial, Helvetica, sans-serif;
}
.buttons{
background-color: #469330;
border: none;
color: white;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
cursor: pointer;
}
#page-wrap{
padding: 20vh;
}
</style>
{% endblock %}
{% block content %}
<div class="centered" id="page-wrap" style="text-align:center;">
<h2>Влез в акаунта си</h2><br>
<form method="post">
{% csrf_token %}
{{ form.as_p }}
<button type="submit" class="buttons">Влез</button><br><br>
<a href="{% url 'signup' %}">Нямаш акаунт? Регистрирай се.</a>
</form>
</div>
{% endblock %}

View File

@ -1,8 +0,0 @@
{% extends 'base.html' %}
{% block title %}Password reset complete{% endblock %}
{% block content %}
<h1>Password reset complete</h1>
<p>Your new password has been set. You can log in now on the <a href="{% url 'login' %}">log in page</a>.</p>
{% endblock %}

View File

@ -1,20 +0,0 @@
{% extends 'base.html' %}
{% block title %}Enter new password{% endblock %}
{% block content %}
{% if validlink %}
<h1>Set a new password!</h1>
<form method="POST">
{% csrf_token %}
{{ form.as_p }}
<input type="submit" value="Change my password">
</form>
{% else %}
<p>The password reset link was invalid, possibly because it has already been used. Please request a new password reset.</p>
{% endif %}

View File

@ -1,8 +0,0 @@
{% extends 'base.html' %}
{% block title %}Email Sent{% endblock %}
{% block content %}
<h1>Check your inbox.</h1>
<p>We've emailed you instructions for setting your password. You should receive the email shortly!</p>
{% endblock %}

View File

@ -1,14 +0,0 @@
{% extends 'base.html' %}
{% block title %}Forgot Your Password?{% endblock %}
{% block content %}
<h1>Forgot your password?</h1>
<p>Enter your email address below, and we'll email instructions for setting a new one.</p>
<form method="POST">
{% csrf_token %}
{{ form.as_p }}
<input type="submit" value="Send me instructions!">
</form>
{% endblock %}

View File

@ -1,37 +0,0 @@
{% extends 'base.html' %}
{% block title %}Sign Up{% endblock %}
{% block optionalParams %}
<style>
html{
background: linear-gradient(180deg, rgba(70,147,48,1) 33%, rgba(109,126,107,1) 100%) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
font-family: Arial, Helvetica, sans-serif;
}
#page-wrap{
padding: 20vh;
}
</style>
{% endblock %}
{% block content %}
<div class="centered" id="page-wrap">
<h2>Регистрирай се</h2><br><br>
<form method="post">
{% csrf_token %}
{% for field in form %}
<div class="fieldWrapper">
{{ field.errors }}
{{ field.label_tag }}<br> {{ field }}
</div><br>
{% endfor %}
<button type="submit" class="buttons"">Регистрация</button>
</form>
</div>
{% endblock %}