Added support for level=family
This commit is contained in:
@@ -11,7 +11,8 @@
|
||||
* cyan #54bbd9 #469db5 #d8ebf0 #a7d5e1 #86cfe4 #54bbd9 #4cb8d7 #17343c #3a8ea5 Ski
|
||||
* caramel #9c5b22 #78461a #f0e3d8 #e1c6b0 #ce792d #9c5b22 #935720 #3c230d #613915 Wanderung
|
||||
* purple #866dac #566088 #e1d8f0 #c2b0e1 #a694c2 #866dac #8067a8 #2f263c #5a4876 Mountainbike
|
||||
* brown ??? ??? ??? ??? #925f36 ??? ??? ??? ???
|
||||
* plum #a068a0 #784e78 #ebd4eb #dcb1dc #be91be #906e90 #a780a7 #352935 #705670 family
|
||||
* brown #??? #??? #??? #??? #925f36 #??? #??? #??? #???
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -274,7 +275,7 @@ thead input {
|
||||
}
|
||||
|
||||
/*
|
||||
* Elements for sport categories
|
||||
* Elements for sport choices
|
||||
*/
|
||||
/*
|
||||
* Bergsteigen: lime
|
||||
@@ -343,8 +344,47 @@ thead input {
|
||||
}
|
||||
|
||||
/*
|
||||
* Universal Buttons
|
||||
* Elements for level choices
|
||||
*/
|
||||
/*
|
||||
* advanced: mandarin
|
||||
*/
|
||||
.label-level-advanced {
|
||||
background-color: #e84e1b;
|
||||
}
|
||||
.btn-level-advanced {
|
||||
background-color: #e84e1b;
|
||||
border-color: #aa3711;
|
||||
color: #fff;
|
||||
}
|
||||
.btn-level-advanced.focus, .btn-level-advanced:focus, .btn-level-advanced:hover {
|
||||
background-color: #b43a12;
|
||||
border-color: #3c1306;
|
||||
color: #fff;
|
||||
}
|
||||
/*
|
||||
* family: plum
|
||||
*/
|
||||
.label-level-family {
|
||||
background-color: #be91be;
|
||||
}
|
||||
.btn-level-family {
|
||||
background-color: #be91be;
|
||||
border-color: #a780a7;
|
||||
color: #fff;
|
||||
}
|
||||
.btn-level-family.focus, .btn-level-family:focus, .btn-level-family:hover {
|
||||
background-color: #906e90;
|
||||
border-color: #352935;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
/*
|
||||
* Coloured Elements (Buttons, Labels) for universal use
|
||||
*/
|
||||
.label-orange {
|
||||
background-color: #f07d00;
|
||||
}
|
||||
.btn-orange {
|
||||
background-color: #f07d00;
|
||||
border-color: #d77000;
|
||||
@@ -355,6 +395,9 @@ thead input {
|
||||
border-color: #572d00;
|
||||
color: #fff;
|
||||
}
|
||||
.label-green {
|
||||
background-color: #58ab27;
|
||||
}
|
||||
.btn-green {
|
||||
background-color: #58ab27;
|
||||
border-color: #4d9622;
|
||||
@@ -365,6 +408,9 @@ thead input {
|
||||
border-color: #182e0b;
|
||||
color: #fff;
|
||||
}
|
||||
.label-blue {
|
||||
background-color: #1d70b7;
|
||||
}
|
||||
.btn-blue {
|
||||
background-color: #1d70b7;
|
||||
border-color: #1a63a1;
|
||||
@@ -375,6 +421,9 @@ thead input {
|
||||
border-color: #081f33;
|
||||
color: #fff;
|
||||
}
|
||||
.label-yellow {
|
||||
background-color: #f9b000;
|
||||
}
|
||||
.btn-yellow {
|
||||
background-color: #f9b000;
|
||||
border-color: #e09e00;
|
||||
@@ -385,6 +434,9 @@ thead input {
|
||||
border-color: #604400;
|
||||
color: #fff;
|
||||
}
|
||||
.label-red {
|
||||
background-color: #be1621;
|
||||
}
|
||||
.btn-red {
|
||||
background-color: #be1621;
|
||||
border-color: #a7131d;
|
||||
@@ -395,6 +447,9 @@ thead input {
|
||||
border-color: #350609;
|
||||
color: #fff;
|
||||
}
|
||||
.label-mandarin {
|
||||
background-color: #e84e1b;
|
||||
}
|
||||
.btn-mandarin {
|
||||
background-color: #e84e1b;
|
||||
border-color: #aa3711;
|
||||
@@ -405,6 +460,9 @@ thead input {
|
||||
border-color: #3c1306;
|
||||
color: #fff;
|
||||
}
|
||||
.label-lime {
|
||||
background-color: #bccf07;
|
||||
}
|
||||
.btn-lime {
|
||||
background-color: #bccf07;
|
||||
border-color: #7c8801;
|
||||
@@ -415,6 +473,9 @@ thead input {
|
||||
border-color: #2e3200;
|
||||
color: #fff;
|
||||
}
|
||||
.label-cyan {
|
||||
background-color: #86cfe4;
|
||||
}
|
||||
.btn-cyan {
|
||||
background-color: #86cfe4;
|
||||
border-color: #4cb8d7;
|
||||
@@ -425,6 +486,9 @@ thead input {
|
||||
border-color: #17343c;
|
||||
color: #fff;
|
||||
}
|
||||
.label-caramel {
|
||||
background-color: #ce792d;
|
||||
}
|
||||
.btn-caramel {
|
||||
background-color: #ce792d;
|
||||
border-color: #935720;
|
||||
@@ -435,6 +499,9 @@ thead input {
|
||||
border-color: #3c230d;
|
||||
color: #fff;
|
||||
}
|
||||
.label-purple {
|
||||
background-color: #a694c2;
|
||||
}
|
||||
.btn-purple {
|
||||
background-color: #a694c2;
|
||||
border-color: #8067a8;
|
||||
@@ -445,6 +512,19 @@ thead input {
|
||||
border-color: #2f263c;
|
||||
color: #fff;
|
||||
}
|
||||
.label-plum {
|
||||
background-color: #be91be;
|
||||
}
|
||||
.btn-plum {
|
||||
background-color: #be91be;
|
||||
border-color: #a780a7;
|
||||
color: #fff;
|
||||
}
|
||||
.btn-plum.focus, .btn-plum:focus, .btn-plum:hover {
|
||||
background-color: #906e90;
|
||||
border-color: #352935;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.btn-white {
|
||||
background-color: #fff;
|
||||
|
||||
@@ -71,6 +71,7 @@ DEADLINE_CHOICES = ChoiceSet([
|
||||
LEVEL_CHOICES = ChoiceSet([
|
||||
('beginner', _(u'Anfänger')),
|
||||
('advanced', _(u'Fortgeschrittene')),
|
||||
('family', _(u'Familien')),
|
||||
])
|
||||
|
||||
MEALS_CHOICES = ChoiceSet([
|
||||
|
||||
@@ -970,28 +970,38 @@ class DescriptionForm(EventCreateForm):
|
||||
|
||||
value = u''
|
||||
if mode == 'training':
|
||||
if level == 'beginner':
|
||||
value += u'%s ' % ugettext(u'Grundkurs')
|
||||
# Titelprefix für Kurse
|
||||
if level == 'family':
|
||||
value += u'%s' % ugettext(u'Familienkurs')
|
||||
elif level == 'beginner':
|
||||
value += u'%s' % ugettext(u'Grundkurs')
|
||||
else:
|
||||
value += u'%s ' % ugettext(u'Aufbaukurs')
|
||||
value += u'%s' % ugettext(u'Aufbaukurs')
|
||||
|
||||
if sport == 'B':
|
||||
value += u'%s' % ugettext(u'Alpin')
|
||||
value += u' %s' % ugettext(u'Alpin')
|
||||
elif sport == 'K':
|
||||
if terrain == 'gym':
|
||||
value += ugettext(u'Indoorklettern')
|
||||
value += u' %s' % ugettext(u'Indoorklettern')
|
||||
elif terrain == 'crag':
|
||||
value += ugettext(u'Fels')
|
||||
value += u' %s' % ugettext(u'Fels')
|
||||
elif terrain == 'alpine':
|
||||
value += ugettext(u'Alpinklettern')
|
||||
value += u' %s' % ugettext(u'Alpinklettern')
|
||||
|
||||
value += u': ...'
|
||||
elif sport == 'W' and not last_day:
|
||||
value += u'%s ...' % ugettext(u'Tageswanderung')
|
||||
elif sport == 'W':
|
||||
# Titelprefix für Wanderungen
|
||||
if level == 'family':
|
||||
value += u'%s ...' % ugettext(u'Familienwanderung')
|
||||
elif not last_day:
|
||||
value += u'%s ...' % ugettext(u'Tageswanderung')
|
||||
elif level == 'family':
|
||||
# Titelprefix für sonstige Familientouren
|
||||
value += u'%s: ...' % ugettext(u'Familientour')
|
||||
|
||||
if app_config.settings.forms_development_init:
|
||||
if not value:
|
||||
value = u'%s' % choices.SPORT_CHOICES.get_label(sport)
|
||||
value += u'%s' % choices.SPORT_CHOICES.get_label(sport)
|
||||
|
||||
return value
|
||||
|
||||
|
||||
18
dav_events/migrations/0043_alter_event_level.py
Normal file
18
dav_events/migrations/0043_alter_event_level.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 3.2.13 on 2023-02-26 22:19
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('dav_events', '0042_auto_20220607_1345'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='event',
|
||||
name='level',
|
||||
field=models.CharField(choices=[('beginner', 'Anfänger'), ('advanced', 'Fortgeschrittene'), ('family', 'Familien')], max_length=25, verbose_name='Schwierigkeitsnivau'),
|
||||
),
|
||||
]
|
||||
@@ -8,6 +8,7 @@
|
||||
<div style="float: right;">
|
||||
<button id="btn-filter-All" type="button" class="btn btn-xs btn-green">Alle Touren</button>
|
||||
<button id="btn-filter-B" type="button" class="btn btn-xs btn-sport-B btn-white">Bergsteigen</button>
|
||||
<button id="btn-filter-family" type="button" class="btn btn-xs btn-level-family btn-white">Familien</button>
|
||||
<button id="btn-filter-K" type="button" class="btn btn-xs btn-sport-K btn-white">Klettern</button>
|
||||
<button id="btn-filter-M" type="button" class="btn btn-xs btn-sport-M btn-white">Mountainbike</button>
|
||||
<button id="btn-filter-S" type="button" class="btn btn-xs btn-sport-S btn-white">Ski</button>
|
||||
@@ -18,6 +19,7 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="hidden">Sport</th>
|
||||
<th class="hidden">Level</th>
|
||||
<th><input type="text" id="searchfield" placeholder="{% trans 'Volltextsuche' %}"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -25,6 +27,7 @@
|
||||
{% for event in event_list %}
|
||||
<tr>
|
||||
<td class="hidden">{{ event.sport }}</td>
|
||||
<td class="hidden">{{ event.level }}</td>
|
||||
<td>
|
||||
<div class="pull-right" style="margin-left: 2em;">
|
||||
<a role="button" id="controlChevronCollapseDetails{{ event.id }}" data-toggle="collapse"
|
||||
@@ -66,6 +69,9 @@
|
||||
{{ event.get_number }} - {{ event.title }}
|
||||
</a>
|
||||
</span></strong>
|
||||
{% if event.level == 'family' %}
|
||||
 <span class="label label-level-family">für Familien</span>
|
||||
{% endif %}
|
||||
<p>
|
||||
{% if event.is_canceled %}<del>{% endif %}
|
||||
{{ event.get_formated_date }}
|
||||
@@ -121,19 +127,33 @@
|
||||
</table>
|
||||
<script type="text/javascript">
|
||||
function filter_sport(table, sport) {
|
||||
const sports = ["All", "B", "K", "M", "S", "W"];
|
||||
const choices = ["All", "B", "K", "M", "S", "W"];
|
||||
var search = sport;
|
||||
|
||||
for(let i in sports) {
|
||||
if(sport != sports[i])
|
||||
$("#btn-filter-" + sports[i]).addClass("btn-white");
|
||||
for(let i in choices) {
|
||||
if(sport != choices[i])
|
||||
$("#btn-filter-" + choices[i]).addClass("btn-white");
|
||||
}
|
||||
$("#btn-filter-" + sport).removeClass("btn-white");
|
||||
|
||||
if(sport == "All")
|
||||
search = "";
|
||||
table.column(0).search(search).draw();
|
||||
}
|
||||
};
|
||||
function filter_level(table, level) {
|
||||
const choices = ["All", "beginner", "advanced", "family"];
|
||||
var search = level;
|
||||
|
||||
for(let i in choices) {
|
||||
if(level != choices[i])
|
||||
$("#btn-filter-" + choices[i]).addClass("btn-white");
|
||||
}
|
||||
$("#btn-filter-" + level).removeClass("btn-white");
|
||||
|
||||
if(level == "All")
|
||||
search = "";
|
||||
table.column(1).search(search).draw();
|
||||
};
|
||||
$(document).ready( function () {
|
||||
var table = $("#objects_table").DataTable( {
|
||||
ordering: false,
|
||||
@@ -150,24 +170,34 @@
|
||||
} );
|
||||
$("#btn-filter-All").on("click", function() {
|
||||
filter_sport(table, "All");
|
||||
filter_level(table, "All");
|
||||
} );
|
||||
$("#btn-filter-B").on("click", function() {
|
||||
filter_level(table, "All");
|
||||
filter_sport(table, "B");
|
||||
} );
|
||||
$("#btn-filter-K").on("click", function() {
|
||||
filter_level(table, "All");
|
||||
filter_sport(table, "K");
|
||||
} );
|
||||
$("#btn-filter-M").on("click", function() {
|
||||
filter_level(table, "All");
|
||||
filter_sport(table, "M");
|
||||
} );
|
||||
$("#btn-filter-S").on("click", function() {
|
||||
filter_level(table, "All");
|
||||
filter_sport(table, "S");
|
||||
} );
|
||||
$("#btn-filter-W").on("click", function() {
|
||||
filter_level(table, "All");
|
||||
filter_sport(table, "W");
|
||||
} );
|
||||
$("#btn-filter-family").on("click", function() {
|
||||
filter_sport(table, "All");
|
||||
filter_level(table, "family");
|
||||
} );
|
||||
$("#searchfield").on( "keyup change", function() {
|
||||
table.column(1).search( this.value ).draw();
|
||||
table.column(2).search( this.value ).draw();
|
||||
} );
|
||||
$("#objects_table_filter").hide();
|
||||
filter_sport(table, "{{ init_sport_filter|default:'All' }}");
|
||||
|
||||
Reference in New Issue
Block a user