From a11afbfc179f201fd2b417fd527cfefa3640fdcf Mon Sep 17 00:00:00 2001 From: DarkPete Date: Mon, 17 Dec 2018 15:37:50 +0100 Subject: [PATCH] INQ-7 schema modfications and layout modifications --- App.py | 21 ++++++++--- inquire.db | Bin 28672 -> 28672 bytes schema.sql | 12 ++++++- static/style.css | 28 +++++++++++++-- templates/courses.html | 67 +++++++++++++++++++++++++++++++++++ templates/lectures.html | 75 ++++++++++++++++++++++++++++++++++++++++ templates/student.html | 26 +++++++------- 7 files changed, 208 insertions(+), 21 deletions(-) create mode 100644 templates/courses.html create mode 100644 templates/lectures.html diff --git a/App.py b/App.py index 13ee422..fffd727 100644 --- a/App.py +++ b/App.py @@ -18,10 +18,7 @@ def home(): if not session.get('logged_in'): return render_template('login.html') else: - if session.get('user_type') == 'lecturer': - return redirect('/lecturer') - else: - return redirect('/student') + return redirect('/courses') @app.route('/student',methods=['GET', 'POST']) def student(): @@ -74,6 +71,22 @@ def upvote(quest_id): db.commit() return '200' +############################################################ +@app.route('/courses') # +def courses(): # + return render_template('courses.html') + +@app.route('/lectures/', methods=['POST', 'GET']) +def lectures(lect_id): + return render_template('lectures.html') + +@app.route('/account', methods=['GET', 'POST']) +def account(): + if session.get('user_type') == 'lecturer': + return redirect(url_for('lecturer')) + else: # + return redirect(url_for('student')) # +############################################################ if __name__ == '__main__': app.secret_key = os.urandom(12) diff --git a/inquire.db b/inquire.db index a12dc5dd5409dc18b9dba810e3cf5ade7ff62c04..5d44de80ecc9866f35f2254132841648d0dd17f1 100644 GIT binary patch delta 34 qcmZp8z}WDBae_3Xz(g5mRsjaxk2^M|RQoe>PA>Ep-u&60R{;RfV++dw delta 34 qcmZp8z}WDBae_1>|3n#QR(=LOf!`Zbs{I)`CKvh(Z~pAhs{jDSeG4l9 diff --git a/schema.sql b/schema.sql index 51898b5..84d95c0 100644 --- a/schema.sql +++ b/schema.sql @@ -15,7 +15,10 @@ CREATE TABLE question ( created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, question_text TEXT NOT NULL, upvotes INTEGER NOT NULL, - FOREIGN KEY (subject_id) REFERENCES subject (subject_id) + has_answer BOOLEAN DEFAULT 0, + answer TEXT, + FOREIGN KEY (subject_id) REFERENCES subject (subject_id), + FOREIGN KEY (user_id) REFERENCES user (user_id) ); CREATE TABLE subject ( @@ -25,6 +28,13 @@ CREATE TABLE subject ( FOREIGN KEY (user_id) REFERENCES user (user_id) ); +CREATE TABLE subject_day ( + subject_day_id INTEGER PRIMARY KEY AUTOINCREMENT, + subject_id INTEGER, + topic TEXT NOT NULL + FOREIGN KEY (subject_id) REFERENCES subject(subject_id) +); + INSERT INTO user (username, password, lecturer) VALUES ('admin','admin',1); INSERT INTO user (username, password, lecturer) VALUES ('jassem','jassem',1); INSERT INTO user (username, password, lecturer) VALUES ('user','user',0); diff --git a/static/style.css b/static/style.css index 4dae847..d22b102 100644 --- a/static/style.css +++ b/static/style.css @@ -53,6 +53,7 @@ ul > li:not(:last-child) { .counter { display: flex; align-items: center; + min-width: 60px; } .counter > i { padding-right: 10px; @@ -159,10 +160,10 @@ ul > li:not(:last-child) { width: 100%; transition: 0.2s all; } -.btn--answer { +.btn--answer, #ask-question { transition: all 0.2s; } -#btn--login:hover, .btn--answer:hover { +#btn--login:hover, .btn--answer:hover, #ask-question:hover { box-shadow: 0px 10px 26px 0px rgba(0,0,0,0.75); } .forgot__text { @@ -201,4 +202,27 @@ ul > li:not(:last-child) { } #questions-list .row { margin-bottom: 0px !important; +} +.date { + line-height: 54px; +} +.ask__container--content { + display: flex; + justify-content: center; + padding-top: 10px !important; + padding-bottom: 10px !important; + padding-left: 120px !important; + padding-right: 120px !important; + padding-bottom: 20px !important; +} +.ask__container--content > div { + height: 56px; + line-height: 56px; + transition: 0.5s all; +} +.ask__container__lecturer--content > div { + height: 80px; + display: flex; + align-items: center; + justify-content: center; } \ No newline at end of file diff --git a/templates/courses.html b/templates/courses.html new file mode 100644 index 0000000..7e5fc3c --- /dev/null +++ b/templates/courses.html @@ -0,0 +1,67 @@ +{% extends "index.html" %} +{% block title %}Lista kursów{% endblock %} + +{% block content %} +
+
+
+
+ Lista kursów +
+
+
+
+
+
+
+
+
+ +
    +
  • + + Algorytmy Kombinatoryczne w Bioinformatyce + + OTWÓRZ +
  • +
  • + + Optymalizacja kombinatoryczna + + OTWÓRZ +
  • +
  • + + Podstawy JavaScriptu dla programistów C# + + OTWÓRZ +
  • +
+
+
+
+
+
+ +{% endblock %} + +{% block script %} + +{% endblock %} \ No newline at end of file diff --git a/templates/lectures.html b/templates/lectures.html new file mode 100644 index 0000000..f69f4ae --- /dev/null +++ b/templates/lectures.html @@ -0,0 +1,75 @@ +{% extends "index.html" %} +{% block title %}Terminy wykładów{% endblock %} + +{% block content %} +
+
+
+
+ Nazwa wykładu +
+
+
+
+
+
+
+
+
+ Pytania studentów +
    +
  • + + 30.11.2018 + + + Wykład o Piotrze + + OTWÓRZ +
  • +
  • + + 32.11.2018 + + + Wykład o Szymonie + + OTWÓRZ +
  • +
  • + + 33.11.2018 + + + Wykład o Pythonie + + OTWÓRZ +
  • +
+
+
+
+
+
+ +{% endblock %} + +{% block script %} + +{% endblock %} \ No newline at end of file diff --git a/templates/student.html b/templates/student.html index 2340b33..a1ca863 100644 --- a/templates/student.html +++ b/templates/student.html @@ -4,7 +4,7 @@ {% block content %}
power_settings_new -
+
Panel studenta @@ -16,24 +16,22 @@
-
+
Pytania studentów
    {% for question in questions %} -
  • {{ question[3] }}thumb_up{{ question[4] }}
  • +
  • + {{ question[3] }} + + thumb_up + {{ question[4] }} + +
  • {% endfor %}
-
-
-
-
-