Skip to content
Snippets Groups Projects
Commit a7305965 authored by Jiří Setnička's avatar Jiří Setnička
Browse files

CSS only taby + jejich použití v org_submit_list

parent 95118256
No related branches found
No related tags found
1 merge request!28Formulář na vše na stránce řešení
...@@ -24,8 +24,18 @@ ...@@ -24,8 +24,18 @@
{% if solution %} {% if solution %}
<h3>Odevzdaná řešení</h3> <div class="tabbed">
<input type="radio" id="tab1" name="css-tabs" checked>
<input type="radio" id="tab2" name="css-tabs">
<input type="radio" id="tab3" name="css-tabs">
<ul class="tabs">
<li class="tab"><label for="tab1">Odevzdaná řešení ({{ sol_papers|length }})</label>
<li class="tab"><label for="tab2">Opravená řešení ({{ fb_papers|length }})</label>
<li class="tab"><label for="tab3">Historie udělených bodů</label>
</ul>
<div class="tab-content">
<p><i> <p><i>
{% if sol_papers|length > 1 %} {% if sol_papers|length > 1 %}
Existuje více než jedna verze řešení, finální je podbarvená. Existuje více než jedna verze řešení, finální je podbarvená.
...@@ -73,9 +83,9 @@ Existuje více než jedna verze řešení, finální je podbarvená. ...@@ -73,9 +83,9 @@ Existuje více než jedna verze řešení, finální je podbarvená.
{% else %} {% else %}
<p>Žádná. <p>Žádná.
{% endif %} {% endif %}
</div>
<h3>Opravená řešení</h3> <div class="tab-content">
<p><i> <p><i>
{% if fb_papers|length > 1 %} {% if fb_papers|length > 1 %}
Existuje více než jedna verze oprav, finální je podbarvená. Existuje více než jedna verze oprav, finální je podbarvená.
...@@ -124,10 +134,10 @@ Existuje více než jedna verze oprav, finální je podbarvená. ...@@ -124,10 +134,10 @@ Existuje více než jedna verze oprav, finální je podbarvená.
{% else %} {% else %}
<p>Žádná. <p>Žádná.
{% endif %} {% endif %}
</div>
<div class="tab-content">
{% if points_history %} {% if points_history %}
<h3>Historie udělených bodů</h3>
<p><i>Účastník po uzavření kola uvidí jen naposledy zadané body.</i></p> <p><i>Účastník po uzavření kola uvidí jen naposledy zadané body.</i></p>
<table class=data> <table class=data>
<thead> <thead>
...@@ -144,7 +154,11 @@ Existuje více než jedna verze oprav, finální je podbarvená. ...@@ -144,7 +154,11 @@ Existuje více než jedna verze oprav, finální je podbarvená.
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>
{% else %}
<p>Zatím nebyly uděleny žádné body.
{% endif %} {% endif %}
</div>
</div>
{% else %} {% else %}
<p>Žádné odevzdané řešení. {% if form %}Můžete ho přidat pomocí formuláře níže.{% endif %} <p>Žádné odevzdané řešení. {% if form %}Můžete ho přidat pomocí formuláře níže.{% endif %}
......
...@@ -238,3 +238,64 @@ table.data tbody tr.job-failed:hover { ...@@ -238,3 +238,64 @@ table.data tbody tr.job-failed:hover {
div.alert + div.alert { div.alert + div.alert {
margin-top: -22px; margin-top: -22px;
} }
/* Tabs - source: https://codepen.io/MPDoctor/pen/mpJdYe */
.tabbed {
margin: 15px 0px;
}
.tabbed [type="radio"] {
/* hiding the inputs */
display: none;
}
.tabs {
display: flex;
align-items: stretch;
list-style: none;
padding: 0;
margin-bottom: 0px;
border-bottom: 1px solid #ddd;
}
.tab > label {
display: block;
margin-bottom: -1px;
padding: 12px 15px;
border: 1px solid #ddd;
background: #eee;
color: #666;
font-size: 16px;
cursor: pointer;
transition: all 0.3s;
}
.tab:hover label {
border-top-color: #333;
color: #333;
}
.tab-content {
display: none;
margin: 0px;
padding: 10px;
border: 1px solid #ddd;
border-top: 0px;
}
/* As we cannot replace the numbers with variables or calls to element properties, the number of this selector parts is our tab count limit */
.tabbed [type="radio"]:nth-of-type(1):checked ~ .tabs .tab:nth-of-type(1) label,
.tabbed [type="radio"]:nth-of-type(2):checked ~ .tabs .tab:nth-of-type(2) label,
.tabbed [type="radio"]:nth-of-type(3):checked ~ .tabs .tab:nth-of-type(3) label,
.tabbed [type="radio"]:nth-of-type(4):checked ~ .tabs .tab:nth-of-type(4) label,
.tabbed [type="radio"]:nth-of-type(5):checked ~ .tabs .tab:nth-of-type(5) label {
border-bottom-color: #fff;
border-top-color: #999;
background: #fff;
color: #222;
}
.tabbed [type="radio"]:nth-of-type(1):checked ~ .tab-content:nth-of-type(1),
.tabbed [type="radio"]:nth-of-type(2):checked ~ .tab-content:nth-of-type(2),
.tabbed [type="radio"]:nth-of-type(3):checked ~ .tab-content:nth-of-type(3),
.tabbed [type="radio"]:nth-of-type(4):checked ~ .tab-content:nth-of-type(4) {
display: block;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment