Mercurial Hosting > freedit
diff src/thread.html.luan @ 18:94e26bffd4fb
UI work
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 11 Jul 2022 12:14:05 -0600 |
parents | bff178656073 |
children | da006d1c1eba |
line wrap: on
line diff
--- a/src/thread.html.luan Thu Jul 07 15:30:06 2022 -0600 +++ b/src/thread.html.luan Mon Jul 11 12:14:05 2022 -0600 @@ -1,6 +1,8 @@ local Luan = require "luan:Luan.luan" local error = Luan.error local ipairs = Luan.ipairs or error() +local Time = require "luan:Time.luan" +local time_now = Time.now or error() local Io = require "luan:Io.luan" local Http = require "luan:http/Http.luan" local Shared = require "site:/lib/Shared.luan" @@ -27,6 +29,7 @@ local subject_html = posts[1].subject_html local user = User.current() local user_name = user and user.name + local now = time_now() Io.stdout = Http.response.text_writer() %> <!doctype html> @@ -35,9 +38,29 @@ <% head() %> <title><%=forum_title%>: <%=subject_html%></title> <style> + div[author] { + margin-bottom: 6px; + font-size: 10px; + } + div[author] img { + width: 28px; + vertical-align: middle; + border-radius: 50%; + } + div[author] a { + font-weight: bold; + } + span[ago] { + color: #888; + } [message] { white-space: pre-wrap; } + textarea { + width: 100%; + max-width: 450px; + height: 100px; + } </style> <script> function cancelEdit(post) { @@ -62,9 +85,19 @@ let post = span.getAttribute('delete'); ajax( '/delete.js?post=' + post ); } + + function init() { + let spans = document.querySelectorAll('span[ago]'); + for( let i=0; i<spans.length; i++ ) { + let span = spans[i]; + let date = span.getAttribute('date'); + date = parseInt(date); + span.title = new Date(date).toLocaleString(); + } + } </script> </head> - <body> + <body onload="init()"> <% header() %> <div content> <h1><%=subject_html%></h1> @@ -75,6 +108,11 @@ %> <hr> <div post="<%=post.id%>"> + <div author> + <img src="/images/profile.png"> + <a href="/whatever"><%= post.author_name %></a> + <span ago date="<%=post.date%>"><% post.ago(now) %> ago</span> + </div> <div output> <% bbcode_to_html(post.content) %> <p>