mirror of https://github.com/espruino/BangleApps
Let user define README file in apps.json. Only show Read More link if one present
parent
f384d01c34
commit
7df6bafdf9
|
@ -898,6 +898,7 @@
|
|||
"tags": "clock,mario,retro",
|
||||
"type": "clock",
|
||||
"allow_emulator":true,
|
||||
"readme": "README.md",
|
||||
"storage": [
|
||||
{"name":"marioclock.app.js","url":"marioclock-app.js"},
|
||||
{"name":"marioclock.img","url":"marioclock-icon.js","evaluate":true}
|
||||
|
|
|
@ -23,13 +23,17 @@ function showChangeLog(appid) {
|
|||
httpGet(`apps/${appid}/ChangeLog`).
|
||||
then(show).catch(()=>show("No Change Log available"));
|
||||
}
|
||||
function hasReadme(appid) {
|
||||
var app = appNameToApp(appid);
|
||||
return app.readme;
|
||||
}
|
||||
function showReadme(appid) {
|
||||
var app = appNameToApp(appid);
|
||||
function show(contents) {
|
||||
if (!contents) return;
|
||||
showPrompt(app.name + " Documentation", marked(contents), {ok: true}, false).catch(() => {});
|
||||
}
|
||||
httpGet(`apps/${appid}/README.md`).then(show).catch(()=>show("No more information available."));
|
||||
httpGet(`apps/${appid}/${app.readme}`).then(show).catch(()=>show("Failed to load README."));
|
||||
}
|
||||
function handleCustomApp(appTemplate) {
|
||||
// Pops up an IFRAME that allows an app to be customised
|
||||
|
@ -190,7 +194,7 @@ function refreshLibrary() {
|
|||
</div>
|
||||
<div class="tile-content">
|
||||
<p class="tile-title text-bold">${escapeHtml(app.name)} ${versionInfo}</p>
|
||||
<p class="tile-subtitle">${escapeHtml(app.description)}<br/>${readme}</p>
|
||||
<p class="tile-subtitle">${escapeHtml(app.description)}${hasReadme ? `<br/>${readme}` : ''}</p>
|
||||
<a href="https://github.com/espruino/BangleApps/tree/master/apps/${app.id}" target="_blank" class="link-github"><img src="img/github-icon-sml.png" alt="See the code on GitHub"/></a>
|
||||
</div>
|
||||
<div class="tile-action">
|
||||
|
|
Loading…
Reference in New Issue