Skip to content

Commit

Permalink
Update gwsumm to handle updated gwbootstrap
Browse files Browse the repository at this point in the history
  • Loading branch information
Evan Goetz committed Mar 22, 2024
1 parent 00a0fe7 commit 372c0cd
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 22 deletions.
2 changes: 1 addition & 1 deletion gwsumm/html/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def state_switcher(states, default=0):
page.li(class_='nav-item dropdown')
page.a(str(current), class_='nav-link dropdown-toggle', href='#',
id_='states', role='button', title='Show/hide state menu',
**{'data-toggle': 'dropdown'})
**{'data-bs-toggle': 'dropdown'})
page.div(
class_='dropdown-menu dropdown-menu-right state-switch shadow',
id_='statemenu',
Expand Down
23 changes: 12 additions & 11 deletions gwsumm/html/static.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,33 +24,34 @@
from collections import OrderedDict

__author__ = 'Duncan Macleod <duncan.macleod@ligo.org>'
__credits__ = 'Alex Urban <alexander.urban@ligo.org>'
__credits__ = ('Alex Urban <alexander.urban@ligo.org>,'
' Evan Goetz <evan.goetz@ligo.org>')


# build collection of CSS resources
CSS = OrderedDict((
('font-awesome', 'https://cdnjs.cloudflare.com/ajax/libs/'
'font-awesome/5.15.1/css/fontawesome.min.css'),
'font-awesome/6.5.1/css/fontawesome.min.css'),
('font-awesome-solid', 'https://cdnjs.cloudflare.com/ajax/libs/'
'font-awesome/5.15.1/css/solid.min.css'),
('gwbootstrap', 'https://cdn.jsdelivr.net/npm/gwbootstrap@1.3.2/'
'font-awesome/6.5.1/css/solid.min.css'),
('gwbootstrap', 'https://cdn.jsdelivr.net/npm/gwbootstrap@1.3.3/'
'lib/gwbootstrap.min.css'),
))

# build collection of javascript resources
JS = OrderedDict((
('jquery', 'https://code.jquery.com/jquery-3.5.1.min.js'),
('jquery-ui', 'https://code.jquery.com/ui/1.12.1/jquery-ui.min.js'),
('jquery', 'https://code.jquery.com/jquery-3.7.1.min.js'),
('jquery-ui', 'https://code.jquery.com/ui/1.13.2/jquery-ui.min.js'),
('moment', 'https://cdnjs.cloudflare.com/ajax/libs/'
'moment.js/2.29.1/moment.min.js'),
('bootstrap', 'https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/'
'moment.js/2.30.1/moment.min.js'),
('bootstrap', 'https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/'
'dist/js/bootstrap.bundle.min.js'),
('fancybox', 'https://cdnjs.cloudflare.com/ajax/libs/'
'fancybox/3.5.7/jquery.fancybox.min.js'),
('fancybox', 'https://cdn.jsdelivr.net/npm/@fancyapps/ui@5.0/'
'dist/fancybox/fancybox.umd.js'),
('datepicker', 'https://cdnjs.cloudflare.com/ajax/libs/'
'bootstrap-datepicker/1.9.0/js/'
'bootstrap-datepicker.min.js'),
('gwbootstrap', 'https://cdn.jsdelivr.net/npm/gwbootstrap@1.3.2/'
('gwbootstrap', 'https://cdn.jsdelivr.net/npm/gwbootstrap@1.3.3/'
'lib/gwbootstrap-extra.min.js'),
))

Expand Down
12 changes: 6 additions & 6 deletions gwsumm/html/tests/test_bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@ def test_state_switcher():
assert parse_html(str(switcher)) == parse_html(
'<ul class="nav navbar-nav">\n<li class="nav-item dropdown">\n'
'<a class="nav-link dropdown-toggle" href="#" id="states" role='
'"button" title="Show/hide state menu" data-toggle="dropdown">Test</a>'
'\n<div class="dropdown-menu dropdown-menu-right state-switch shadow" '
'id="statemenu">\n<h6 class="dropdown-header">Select below to view '
'this page in another state (different time segments).</h6>\n<div '
'class="dropdown-divider"></div>\n<a class="dropdown-item state" '
'"button" title="Show/hide state menu" data-bs-toggle="dropdown">Test'
'</a>\n<div class="dropdown-menu dropdown-menu-right state-switch '
'shadow" id="statemenu">\n<h6 class="dropdown-header">Select below to '
'view this page in another state (different time segments).</h6>\n'
'<div class="dropdown-divider"></div>\n<a class="dropdown-item state" '
'title="Test" id="state_test" onclick="jQuery(this).load_state'
'(&quot;#test&quot;);">Test</a>\n</div>\n</li>\n</ul>')

Expand All @@ -102,6 +102,6 @@ def test_base_map_dropdown():
assert parse_html(str(menu_wbases)) == parse_html(
'<div class="dropdown base-map">\n<a href="#" class="navbar-brand '
'nav-link border border-white rounded dropdown-toggle" role="button" '
'data-toggle="dropdown">test</a>\n<div class="dropdown-menu '
'data-bs-toggle="dropdown">test</a>\n<div class="dropdown-menu '
'dropdown-1-col shadow">\n<a title="key" class="dropdown-item" '
'data-new-base="value">key</a>\n</div>\n</div>')
4 changes: 2 additions & 2 deletions gwsumm/html/tests/test_static.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ def test_get_js():
# test list of files
js_files = list(x.split('/')[-1] for x in js.values())
assert js_files == [
'jquery-3.5.1.min.js',
'jquery-3.7.1.min.js',
'jquery-ui.min.js',
'moment.min.js',
'bootstrap.bundle.min.js',
'jquery.fancybox.min.js',
'fancybox.umd.js',
'bootstrap-datepicker.min.js',
'gwbootstrap-extra.min.js',
]
2 changes: 1 addition & 1 deletion gwsumm/tabs/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,7 @@ def write_state_html(self, state):
page.div(class_='card border-info mb-1 shadow-sm')
page.div(class_='card-header text-white bg-info')
page.a(flag.name, class_='card-link cis-link collapsed',
href='#flag%d' % i, **{'data-toggle': 'collapse',
href='#flag%d' % i, **{'data-bs-toggle': 'collapse',
'aria-expanded': 'false'})
page.div.close() # card-header
page.div(id_='flag%d' % i, class_='collapse',
Expand Down
2 changes: 1 addition & 1 deletion gwsumm/tabs/guardian.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ def write_state_html(self, state):
page.div(class_='card-header text-white bg-info')
page.a('%s [%d]' % (name, bit), href='#collapse-%d' % bit,
class_='card-link cis-link collapsed',
**{'data-toggle': 'collapse', 'aria-expandedt': 'false'})
**{'data-bs-toggle': 'collapse', 'aria-expanded': 'false'})
page.div.close() # card-header

# body
Expand Down

0 comments on commit 372c0cd

Please sign in to comment.