Skip to content

Commit

Permalink
SIO-2075 Mainpage update
Browse files Browse the repository at this point in the history
In the current version, the main page is a portal. We want
a mainpage to be a separate entity.

Change-Id: I7e6ef9406cfa44ee53a1e2039f08ac25a4ff2fde
  • Loading branch information
olafik committed Apr 17, 2018
1 parent a81c7fa commit 3e4f185
Show file tree
Hide file tree
Showing 51 changed files with 3,634 additions and 1,539 deletions.
8 changes: 8 additions & 0 deletions oioioi/base/static/scss/_language-picker.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.current-language {
position: absolute;
right: 5px;
font-weight: bold;
font-size: 18px;
margin: 0px 5px 0px 0px;
color: $brand-success;
}
14 changes: 11 additions & 3 deletions oioioi/base/static/scss/_navbar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ body {
> a,
.dropdown > a,
.oioioi-navbar__extra > a,
.oioioi-navbar__extra > .dropdown > a {
.oioioi-navbar__extra > .dropdown > a,
.oioioi-navbar__menu-uncollapsed > a {
@include centered-block($navbar-height);
color: $oioioi-navbar-link-color;
padding: 0 $oioioi-navbar-padding-base-horizontal;
Expand Down Expand Up @@ -127,7 +128,8 @@ body {
padding: 0 $oioioi-navbar-padding-base-horizontal;
}

> .oioioi-navbar__extra {
> .oioioi-navbar__extra,
> .oioioi-navbar__menu-uncollapsed {
display: flex;
}

Expand Down Expand Up @@ -163,7 +165,8 @@ body {
// * Labels get shrunk
@media (max-width: $screen-md-max) {
.oioioi-navbar,
.oioioi-navbar > .oioioi-navbar__extra {
.oioioi-navbar > .oioioi-navbar__extra,
.oioioi-navbar__menu-uncollapsed {
> a > .label,
.dropdown > a > .label {
max-width: $oioioi-navbar-label-md-width;
Expand All @@ -173,6 +176,7 @@ body {

// Small screens
// * Menu replaces brand
// * Navbar links collapse to a dropdown menu
// * Contest picker max width decreases
// * Username and labels gets hidden (only icons)
@media (max-width: $screen-sm-max) {
Expand All @@ -181,6 +185,10 @@ body {
display: block;
}

> .oioioi-navbar__menu-uncollapsed {
display: none;
}

> .oioioi-navbar__brand:not(.oioioi-navbar__brand--always) {
display: none;
}
Expand Down
1 change: 1 addition & 0 deletions oioioi/base/static/scss/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
@import "scss/layout";
@import "scss/markdown-editor";
@import "scss/spinner";
@import "scss/language-picker";

body {
min-width: $oioioi-body-min-width;
Expand Down
8 changes: 2 additions & 6 deletions oioioi/base/templates/base-with-menu.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,8 @@
{% block body-class %}body-with-menu{% endblock %}
{% block container-class %}container-fluid{% endblock %}

{% block navbar-menu %}
<a class="oioioi-navbar__brand" href="{% url 'index' contest_id=None %}">{{ site_name }}</a>

<div class="oioioi-navbar__menu dropdown">
{% include "ingredients/navbar-menu.html" %}
</div>
{% block navbar-logo %}
{% include "ingredients/navbar-logo-with-menu.html" %}
{% endblock %}

{% block body %}
Expand Down
11 changes: 8 additions & 3 deletions oioioi/base/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<meta charset="UTF-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="{{ STATIC_URL }}favicon.ico" />
{% include "ingredients/head-favicon.html" %}

{% comment %}
Load jQuery because inlined scripts in some views depends on it.
Expand Down Expand Up @@ -41,8 +41,8 @@
{% if request.session.admin_time %} oioioi-navbar--admin-time {% endif %}
{% if is_under_su %} oioioi-navbar--admin-su {% endif %} {% block navbar-class %}{% endblock %}">

{% block navbar-menu %}
<a class="oioioi-navbar__brand oioioi-navbar__brand--always" href="{% url 'index' contest_id=None %}">{{ site_name }}</a>
{% block navbar-logo %}
{% include "ingredients/navbar-logo.html" with always_visible=True %}
{% endblock %}

<div class="oioioi-navbar__contests">
Expand Down Expand Up @@ -72,6 +72,11 @@
{% endif %}
</div>

<div class="oioioi-navbar__lang">
{% block navbar_language_selector %}
{% include 'ingredients/language-picker.html' %}
{% endblock %}
</div>

<div class="oioioi-navbar__user-su">
{% block navbar_user_su_panel %}
Expand Down
3 changes: 3 additions & 0 deletions oioioi/base/templates/ingredients/head-favicon.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{% load staticfiles %}

<link rel="shortcut icon" href="{% static "favicon.ico" %}"/>
32 changes: 22 additions & 10 deletions oioioi/base/templates/ingredients/language-picker.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,24 @@
{% if LANGUAGES|length > 1 %}
{% load i18n %}
<li class="divider" role="separator"></li>
{% for lang_short, lang_name in LANGUAGES %}
<li>
<a href="#" class="lang-select" lang="{{ lang_short }}">
<img title="{{ lang_short|language_name_local }}" src="{{ STATIC_URL }}images/flags/{{ lang_short }}.png"/>
{{ lang_short|language_name_local }}
</a>
</li>
{% endfor %}
{% load i18n %}
{% get_current_language as LANGUAGE_CODE %}

<div class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
<img title="{{ LANGUAGE_CODE|language_name_local }}" src="{{ STATIC_URL }}images/flags/{{ LANGUAGE_CODE }}.png"/>
<span class="caret"></span>
</a>
<ul class="dropdown-menu pull-right">
{% for lang_short, lang_name in LANGUAGES %}
<li>
<a href="#" class="lang-select" lang="{{ lang_short }}">
<img title="{{ lang_short|language_name_local }}" src="{{ STATIC_URL }}images/flags/{{ lang_short }}.png"/>
{{ lang_short|language_name_local }}
{% if lang_short == LANGUAGE_CODE %}
<span class="current-language"></span>
{% endif %}
</a>
</li>
{% endfor %}
</ul>
</div>
{% endif %}
5 changes: 5 additions & 0 deletions oioioi/base/templates/ingredients/navbar-logo-with-menu.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{% include "ingredients/navbar-logo.html" with always_visible=False %}

<div class="oioioi-navbar__menu dropdown">
{% include "ingredients/navbar-menu.html" %}
</div>
3 changes: 3 additions & 0 deletions oioioi/base/templates/ingredients/navbar-logo.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<a class="oioioi-navbar__brand {% if always_visible %}oioioi-navbar__brand--always{% endif %}" href="{% url 'index' contest_id=None %}">
{{ site_name }}
</a>
2 changes: 0 additions & 2 deletions oioioi/base/templates/ingredients/navbar-user.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
<button type="submit" class="btn btn-primary">{% trans "Log in" %}</button>
</form>
</li>
{% include 'ingredients/language-picker.html' %}
</ul>
</div>
{% else %}
Expand Down Expand Up @@ -51,7 +50,6 @@
{% for item in menu %}
<li><a href="{{ item.url }}" {{ item.attrs }}>{{ item.text }}</a></li>
{% endfor %}
{% include 'ingredients/language-picker.html' %}

{% su_dropdown_form %}
{% user_info_dropdown_form %}
Expand Down
10 changes: 7 additions & 3 deletions oioioi/clock/static/common/clocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,13 @@ $(function() {
* @returns {string} formatted date
*/
function getDatetimeString(time) {
return time.getFullYear() + '-' + time.getMonth() + '-'
+ time.getDay() + ' ' + time.getHours() + ':'
+ time.getMinutes() + ':' + time.getSeconds();
function twoDigit(number) {
return ("0" + number).slice(-2);
}

return time.getFullYear() + '-' + twoDigit(time.getMonth() + 1) + '-'
+ twoDigit(time.getDate()) + ' ' + twoDigit(time.getHours()) + ':'
+ twoDigit(time.getMinutes()) + ':' + twoDigit(time.getSeconds());
}

/**
Expand Down
Binary file modified oioioi/locale/en/LC_MESSAGES/django.mo
Binary file not shown.
Loading

0 comments on commit 3e4f185

Please sign in to comment.