mirror of
https://github.com/webrecorder/pywb.git
synced 2025-03-15 00:03:28 +01:00
head_insert: don't include banner_html, only used for framed replay now
wombat: bump to latest wombat 3.3.7 add new custom_banner to head_insert template for frameless replay
This commit is contained in:
parent
c28941a0b6
commit
e20fac2c75
@ -78,10 +78,11 @@ class RewriterApp(object):
|
||||
self.redirect_to_exact = config.get('redirect_to_exact')
|
||||
|
||||
self.banner_view = BaseInsertView(self.jinja_env, self._html_templ('banner_html'))
|
||||
self.custom_banner_view = BaseInsertView(self.jinja_env, self._html_templ('custom_banner_html'))
|
||||
|
||||
self.head_insert_view = HeadInsertView(self.jinja_env,
|
||||
self._html_templ('head_insert_html'),
|
||||
self.banner_view)
|
||||
self.custom_banner_view)
|
||||
|
||||
self.frame_insert_view = TopFrameView(self.jinja_env,
|
||||
self._html_templ('frame_insert_html'),
|
||||
|
@ -12,6 +12,7 @@ templates_dir: templates
|
||||
|
||||
# Template HTML
|
||||
banner_html: banner.html
|
||||
custom_banner_html: custom_banner.html
|
||||
head_insert_html: head_insert.html
|
||||
frame_insert_html: frame_insert.html
|
||||
|
||||
@ -36,6 +37,7 @@ info_json: collinfo.json
|
||||
# HTML Templates List
|
||||
html_templates:
|
||||
- banner_html
|
||||
- custom_banner_html
|
||||
- head_insert_html
|
||||
- frame_insert_html
|
||||
|
||||
|
@ -371,7 +371,7 @@ class HeadInsertView(BaseInsertView):
|
||||
|
||||
if self.banner_view:
|
||||
banner_html = self.banner_view.render_to_string(env, cdx=cdx, **params)
|
||||
params['banner_html'] = banner_html
|
||||
params['custom_banner_html'] = banner_html
|
||||
|
||||
return self.render_to_string(env, cdx=cdx, **params)
|
||||
|
||||
|
1
pywb/templates/custom_banner.html
Normal file
1
pywb/templates/custom_banner.html
Normal file
@ -0,0 +1 @@
|
||||
<!-- Add custom banner here. Used only in non-framed replay. -->
|
@ -62,7 +62,11 @@
|
||||
|
||||
{% endif %}
|
||||
|
||||
{{ banner_html }}
|
||||
{% if not is_framed %}
|
||||
|
||||
{{ custom_banner_html }}
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% endautoescape %}
|
||||
|
||||
|
@ -275,18 +275,19 @@ class TestManagedColls(CollsDirMixin, BaseConfigTest):
|
||||
assert 'pywb custom search page' in resp.text
|
||||
|
||||
def test_add_custom_banner(self):
|
||||
""" Test adding custom banner.html per-collection template
|
||||
""" Test adding custom_banner.html per-collection template
|
||||
"""
|
||||
|
||||
banner_file = os.path.join(self.root_dir, COLLECTIONS, 'test',
|
||||
'templates', 'banner.html')
|
||||
'templates', 'custom_banner.html')
|
||||
|
||||
with open(banner_file, 'w+b') as fh:
|
||||
fh.write(b'<div>Custom Banner Here!</div>')
|
||||
fh.write(b'\n{{ metadata | tojson }}')
|
||||
|
||||
def test_add_custom_banner_replay(self, fmod):
|
||||
resp = self.get('/test/20140103030321/http://example.com/?example=1', fmod)
|
||||
def test_add_custom_banner_replay(self):
|
||||
"""Test custom banner appears in unframed replay."""
|
||||
resp = self.get('/test/20140103030321/http://example.com/?example=1', None)
|
||||
assert '<div>Custom Banner Here!</div>' in resp.text
|
||||
|
||||
def test_more_custom_templates(self):
|
||||
@ -316,10 +317,9 @@ class TestManagedColls(CollsDirMixin, BaseConfigTest):
|
||||
#assert '"some":"value"' in resp.text, resp.text
|
||||
assert '{"some":"value"}' in resp.text, resp.text
|
||||
|
||||
def test_replay_banner_metadata(self, fmod):
|
||||
""" Test adding metadata in replay banner (both framed and non-frame)
|
||||
"""
|
||||
resp = self.get('/test/20140103030321{0}/http://example.com/?example=1', fmod)
|
||||
def test_replay_banner_metadata(self):
|
||||
"""Test adding metadata in custom banner for unframed replay."""
|
||||
resp = self.get('/test/20140103030321/http://example.com/?example=1', None)
|
||||
assert '<div>Custom Banner Here!</div>' in resp.text
|
||||
#assert '"some":"value"' in resp.text
|
||||
assert '{"some":"value"}' in resp.text, resp.text
|
||||
|
@ -35,7 +35,6 @@ class TestPrefixedDeploy(BaseConfigTest):
|
||||
|
||||
assert '"20140127171238"' in resp.text, resp.text
|
||||
assert "'http://localhost:80/prefix/static/wombat.js'" in resp.text
|
||||
assert "http://localhost:80/prefix/static/vue/vueui.js" in resp.text
|
||||
assert '"http://localhost:80/prefix/static/"' in resp.text
|
||||
assert '"http://localhost:80/prefix/pywb/"' in resp.text
|
||||
assert 'WBWombatInit' in resp.text, resp.text
|
||||
|
Loading…
x
Reference in New Issue
Block a user