diff --git a/VIPSWeb/templatetags/template_helper.py b/VIPSWeb/templatetags/template_helper.py index e3a4eee65199f42914f232cb5487492c20c934cc..e5a7dc852e8a6c3c0b0fb60514ee9a877fae974a 100644 --- a/VIPSWeb/templatetags/template_helper.py +++ b/VIPSWeb/templatetags/template_helper.py @@ -69,7 +69,7 @@ def generate_main_menu(context): top_level = Information.objects.filter(parent_information__isnull=True) items_html = [] for info in top_level: - info_locale = InformationLocale.get_information_locale_with_fallback(info.pk) + info_locale = InformationLocale.get_information_locale_with_fallback(info.pk, request.LANGUAGE_CODE) items_html.append( item_template % (reverse('information:detail', kwargs={"information_id":info.pk}), info_locale.headline) ) menu_html += dropdown_template % (" currentLink" if request.path.startswith("/information") else "",_("Information"),"".join(items_html)) diff --git a/forecasts/templates/forecasts/detail.html b/forecasts/templates/forecasts/detail.html index af6b0430d1fe1ed4c65b92aac0fae1a53112672e..e9fc6f7955b6dccf20d426703d3ae711ff014935 100644 --- a/forecasts/templates/forecasts/detail.html +++ b/forecasts/templates/forecasts/detail.html @@ -89,6 +89,25 @@ <div class="alert alert-info">{% trans "No results for this forecast" %}</div> {% endif %} +{% endblock %} +{% block customCSS %} +<style type="text/css"> + .table-fixed thead { + width: 97%; + } + .table-fixed tbody { + height: 230px; + overflow-y: auto; + width: 100%; + } + .table-fixed thead, .table-fixed tbody, .table-fixed tr, .table-fixed td, .table-fixed th { + display: block; + } + .table-fixed tbody td, .table-fixed thead > tr> th { + float: left; + border-bottom-width: 0; + } +</style> {% endblock %} {% block customJS %} <script type="text/javascript" src="{% url "views.settings_js" %}"></script> diff --git a/information/views.py b/information/views.py index c12ff5c5a799dbee4b4fe791f2d16cef05686330..bab2a73dc3d2fd817110f6f4e174b767478f0e4c 100644 --- a/information/views.py +++ b/information/views.py @@ -32,7 +32,7 @@ def index(request): return render(request, 'information/index.html', context) def detail(request, information_id): - information_locale = InformationLocale.get_information_locale_with_fallback(information_id) + information_locale = InformationLocale.get_information_locale_with_fallback(information_id, request.LANGUAGE_CODE) # Is there a parent? #parent_information = information_locale.information.parent_information # We get all the children too @@ -44,16 +44,16 @@ def detail(request, information_id): 'information_locale' : information_locale, #'parent_information' : parent_information, #'children_locales':children_locales, - 'breadcrumb': get_breadcrumb(information_locale.information), - 'menu_html': get_menu_html(None, information_id) + 'breadcrumb': get_breadcrumb(information_locale.information, request.LANGUAGE_CODE), + 'menu_html': get_menu_html(None, information_id, request.LANGUAGE_CODE) } return render(request, 'information/detail.html', context) -def get_breadcrumb(information): +def get_breadcrumb(information, language): active_id= information.pk breadcrumb = []#[] while information != None: - information_locale = InformationLocale.get_information_locale_with_fallback(information.pk) + information_locale = InformationLocale.get_information_locale_with_fallback(information.pk, language) children_locales = [] for child in information_locale.information.children.all(): children_locales.append(InformationLocale.get_information_locale_with_fallback(child.pk)) @@ -87,7 +87,7 @@ toggleable_item_template=""" simple_item_template = """<li class="%s">%s</li>""" ## Recursive method -def get_menu_html(parent_information, active_information_pk): +def get_menu_html(parent_information, active_information_pk, language): # We start with backtracking from the active information object if(parent_information == None): @@ -97,7 +97,7 @@ def get_menu_html(parent_information, active_information_pk): items_html = [] for info in items: - info_locale = InformationLocale.get_information_locale_with_fallback(info.pk) + info_locale = InformationLocale.get_information_locale_with_fallback(info.pk, language) if info.pk == int(active_information_pk): active_class = "active" title = """<span class="active">%s</span>""" % info_locale.headline @@ -105,7 +105,7 @@ def get_menu_html(parent_information, active_information_pk): active_class = "" title = link_title % (reverse('information:detail', kwargs={"information_id":info.pk}), info_locale.headline) - child_menu_html = get_menu_html(info, active_information_pk) + child_menu_html = get_menu_html(info, active_information_pk, language) # If item has no child items, create simple item if child_menu_html == "": items_html.append(simple_item_template % (active_class, title))