mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-12-03 01:23:31 +01:00
# Conflicts: # public/asset-manifest.json # public/css/all.min.css # public/css/style.css # public/partials/gist.htm # public/script/components.js # public/script/vendor.min.js # test/vue-ui.test.js
124 lines
15 KiB
HTML
124 lines
15 KiB
HTML
<div class="pr-page review-page">
|
|
<div class="container paper-page pr-page-inner">
|
|
<div class="paper-crumbs">
|
|
<a href="/dashboard">Reviewer</a> /
|
|
<span class="here">Gist</span>
|
|
</div>
|
|
|
|
<header class="pr-header">
|
|
<div class="pr-title-row">
|
|
<h1 class="paper-page-title pr-title">
|
|
<span v-if="details?.description"><template v-for="(seg, si) in redactParts(details.description)" :key="si"><span v-if="seg.n" class="redact-slot" role="img" :aria-label="'Redacted term ' + seg.n"><i>{{ seg.n }}</i></span><template v-else>{{ seg.t }}</template></template></span>
|
|
<span class="text-muted" v-if="!details?.description">Untitled gist</span>
|
|
</h1>
|
|
<a class="btn btn-sm" aria-label="Edit" v-if="options?.isAdmin || options?.isOwner" :href="safeUrl("/gist-anonymize/" + (gistId))"><svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-edit"></use></svg><span class="d-none d-md-inline"> Edit</span></a>
|
|
</div>
|
|
<div class="pr-header-meta">
|
|
<span class="paper-pill" :class="{'good': details?.isPublic, 'warn': !details?.isPublic}">
|
|
{{ details?.isPublic ? 'Public' : 'Secret' }}
|
|
</span>
|
|
<span class="pr-meta-item" v-if="details?.ownerLogin">
|
|
<svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-user"></use></svg> <span class="pr-author" :class="{ 'is-redacted': isRedactedName(details.ownerLogin) }"><template v-if="!isRedactedName(details.ownerLogin)">@</template><template v-for="(seg, si) in redactParts(details.ownerLogin)" :key="si"><span v-if="seg.n" class="redact-slot" role="img" :aria-label="'Redacted term ' + seg.n"><i>{{ seg.n }}</i></span><template v-else>{{ seg.t }}</template></template></span>
|
|
</span>
|
|
<span class="pr-meta-item" v-if="details?.updatedDate">
|
|
<svg class="ui-icon" aria-hidden="true"><use href="#project-icon-clock"></use></svg> <span v-text="fmt?.date(details?.updatedDate)"></span>
|
|
</span>
|
|
<span class="pr-meta-item" v-if="details?.anonymizeDate">
|
|
<svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-shield"></use></svg> Anonymized <span v-text="fmt?.date(details?.anonymizeDate)"></span>
|
|
</span>
|
|
</div>
|
|
</header>
|
|
|
|
<nav class="paper-tabs" role="tablist" v-if="(details?.files && details?.files?.length) || (details?.comments && details?.comments?.length)">
|
|
<button class="paper-tab" type="button" role="tab" v-if="details?.files" :class="{'active': tabState?.active == 'files'}" id="gist-files-tab" :aria-selected="tabState?.active === 'files'" aria-controls="gist-files-panel" :tabindex="tabState?.active === 'files' ? 0 : -1" @keydown="previewTabKeydown($event)" @click="tabState.active = 'files'">
|
|
<svg class="ui-icon" aria-hidden="true"><use href="#project-type-gist"></use></svg>
|
|
<span v-text="fmt.plural(details?.files?.length, {'0': 'No files', 'one': '1 file', 'other': '{} files'})"></span>
|
|
</button>
|
|
<button class="paper-tab" type="button" role="tab" v-if="details?.comments" :class="{'active': tabState?.active == 'comments'}" id="gist-comments-tab" :aria-selected="tabState?.active === 'comments'" aria-controls="gist-comments-panel" :tabindex="tabState?.active === 'comments' ? 0 : -1" @keydown="previewTabKeydown($event)" @click="tabState.active = 'comments'">
|
|
<svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-comment"></use></svg>
|
|
<span v-text="fmt.plural(details?.comments?.length, {'0': 'No comments', 'one': '1 comment', 'other': '{} comments'})"></span>
|
|
</button>
|
|
</nav>
|
|
|
|
<div class="paper-tab-content">
|
|
<div role="tabpanel" id="gist-files-panel" aria-labelledby="gist-files-tab" v-if="details?.files && tabState?.active =='files'">
|
|
<div class="toc-layout" :class="{ 'has-toc': showGistToc() }">
|
|
<div class="toc-main">
|
|
<div class="toc-bar" v-if="showGistToc()">
|
|
<div class="toc-menu">
|
|
<button type="button" class="btn btn-sm btn-ghost toc-menu-btn" :class="{ 'is-on': tocOpen }" aria-haspopup="true" :aria-expanded="tocOpen ? 'true' : 'false'" @click.stop="tocOpen = !tocOpen"><svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-outline"></use></svg><span class="toc-menu-label">In this gist</span><span class="toc-menu-current" v-if="gistToc()[activeFileIndex()]"><template v-for="(seg, si) in gistToc()[activeFileIndex()].parts" :key="si"><span v-if="seg.n" class="redact-slot" role="img" :aria-label="'Redacted term ' + seg.n"><i>{{ seg.n }}</i></span><template v-else>{{ seg.t }}</template></template></span><svg class="ui-icon toc-menu-chevron" aria-hidden="true"><use href="#ui-icon-chevron-down"></use></svg></button>
|
|
<nav class="toc-menu-pop toc-rail" v-if="tocOpen" aria-label="In this gist"><template v-for="f in gistToc()" :key="f.id"><a :href="'#' + f.id" class="toc-file" :class="{ 'is-current': activeFileIndex() === f.index, 'is-active': activeFileIndex() === f.index && !f.headings.some(h => h.id === activeAnchor) }" :aria-current="activeFileIndex() === f.index ? 'location' : null" @click.prevent="jumpToAnchor(f.id)"><span class="toc-file-name"><template v-for="(seg, si) in f.parts" :key="si"><span v-if="seg.n" class="redact-slot" role="img" :aria-label="'Redacted term ' + seg.n"><i>{{ seg.n }}</i></span><template v-else>{{ seg.t }}</template></template></span><span class="toc-file-meta">{{ f.language }} · {{ f.lines != null ? fmt.plural(f.lines, {'one': '1 line', 'other': '{} lines'}) : fmt.humanFileSize(f.size || 0) }}</span></a><a v-for="h in f.headings" :key="h.id" :href="'#' + h.id" :class="['toc-heading', 'depth-' + h.depth, { 'is-active': activeAnchor === h.id }]" :aria-current="activeAnchor === h.id ? 'location' : null" @click.prevent="jumpToAnchor(h.id)"><template v-for="(seg, si) in h.parts" :key="si"><span v-if="seg.n" class="redact-slot" role="img" :aria-label="'Redacted term ' + seg.n"><i>{{ seg.n }}</i></span><template v-else>{{ seg.t }}</template></template></a></template></nav>
|
|
</div>
|
|
</div>
|
|
<section class="gist-file-card" v-for="(file, index) in details?.files" :key="index" :id="gistFileId(index)" :aria-labelledby="gistFileId(index) + '-name'">
|
|
<header class="gist-file-head">
|
|
<svg class="ui-icon" aria-hidden="true"><use href="#project-icon-file"></use></svg>
|
|
<h2 class="gist-file-name" :id="gistFileId(index) + '-name'"><template v-for="(seg, si) in redactParts(file?.filename)" :key="si"><span v-if="seg.n" class="redact-slot" role="img" :aria-label="'Redacted term ' + seg.n"><i>{{ seg.n }}</i></span><template v-else>{{ seg.t }}</template></template></h2>
|
|
<span class="gist-file-meta">{{ gistToc()[index]?.language }}<span class="sep">·</span>{{ gistToc()[index]?.lines != null ? fmt.plural(gistToc()[index]?.lines, {'one': '1 line', 'other': '{} lines'}) : fmt.humanFileSize(file?.size || 0) }}</span>
|
|
<div class="gist-file-tools">
|
|
<div class="seg-filter gist-view-toggle" role="radiogroup" :aria-label="'View of ' + file?.filename" v-if="gistHasRendered(index)"><button type="button" role="radio" class="seg-chip" :class="{ active: gistView(index) === 'rendered' }" :aria-checked="gistView(index) === 'rendered' ? 'true' : 'false'" @click="setGistView(index, 'rendered')">{{ gistKind(index) === 'csv' ? 'Table' : 'Preview' }}</button><button type="button" role="radio" class="seg-chip" v-if="gistKind(index) === 'csv'" :class="{ active: gistView(index) === 'chart' }" :aria-checked="gistView(index) === 'chart' ? 'true' : 'false'" @click="setGistView(index, 'chart')">Chart</button><button type="button" role="radio" class="seg-chip" :class="{ active: gistView(index) === 'raw' }" :aria-checked="gistView(index) === 'raw' ? 'true' : 'false'" @click="setGistView(index, 'raw')">Source</button></div>
|
|
<div class="tb-file gist-file-actions" role="group" aria-label="File actions" v-if="!['too-large', 'hidden', 'empty', 'binary'].includes(gistKind(index))">
|
|
<a class="tb-seg-btn" :href="safeUrl(gistRawUrl(file))" target="_blank" rel="noopener" :title="file?.encoding === 'base64' ? 'Open the file' : 'Open the raw file'">Raw</a>
|
|
<button type="button" class="tb-seg-btn tb-seg-icon" v-if="file?.encoding !== 'base64'" :aria-label="gistCopied === index ? 'Copied' : 'Copy file contents'" :title="gistCopied === index ? 'Copied' : 'Copy file contents'" @click="copyGistFile(index)"><svg class="ui-icon" aria-hidden="true"><use :href="gistCopied === index ? '#ui-icon-check' : '#project-icon-copy'"></use></svg></button>
|
|
<a class="tb-seg-btn tb-seg-icon" :href="safeUrl(gistRawUrl(file))" :download="file?.filename" aria-label="Download file" title="Download file"><svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-download"></use></svg></a>
|
|
</div>
|
|
</div>
|
|
</header>
|
|
<div class="gist-file-body" :class="'is-' + (gistView(index) === 'raw' && gistHasRendered(index) ? 'code' : gistKind(index))">
|
|
<gist-file v-if="gistKind(index) === 'markdown' && gistView(index) === 'rendered'" :file="file" :reader="true" :id-prefix="gistFileId(index) + '-'" @outline="setFileOutline(index, $event)"></gist-file>
|
|
<gist-file v-else-if="gistKind(index) === 'code' || (gistHasRendered(index) && gistView(index) === 'raw')" :file="gistSourceFile(index)" :reader="true"></gist-file>
|
|
<div class="notebook-body" v-else-if="gistKind(index) === 'notebook'"><notebook class="markdown-body" :content="file.content"></notebook></div>
|
|
<data-table v-else-if="gistKind(index) === 'csv'" :key="file?.filename" :rows="gistCsvRows(file)" :name="file?.filename" :state-key="'table-' + (index + 1)" :view="gistView(index) === 'chart' ? 'chart' : 'table'"></data-table>
|
|
<div class="media-stage" v-else-if="gistKind(index) === 'image' || gistKind(index) === 'svg'"><img class="image-content" :src="safeUrl(gistMediaUrl(file))" :alt="file?.filename"></div>
|
|
<div class="media-stage" v-else-if="gistKind(index) === 'video'"><video class="video-content" controls preload="metadata" playsinline :src="safeUrl(gistMediaUrl(file))"></video></div>
|
|
<div class="media-stage is-audio" v-else-if="gistKind(index) === 'audio'"><audio controls preload="metadata" :src="safeUrl(gistMediaUrl(file))"></audio></div>
|
|
<pdfviewer v-else-if="gistKind(index) === 'pdf'" :src="safeUrl(gistMediaUrl(file))"></pdfviewer>
|
|
<div class="file-state" v-else-if="gistKind(index) === 'binary'">
|
|
<svg class="ui-icon file-state-icon" aria-hidden="true"><use href="#project-icon-file"></use></svg>
|
|
<h3 class="file-state-title">This file isn't shared</h3>
|
|
<p class="file-state-msg">Binary files other than images can carry author details that anonymization can't remove, so anonymized gists don't include them.</p>
|
|
</div>
|
|
<div class="file-state" v-else-if="gistKind(index) === 'too-large'" role="note">
|
|
<svg class="ui-icon file-state-icon" aria-hidden="true"><use href="#ui-icon-warning"></use></svg>
|
|
<h3 class="file-state-title">This file is too large to preview</h3>
|
|
<p class="file-state-msg">It is over the size limit for anonymized gist files, so it can't be shown or downloaded from this link.</p>
|
|
</div>
|
|
<div class="file-state" v-else-if="gistKind(index) === 'hidden'" role="note">
|
|
<svg class="ui-icon file-state-icon" aria-hidden="true"><use href="#project-icon-file"></use></svg>
|
|
<h3 class="file-state-title">Image not shown</h3>
|
|
<p class="file-state-msg">The author chose not to display images in this anonymized gist.</p>
|
|
</div>
|
|
<div class="file-state" v-else>
|
|
<svg class="ui-icon file-state-icon" aria-hidden="true"><use href="#project-icon-file"></use></svg>
|
|
<h3 class="file-state-title">This file is empty</h3>
|
|
<p class="file-state-msg">It has no content in this snapshot.</p>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
<div class="paper-table-empty" v-if="!details?.files?.length">
|
|
<svg class="ui-icon" aria-hidden="true"><use href="#project-icon-file"></use></svg>
|
|
<span>No files in this gist.</span>
|
|
</div>
|
|
</div>
|
|
<aside class="page-toc" v-if="showGistToc()" aria-label="In this gist">
|
|
<div class="page-toc-head">In this gist</div>
|
|
<nav class="toc-rail"><template v-for="f in gistToc()" :key="f.id"><a :href="'#' + f.id" class="toc-file" :class="{ 'is-current': activeFileIndex() === f.index, 'is-active': activeFileIndex() === f.index && !f.headings.some(h => h.id === activeAnchor) }" :aria-current="activeFileIndex() === f.index ? 'location' : null" @click.prevent="jumpToAnchor(f.id)"><span class="toc-file-name"><template v-for="(seg, si) in f.parts" :key="si"><span v-if="seg.n" class="redact-slot" role="img" :aria-label="'Redacted term ' + seg.n"><i>{{ seg.n }}</i></span><template v-else>{{ seg.t }}</template></template></span><span class="toc-file-meta">{{ f.language }} · {{ f.lines != null ? fmt.plural(f.lines, {'one': '1 line', 'other': '{} lines'}) : fmt.humanFileSize(f.size || 0) }}</span></a><a v-for="h in f.headings" :key="h.id" :href="'#' + h.id" :class="['toc-heading', 'depth-' + h.depth, { 'is-active': activeAnchor === h.id }]" :aria-current="activeAnchor === h.id ? 'location' : null" @click.prevent="jumpToAnchor(h.id)"><template v-for="(seg, si) in h.parts" :key="si"><span v-if="seg.n" class="redact-slot" role="img" :aria-label="'Redacted term ' + seg.n"><i>{{ seg.n }}</i></span><template v-else>{{ seg.t }}</template></template></a></template></nav>
|
|
</aside>
|
|
</div>
|
|
</div>
|
|
|
|
<div role="tabpanel" id="gist-comments-panel" aria-labelledby="gist-comments-tab" v-if="details?.comments && tabState?.active =='comments'">
|
|
<ul class="pr-comments">
|
|
<li class="pr-timeline-item" v-for="(comment, index) in details?.comments" :key="index">
|
|
<pr-thread :comments="[comment]" :fmt="fmt"></pr-thread>
|
|
</li>
|
|
<li class="paper-table-empty" v-if="!details?.comments?.length">
|
|
<svg class="ui-icon" aria-hidden="true"><use href="#ui-icon-comment"></use></svg>
|
|
<span>No comments on this gist.</span>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|