Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
V
VIPSWeb
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VIPS
VIPSWeb
Commits
684cd868
Commit
684cd868
authored
9 years ago
by
Tor-Einar Skog
Browse files
Options
Downloads
Patches
Plain Diff
Fixed translation issue for information items
parent
e1fbee98
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
VIPSWeb/templatetags/template_helper.py
+1
-1
1 addition, 1 deletion
VIPSWeb/templatetags/template_helper.py
forecasts/templates/forecasts/detail.html
+19
-0
19 additions, 0 deletions
forecasts/templates/forecasts/detail.html
information/views.py
+8
-8
8 additions, 8 deletions
information/views.py
with
28 additions
and
9 deletions
VIPSWeb/templatetags/template_helper.py
+
1
−
1
View file @
684cd868
...
@@ -69,7 +69,7 @@ def generate_main_menu(context):
...
@@ -69,7 +69,7 @@ def generate_main_menu(context):
top_level
=
Information
.
objects
.
filter
(
parent_information__isnull
=
True
)
top_level
=
Information
.
objects
.
filter
(
parent_information__isnull
=
True
)
items_html
=
[]
items_html
=
[]
for
info
in
top_level
:
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
)
)
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
))
menu_html
+=
dropdown_template
%
(
"
currentLink
"
if
request
.
path
.
startswith
(
"
/information
"
)
else
""
,
_
(
"
Information
"
),
""
.
join
(
items_html
))
...
...
This diff is collapsed.
Click to expand it.
forecasts/templates/forecasts/detail.html
+
19
−
0
View file @
684cd868
...
@@ -89,6 +89,25 @@
...
@@ -89,6 +89,25 @@
<div
class=
"alert alert-info"
>
{% trans "No results for this forecast" %}
</div>
<div
class=
"alert alert-info"
>
{% trans "No results for this forecast" %}
</div>
{% endif %}
{% 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 %}
{% endblock %}
{% block customJS %}
{% block customJS %}
<script
type=
"text/javascript"
src=
"{% url "
views.settings_js
"
%}"
></script>
<script
type=
"text/javascript"
src=
"{% url "
views.settings_js
"
%}"
></script>
...
...
This diff is collapsed.
Click to expand it.
information/views.py
+
8
−
8
View file @
684cd868
...
@@ -32,7 +32,7 @@ def index(request):
...
@@ -32,7 +32,7 @@ def index(request):
return
render
(
request
,
'
information/index.html
'
,
context
)
return
render
(
request
,
'
information/index.html
'
,
context
)
def
detail
(
request
,
information_id
):
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?
# Is there a parent?
#parent_information = information_locale.information.parent_information
#parent_information = information_locale.information.parent_information
# We get all the children too
# We get all the children too
...
@@ -44,16 +44,16 @@ def detail(request, information_id):
...
@@ -44,16 +44,16 @@ def detail(request, information_id):
'
information_locale
'
:
information_locale
,
'
information_locale
'
:
information_locale
,
#'parent_information' : parent_information,
#'parent_information' : parent_information,
#'children_locales':children_locales,
#'children_locales':children_locales,
'
breadcrumb
'
:
get_breadcrumb
(
information_locale
.
information
),
'
breadcrumb
'
:
get_breadcrumb
(
information_locale
.
information
,
request
.
LANGUAGE_CODE
),
'
menu_html
'
:
get_menu_html
(
None
,
information_id
)
'
menu_html
'
:
get_menu_html
(
None
,
information_id
,
request
.
LANGUAGE_CODE
)
}
}
return
render
(
request
,
'
information/detail.html
'
,
context
)
return
render
(
request
,
'
information/detail.html
'
,
context
)
def
get_breadcrumb
(
information
):
def
get_breadcrumb
(
information
,
language
):
active_id
=
information
.
pk
active_id
=
information
.
pk
breadcrumb
=
[]
#[]
breadcrumb
=
[]
#[]
while
information
!=
None
:
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
=
[]
children_locales
=
[]
for
child
in
information_locale
.
information
.
children
.
all
():
for
child
in
information_locale
.
information
.
children
.
all
():
children_locales
.
append
(
InformationLocale
.
get_information_locale_with_fallback
(
child
.
pk
))
children_locales
.
append
(
InformationLocale
.
get_information_locale_with_fallback
(
child
.
pk
))
...
@@ -87,7 +87,7 @@ toggleable_item_template="""
...
@@ -87,7 +87,7 @@ toggleable_item_template="""
simple_item_template
=
"""
<li class=
"
%s
"
>%s</li>
"""
simple_item_template
=
"""
<li class=
"
%s
"
>%s</li>
"""
## Recursive method
## 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
# We start with backtracking from the active information object
if
(
parent_information
==
None
):
if
(
parent_information
==
None
):
...
@@ -97,7 +97,7 @@ def get_menu_html(parent_information, active_information_pk):
...
@@ -97,7 +97,7 @@ def get_menu_html(parent_information, active_information_pk):
items_html
=
[]
items_html
=
[]
for
info
in
items
:
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
):
if
info
.
pk
==
int
(
active_information_pk
):
active_class
=
"
active
"
active_class
=
"
active
"
title
=
"""
<span class=
"
active
"
>%s</span>
"""
%
info_locale
.
headline
title
=
"""
<span class=
"
active
"
>%s</span>
"""
%
info_locale
.
headline
...
@@ -105,7 +105,7 @@ def get_menu_html(parent_information, active_information_pk):
...
@@ -105,7 +105,7 @@ def get_menu_html(parent_information, active_information_pk):
active_class
=
""
active_class
=
""
title
=
link_title
%
(
reverse
(
'
information:detail
'
,
kwargs
=
{
"
information_id
"
:
info
.
pk
}),
info_locale
.
headline
)
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 item has no child items, create simple item
if
child_menu_html
==
""
:
if
child_menu_html
==
""
:
items_html
.
append
(
simple_item_template
%
(
active_class
,
title
))
items_html
.
append
(
simple_item_template
%
(
active_class
,
title
))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment