Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bwinf
medal
Commits
795897d5
Commit
795897d5
authored
Sep 26, 2019
by
Robert Czechowski
Browse files
Add jwinf template for contest overview
parent
b7251475
Pipeline
#227
passed with stage
in 7 minutes and 6 seconds
Changes
5
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
src/core.rs
View file @
795897d5
...
...
@@ -125,7 +125,7 @@ pub fn debug_create_session<T: MedalConnection>(conn: &T, session_token: Option<
pub
enum
ContestVisibility
{
All
,
Open
,
Current
Current
,
}
pub
fn
show_contests
<
T
:
MedalConnection
>
(
conn
:
&
T
,
visibility
:
ContestVisibility
)
->
MedalValue
{
...
...
@@ -144,6 +144,12 @@ pub fn show_contests<T: MedalConnection>(conn: &T, visibility: ContestVisibility
.filter
(|
ci
|
ci
.duration
!=
0
||
visibility
!=
ContestVisibility
::
Current
)
.collect
();
data
.insert
(
"contest"
.to_string
(),
to_json
(
&
v
));
data
.insert
(
"contestlist_header"
.to_string
(),
to_json
(
&
match
visibility
{
ContestVisibility
::
Open
=>
"Trainigsaufgaben"
,
ContestVisibility
::
Current
=>
"Aktuelle Wettbewerbe"
,
ContestVisibility
::
All
=>
"Alle Wettbewerbe"
,
}));
(
"contests"
.to_owned
(),
data
)
}
...
...
@@ -170,7 +176,8 @@ fn generate_subtaskstars(tg: &Taskgroup, grade: &Grade, ast: Option<i32>) -> Vec
subtaskinfos
}
pub
fn
show_contest
<
T
:
MedalConnection
>
(
conn
:
&
T
,
contest_id
:
i32
,
session_token
:
&
str
,
query_string
:
Option
<
String
>
)
->
MedalValueResult
{
pub
fn
show_contest
<
T
:
MedalConnection
>
(
conn
:
&
T
,
contest_id
:
i32
,
session_token
:
&
str
,
query_string
:
Option
<
String
>
)
->
MedalValueResult
{
let
c
=
conn
.get_contest_by_id_complete
(
contest_id
);
let
grades
=
conn
.get_contest_user_grades
(
&
session_token
,
contest_id
);
...
...
@@ -314,7 +321,7 @@ pub fn start_contest<T: MedalConnection>(conn: &T, contest_id: i32, session_toke
// Check logged in or open contest
if
c
.duration
!=
0
&&
!
session
.is_logged_in
()
{
return
Err
(
MedalError
::
AccessDenied
)
return
Err
(
MedalError
::
AccessDenied
)
;
}
// Check CSRF token
...
...
src/webfw_iron.rs
View file @
795897d5
...
...
@@ -271,7 +271,7 @@ fn greet_personal<C>(req: &mut Request) -> IronResult<Response>
// Antwort erstellen und zurücksenden
core
::
index
(
&*
conn
,
session_token
,
(
self_url
,
oauth_providers
))
};
// Antwort erstellen und zurücksenden
let
mut
resp
=
Response
::
new
();
resp
.set_mut
(
Template
::
new
(
&
template
,
data
))
.set_mut
(
status
::
Ok
);
...
...
@@ -403,7 +403,7 @@ fn login<C>(req: &mut Request) -> IronResult<Response>
(
config
.self_url
.clone
(),
config
.oauth_providers
.clone
())
};
let
mut
data
=
json_val
::
Map
::
new
();
let
query_string
=
req
.url
.query
()
.map
(|
s
|
s
.to_string
());
...
...
templates/jwinf/contest.hbs
View file @
795897d5
...
...
@@ -28,7 +28,7 @@
<div
class=
"column is-one-third"
>
{{#if
logged_in
}}
<
!--
div class="columns alogin">
<div
class=
"columns alogin"
>
<div
class=
"column is-four-fifths"
>
Eingeloggt als
<em>
{{
username
}}
</em>
{{#if
firstname
}}{{#if
lastname
}}
...
...
@@ -47,7 +47,7 @@
</div>
<div
class=
"columns alogin"
>
<div
class=
"column"
></div>
</div
--
>
</div>
{{/if}}
</div>
</div>
...
...
templates/jwinf/contests.hbs
deleted
120000 → 0
View file @
b7251475
../default/contests.hbs
\ No newline at end of file
templates/jwinf/contests.hbs
0 → 100644
View file @
795897d5
<!DOCTYPE html>
<html
lang=
"en"
style=
"background-color: #fafafa;"
>
<head>
<meta
charset=
"utf-8"
>
<title>
Jugendwettbewerb Informatik: Programmieren – einfacher als du denkst!
</title>
<link
rel=
"stylesheet"
href=
"/static/lib/bulma/bulma-0.7.5.css"
>
<link
rel=
"icon"
href=
"/static/images/favicon.png"
type=
"image/png"
>
<style>
ul
{
font-size
:
larger
;
margin-left
:
20px
;
}
</style>
</head>
<body
style=
"background-color: white;"
>
<div
class=
"container"
>
<div
class=
"columns"
>
<div
class=
"column is-two-thirds"
>
<p>
<p>
<a
href=
"/"
>
<img
style=
"float:left; margin: 0px 10px;"
src=
"/static/images/klein.png"
>
</a>
<h1
class=
"title"
>
Jugendwettbewerb Informatik
</h1>
<h2
class=
"subtitle"
>
Programmieren – einfacher als du denkst!
</h2>
</div>
<div
class=
"column is-one-third"
>
{{#if
logged_in
}}
<div
class=
"columns alogin"
>
<div
class=
"column is-four-fifths"
>
Eingeloggt als
<em>
{{
username
}}
</em>
{{#if
firstname
}}{{#if
lastname
}}
(
{{
firstname
}}
{{
lastname
}}
)
{{/if}}{{/if}}
{{#if
teacher
}}
[Lehrer]
{{/if}}
<br>
<a
href=
"/profile"
class=
"button is-info is-small"
>
👤
Profil
</a>
{{#if
teacher
}}
<a
href=
"/group/"
class=
"button is-info is-small"
>
⚙
Gruppenverwaltung
</a>
{{/if}}
</div>
<div
class=
"column"
><a
href=
"/logout"
class=
"button is-small is-danger"
type=
"submit"
>
⨯
Logout
</a></div>
</div>
<div
class=
"columns alogin"
>
<div
class=
"column"
></div>
</div>
{{/if}}
</div>
</div>
<div
class=
"columns"
id=
"bare_content"
>
<div
class=
"column is-8 is-offset-2"
>
<div
style=
"min-height: 400px; margin-bottom:100px;"
>
<h3
class=
"title is-4"
>
{{
contestlist_header
}}
</h3>
<p>
<ul>
{{#
each
contest
}}
<li><a
href=
"/contest/
{{
id
}}
"
>
{{
name
}}
</a></li>
{{/
each
}}
</ul>
</p>
</div>
</div>
</div>
</div>
<footer
class=
"footer"
>
<div
class=
"content has-text-centered"
>
<p>
Der
<strong>
Jugendwettbewerb Informatik
</strong>
ist ein Angebot der
<a
href=
"https://bwinf.de"
>
Bundesweiten Informatikwettbewerbe
</a>
.
</p>
</div>
</footer>
</body>
</html>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment