Skip to content

Commit

Permalink
template fixes: fix comment in head, footer, header templates
Browse files Browse the repository at this point in the history
vueui fixes:
- fix error if no urls found on calendar page
- convert url to text box to allow enter new urls
- fix suport for logo, have logo link to home page
  • Loading branch information
ikreymer committed Jan 25, 2022
1 parent 6137543 commit 581e460
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 25 deletions.
45 changes: 32 additions & 13 deletions pywb/static/vue/vueui.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pywb/templates/banner.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<link rel='stylesheet' href='{{ static_prefix }}/vue_banner.css'/>
<script src="{{ static_prefix }}/vue/vueui.js"></script>
<script>
VueUI.main("{{ static_prefix }}", "{{ url }}", "{{ wb_prefix }}", "{{ timestamp }}");
VueUI.main("{{ static_prefix }}", "{{ url }}", "{{ wb_prefix }}", "{{ timestamp }}", "{{ ui.logo }}");
</script>

{% if ui.vue_timeline_banner %}
Expand Down
2 changes: 1 addition & 1 deletion pywb/templates/footer.html
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
## place content to be added at the very end of the <body> tag here
{# place content to be added at the very end of the <body> tag in this file below #}

2 changes: 1 addition & 1 deletion pywb/templates/head.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
## place optional content to be injected into the <head> of every page here
{# place optional content to be injected into the <head> of every page in this file below #}
2 changes: 1 addition & 1 deletion pywb/templates/header.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## place content to be added at the very beginning of the <body> tag here
{# place content to be added at the very beginning of the <body> tag in this file below #}
<header>
{% if not err_msg and locales|length > 1 %}
<div class="language-select">
Expand Down
2 changes: 1 addition & 1 deletion pywb/templates/query.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ <h4 class="display-4 text-center text-sm-left p-0">{{ _('Search Results') }}</h4
renderCal.init();

{% else %}
VueUI.main("{{ static_prefix }}", "{{ url }}", "{{ prefix }}", "{{ ui.logo }}");
VueUI.main("{{ static_prefix }}", "{{ url }}", "{{ prefix }}", undefined, "{{ ui.logo }}");

{% endif %}

Expand Down
24 changes: 19 additions & 5 deletions pywb/vueui/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="app" :class="{expanded: showTimelineView}" data-app="webrecorder-replay-app">
<div class="banner">
<div class="line">
<div class="logo"><a href="/"><img :src="config.logoImg" /></a></div>
<div class="logo"><a href="/"><img :src="config.logoImg" style="max-width: 80px" /></a></div>
<div class="timeline-wrap">
<div class="line">
<div class="breadcrumbs-wrap">
Expand Down Expand Up @@ -35,13 +35,15 @@
</div>
</div>
<div class="snapshot-title">
<div>{{ config.url }}</div>
<form @submit="gotoUrl">
<input id="theurl" type="text" :value="config.url"></input>
</form>
<div v-if="currentSnapshot && !showFullView">
<span v-if="config.title">{{ config.title }}</span>
Current capture: {{currentSnapshot.getTimeDateFormatted()}}
</div>
</div>
<CalendarYear v-if="showFullView"
<CalendarYear v-if="showFullView && currentPeriod && currentPeriod.children.length"
:period="currentPeriod"
:current-snapshot="currentSnapshot"
@goto-period="gotoPeriod">
Expand Down Expand Up @@ -124,6 +126,13 @@ export default {
this.$emit("show-snapshot", snapshot);
this.showFullView = false;
},
gotoUrl(event) {
event.preventDefault();
const newUrl = document.querySelector("#theurl").value;
if (newUrl !== this.url) {
window.location.href = this.config.prefix + "*/" + newUrl;
}
},
init() {
this.config.url = this.config.initialView.url;
if (this.config.initialView.title) {
Expand All @@ -134,8 +143,10 @@ export default {
this.showTimelineView = true;
} else {
this.showFullView = false;
this.showFullView = true;
this.setSnapshot(this.config.initialView);
this.showTimelineView = true;
if (this.currentPeriod.children.length) {
this.setSnapshot(this.config.initialView);
}
}
if (window.sessionStorage) {
const currentPeriodId = window.sessionStorage.getItem(this.sessionStorageUrlKey);
Expand Down Expand Up @@ -242,4 +253,7 @@ export default {
font-weight: bold;
font-size: 16px;
}
#theurl {
width: 400px;
}
</style>
4 changes: 2 additions & 2 deletions pywb/vueui/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class CDXLoader {

this.opts.initialView = {url, timestamp};

this.opts.logoImg = this.staticPrefix + (this.logoUrl ? this.logoUrl : "/pywb-logo-sm.png");
this.opts.logoImg = this.staticPrefix + "/" + (this.logoUrl ? this.logoUrl : "pywb-logo-sm.png");

this.loadCDX(queryURL).then((cdxList) => {
this.app = this.initApp(cdxList, this.opts, (snapshot) => this.loadSnapshot(snapshot));
Expand All @@ -60,7 +60,7 @@ class CDXLoader {
app.$set(app, "snapshots", pywbData.snapshots);
app.$set(app, "currentPeriod", pywbData.timeline);

app.$set(app, "config", {...app.config, ...config});
app.$set(app, "config", {...app.config, ...config, prefix: this.prefix});

app.$mount("#app");

Expand Down

0 comments on commit 581e460

Please sign in to comment.