From 25e24462ffa388d8a8d494c0888968fe83b5894c Mon Sep 17 00:00:00 2001 From: Andrei Date: Fri, 27 Jan 2023 19:47:05 +0500 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B0=20=D1=81=D1=82=D1=80=D0=B0=D0=BD=D0=B8=D1=86=D0=B0?= =?UTF-8?q?=20=D0=BE=D1=82=D0=BE=D0=B1=D1=80=D0=B0=D0=B6=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D1=8F=20=D0=B8=D0=BD=D1=84=D0=BE=D1=80=D0=BC=D0=B0=D1=86=D0=B8?= =?UTF-8?q?=D0=B8=20=D0=BE=20=D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2?= =?UTF-8?q?=D0=B0=D1=82=D0=B5=D0=BB=D0=B5=20=D0=BF=D0=BE=20=D0=B0=D0=B4?= =?UTF-8?q?=D1=80=D0=B5=D1=81=D1=83:=20"user/",=20=D1=81=D1=82?= =?UTF-8?q?=D1=80=D0=B0=D0=BD=D0=B8=D1=86=D0=B0=20=D0=BE=D1=88=D0=B8=D0=B1?= =?UTF-8?q?=D0=BE=D0=BA=20=D0=B1=D1=8B=D0=BB=D0=B0=20=D1=83=D0=BD=D0=B8?= =?UTF-8?q?=D1=84=D0=B8=D1=86=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B0=20?= =?UTF-8?q?=D0=B8=20=D1=82=D0=B5=D0=BF=D0=B5=D1=80=D1=8C=20=D0=B8=D1=81?= =?UTF-8?q?=D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D1=83=D0=B5=D1=82=D1=81=D1=8F=20?= =?UTF-8?q?=D0=B4=D0=BB=D1=8F=20=D0=B2=D1=81=D0=B5=D1=85=20=D0=BE=D1=88?= =?UTF-8?q?=D0=B8=D0=B1=D0=BE=D0=BA,=20=D0=BF=D1=80=D0=BE=D0=BF=D0=B8?= =?UTF-8?q?=D1=81=D0=B0=D0=BD=D0=BD=D1=8B=D1=85=20=D0=B2=20main.py.=20?= =?UTF-8?q?=D0=9F=D1=80=D0=B8=20=D0=BD=D0=B0=D0=B6=D0=B0=D1=82=D0=B8=D0=B8?= =?UTF-8?q?=20=D0=BD=D0=B0=20=D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2?= =?UTF-8?q?=D0=B0=D1=82=D0=B5=D0=BB=D1=8F,=20=D1=81=D0=B0=D0=B9=D1=82=20?= =?UTF-8?q?=D0=BF=D0=B5=D1=80=D0=B5=D0=BA=D0=B8=D0=B4=D1=8B=D0=B2=D0=B0?= =?UTF-8?q?=D0=B5=D1=82=20=D0=BD=D0=B0=20=D1=81=D1=82=D1=80=D0=B0=D0=BD?= =?UTF-8?q?=D0=B8=D1=86=D1=83=20=D0=BE=D1=82=D0=BE=D0=B1=D1=80=D0=B0=D0=B6?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=B8=D0=BD=D1=84=D0=BE=D1=80=D0=BC?= =?UTF-8?q?=D0=B0=D1=86=D0=B8=D0=B8=20=D0=BE=20=D0=BD=D0=B5=D0=BC.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 19 ++++ static/css/projects.css | 14 +++ static/css/user_view.css | 217 +++++++++++++++++++++++++++++++++++++++ templates/projects.html | 6 +- templates/user_view.html | 86 ++++++++++++++++ 5 files changed, 340 insertions(+), 2 deletions(-) create mode 100644 static/css/user_view.css create mode 100644 templates/user_view.html diff --git a/main.py b/main.py index b01d5b0..5c1b7fc 100644 --- a/main.py +++ b/main.py @@ -64,6 +64,25 @@ def delete_project(id_project): return redirect('/login') +@app.route('/user/', methods=['GET', 'POST']) +def user_view(_login): + if current_user.is_authenticated: + data_session = db_session.create_session() + user = data_session.query(User).filter(User.login == _login).first() + if user: + projects = data_session.query(Projects).filter(or_(Projects.creator == user.id, Projects.id.in_( + list(map(lambda x: x[0], data_session.query( + StaffProjects.project).filter( + StaffProjects.user == user.id).all()))))).all() + resp = list(map(lambda x: get_projects_data(x), projects)) + return render_template('user_view.html', title=user.name + ' ' + user.surname, user=user, + list_projects=resp) + else: + abort(404) + else: + return redirect('/login') + + @app.route('/projects/new', methods=['GET', 'POST']) def new_project(): if current_user.is_authenticated: diff --git a/static/css/projects.css b/static/css/projects.css index a547be7..385cee2 100644 --- a/static/css/projects.css +++ b/static/css/projects.css @@ -232,6 +232,7 @@ margin-left: 9px; margin-top: 10px; overflow-x: auto; + color: #000000 !important; } .new_project_button { width: 13vw; @@ -263,4 +264,17 @@ display: flex; align-items: center; justify-content: center; +} +.link_to_user { + width: 16vw; + height: 3.5vw; + display: flex; + align-items: center; + justify-content: flex-start; + flex-direction: row; + flex-wrap: no-wrap; + text-decoration: none; +} +.link_to_user:hover { + text-decoration: none; } \ No newline at end of file diff --git a/static/css/user_view.css b/static/css/user_view.css new file mode 100644 index 0000000..eab195d --- /dev/null +++ b/static/css/user_view.css @@ -0,0 +1,217 @@ +.user_view_page { + height: 120vw; + background-color: #dcb495; +} +.user_data_block { + width: 85%; + height: 65vw; + margin-left: 7.5%; + display: flex; + flex-direction: column; + align-items: center; + background-color:#a8886f; + border-radius: 4vw; +} +.user_photo { + margin-top: 30px; + width: 15vw; + height: 15vw; + border: 0.2vw solid #ffffff; + border-radius: 2vw; +} +.first_data_block { + width: 100%; + display: flex; + align-items: center; + justify-content: space-evenly; +} +.user_data { + width: 95%; + height: 30vw; + display: flex; + flex-direction: column; + align-items: center; +} +.data_header { + font-size: 2vw; + color: #ffffff; + font-weight: bold; +} +.data_block { + background-color:#f5d3b8; + width: 25vw; + height: 5vw; + border-radius: 5vw; + display: flex; + justify-content: center; + align-items: center; +} +.data_text { + width: 100%; + height: 100%; + display: flex; + justify-content: center; + align-items: center; + margin-top: 5px; + font-size: 1.5vw; + color: #000000; + overflow-x: auto; +} +.surname_block, .about_block { + width: 90%; +} +.about_bottom { + border-radius: 3vw; + height: 20vw !important; +} +.data_bottom { + width: 100% !important; +} +.list_project { + width: 95%; + margin-left: 2.5%; + margin-top: 2vw; + overflow-y: hidden; + overflow-x: hidden; +} +.project_header_button { + height: 5.5vw; + width: 100%; + text-align: left; + border-radius: 5vw; + background-color: #9E795A; + border-color: #9E795A; + border-bottom-color: #9E795A; + color: #ffffff; + display: flex; + align-items: center; +} +.project_description_block { + background-color: #9E795A; + width: 100%; + height: 20vw; + border-radius: 2vw; +} +.project_logo_block { + width: 4.5vw; + height: 4.5vw; + border: 0.3vw solid #ffffff; + background-color: #ffffff; + border-radius: 2vw; + display: flex; + justify-content: center; + align-items: center; +} +.project_logo { + width: 4vw; + height: 4vw; + border-radius: 5vw; +} +.project_title_block { + width: 70%; + height: 4vw; +} +.project_title { + font-size: 3.5vw; +} +.project_button_block_one { + width: 50%; + display: flex; + justify-content: space-evenly; + align-items: flex-start; +} +.project_description { + width: 98%; + height: 100%; + margin-left: 1%; + display: flex; + flex-direction: row; + flex-wrap: nowrap; + align-content: center; + align-items: center; + justify-content: space-evenly; +} +.collaborator_block { + width: 22%; + height: 90%; + background-color: #EDCBB0; + border-radius: 2vw; + overflow-y: auto; +} +.description_block { + width: 48%; + height: 90%; + display: flex; + flex-direction: column; + align-items: center; + flex-wrap: nowrap; +} +.description_header_text { + font-size: 2vw; +} +.description_block_text { + width: 90% !important; + height: 80% !important; + width: 50%; + background-color: #dcb495; + border-radius: 2vw; +} +.description_text { + width: 100% !important; + height: 100%; + font-size: 1.5vw; + overflow-wrap: normal; /* не поддерживает IE, Firefox; является копией word-wrap */ + word-wrap: normal; + word-break: normal; /* не поддерживает Opera12.14, значение keep-all не поддерживается IE, Chrome */ + line-break: auto; /* нет поддержки для русского языка */ + hyphens: manual; /* значение auto не поддерживается Chrome */ + margin: 2vw; +} +.user_projects_block { + margin-top: 35px; + margin-left: 3%; + border: 0.2vw solid #694a2d; + border-radius: 4.5vw; + width: 94%; + height: 45vw; + overflow-y: auto; +} +.user { + width: 16vw; + height: 3.5vw; + background-color: #ffffff; + border: 2px solid #9E795A; + border-radius: 3vw; + margin-top: 5px; + display: flex; + align-items: center; + justify-content: flex-start; + flex-direction: row; + flex-wrap: no-wrap; +} +.user_logo { + margin-left: 3px; + width: 3vw; + height: 3vw; + border-radius: 5vw; + background-color: #000000; +} +.user_names { + margin-left: 9px; + margin-top: 10px; + overflow-x: auto; + color: #000000 !important; +} +.link_to_user { + width: 16vw; + height: 3.5vw; + display: flex; + align-items: center; + justify-content: flex-start; + flex-direction: row; + flex-wrap: no-wrap; + text-decoration: none; +} +.link_to_user:hover { + text-decoration: none; +} \ No newline at end of file diff --git a/templates/projects.html b/templates/projects.html index 7814c3c..60e3067 100644 --- a/templates/projects.html +++ b/templates/projects.html @@ -42,8 +42,10 @@
{% for user in project.staff %}
- -

{{user.name}}

+ + +

{{user.name}}

+
{% endfor %}
diff --git a/templates/user_view.html b/templates/user_view.html new file mode 100644 index 0000000..ea8fba9 --- /dev/null +++ b/templates/user_view.html @@ -0,0 +1,86 @@ + +{% extends "base.html" %} {% block content %} +
+
+
+ +
+
+
+
+

Имя

+
+

{{ user.name }}

+
+
+ +
+
+

Фамилия

+
+

{{ user.surname }}

+
+
+
+

О себе

+
+

{{ user.about }}

+
+
+
+
+
+ {% for project in list_projects %} +
+
+

+ +

+
+
+
+
+ {% for user in project.staff %} + + {% endfor %} +
+
+
+
+

Описание

+
+
+

{{ project.description }}

+
+
+
+
+
+
+ {% endfor %} +
+
+{% endblock %} \ No newline at end of file