This commit is contained in:
Dawid Majsnerowski 2020-01-01 20:18:40 +01:00
commit 76d0e7ab4b
26 changed files with 146 additions and 78 deletions

View File

@ -2,16 +2,12 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="b23c009e-2f8a-48f7-8b29-023f93596932" name="Default Changelist" comment="">
<change afterPath="$PROJECT_DIR$/bestnotes/static/note.css" afterDir="false" />
<change afterPath="$PROJECT_DIR$/bestnotes/templates/note.html" afterDir="false" />
<change afterPath="$PROJECT_DIR$/bestnotes/templates/test.html" afterDir="false" />
<change afterPath="$PROJECT_DIR$/bestnotes/templates/testid.html" afterDir="false" />
<change afterPath="$PROJECT_DIR$/bestnotes/static/topics.css" afterDir="false" />
<change afterPath="$PROJECT_DIR$/bestnotes/templates/topics.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/bestnotes/admin.py" beforeDir="false" afterPath="$PROJECT_DIR$/bestnotes/admin.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/bestnotes/models.py" beforeDir="false" afterPath="$PROJECT_DIR$/bestnotes/models.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/bestnotes/templates/subjects.html" beforeDir="false" afterPath="$PROJECT_DIR$/bestnotes/templates/subjects.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/bestnotes/urls.py" beforeDir="false" afterPath="$PROJECT_DIR$/bestnotes/urls.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/bestnotes/views.py" beforeDir="false" afterPath="$PROJECT_DIR$/bestnotes/views.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/db.sqlite3" beforeDir="false" afterPath="$PROJECT_DIR$/db.sqlite3" afterDir="false" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" />

View File

@ -0,0 +1,3 @@
.oneimg {
height: 100vh;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 KiB

View File

@ -0,0 +1,4 @@
.subjectname{
text-decoration: none;
color:white;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View File

@ -6,31 +6,31 @@
{% block content %}
{% include 'navbar.html' %}
<div class="bg-secondary">
<div class="w-100 p-3 mb-2 text-white">
<div >
<img src="{% static 'bg_notes.jpg' %}" class="w-100 img-fluid"/>
</div>
<div class="mb-5">
<div>
<img src="{% static 'laptop2.jpg' %}" class="w-100 img-fluid"/>
</div>
<div>
<div class="w-25 d-flex justify-content-center">
<img src="{% static 'laptop.png' %}" class="img-fluid "/>
</div>
<div class="d-flex justify-content-center">
<h2>Stwórz najlepszą wersję mobilnych notatek</h2>
</div>
</div>
<div class="container-fluid">
<div class="row">
<div class="col-6 my-auto" id="laptop_container">
<img id="laptop_img" src="{% static 'laptop.png' %}" class="w-25 img-fluid mx-auto d-block"/>
</div>
<div class="col-6 my-auto" id="text0_container">
<h3 class="text-white text-center" id="text0">Stwórz najlepszą wersję mobilnych notatek</h3>
</div>
</div>
<div class="w-50 d-flex justify-content-center">
<div >
<h3>Dziel się notatkami ze znajomymi</h3>
</div>
<div class="row mt-5">
<div class="col-6 my-auto" id="text1_container">
<h3 class="text-white text-center" id="text1">Dziel się notatkami ze znajomymi</h3>
</div>
<div class="col-6 my-auto" id="userplus_container">
<img "userplus_img" src="{% static 'userplus.png' %}" class="w-25 img-fluid mx-auto d-block"/>
</div>
</div>
</div>

View File

@ -7,13 +7,13 @@
<span class="navbar-toggler-icon"></span>
</button>
<ul class="navbar-nav collapse navbar-collapse" id="navbarNav">
<li class="nav-item nav-link"><a class="nolink" href="{% url 'homepage' %}"><i class="fa fa-home fa-2x"></a></i></li>
<li id="home" class="nav-item nav-link"><a class="nolink" href="{% url 'homepage' %}"><i class="fa fa-home fa-2x"></a></i></li>
{% if user.is_authenticated %}
<li class="nav-item nav-link"><a class="nolink" href="#"><i class="fa fa-pencil-square-o fa-2x"></a></i></li>
<li class="nav-item nav-link active"><a class="nolink" href="{% url 'subject' %}"><i class="fa fa-list-ul fa-2x"></i></a></li>
<li class="nav-item nav-link"><a class="nolink" href="{% url 'logout' %}"><i class="fa fa-sign-out fa-2x"></i></a></li>
<li id="add_note" class="nav-item nav-link"><a class="nolink" href="#"><i class="fa fa-pencil-square-o fa-2x"></a></i></li>
<li id="all_subjects" class="nav-item nav-link active"><a class="nolink" href="{% url 'subject' %}"><i class="fa fa-list-ul fa-2x"></i></a></li>
<li id="logout" class="nav-item nav-link"><a class="nolink" href="{% url 'logout' %}"><i class="fa fa-sign-out fa-2x"></i></a></li>
{% else %}
<li class="nav-item nav-link"><a class="nolink" href="{% url 'login' %}">Zaloguj się</a></li>
<li id="login" class="nav-item nav-link"><a class="nolink" href="{% url 'login' %}">Zaloguj się</a></li>
{% endif %}
</ul>
</nav>

View File

@ -6,12 +6,17 @@
{% block content %}
{% include 'navbar.html' %}
<div class="container d-flex justify-content-center">
<div class="row mt-4"><h1 class="text-white">Tytuł: {{ note.name }}</h1></div>
<div class="row mt-4"><h1 id="note_title" class="text-white">Tytuł: {{ note.name }}</h1></div>
</div>
{% if note.user.user.id == user.id %}
<div class="container">
<div class="row d-flex justify-content-center"><button id="edit_note" class="btn-success mr-1">Edytuj</button> <button id="delete_note" class="btn-danger">Usuń</button></div>
</div>
{% endif %}
<div class="container">
<div class="d-flex justify-content-center mt-5">
<h3 class="text-white"> {{ note.text }}</h3>
<h3 class="text-white" id="note_text"> {{ note.text }}</h3>
</div>
</div>

View File

@ -11,23 +11,23 @@
<div class="container">
<div class="row">
<div class="col-sm-6">
<h2 class="text-white text-center">Dostępne notatki</h2>
<ul class="list-group cProductsList mt-3">
{% for note in notes%}
<div class="col-sm-6" id="all_container">
<h2 class="text-white text-center" id="avaliable_notes">Dostępne notatki</h2>
<ul class="list-group cProductsList mt-3" id="all_notes_list">
{% for note in notes %}
{% if user.id != note.user.user.id %}
<a href="/bestnotes/note/{{ note.id }}" class="list-group-item list-group-item-action">{{ note.name }}</a>
{% endif %}
<a href="/bestnotes/note/{{ note.id }}" id="{{ note_name }}{{note_id}}" class="list-group-item list-group-item-action">{{ note.name }}</a>
{% endif %}
{% endfor %}
</ul>
</div>
<div class="col-sm-6">
<h2 class="text-white text-center">Twoje notatki</h2>
<ul class="list-group cProductsList mt-3">
{% for note in notes%}
{% if user.id == note.user.user.id %}
<a href="/bestnotes/note/{{ note.id }}" class="list-group-item list-group-item-action">{{ note.name }}</a>
{% endif %}
<div class="col-sm-6" id="your_container">
<h2 class="text-white text-center" id="your_notes">Twoje notatki</h2>
<ul class="list-group cProductsList mt-3" id="your_notes_list">
{% for note in notes %}
{% if user.id == note.user.user.id %}
<a href="/bestnotes/note/{{ note.id }}" id="{{ note_name }}{{note_id}}" class="list-group-item list-group-item-action">{{ note.name }}</a>
{% endif %}
{% endfor %}
</ul>
</div>

View File

@ -10,37 +10,32 @@
{% include 'navbar.html' %}
<div class="container">
<div class="d-flex justify-content-center mt-5">
<h3 class="text-white">Dodaj nowy przedmiot</h3>
<div class="mb-5">
<div>
<img src="{% static 'laptop2.jpg' %}" class="w-100 img-fluid"/>
</div>
</div>
<div class="container mb-5">
<div class="row">
<div class="col-sm-6 mb-5">
<h2 class="text-white text-center mb-5 bg-dark" id="avaliable_notes">Dostępne notatki</h2>
<h4 class="text-white text-center" id="choose_subject_all">Wybierz przedmiot</h4>
<ul class="list-group cProductsList mt-3" id="list_all">
{% for subject in subjects %}
<a href="/bestnotes/topics_by_subject_id/{{ subject.id }}" id="{{ subject.name }}{{subject.id}}" class="list-group-item list-group-item-action">{{ subject.name }}</a>
{% endfor %}
</ul>
</div>
<div class="col-sm-6">
<h2 class="text-white text-center mb-5 bg-dark" id="your_notes">Twoje notatki</h2>
<h4 class="text-white text-center" id="choose_subject_yours">Wybierz przedmiot</h4>
<ul class="list-group cProductsList mt-3" id="list_yours">
{% for subject in student_subjects %}
<a href="/bestnotes/topics_by_subject_id/{{ subject.id }}" id="{{ subject.name }}{{subject.id}}" class="list-group-item list-group-item-action">{{ subject.name }}</a>
{% endfor %}
</ul>
</div>
<div class="d-flex justify-content-center mt-3">
<form role="form">
<input type="text" class="form-control" placeholder="Nowy przedmiot" name="przedmiot">
</form>
<button type="button" class="btn btn btn-primary ml-1">Dodaj</button>
</div>
<div class="d-flex justify-content-center mt-5">
<h3 class="text-white">Lista przedmiotów</h3>
</div>
<a class="row justify-content-center text-white">Liczba dostępnych przedmiotów: 3/5</a>
<ul class="list-group cProductsList mt-3">
<li class="list-group-item d-sm-flex justify-content-between"><p class="p-0 m-0 flex-grow-1">Programowanie</p>
<button class="btn-primary mr-1" ><a class="nolink" href="/bestnotes/notes/1">Zarządzaj</a></button>
<button class="btn-success mr-1">Edytuj</button>
<button class="btn-danger">Usuń</button>
</li>
<li class="list-group-item d-sm-flex justify-content-between"><p class="p-0 m-0 flex-grow-1">Matematyka</p>
<button class="btn-primary mr-1"><a class="nolink" href="/bestnotes/notes/2">Zarządzaj</a></button>
<button class="btn-success mr-1">Edytuj</button>
<button class="btn-danger">Usuń</button>
</li>
<li class="list-group-item d-sm-flex justify-content-between"><p class="p-0 m-0 flex-grow-1">Systemy informatyczne</p>
<button class="btn-primary mr-1"><a class="nolink" href="/bestnotes/notes/3">Zarządzaj</a></button>
<button class="btn-success mr-1">Edytuj</button>
<button class="btn-danger">Usuń</button>
</li>
</ul>
</div>
{% else %}

View File

@ -0,0 +1,25 @@
{% extends 'base.html' %}
{% load static %}
{% block css %}
<link rel="stylesheet" type="text/css" href="{% static 'topics.css' %}">
{% endblock %}
{% block content %}
{% include 'navbar.html' %}
<div class="container d-flex justify-content-center">
<div class="row mt-4"><h1 class="subjectname">{{subject_name}}</h1></div>
</div>
<div class="container d-flex justify-content-center">
<div class="row">
<div class="col-sm-12">
<h2 class="text-white text-center">Dostępne zagadnienia</h2>
<ul class="list-group cProductsList mt-4">
{% for topic in topics%}
<a href="/bestnotes/notes_by_topic/{{ topic.id }}" class="list-group-item list-group-item-action">{{ topic.name }}</a>
{% endfor %}
</ul>
</div>
</div>
</div>
{% endblock %}

View File

@ -6,9 +6,11 @@ urlpatterns = [
path('', views.homepage, name='homepage'),
#path('/', views.login),
path('accounts/', include("django.contrib.auth.urls")),
path('subject/', views.subject, name="subject"),
path('subject/', views.subjects_all, name="subject"),
path('subject/<id>', views.subject_id, name="subjectid"),
path('note/<id>', views.note_id, name="note"),
path('notes_by_topic/<topic_id>', views.notes_by_topic_id, name="notes"),
path('topics_by_subject_id/<subject_id>', views.topics_by_subject_id, name="topics"),
path('notes/', views.notes_all, name="notes"),
path('notes/<subject_id>', views.notes_name, name="notes_id")

View File

@ -1,5 +1,5 @@
from django.shortcuts import render
from bestnotes.models import Note
from bestnotes.models import Note, Topic, Subject
# Create your views here.
from django.http import HttpResponse
@ -38,9 +38,47 @@ def notes_name(request,subject_id):
#Change website here
return render(request, "notes.html", context)
def notes_by_topic_id(request,topic_id):
all_notes = Note.objects.all()
topic_notes = all_notes.filter(topic__id=topic_id) #Get all notes with given topic id
context = {
'notes' : topic_notes
}
#Change website here
return render(request, "notes.html", context)
def topics_by_subject_id(request,subject_id):
all_topics = Topic.objects.all()
topics_under_subject = all_topics.filter(subject__id=subject_id) #get topics under given subject
if len(topics_under_subject) > 0:
subject_name = all_topics[0].subject.name # Get note with given id
context = {
'subject_name': subject_name,
'topics': topics_under_subject
}
return render(request, "topics.html", context)
else:
return HttpResponse("Topics not found.")
def notes_all(request):
all_notes = Note.objects.all()
context = {
'notes' : all_notes
}
return render(request, "test.html", context)
return render(request, "test.html", context)
def subjects_all(request):
all_subjects = Subject.objects.all()
student_notes = Note.objects.all().filter(user__user__id=request.user.id)
student_subjects = []
for note in student_notes:
student_subjects.append(note.topic.subject)
context = {
'subjects' : all_subjects,
'student_subjects': student_subjects
}
return render(request, "subjects.html", context)

Binary file not shown.