Skip to content

Commit c3fb8e7

Browse files
committed
Merge pull request #194 from jbenito3/bulletin-change-menu-urls
CERNBulletin: changed menu URLs after 2016/41
2 parents c7ee687 + 1263559 commit c3fb8e7

File tree

1 file changed

+26
-5
lines changed

1 file changed

+26
-5
lines changed

modules/webjournal/lib/elements/bfe_webjournal_main_navigation.py

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"""
2121
WebJournal element - Prints main (horizontal) navigation menu
2222
"""
23-
from invenio.legacy.webjournal_utils import \
23+
from invenio.webjournal_utils import \
2424
parse_url_string, \
2525
make_journal_url, \
2626
get_journal_categories
@@ -53,13 +53,34 @@ def format_element(bfo, category_prefix, category_suffix, separator=" | ",
5353
)
5454

5555
# Build the links to categories
56+
new_bulletin_urls = {
57+
'News Articles': 'https://home.cern/%scern-people',
58+
'Official News': 'https://home.cern/%scern-people/official-communications',
59+
'Announcements': 'https://home.cern/%scern-people/announcements',
60+
'Events': 'https://home.cern/%scern-people/events',
61+
'Training and Development': None
62+
}
5663
categories_links = []
5764
for category in journal_categories:
5865
# Create URL
59-
category_url = make_journal_url(bfo.user_info['uri'],
60-
{'category': category,
61-
'recid': '',
62-
'ln': bfo.lang})
66+
issue_year, issue_number = args['issue_year'], args['issue_number']
67+
if journal_name == 'CERNBulletin' and \
68+
category in new_bulletin_urls and \
69+
(issue_year > 2016 or
70+
(issue_year == 2016 and issue_number > 41)):
71+
if not new_bulletin_urls[category]:
72+
continue
73+
else:
74+
if ln != 'fr':
75+
lang = ''
76+
else:
77+
lang = 'fr/'
78+
category_url = new_bulletin_urls[category] % lang
79+
else:
80+
category_url = make_journal_url(bfo.user_info['uri'],
81+
{'category': category,
82+
'recid': '',
83+
'ln': bfo.lang})
6384
# Create HTML link
6485
linkattrd = {}
6586
if category.lower() == selected_category.lower():

0 commit comments

Comments
 (0)