Notes/src/views/share/page.ejs

93 lines
3.9 KiB
Plaintext
Raw Normal View History

2021-10-19 22:48:38 +02:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
2022-08-17 15:18:34 -04:00
<% if (note.hasLabel("shareDescription")) { %>
<meta name="description" content="<%= note.getLabelValue("shareDescription") %>">
<% } %>
<meta name="viewport" content="width=device-width, initial-scale=1">
<% if (note.hasRelation("shareFavicon")) { %>
<link rel="shortcut icon" href="api/notes/<%= note.getRelation("shareFavicon").value %>/download">
<% } else { %>
2021-10-19 22:48:38 +02:00
<link rel="shortcut icon" href="../favicon.ico">
<% } %>
<script src="../<%= appPath %>/share.js"></script>
<% if (!note.isLabelTruthy("shareOmitDefaultCss")) { %>
2024-08-11 01:20:17 +02:00
<link href="../<%= assetPath %>/node_modules/normalize.css/normalize.css" rel="stylesheet">
<link href="../<%= assetPath %>/stylesheets/share.css" rel="stylesheet">
2021-12-22 11:43:21 +01:00
<% } %>
2021-10-19 22:48:38 +02:00
<% if (note.type === 'text' || note.type === 'book') { %>
<link href="../<%= assetPath %>/libraries/ckeditor/ckeditor-content.css" rel="stylesheet">
2021-10-19 22:48:38 +02:00
<% } %>
<% for (const cssRelation of note.getRelations("shareCss")) { %>
2021-12-27 20:48:14 +01:00
<link href="api/notes/<%= cssRelation.value %>/download" rel="stylesheet">
<% } %>
<% for (const jsRelation of note.getRelations("shareJs")) { %>
2022-01-01 22:32:38 +01:00
<script type="module" src="api/notes/<%= jsRelation.value %>/download"></script>
<% } %>
<% if (note.isLabelTruthy('shareDisallowRobotIndexing')) { %>
<meta name="robots" content="noindex,follow" />
<% } %>
2021-12-27 20:48:14 +01:00
<%- header %>
2021-10-19 22:48:38 +02:00
<title><%= note.title %></title>
</head>
2023-10-08 14:54:37 -04:00
<body data-note-id="<%= note.noteId %>" data-ancestor-note-id="<%= subRoot.note.noteId %>">
2021-12-27 20:48:14 +01:00
<div id="layout">
<div id="main">
2022-12-21 16:11:00 +01:00
<% if (note.parents[0].noteId !== '_share' && note.parents.length !== 0) { %>
2021-12-28 13:57:37 +01:00
<nav id="parentLink">
2024-09-08 20:36:25 +03:00
<%= t("share_page.parent") %> <a href="<%= note.parents[0].shareId %>"
class="type-<%= note.parents[0].type %>"><%= note.parents[0].title %></a>
</nav>
2021-12-27 20:48:14 +01:00
<% } %>
2021-12-28 13:40:51 +01:00
2021-12-27 20:48:14 +01:00
<h1 id="title"><%= note.title %></h1>
2021-10-19 22:48:38 +02:00
<% if (note.hasLabel("pageUrl")) { %>
2024-09-08 20:36:25 +03:00
<div id="noteClippedFrom"><%- t("share_page.clipped-from", { url: `<a href="${note.getLabelValue("pageUrl")}">${note.getLabelValue("pageUrl")}</a>` }) %></div>
<% } %>
<% if (!isEmpty) { %>
2021-12-28 13:40:51 +01:00
<div id="content" class="type-<%= note.type %><% if (note.type === 'text') { %> ck-content<% } %>">
2021-12-21 22:01:06 +01:00
<%- content %>
2021-10-19 22:48:38 +02:00
</div>
2021-12-27 20:48:14 +01:00
<% } %>
<% if (note.hasVisibleChildren()) { %>
2021-12-28 13:57:37 +01:00
<nav id="childLinks" class="<% if (isEmpty) { %>grid<% } else { %>list<% } %>">
2021-12-27 20:48:14 +01:00
<% if (!isEmpty) { %>
<hr>
2024-09-08 20:36:25 +03:00
<span><%= t("share_page.child-notes") %> </span>
2021-12-27 20:48:14 +01:00
<% } %>
<ul>
<%
for (const childNote of note.getVisibleChildNotes()) {
const isExternalLink = childNote.hasLabel('shareExternalLink');
const linkHref = isExternalLink ? childNote.getLabelValue('shareExternalLink') : `./${childNote.shareId}`;
const target = isExternalLink ? `target="_blank" rel="noopener noreferrer"` : '';
%>
<li>
<a href="<%= linkHref %>" <%= target %>
class="type-<%= childNote.type %>"><%= childNote.title %></a>
</li>
<% } %>
</ul>
2021-12-27 20:48:14 +01:00
</nav>
<% } else if (isEmpty) { %>
2024-09-08 20:36:25 +03:00
<p><%= t("share_page.no-content") %></p>
2021-12-27 20:48:14 +01:00
<% } %>
</div>
2021-12-21 22:01:06 +01:00
<% if (subRoot.note.hasVisibleChildren()) { %>
2021-12-28 13:57:37 +01:00
<button id="toggleMenuButton"></button>
2021-12-21 22:01:06 +01:00
2021-12-22 11:43:21 +01:00
<nav id="menu">
<%- include('tree_item', {note: subRoot.note, branch: subRoot.branch, activeNote: note}) %>
2021-12-22 11:43:21 +01:00
</nav>
2021-12-27 20:48:14 +01:00
<% } %>
</div>
2021-10-19 22:48:38 +02:00
</body>
</html>