Commit 32baa86a authored by Robert Czechowski's avatar Robert Czechowski

Add shortcut to results pages from group page

parent 6bfc27d5
Pipeline #457 canceled with stages
......@@ -371,19 +371,29 @@ fn debug_create_session<C>(req: &mut Request) -> IronResult<Response>
fn contests<C>(req: &mut Request) -> IronResult<Response>
where C: MedalConnection + std::marker::Send + 'static {
let session_token = req.require_session_token()?;
let query_string = req.url.query().unwrap_or("").to_string();
// TODO: Move to core::* ?
let visibility = if query_string.contains("open") {
core::ContestVisibility::Open
} else if query_string.contains("current") {
core::ContestVisibility::Current
} else {
core::ContestVisibility::All
};
let config = req.get::<Read<SharedConfiguration>>().unwrap();
let (self_url, oauth_providers) = (config.self_url.clone(), config.oauth_providers.clone());
let (template, mut data) = with_conn![core::show_contests,
C,
req,
&session_token,
(self_url, oauth_providers),
core::ContestVisibility::All];
let (template, mut data) =
with_conn![core::show_contests, C, req, &session_token, (self_url, oauth_providers), visibility];
config.server_message.as_ref().map(|sm| data.insert("server_message".to_string(), to_json(&sm)));
if query_string.contains("results") {
data.insert("direct_link_to_results".to_string(), to_json(&true));
}
let mut resp = Response::new();
resp.set_mut(Template::new(&template, data)).set_mut(status::Ok);
Ok(resp)
......
......@@ -14,10 +14,10 @@
<div class="columns" id="bare_content">
<div class="column is-4 is-offset-2">
<div style="min-height: 400px; margin-bottom:100px;">
<h3 class="title is-4">{{contestlist_header}}</h3>
<h3 class="title is-4">{{#if ../direct_link_to_results }}Ergebnisse einsehen für{{else}}{{contestlist_header}}{{/if}}</h3>
{{#each contest}}
<a href="/contest/{{ id }}">
<div class="notification is-success" style="margin-bottom:20px;">
<a href="/contest/{{ id }}{{#if ../direct_link_to_results }}/result/{{/if}}">
<div class="notification {{#if ../direct_link_to_results }}is-info{{else}}is-success{{/if}}" style="margin-bottom:20px;">
<h3 class="title is-5">{{ name }}</h3>
</div>
</a>
......
......@@ -35,8 +35,10 @@
</div></div>
<div class="columns">
<div class="column is-8 is-offset-2">
<h4 class="subtitle is-5">Wettbewerbsergebnisse</h4>
<p> <a href="/contest/?results" class="button is-info">Wettbewerbsergebnisse meiner Gruppen</a></p><p>&nbsp;</p>
<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}}
......
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