Открыть боковую панель
peteroshkvarkov
Project-38
Коммиты
f3dfaf1c
Коммит
f3dfaf1c
создал
Ноя 06, 2023
по автору
Кабанин Денис Андреевич
Просмотр файлов
Стилизовал фильтры для более удобной разработки
владелец
87d4e69b
Изменения
4
Скрыть пробелы
Построчно
Рядом
portal/projects/migrations/0005_project_nominations.py
0 → 100644
Просмотр файла @
f3dfaf1c
# Generated by Django 4.2a1 on 2023-11-06 08:50
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'projects'
,
'0004_project_defence_video'
),
]
operations
=
[
migrations
.
AddField
(
model_name
=
'project'
,
name
=
'nominations'
,
field
=
models
.
CharField
(
max_length
=
100
,
null
=
True
),
),
]
portal/static/css/archive/archive.css
0 → 100644
Просмотр файла @
f3dfaf1c
body
{
background
:
#ffffff
;
}
.header
{
padding
:
45px
176px
;
display
:
flex
;
align-items
:
center
;
width
:
100%
;
}
.logo
{
margin-right
:
auto
;
}
.nav
{
margin-right
:
90px
;
}
.nav-list
{
display
:
flex
;
gap
:
30px
;
}
.nav-item
{
color
:
#000
;
font-size
:
20px
;
font-style
:
normal
;
font-weight
:
700
;
line-height
:
normal
;
}
.user
{
display
:
flex
;
gap
:
12px
;
}
.username
{
color
:
#007EFA
;
font-size
:
20px
;
font-style
:
normal
;
font-weight
:
700
;
line-height
:
normal
;
}
.avatar
{
max-width
:
50px
;
max-height
:
50px
;
}
.filters
{
margin-bottom
:
40px
;
}
.left
,
.right
{
display
:
inline-block
;
}
.left
{
margin-right
:
15px
;
min-width
:
600px
;
}
.search
{
margin-bottom
:
10px
;
width
:
100%
;
display
:
flex
;
justify-content
:
center
;
align-items
:
center
;
}
.search-input
{
width
:
100%
;
border
:
1px
solid
#103A84
;
border-radius
:
30px
;
background
:
#fff
;
outline
:
none
;
padding
:
12px
20px
;
font-weight
:
400
;
font-size
:
14px
;
line-height
:
16px
;
}
.search-button
{
width
:
40px
;
height
:
40px
;
margin-left
:
-40px
;
padding
:
19px
;
border-top-right-radius
:
30px
;
border-bottom-right-radius
:
30px
;
border
:
none
;
color
:
transparent
;
background
:
#103A84
url('../../img/admin_menu/search.svg')
no-repeat
40%
center
;
cursor
:
pointer
;
}
.tags
{
margin-bottom
:
20px
;
}
.tag-list
{
display
:
flex
;
gap
:
15px
;
}
.btn-tag
{
padding
:
5px
10px
;
font-size
:
16px
;
background-color
:
#ffffff
;
outline
:
none
;
border
:
1px
solid
#103A84
;
border-radius
:
5px
;
cursor
:
pointer
;
transition
:
background
0.3s
linear
,
color
0.3s
linear
;
}
.btn-tag
:hover
{
background-color
:
#f1f1f1
;
}
.btn-tag
:active
{
background
:
#103A84
;
color
:
#fff
;
transition
:
background
0.3s
linear
,
color
0.3s
linear
;
}
.btn-tag-active
{
background
:
#103A84
;
color
:
#fff
;
}
.btn-tag-active
:hover
{
background
:
#3e5e96
;
}
.btn-tag-active
:active
{
background-color
:
#ffffff
;
color
:
#000000
;
}
.filter
{
display
:
flex
;
align-items
:
flex-start
;
gap
:
5px
;
}
.div-list
{
display
:
inline-flex
;
}
.div-list
:first-child
{
margin-right
:
auto
;
}
.list-name
{
margin
:
0
;
background
:
#103A84
;
padding
:
10px
8px
;
color
:
#fff
;
font-weight
:
400
;
font-size
:
14px
;
line-height
:
16px
;
border-top-left-radius
:
5px
;
border-bottom-left-radius
:
5px
;
}
.list-names
{
position
:
relative
;
margin
:
0
;
padding
:
0
;
list-style
:
none
;
}
.list
{
position
:
absolute
;
max-height
:
200px
;
overflow-y
:
auto
;
overflow-x
:
hidden
;
display
:
none
;
padding
:
0
;
margin
:
0
;
box-shadow
:
0px
0px
5px
rgba
(
0
,
0
,
0
,
0.5
);
background
:
#fff
;
}
.list-p
{
margin
:
0
;
padding
:
9px
8px
;
padding-right
:
25px
;
border
:
1px
solid
#103A84
;
border-top-right-radius
:
5px
;
border-bottom-right-radius
:
5px
;
width
:
100%
;
min-height
:
36px
;
font-size
:
14px
;
line-height
:
16px
;
font-weight
:
400
;
color
:
#121212
;
background
:
#fff
url('../../img/global/arrow-down.svg')
no-repeat
95%
center
;
cursor
:
pointer
;
}
.list-li
{
padding
:
9px
8px
;
font-size
:
14px
;
line-height
:
16px
;
font-weight
:
400
;
color
:
#121212
;
cursor
:
pointer
;
}
.list-li
:hover
{
background
:
#ccc
;
}
.btn
{
padding
:
8px
30px
;
outline
:
none
;
border
:
none
;
font-size
:
16px
;
border-radius
:
5px
;
cursor
:
pointer
;
background
:
#103A84
;
color
:
#fff
;
transition
:
background
0.1s
linear
;
}
.btn
:active
{
background
:
#3e5e96
;
}
\ Нет новой строки в конце файла
portal/static/js/projects/archive.js
Просмотр файла @
f3dfaf1c
...
...
@@ -3,4 +3,16 @@ $("ul li.list-li.nominations").click(function () {
});
$
(
"
ul li.list-li.subject
"
).
click
(
function
()
{
$
(
"
#subject-filter
"
).
val
(
$
(
this
).
text
());
});
\ Нет новой строки в конце файла
});
function
search_tag
(
btn
,
search_name
)
{
let
name
=
$
(
'
.search-input
'
).
attr
(
'
name
'
);
if
(
name
==
search_name
)
{
$
(
'
.btn-tag
'
).
removeClass
(
'
btn-tag-active
'
);
$
(
'
.search-input
'
).
attr
(
'
name
'
,
'
name
'
);
}
else
{
$
(
'
.btn-tag
'
).
removeClass
(
'
btn-tag-active
'
);
$
(
btn
).
addClass
(
'
btn-tag-active
'
);
$
(
'
.search-input
'
).
attr
(
'
name
'
,
search_name
);
}
}
\ Нет новой строки в конце файла
portal/templates/projects/archive.html
Просмотр файла @
f3dfaf1c
{% load static %}
{% load js %}
{% block head %}
<title>
Архив работ
</title>
<meta
charset=
"UTF-8"
>
<!DOCTYPE html>
<html
lang=
"ru"
>
<head>
{% load static %}
{% load js %}
<meta
charset=
"UTF-8"
>
<meta
http-equiv=
"X-UA-Compatible"
content=
"IE=edge"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
>
<link
rel=
"preconnect"
href=
"https://fonts.googleapis.com"
>
<link
rel=
"preconnect"
href=
"https://fonts.gstatic.com"
crossorigin
>
<link
href=
"https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;700&display=swap"
rel=
"stylesheet"
>
<link
rel=
"shortcut icon"
href=
"{% static 'img/global/icon.png' %}"
type=
"image/x-icon"
>
<title>
Архив работ
</title>
<link
rel=
"stylesheet"
href=
"{% static 'css/global/index.css' %}"
>
<link
rel=
"stylesheet"
href=
"{% static 'css/archive/archive.css' %}"
>
<script
src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js"
></script>
{% endblock head %}
{% block content %}
</head>
<div
class=
"filters"
>
<form
class=
"container"
method=
"POST"
action=
"{% url 'archive' %}"
>
{% csrf_token %}
<div
class=
"left"
>
<div
class=
"search"
>
<input
class=
"search-input"
type=
"text"
placeholder=
"Поиск..."
name=
"name"
>
<button
class=
"search-button"
></button>
</div>
<div
class=
"checkboxes"
>
<div
class=
"div-list"
>
<div
class=
"list-name"
>
Предмет
</div>
<input
type=
"hidden"
id=
"subject-filter"
name=
"subject"
/>
<div
class=
"list-names"
>
<div
class=
"list-p"
>
Не указано
</div>
<ul
class=
"list"
name=
"subject"
>
<li
class=
"list-li subject"
>
Не указано
</li>
{% for subject in subjects %}
<li
class=
"list-li subject"
>
{{subject}}
</li>
{% endfor %}
</ul>
<body>
<header
class=
"header"
>
<a
href=
"{% url 'home' %}"
class=
"logo"
><img
src=
"{% static 'img/global/long_logo.svg' %}"
alt=
"Логотип лицея"
></a>
<nav
class=
"nav"
>
<ul
class=
"nav-list"
>
<li
class=
"nav-item"
>
<a
href=
"{% url 'home' %}#contests"
>
Конкурсы
</a>
</li>
<li
class=
"nav-item"
>
<a
href=
"{% url 'archive' %}"
>
Архив работ
</a>
</li>
<li
class=
"nav-item"
>
<a
href=
"{% url 'announcements' %}"
>
Новости
</a>
</li>
</ul>
</nav>
{% if user.is_authenticated %}
<a
class=
"user"
href=
"{% url 'profile' %}"
>
<p
class=
"username"
>
{{ user.username }}
</p>
<img
class=
"avatar"
src=
"{{ user.avatar.url }}"
alt=
"Аватарка пользователя"
>
</a>
{% else %}
<a
class=
"user"
href=
"{% url 'login' %}"
>
<p
class=
"username"
>
Профиль
</p>
<img
class=
"avatar"
src=
"{% static 'img/global/avatar.png' %}"
alt=
"Аватарка пользователя"
>
</a>
{% endif %}
</header>
<main
class=
"main"
>
<div
class=
"filters"
>
<form
class=
"container"
method=
"POST"
action=
"{% url 'archive' %}"
>
{% csrf_token %}
<div
class=
"left"
>
<div
class=
"search"
>
<input
class=
"search-input"
type=
"text"
placeholder=
"Поиск..."
name=
"name"
>
<button
class=
"search-button"
></button>
</div>
</div>
<div
class=
"div-list"
>
<div
class=
"list-name"
>
Номинация
</div>
<input
type=
"hidden"
id=
"nominations-filter"
name=
"nominations"
/>
<div
class=
"list-names"
>
<div
class=
"list-p"
>
Не указано
</div>
<ul
class=
"list"
name=
"nominations"
>
<li
class=
"list-li nominations"
>
Не указано
</li>
{% for nomination in nominations %}
<li
class=
"list-li nominations"
>
{{nomination}}
</li>
{% endfor %}
<div
class=
"tags"
>
<ul
class=
"tag-list"
>
<item
class=
"tag-item"
>
<button
class=
"btn-tag"
type=
"button"
onclick=
"search_tag(this, 'nam')"
>
Название
</button>
</item>
<item
class=
"tag-item"
>
<button
class=
"btn-tag"
type=
"button"
onclick=
"search_tag(this, 'dscr')"
>
Описание
</button>
</item>
<item
class=
"tag-item"
>
<button
class=
"btn-tag"
type=
"button"
onclick=
"search_tag(this, 'teacher')"
>
Учитель
</button>
</item>
<item
class=
"tag-item"
>
<button
class=
"btn-tag"
type=
"button"
onclick=
"search_tag(this, 'student')"
>
Ученик
</button>
</item>
</ul>
</div>
<div
class=
"filter"
>
<div
class=
"div-list"
>
<div
class=
"list-name"
>
Предмет
</div>
<input
type=
"hidden"
id=
"subject-filter"
name=
"subject"
/>
<div
class=
"list-names"
>
<div
class=
"list-p"
>
Не указано
</div>
<ul
class=
"list"
name=
"subject"
>
<li
class=
"list-li subject"
>
Не указано
</li>
{% for subject in subjects %}
<li
class=
"list-li subject"
>
{{subject}}
</li>
{% endfor %}
</ul>
</div>
</div>
<div
class=
"div-list"
>
<div
class=
"list-name"
>
Номинация
</div>
<input
type=
"hidden"
id=
"nominations-filter"
name=
"nominations"
/>
<div
class=
"list-names"
>
<div
class=
"list-p"
>
Не указано
</div>
<ul
class=
"list"
name=
"nominations"
>
<li
class=
"list-li nominations"
>
Не указано
</li>
{% for nomination in nominations %}
<li
class=
"list-li nominations"
>
{{nomination}}
</li>
{% endfor %}
</ul>
</div>
</div>
</div>
</div>
<div>
<input
type=
"checkbox"
id=
"past_year"
class=
"checkbox"
name=
"past_year"
>
<label
class=
"checkbox-name"
for=
"past_year"
>
Прошлых лет
</label>
<div
class=
"right"
>
<button
class=
"btn filter_btn"
type=
"submit"
>
Применить
</button>
</div>
</div>
</div>
<div
class=
"right"
>
<button
class=
"btn filter_btn"
type=
"submit"
>
Применить
</button>
</div>
<div
class=
"tea"
>
<h3
class=
"h3 tea"
>
Учитель*
</h3>
<div>
<input
type=
"text"
class=
"search-block-input form-input search-block-teachers teacher-open"
placeholder=
"ФИО учителя"
>
<input
type=
"text"
class=
"new-teacher wf"
placeholder=
"ФИО учителя"
name=
"new-teacher"
>
<ul
class=
"search-block-result-list"
></ul>
<ul
class=
"search-block-list"
></ul>
</div>
<input
type=
"hidden"
class=
"search-block-hidden-input"
required
>
<input
type=
"hidden"
name=
"teacher"
class=
"search-block-for-teacher"
>
<div
class=
"checkbox"
>
<input
type=
"checkbox"
name=
"teacher-checkbox"
id=
"teacher-checkbox"
onclick=
"checkbox()"
>
<label
for=
"teacher-checkbox"
class=
"checkbox-label"
>
Учитель не из лицея
</label>
</div>
</form>
</div>
</form>
</div>
<ul>
{%for project in projects%}
<li>
<div>
<span>
{{project.name}}
</span>
<div>
{{project.description}}
</div>
<div>
{% if user.is_authenticated%}
<a
href=
"{% url 'projects' %}?id={{project.abstruct.id}}"
title=
"Загрузить файл"
class=
"download-link"
>
Реферат
</a>
{% endif %}
<a
href=
"{% url 'projects' %}?id={{project.defence.id}}"
title=
"Загрузить файл"
class=
"download-link"
>
Защита
</a>
<a
href=
"{% url 'download_file' %}?file_id={{project.presentation.id}}"
title=
"Загрузить файл"
class=
"download-link"
>
Презентация
</a>
{% if project.defence_video is not null%}
<a
href=
"{{project.defence_video}}"
title=
"Загрузить файл"
class=
"download-link"
>
Видео с защиты
</a>
{% endif %}
</div>
<div>
{{ project.subjects }}
</div>
</div>
</li>
{%endfor%}
</ul>
<ul>
{%for project in projects%}
<li>
<div>
<span>
{{project.name}}
</span>
<div>
{{project.description}}
</div>
<div>
{% if user.is_authenticated%}
<a
href=
"{% url 'projects' %}?id={{project.abstruct.id}}"
title=
"Загрузить файл"
class=
"download-link"
>
Реферат
</a>
{% endif %}
<a
href=
"{% url 'projects' %}?id={{project.defence.id}}"
title=
"Загрузить файл"
class=
"download-link"
>
Защита
</a>
<a
href=
"{% url 'download_file' %}?file_id={{project.presentation.id}}"
title=
"Загрузить файл"
class=
"download-link"
>
Презентация
</a>
{% if project.defence_video is not null%}
<a
href=
"{{project.defence_video}}"
title=
"Загрузить файл"
class=
"download-link"
>
Видео с
защиты
</a>
{% endif %}
</div>
<div>
{{ project.subjects }}
</div>
</div>
</li>
{%endfor%}
</ul>
<script
src=
"{% static 'js/global/list.js' %}"
></script>
<script
src=
"{% static 'js/projects/archive.js' %}"
></script>
<script
src=
"{% static 'js/global/search_block.js' %}"
></script>
<script>
let
teacher_arr
=
{{
teachers
|
js
}}
let
teacher_name
=
[];
<script
src=
"{% static 'js/global/list.js' %}"
></script>
<script
src=
"{% static 'js/projects/archive.js' %}"
></script>
<script
src=
"{% static 'js/global/search_block.js' %}"
></script>
<script>
let
teacher_arr
=
{{
teachers
|
js
}}
let
teacher_name
=
[];
for
(
let
i
=
0
;
i
<
teacher_arr
.
length
;
i
++
)
{
teacher_name
.
push
(
teacher_arr
[
i
][
0
]);
}
for
(
let
i
=
0
;
i
<
teacher_arr
.
length
;
i
++
)
{
teacher_name
.
push
(
teacher_arr
[
i
][
0
]);
}
$
(
'
.search-block-subjects
'
).
on
(
'
focus
'
,
function
()
{
list_arr
=
{{
subjects_names
|
js
}};
max_item
=
3
;
add_other_text
=
true
;
});
$
(
'
.search-block-
subject
s
'
).
on
(
'
focus
'
,
function
()
{
list_arr
=
{{
subjects_names
|
js
}}
;
max_item
=
3
;
add_other_text
=
tru
e
;
});
$
(
'
.search-block-
teacher
s
'
).
on
(
'
focus
'
,
function
()
{
list_arr
=
teacher_name
;
max_item
=
1
;
add_other_text
=
fals
e
;
});
$
(
'
.search-block-
teachers
'
).
on
(
'
focus
'
,
function
()
{
l
ist_arr
=
t
each
er_name
;
max_item
=
1
;
add_other_text
=
false
;
});
$
(
$
(
'
.search-block-
result-list
'
)[
0
]
).
on
(
'
click
'
,
function
()
{
l
et
input
=
$
(
'
.s
ea
r
ch
-block-hidden-input
'
)[
0
]
;
teacher_id
(
input
)
;
teacher_del
()
;
});
$
(
$
(
'
.search-block-result-list
'
)[
0
]).
on
(
'
click
'
,
function
()
{
let
input
=
$
(
'
.search-block-hidden-input
'
)[
0
];
teacher_id
(
input
);
teacher_del
();
});
function
teacher_del
()
{
$
(
$
(
'
.search-block-div
'
)[
0
]).
on
(
'
click
'
,
function
()
{
let
input
=
$
(
'
.search-block-hidden-input
'
)[
0
];
teacher_id
(
input
);
});
}
</script>
<script
src=
"{% static 'js/projects/create_page.js' %}"
></script>
</main>
</body>
function
teacher_del
()
{
$
(
$
(
'
.search-block-div
'
)[
0
]).
on
(
'
click
'
,
function
()
{
let
input
=
$
(
'
.search-block-hidden-input
'
)[
0
];
teacher_id
(
input
);
});
}
</script>
<script
src=
"{% static 'js/projects/create_page.js' %}"
></script>
{% endblock content %}
\ Нет новой строки в конце файла
</html>
\ Нет новой строки в конце файла
Редактирование
Предварительный просмотр
Поддерживает Markdown
0%
Попробовать снова
или
прикрепить новый файл
.
Отмена
You are about to add
0
people
to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Отмена
Пожалуйста,
зарегистрируйтесь
или
войдите
чтобы прокомментировать