mod_http_muc_log: Compose page title from room data
authorKim Alvefur <zash@zash.se>
Sun, 13 Oct 2019 16:16:14 +0200
changeset 3719 f03a023cd523
parent 3718 04ff0de40ba9
child 3720 3db27b8f1cb0
mod_http_muc_log: Compose page title from room data More flexible than composing the title from name and date in the controller. Also opens the door to using other room data fields.
mod_http_muc_log/http_muc_log.html
mod_http_muc_log/mod_http_muc_log.lua
--- a/mod_http_muc_log/http_muc_log.html	Sun Oct 13 16:00:16 2019 +0200
+++ b/mod_http_muc_log/http_muc_log.html	Sun Oct 13 16:16:14 2019 +0200
@@ -4,7 +4,7 @@
 <meta charset="utf-8">
 <meta name="viewport" content="width=device-width, initial-scale=1">
 {date&<meta name="dcterms.date" content="{date}">}
-<title>{title}</title>
+<title>{title?{room.name?{jid_node}}{date& - {date}}}</title>
 <style>
 :link,:visited{color:#3465a4;text-decoration:none;}
 :link:hover,:visited:hover{color:#6197df;}
@@ -46,7 +46,7 @@
 </head>
 <body>
 <header>
-<h1 {lang&lang="{lang}"} title="xmpp:{jid?}">{title}</h1>
+<h1 {lang&lang="{lang}"} title="xmpp:{jid?}">{title?{room.name?{jid_node}}{date& - {date}}}</h1>
 <nav>
 <ul>
 {jid_node&
--- a/mod_http_muc_log/mod_http_muc_log.lua	Sun Oct 13 16:00:16 2019 +0200
+++ b/mod_http_muc_log/mod_http_muc_log.lua	Sun Oct 13 16:16:14 2019 +0200
@@ -240,7 +240,7 @@
 
 	response.headers.content_type = "text/html; charset=utf-8";
 	return render(template, {
-		title = get_room(room):get_name();
+		room = get_room(room)._data;
 		jid = get_room(room).jid;
 		jid_node = jid_split(get_room(room).jid);
 		hide_presence = hide_presence(request);
@@ -376,8 +376,8 @@
 
 	response.headers.content_type = "text/html; charset=utf-8";
 	return render(template, {
-		title = ("%s - %s"):format(get_room(room):get_name(), date);
 		date = date;
+		room = get_room(room)._data;
 		jid = get_room(room).jid;
 		jid_node = jid_split(get_room(room).jid);
 		hide_presence = hide_presence(request);