diff --git a/config/settings.py b/config/settings.py index f1ba50f..c7d6522 100644 --- a/config/settings.py +++ b/config/settings.py @@ -56,6 +56,7 @@ INSTALLED_APPS = [ "django_extensions", "django_social_share", 'fontawesomefree', + "jquery", "users", "trials", diff --git a/config/urls.py b/config/urls.py index e2c4f31..b882af1 100644 --- a/config/urls.py +++ b/config/urls.py @@ -16,12 +16,14 @@ Including another URLconf from django.contrib import admin from django.urls import include from django.urls import path -from .views import home, welcome, help +from .views import home, welcome, help, hard, popular from django.contrib.staticfiles.urls import staticfiles_urlpatterns urlpatterns = [ path('', welcome, name='welcome'), path('home', home, name='home'), + path('popular', popular, name='popular'), + path('hard', hard, name='hard'), path('help', help, name='help'), path('users/', include("users.urls")), path('questions/', include("questions.urls")), diff --git a/config/views.py b/config/views.py index a6157b1..cd37137 100644 --- a/config/views.py +++ b/config/views.py @@ -2,6 +2,7 @@ from django.shortcuts import render, redirect from django.template import loader from django.contrib.auth.decorators import login_required from trials.models import Test +import operator @login_required @@ -18,6 +19,20 @@ def home(request): def help(request): return render(request, 'help.html', ) +@login_required +def popular(request): + context = {} + context['tests'] = Test.objects.filter(avg_rating__gt=0) + context['tests'] = sorted(context['tests'], key=operator.attrgetter('avg_rating'), reverse=True) + return render(request, 'popular.html', context) + +@login_required +def hard(request): + context = {} + context['tests'] = Test.objects.filter(difficulty_label__gt=0) + context['tests'] = sorted(context['tests'], key=operator.attrgetter('difficulty_label'), reverse=True) + return render(request, 'hard.html', context) + def welcome(request): return render(request, 'welcome.html') diff --git a/static/script.js b/static/script.js new file mode 100644 index 0000000..0b8e7bd --- /dev/null +++ b/static/script.js @@ -0,0 +1,21 @@ +//$(function() { +// $(".newQuestionSection" ).draggable().resizable(); +//} ); + +var questionId = 1; + +$('.addQuestionButton').click(function(){ + console.log("REEEEEEEE") + // Clone extra box, and remove duplicate ids + let clone = $("#question-copy").clone().removeAttr("hidden"); + clone.id = "question"- + ++questionId; + //clone.find("*").removeAttr("id"); + clone.find("*").each(function() { + $(this).attr("id", "q" + questionId + "-" + $(this).attr("id")); + }); + clone.find("input:radio").each(function() { + $(this).attr("name", questionId); + }); + // append it to div + $('#canvas').append(clone); +}); \ No newline at end of file diff --git a/static/style.css b/static/style.css index ce253be..080d606 100644 --- a/static/style.css +++ b/static/style.css @@ -1,6 +1,6 @@ .sidenav { height: 100%; - width: 195px; + width: 215px; position: fixed; z-index: 1; top: 0; @@ -44,7 +44,7 @@ } .main { - margin-left: 190px; + margin-left: 215px; padding: 0px 40px; } @@ -515,6 +515,23 @@ background-color:#FF0B7E width: 500px; } +.newQuestionSection { + border-radius: 25px; + border: 2px solid #FF0B7E; + padding: 20px; + width: 750px; + height: 350px; +} + +.questionSectionLabelText { + font-weight: bold; + font-size: 16px; + padding-bottom: 20px; +} + +.addQuestionButton { +} + .editContainer { overflow: scroll; } diff --git a/templates/base.html b/templates/base.html index a462f5f..2a0a349 100644 --- a/templates/base.html +++ b/templates/base.html @@ -16,11 +16,14 @@
Kategorie
Język polski Język angielski @@ -34,13 +37,16 @@ Historia InneKonto
- Ustawienia - Wyloguj + Ustawienia + Pomoc + Wyloguj