@@ -22,20 +22,18 @@ def patch_wider_resource_listing():
2222 """Make sure the full filename is visible in the resource view"""
2323 ckan_path = pathlib .Path (ckan .__file__ ).parent
2424
25- # patch page to increase resource file listing width
26- path_template_page = ckan_path / "templates/page.html"
27- data_page = path_template_page .read_text ()
28- for old , new in [
29- ('<aside class="secondary col-md-3">' ,
30- '<aside class="secondary col-md-5">' ),
31- ('<div class="primary col-md-9 col-xs-12" role="main">' ,
32- '<div class="primary col-md-7 col-xs-12" role="main">' )
33- ]:
34- data_page = data_page .replace (old , new )
35- path_template_page .write_text (data_page )
36-
37- # patch resource listing template, removing the truncate filter
25+ # patch resource listing template
3826 path_template_res = ckan_path / "templates/package/snippets/resources.html"
3927 data_res = path_template_res .read_text ()
40- data_res = data_res .replace ("|truncate(25)" , "" )
28+ st = 'style="word-wrap: break-word"'
29+ for old , new in [
30+ # remove the truncate filter for file names
31+ ("|truncate(25)" , "" ),
32+ # force word wrap of the file names
33+ ('<a href="' ,
34+ f'<a { st } href="' ),
35+ ('<a class="flex-fill" href="' ,
36+ f'<a class="flex-fill" { st } href="' ),
37+ ]:
38+ data_res = data_res .replace (old , new )
4139 path_template_res .write_text (data_res )
0 commit comments