Compare commits

..

1 Commits
master ... dev

Author SHA1 Message Date
saunders c563caef1c Start building emissary templates
We're learning emissary as we go here, figuring out what can be reused and in
the process determining what tweaks or additions might be necessary for the
emissary codebase itself.
2026-07-28 12:48:14 +01:00
6 changed files with 251 additions and 0 deletions

View File

@ -0,0 +1,56 @@
{
templateId: makinghistory-eventfeed
templateRole: eventfeed
extends: []
containedBy: []
model: Stream
label: MakingHistory Event Feed
description: View and/or Edit Sources of Events for MakingHistory
schema: {
type: object
properties: {
icon: {type: "string"}
label: {type: "string"}
summary: {type: "string"}
data: {
type: object
properties: {
searchText: {type: "string"}
content: {type: "string"}
}
}
}
}
states: {
default: {
label: "Default State"
description: "Event feed templates do not use other states [true?]"
}
}
roles: {}
bundles: {}
actions: {
create: {
roles: ["owner", "mod"]
steps: []
}
edit: {
roles: ["owner", "mod"]
steps: []
}
delete: {
roles: ["owner", "mod"]
steps: []
}
view: {
roles: ["anonymous"]
steps: [
{do: "view-html"}
]
}
}
}

View File

@ -0,0 +1,12 @@
{{- $results := .Events.Slice -}}
<div class="cols-2">
{{- range $result := $results -}}
<div class="card" style="overflow-x:hidden;">
<pre>{{- $result | jsonIndent -}}</pre>
</div>
{{- end -}}
</div>

View File

@ -0,0 +1,15 @@
<div id="eventfeed" class="fullscreen padding-none">
<link rel="alternate" type="application/rss+xml" title="RSS Feed" href="/{{.Token}}/feed?{{.QueryString}}">
<div class="md:flex-row" style="background-color:var(--gray50);">
<div class="flex-grow margin-horizontal container">
<div id="events-list">
{{- template "view-events" . -}}
</div>
</div>
</div>
</div> <!-- eventfeed -->

View File

@ -0,0 +1,10 @@
{{- $folders := .FoldersWithSelection}}
{{- $folder := $folders.Selected -}}
{{- $filter := .FilteredByFollowing -}}
{{- $folderID := $folder.FolderID.Hex -}}
{{- $followingID := .QueryParam "origin.followingId" -}}
<div class="page app flex-row">
{{- template "sidebar" $folders -}}
</div>

View File

@ -0,0 +1,65 @@
{{- $folders := .FoldersWithSelection}}
{{- $folder := $folders.Selected -}}
{{- $filter := .FilteredByFollowing -}}
{{- $folderID := $folder.FolderID.Hex -}}
{{- $followingID := .QueryParam "origin.followingId" -}}
<div class="page app flex-row" hx-get="{{.URL}}" hx-trigger="refreshPage from:window" script="on load take .selected from .nav-item for #nav-inbox">
<link rel="stylesheet" href="/.templates/user-inbox/stylesheet">
<!-- Sidebar Content -->
{{- template "sidebar" $folders -}}
<!-- Main App Content -->
<div class="app-content">
<div class="pos-sticky flex-row" style="padding:8px 0px; top:56px; width:100%; background-color:var(--page-background);z-index:100;">
{{- if $filter.NotZero -}}
{{- $following := .FollowingByToken $followingID -}}
<div class="flex-grow-1 margin-top-sm">
<div class="bold"><a href="/@me/inbox?folderId={{$folderID}}" hx-get="/@me/inbox?folderId={{$folderID}}">{{icon $folder.Icon}} {{$folder.Label}}</a></div>
<div class="flex-row margin-vertical">
{{- if ne "" $following.IconURL -}}
<div class="margin-top-xs">
<img src="{{$following.IconURL}}" class="circle width-48">
</div>
{{- end -}}
<div>
<h1 class="margin-top-none margin-bottom-sm ellipsis-block">
{{$following.Label}}
</h1>
<div class="margin-none">
<a href="{{$following.URL}}" target="_blank" class="text-gray">{{$following.URL}}</a>
&middot; {{$following.LastPolled | tinyDate}} ago
&nbsp;
<button class="text-xs" hx-get="/@me/inbox/following-edit?followingId={{$following.FollowingID.Hex}}">Edit Source</button>
</div>
</div>
</div>
</div>
{{- else -}}
<h1 class="margin-top-sm flex-grow-1">{{icon $folder.Icon}} {{$folder.Label}}</h1>
{{- end -}}
</div>
<div class="text-sm nowrap margin-top-sm pos-absolute" style="top:8px; right:8px; z-index:1000;">
<button hx-get="/@me/inbox/following-search?folderId={{$folderID}}" class="primary turboclick">{{icon "add"}} Follow</button>
{{- if $filter.IsZero -}}
<button hx-get="/@me/inbox/filter?folderId={{$folderID}}" class="turboclick">{{icon "filter"}} Filter</button>
{{- else -}}
<button hx-get="/@me/inbox/filter?folderId={{$folderID}}&followingId={{$followingID}}" class="selected ellipsis turboclick" style="max-width:160px;">{{icon "filter-fill"}} {{$filter.Label}}</button>
{{- end -}}
<button hx-get="/@me/inbox/folder-edit?folderId={{$folderID}}" class="turboclick">{{icon "settings"}} Folder Settings</button>
</div>
{{- template "list" . -}}
</div>
<script src="/.templates/user-inbox/hyperscript" type="text/hyperscript"></script>
</div>

View File

@ -0,0 +1,93 @@
{
templateId: events
// This role makes the template eligible to be displayed as a UI choice for user inbox
templateRole: user-inbox
// The model sets which go builder to use with this template
model: inbox
label: Events
description: A simple inbox with a sidebar for folders and several feed layouts
icon: inbox
// Extends inherits from other templates
extends: ["user-inbox"]
// A schema sets up the data structure that will be used inside a template
// Reflected in mongodb
// Based on json, without linking between schemas; all rules must be defined herein
schema: {
title: Events
type: object
properties: {
feeds: {
description: Array of news sources to render on the page
type: array
items: {
type: object
properties: {
uri: {
type: string
}
name: {
type: string
}
trust-level: {
type: string
}
}
}
}
}
}
states: {
published: {
label: Publically viewable events item
}
for-review: {
label: Events item to be reviewed before publishing or not
}
}
roles: {
mod: {
label: Events Moderator
decription: Full control
}
reader: {
label: Events Reader
description: Read only
}
}
/*
bundles: {
stylesheet: {
content-type: text/css
}
hyperscript: {
content-type: text/hyperscript
}
}
*/
actions: {
view: {
roles: ["mod"]
stateRoles: {
published: ["reader"]
}
steps: [
{do: "view-html"}
]
}
inbox: {
roles: ["self"]
do: "view-html"
file: "events"
}
events: {
roles: ["self"]
do: "view-html"
}
/*
sidebar-events: {
roles: ["self"]
do: "view-html"
}
*/
}
}