This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

core / appview / pages / templates / timeline / timeline.html
2.8 kB 79 lines
1{{ define "title" }}timeline{{ end }} 2 3{{ define "extrameta" }} 4 <meta property="og:title" content="timeline · tangled" /> 5 <meta property="og:type" content="object" /> 6 <meta property="og:url" content="https://tangled.org" /> 7 <meta property="og:description" content="tightly-knit social coding" /> 8{{ end }} 9 10{{ define "mainLayout" }} 11<div class="flex-grow"> 12 <div class="max-w-screen-lg mx-auto flex flex-col gap-4"> 13 <main>{{ block "content" . }}{{ end }}</main> 14 </div> 15</div> 16{{ end }} 17 18{{ define "content" }} 19<div id="timeline-grid" class="flex flex-col gap-4 md:grid md:grid-cols-3"> 20 21 <div class="order-3 md:order-none md:col-span-2 md:row-start-1"> 22 {{ template "timeline/fragments/timeline" . }} 23 </div> 24 25 <div class="order-1 md:order-none flex flex-col gap-6 md:col-start-3 md:row-start-1 md:pt-4"> 26 {{ if .ShowNewsletter }} 27 <div id="newsletter-col" class="order-first md:order-last"> 28 {{ template "timeline/fragments/newsletterWidget" . }} 29 </div> 30 {{ end }} 31 {{ template "timeline/fragments/announcements" . }} 32 <div class="hidden md:block"> 33 {{ template "timeline/fragments/vouchSuggestions" . }} 34 </div> 35 {{ template "timeline/fragments/trending" . }} 36 </div> 37</div> 38 39{{ if .ShowNewsletter }} 40<script> 41 (function() { 42 var DISMISS_KEY = 'newsletter-dismissed'; 43 var newsletterCol = document.getElementById('newsletter-col'); 44 if (!newsletterCol) return; 45 46 // hide removes the widget from the DOM without persisting anything. 47 // Used when this browser's localStorage says we already dismissed in a 48 // past session — the server has already told us .ShowNewsletter is true 49 // (no DB row), so we deliberately do NOT re-POST /newsletter/dismiss 50 // here: that would clobber a 'subscribed' row created from another 51 // device after this localStorage entry was set. 52 function hide() { 53 newsletterCol.remove(); 54 } 55 56 // dismiss is the user-initiated path. Persists both locally and (for 57 // logged-in users) server-side so the widget stays hidden on all their 58 // devices. 59 function dismiss() { 60 hide(); 61 try { localStorage.setItem(DISMISS_KEY, '1'); } catch (e) {} 62 fetch('/newsletter/dismiss', { method: 'POST', credentials: 'same-origin' }) 63 .catch(function () { /* localStorage is the fallback */ }); 64 } 65 66 try { 67 if (localStorage.getItem(DISMISS_KEY) === '1') { 68 hide(); 69 return; 70 } 71 } catch (e) { /* storage disabled; keep widget visible */ } 72 73 newsletterCol.addEventListener('click', function(e) { 74 if (e.target.closest('[data-newsletter-dismiss]')) dismiss(); 75 }); 76 })(); 77</script> 78{{ end }} 79{{ end }}