From 1cb1018a4e257b105b44bb6875c112ee8b4f92a0 Mon Sep 17 00:00:00 2001 From: Gordon Williams Date: Thu, 13 Feb 2020 10:12:49 +0000 Subject: [PATCH] Make changelogs viewable --- apps/about/ChangeLog | 2 +- index.js | 24 ++++++++++++++++++++---- utils.js | 8 ++++++-- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/apps/about/ChangeLog b/apps/about/ChangeLog index efbc53fb0..5560f00bc 100644 --- a/apps/about/ChangeLog +++ b/apps/about/ChangeLog @@ -1 +1 @@ -0.00: New App! +0.01: New App! diff --git a/index.js b/index.js index ad1c1aff8..dbc5639be 100644 --- a/index.js +++ b/index.js @@ -51,7 +51,8 @@ Puck.writeProgress = function(charsSent, charsTotal) { pt.style.width = percent+"%"; } } -function showPrompt(title, text) { +function showPrompt(title, text, buttons) { + if (!buttons) buttons={yes:1,no:1}; return new Promise((resolve,reject) => { var modal = htmlElement(` `); document.body.append(modal); + modal.querySelector("a[href='#close']").addEventListener("click",event => { + event.preventDefault(); + reject(); + modal.remove(); + }); htmlToArray(modal.getElementsByTagName("button")).forEach(button => { button.addEventListener("click",event => { event.preventDefault(); @@ -85,6 +92,15 @@ function showPrompt(title, text) { }); }); } +sho +function showChangeLog(appid) { + var app = appNameToApp(appid); + function show(contents) { + showPrompt(app.name+" Change Log",contents,{ok:true}).catch(()=>{});; + } + httpGet(`apps/${appid}/ChangeLog`). + then(show).catch(()=>show("No Change Log available")); +} function handleCustomApp(app) { // Pops up an IFRAME that allows an app to be customised if (!app.custom) throw new Error("App doesn't have custom HTML"); diff --git a/utils.js b/utils.js index 699b247a9..85b6eb0a1 100644 --- a/utils.js +++ b/utils.js @@ -48,13 +48,17 @@ work out what to display re: versions and if we can update */ function getVersionInfo(appListing, appInstalled) { var versionText = ""; var canUpdate = false; + function clicky(v) { + return `${v}`; + } + if (!appInstalled) { if (appListing.version) - versionText = "v"+appListing.version; + versionText = clicky("v"+appListing.version); } else { versionText = (appInstalled.version ? ("v"+appInstalled.version) : "Unknown version"); if (appListing.version != appInstalled.version) { - if (appListing.version) versionText += ", latest "+appListing.version; + if (appListing.version) versionText += ", latest "+clicky("v"+appListing.version); canUpdate = true; } }