Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Odevzdávací Systém MO
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Martin Mareš
Odevzdávací Systém MO
Commits
b2c4a8e8
Commit
b2c4a8e8
authored
4 years ago
by
Jiří Setnička
Browse files
Options
Downloads
Patches
Plain Diff
Generátor drobečků pro soutěže
parent
b13b3ed5
No related branches found
No related tags found
1 merge request
!23
Titulky stránek a drobečková navigace
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
mo/web/jinja.py
+5
-0
5 additions, 0 deletions
mo/web/jinja.py
mo/web/org_contest.py
+35
-0
35 additions, 0 deletions
mo/web/org_contest.py
with
40 additions
and
0 deletions
mo/web/jinja.py
+
5
−
0
View file @
b2c4a8e8
...
@@ -8,6 +8,7 @@ import mo.config as config
...
@@ -8,6 +8,7 @@ import mo.config as config
import
mo.db
as
db
import
mo.db
as
db
import
mo.util_format
as
util_format
import
mo.util_format
as
util_format
from
mo.web
import
app
from
mo.web
import
app
from
mo.web.org_contest
import
contest_breadcrumbs
# Konfigurace Jinjy
# Konfigurace Jinjy
...
@@ -36,6 +37,10 @@ app.jinja_env.globals.update(PaperType=db.PaperType)
...
@@ -36,6 +37,10 @@ app.jinja_env.globals.update(PaperType=db.PaperType)
app
.
jinja_env
.
globals
.
update
(
JobType
=
db
.
JobType
)
app
.
jinja_env
.
globals
.
update
(
JobType
=
db
.
JobType
)
app
.
jinja_env
.
globals
.
update
(
JobState
=
db
.
JobState
)
app
.
jinja_env
.
globals
.
update
(
JobState
=
db
.
JobState
)
# Vlastní pomocné funkce
app
.
jinja_env
.
globals
.
update
(
contest_breadcrumbs
=
contest_breadcrumbs
)
@app.template_filter
()
@app.template_filter
()
def
user_link
(
u
:
db
.
User
)
->
Markup
:
def
user_link
(
u
:
db
.
User
)
->
Markup
:
...
...
This diff is collapsed.
Click to expand it.
mo/web/org_contest.py
+
35
−
0
View file @
b2c4a8e8
...
@@ -243,6 +243,41 @@ def get_contest_site_rr(id: int, site_id: Optional[int], right_needed: Optional[
...
@@ -243,6 +243,41 @@ def get_contest_site_rr(id: int, site_id: Optional[int], right_needed: Optional[
return
contest
,
site
,
rr
return
contest
,
site
,
rr
def
contest_breadcrumbs
(
round
:
Optional
[
db
.
Round
]
=
None
,
contest
:
Optional
[
db
.
Contest
]
=
None
,
site
:
Optional
[
db
.
Place
]
=
None
,
task
:
Optional
[
db
.
Task
]
=
None
,
action
:
Optional
[
str
]
=
None
)
->
str
:
elements
=
[(
url_for
(
'
org_rounds
'
),
'
Soutěže
'
)]
round_id
=
None
if
round
:
round_id
=
round
.
round_id
elements
.
append
((
url_for
(
'
org_round
'
,
id
=
round_id
),
round
.
round_code
()))
ct_id
=
None
if
contest
:
ct_id
=
contest
.
contest_id
elements
.
append
((
url_for
(
'
org_contest
'
,
id
=
ct_id
),
contest
.
place
.
name
))
site_id
=
None
if
site
:
site_id
=
site
.
place_id
elements
.
append
((
url_for
(
'
org_contest
'
,
id
=
ct_id
,
site_id
=
site_id
),
f
"
soutěžní místo
{
site
.
name
}
"
))
task_id
=
None
if
task
:
task_id
=
task
.
task_id
elements
.
append
((
url_for
(
'
org_contest_task
'
,
contest_id
=
ct_id
,
site_id
=
site_id
,
task_id
=
task_id
)
if
ct_id
else
url_for
(
'
org_round_task_edit
'
,
id
=
round_id
,
task_id
=
task_id
),
f
"
{
task
.
code
}
{
task
.
name
}
"
))
if
action
:
elements
.
append
((
''
,
action
))
return
(
"
\n
"
.
join
([
f
"
<li><a href=
'
{
url
}
'
>
{
name
}
</a>
"
for
url
,
name
in
elements
[:
-
1
]])
+
"
<li>
"
+
elements
[
-
1
][
1
]
)
@app.route
(
'
/org/contest/c/<int:id>
'
)
@app.route
(
'
/org/contest/c/<int:id>
'
)
@app.route
(
'
/org/contest/c/<int:id>/site/<int:site_id>/
'
)
@app.route
(
'
/org/contest/c/<int:id>/site/<int:site_id>/
'
)
def
org_contest
(
id
:
int
,
site_id
:
Optional
[
int
]
=
None
):
def
org_contest
(
id
:
int
,
site_id
:
Optional
[
int
]
=
None
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment