Commit 5f3d7c9d authored by Robert Czechowski's avatar Robert Czechowski
Browse files

Add template basing and add based templates for template set 'jwinf'

parent 3a79be49
Pipeline #304 failed with stage
in 6 minutes and 19 seconds
......@@ -80,6 +80,7 @@ pub fn index<T: MedalConnection>(conn: &T, session_token: Option<String>,
data.insert("self_url".to_string(), to_json(&self_url));
data.insert("oauth_links".to_string(), to_json(&oauth_links));
data.insert("parent".to_string(), to_json(&"base"));
("index".to_owned(), data)
}
......@@ -164,6 +165,7 @@ pub fn show_contests<T: MedalConnection>(conn: &T, session_token: &str, visibili
ContestVisibility::All => "Alle Wettbewerbe",
}));
data.insert("parent".to_string(), to_json(&"base"));
("contests".to_owned(), data)
}
......@@ -529,6 +531,7 @@ pub fn show_groups<T: MedalConnection>(conn: &T, session_token: &str) -> MedalVa
data.insert("group".to_string(), to_json(&v));
data.insert("csrf_token".to_string(), to_json(&session.csrf_token));
data.insert("parent".to_string(), to_json(&"base"));
Ok(("groups".to_string(), data))
}
......@@ -569,6 +572,7 @@ pub fn show_group<T: MedalConnection>(conn: &T, group_id: i32, session_token: &s
data.insert("group".to_string(), to_json(&gi));
data.insert("member".to_string(), to_json(&v));
data.insert("parent".to_string(), to_json(&"base"));
Ok(("group".to_string(), data))
}
......@@ -738,6 +742,7 @@ pub fn show_profile<T: MedalConnection>(conn: &T, session_token: &str, user_id:
}
}
data.insert("parent".to_string(), to_json(&"base"));
Ok(("profile".to_string(), data))
}
......
......@@ -885,7 +885,7 @@ pub fn get_handlebars_engine(template_name: &str) -> impl AfterMiddleware {
// HandlebarsEngine will look up all files with "./examples/templates/**/*.hbs"
let mut hbse = HandlebarsEngine::new();
hbse.add(Box::new(DirectorySource::new(&format!("./templates/{}/", template_name) as &str, ".hbs")));
// load templates from all registered sources
if let Err(r) = hbse.reload() {
panic!("{}", r);
......
<!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">
</head>
<body style="background-color: white;">
<div class="container">
<div class="columns">
<div class="column is-two-thirds">
<p>&nbsp;<p>
<a href="/">
<img style="float:left; margin-right: 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">
&nbsp;
{{#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">👤 &nbsp; Profil</a>
{{#if teacher}}
<a href="/group/" class="button is-info is-small">&nbsp; Gruppenverwaltung</a>
{{/if}}
</div>
<div class="column"><a href="/logout" class="button is-small is-danger" type="submit">&nbsp; Logout</a></div>
</div>
<div class="columns alogin">
<div class="column"></div>
</div>
{{else}}
<!--form action="login" method="post">
<div class="columns blogin">
<div class="column is-two-fifths"><input class="input is-small" type="text" name="username" autofocus placeholder="Benutzername"></div>
<div class="column is-two-fifths"><input class="input is-small" type="password" name="password" placeholder="Passwort"></div>
<div class="column"><input class="button is-small is-success" type="submit" value="↪ &nbsp; Login" onclick="login();"></div>
</div>
</form-->
<form action="clogin" method="post">
<div class="columns blogin">
<div class="column is-four-fifths"><input class="input is-small" type="text" name="code" placeholder="Gruppencode / Teilnahmecode"></div>
<div class="column"><input class="button is-small is-success" type="submit" value="↪ &nbsp; Login"></div>
</div>
</form>
{{#if self_url}}
{{#each oauth_links}}
<div class="columns blogin">
<div class="column is-two-fifths"></div>
<div class="column">
<a class="button is-small is-info" href="{{ this.2 }}{{ ../self_url }}/oauth/{{ this.0 }}" style="float:right;">{{ this.1 }}</a>
</div>
</div>
{{/each}}
{{/if}}
{{/if}}
</div>
</div>
{{~> page}}
</div>
&nbsp;
<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>
<!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">
</head>
<body style="background-color: white;">
<div class="container">
<div class="columns">
<div class="column is-two-thirds">
<p>&nbsp;<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">
&nbsp;
{{#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">👤 &nbsp; Profil</a>
{{#if teacher}}
<a href="/group/" class="button is-info is-small">&nbsp; Gruppenverwaltung</a>
{{/if}}
</div>
<div class="column"><a href="/logout" class="button is-small is-danger" type="submit">&nbsp; Logout</a></div>
</div>
<div class="columns alogin">
<div class="column"></div>
</div>
{{/if}}
</div>
</div>
{{#*inline "page"}}
<div class="columns">
<div class="column is-12 is-offset-1">
/ <a href="/">Startseite</a> / Wettbewerbsübersicht
</div>
</div>
<div class="columns" id="bare_content">
<div class="column is-4 is-offset-2">
......@@ -63,14 +24,5 @@
</div>
</div>
</div>
</div>
&nbsp;
<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>
{{/inline}}
{{~> (parent)~}}
../default/group.hbs
\ No newline at end of file
{{#*inline "page"}}
<div class="columns">
<div class="column is-12 is-offset-1">
/ <a href="/">Startseite</a> / <a href="./">Gruppenübersicht</a> / Gruppe <em>{{group.name}}</em>
</div>
</div>
<div class="columns">
<div class="column is-8 is-offset-2">
<h3 class="title is-4">Gruppe <em>{{group.name}}</em></h3>
</div>
</div>
<div class="columns">
<div class="column is-8 is-offset-2">
<p>
Mitglieder: –<br>
Marker: {{group.tag}}
</p>
<h4 class="subtitle is-5">Gruppencode: <strong>{{group.code}}</strong></h4>
<p>
Der Gruppencode dient zum Einloggen und erzeugt dabei neue Accounts.
Dabei erhalten die Teilnehmer einen Logincode, mit dem sie sich erneut einloggen können.
Den Logincode können Sie auch im Nachhinein unten in der Mitgliederliste einsehen.
</p>
</div>
</div>
<div class="columns">
<div class="column is-8 is-offset-2">
<h4 class="subtitle is-5">Mitglieder</h4>
{{#if member}}
<table class="table">
<tr>
<th>Name</th>
<th>Logincode</th>
<th>Jahrgangstufe</th>
<th></th>
</tr>
{{#each member}}
<tr>
<td><a href="/user/{{id}}">{{firstname}} {{lastname}}</a></td>
<td>{{logincode}}</td>
<td>{{grade}}</td>
<td><a href="/user/{{id}}">bearbeiten …</a></td>
</tr>
{{/each}}
</table>
{{else}}
<em>
Noch keine Mitglieder vorhanden.
Sobald sich Teilnehmer mit dem Gruppencode oben einloggen, tauchen Sie an dieser Stelle auf.
</em>
{{/if}}
</div>
</div>
{{/inline}}
{{~> (parent)~}}
../default/groups.hbs
\ No newline at end of file
{{#*inline "page"}}
<div class="columns">
<div class="column is-12 is-offset-1">
/ <a href="/">Startseite</a> / Gruppenübersicht
</div>
</div>
<div class="columns">
<div class="column is-8 is-offset-2">
<h3 class="title is-4">Gruppen</h3>
</div></div>
<div class="columns">
<div class="column is-8 is-offset-2">
<h4 class="subtitle is-5">Gruppe anlegen</h4>
<p>
<form action="/group/" method="post">
Gruppename:
<input name="name">
Marker:
<input name="tag" placeholder="optional">
<input type="hidden" name="csrf_token" value="{{csrf_token}}">
<input type="submit" value="Neue Gruppe anlegen">
</form>
</p>
<p>Der Marker kann z. B. der Name der Klasse oder des Kurses sein. Er wird beim Druck von Urkunden mitgedruckt und dient für Sie zur Zuordnung.</p>
<p>Sie können auch Gruppen über einen <a href="csv">CSV-Upload</a> anlegen.
</div></div>
<div class="columns">
<div class="column is-8 is-offset-2">
<h4 class="subtitle is-5">Meine bestehenden Gruppen</h4>
<p>Für die Wettbewerbsergebnisse meiner Gruppen bitte zunächst <a href="/contest/">einen Wettbewerb auswählen</a></p>
<p>
{{#if group}}
<table class="table">
<tr>
<th>Name</th>
<th>Gruppencode</th>
<th>Mitglieder</th>
<th>Marker</th>
<th></th>
</tr>
{{#each group}}
<tr>
<td><a href="/group/{{id}}">{{name}}</a></td>
<td>{{code}}</td>
<td></td>
<td>{{tag}}</td>
<td><a href="/group/{{id}}">bearbeiten …</a></td>
</tr>
{{/each}}
</table>
{{else}}
<em>
Noch keine Gruppe vorhanden.
Legen Sie oben eine neue Gruppe an, um Ihren Schülerinnen und Schülern
die Teilnahme an Wettbewerben zu ermöglichen
</em>
{{/if}}
</p>
</div>
</div>
{{/inline}}
{{~> (parent)~}}
<!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">
</head>
<body style="background-color: white;">
<div class="container">
<div class="columns">
<div class="column is-two-thirds">
<p>&nbsp;<p>
<img style="float:left; margin-right: 10px;" src="/static/images/klein.png">
<h1 class="title">Jugendwettbewerb Informatik</h1>
<h2 class="subtitle">Programmieren – einfacher als du denkst!</h2>
</div>
<div class="column is-one-third">
&nbsp;
{{#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">👤 &nbsp; Profil</a>
{{#if teacher}}
<a href="/group/" class="button is-info is-small">&nbsp; Gruppenverwaltung</a>
{{/if}}
</div>
<div class="column"><a href="/logout" class="button is-small is-danger" type="submit">&nbsp; Logout</a></div>
</div>
<div class="columns alogin">
<div class="column"></div>
</div>
{{else}}
<!--form action="login" method="post">
<div class="columns blogin">
<div class="column is-two-fifths"><input class="input is-small" type="text" name="username" autofocus placeholder="Benutzername"></div>
<div class="column is-two-fifths"><input class="input is-small" type="password" name="password" placeholder="Passwort"></div>
<div class="column"><input class="button is-small is-success" type="submit" value="↪ &nbsp; Login" onclick="login();"></div>
</div>
</form-->
<form action="clogin" method="post">
<div class="columns blogin">
<div class="column is-four-fifths"><input class="input is-small" type="text" name="code" placeholder="Gruppencode / Teilnahmecode"></div>
<div class="column"><input class="button is-small is-success" type="submit" value="↪ &nbsp; Login"></div>
</div>
</form>
{{#if self_url}}
{{#each oauth_links}}
<div class="columns blogin">
<div class="column is-two-fifths"></div>
<div class="column">
<a class="button is-small is-info" href="{{ this.2 }}{{ ../self_url }}/oauth/{{ this.0 }}" style="float:right;">{{ this.1 }}</a>
</div>
</div>
{{/each}}
{{/if}}
{{/if}}
</div>
</div>
{{#*inline "page"}}
{{#if teacher}}
<div class="columns alogin">
<div class="column is-8 is-offset-2">
......@@ -112,15 +45,5 @@
</a>
</div>
</div>
</div>
&nbsp;
<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>
{{/inline}}
{{~> (parent)~}}
../default/profile.hbs
\ No newline at end of file
{{#*inline "page"}}
<div class="columns">
<div class="column is-12 is-offset-1">
/ <a href="/">Startseite</a> / Profil <em>{{firstname}} {{lastname}}</em>
</div>
</div>
<div class="columns">
<div class="column is-8 is-offset-2">
<h3 class="title is-4">
{{#if ownprofile}}
Mein Profil: <em>{{firstname}} {{lastname}}</em>
{{else}}
Benutzerdaten bearbeiten von <em>{{firstname}} {{lastname}}</em>
{{/if}}
</h3>
</div></div>
<div class="columns">
<div class="column is-8 is-offset-2">
{{#if username}}
<p>Benutzername: {{username}}</p>
{{/if}}
{{#if logincode}}
<p>Login-Code: {{logincode}}</p>
{{/if}}
<form action="" method="post">
<table>
<tr>
<td>Vorname:</td><td><input name="firstname" value="{{ firstname }}"></td>
</tr>
<tr>
<td>Nachname:</td><td><input name="lastname" value="{{ lastname }}"></td>
</tr>
{{#if not_in_group}}
<tr>
<td>Straße und Hausnummer:</td><td><input name="street" value="{{ street }}"></td>
</tr>
<tr>
<td>Postleitzahl:</td><td><input name="zip" value="{{ zip }}"></td>
</tr>
<tr>
<td>Stadt:</td><td><input name="city" value="{{ city }}"></td>
</tr>
{{/if}}
<tr>
<td>Jahrgangsstufe:</td><td>
<select name="grade">
<option value="0" {{ sel0 }}>Noch kein Schüler</option>
<option value="1" {{ sel1 }}>1</option>
<option value="2" {{ sel2 }}>2</option>
<option value="3" {{ sel3 }}>3</option>
<option value="4" {{ sel4 }}>4</option>
<option value="5" {{ sel5 }}>5</option>
<option value="6" {{ sel6 }}>6</option>
<option value="7" {{ sel7 }}>7</option>
<option value="8" {{ sel8 }}>8</option>
<option value="9" {{ sel9 }}>9</option>
<option value="10" {{ sel10 }}>10</option>
<option value="11" {{ sel11 }}>11 (G8)</option>
<option value="12" {{ sel12 }}>12 (G8)</option>
<option value="111" {{ sel111 }}>11 (G9)</option>
<option value="112" {{ sel112 }}>12 (G9)</option>
<option value="113" {{ sel113 }}>13 (G9)</option>
<option value="114" {{ sel114 }}>Berufsschule</option>
<option value="255" {{ sel255 }}>Kein Schüler mehr</option>
</select>
</td>
</tr>
{{#if not_in_group}}
<tr>
<td>Neues Passwort:</td><td><input type="password" name="password" value=""></td>
</tr>
<tr>
<td>Neues Passwort (wdh):</td><td><input type="password" name="password_repeat" value=""></td>
</tr>
{{/if}}
<tr>
<td></td><td><input type="hidden" name="csrf_token" value="{{ csrf_token }}"><input type="submit" value="Speichern"></td>
</tr>
</table>
</form>
<div style="color:green; font-weight:bold">
{{#if NothingChanged}}
<p>Keine Änderungen.</p>
{{/if}}
{{#if DataChanged}}
<p>Daten wurden erfolgreich geändert.</p>
{{/if}}
{{#if PasswordChanged}}
<p>Passwort wurde erfolgreich geändert.</p>
{{/if}}
{{#if PasswordMissmatch}}
<p style="color:red;">Die eingegebenen Paswörter stimmen nicht überein. Passwort wurde nicht geändert.</p>
{{/if}}
</div>
</div>
</div>
{{/inline}}
{{~> (parent)~}}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment