annotate src/lib/Shared.luan @ 4:a17e400ddaa1

add email
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 21 Jun 2022 11:58:27 -0600
parents fc3ee39d7764
children 2f20b11affdd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
1 local Luan = require "luan:Luan.luan"
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
2 local error = Luan.error
3
Franklin Schmidt <fschmidt@gmail.com>
parents: 0
diff changeset
3 local Http = require "luan:http/Http.luan"
0
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
4 local Forum = require "site:/lib/Forum.luan"
3
Franklin Schmidt <fschmidt@gmail.com>
parents: 0
diff changeset
5 local User = require "site:/lib/User.luan"
Franklin Schmidt <fschmidt@gmail.com>
parents: 0
diff changeset
6 local Logging = require "luan:logging/Logging.luan"
Franklin Schmidt <fschmidt@gmail.com>
parents: 0
diff changeset
7 local logger = Logging.logger "Shared"
0
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
8
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
9
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
10 local Shared = {}
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
11
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
12 function Shared.head()
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
13 %>
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
14 <meta name="viewport" content="width=device-width, initial-scale=1">
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
15 <style>
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
16 @import "/site.css";
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
17 </style>
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
18 <%
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
19 end
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
20
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
21 function Shared.header()
3
Franklin Schmidt <fschmidt@gmail.com>
parents: 0
diff changeset
22 local user = User.current()
0
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
23 %>
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
24 <div header>
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
25 <a href="/"><%=Forum.title%></a>
3
Franklin Schmidt <fschmidt@gmail.com>
parents: 0
diff changeset
26 -
Franklin Schmidt <fschmidt@gmail.com>
parents: 0
diff changeset
27 <% if user == nil then %>
Franklin Schmidt <fschmidt@gmail.com>
parents: 0
diff changeset
28 <a href="/login.html">login</a>
Franklin Schmidt <fschmidt@gmail.com>
parents: 0
diff changeset
29 <% else %>
Franklin Schmidt <fschmidt@gmail.com>
parents: 0
diff changeset
30 <a href="/account.html"><%=user.name_html%></a>
Franklin Schmidt <fschmidt@gmail.com>
parents: 0
diff changeset
31 <% end %>
0
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
32 </div>
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
33 <%
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
34 end
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
35
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
36 function Shared.footer()
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
37 %>
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
38 <div footer>
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
39 <a href="/config.html">Configuration</a>
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
40 </div>
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
41 <%
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
42 end
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
43
4
a17e400ddaa1 add email
Franklin Schmidt <fschmidt@gmail.com>
parents: 3
diff changeset
44 function Shared.admin_header()
a17e400ddaa1 add email
Franklin Schmidt <fschmidt@gmail.com>
parents: 3
diff changeset
45 %>
a17e400ddaa1 add email
Franklin Schmidt <fschmidt@gmail.com>
parents: 3
diff changeset
46 <div header>
a17e400ddaa1 add email
Franklin Schmidt <fschmidt@gmail.com>
parents: 3
diff changeset
47 <a href="/private/admin.html">Admin</a>
a17e400ddaa1 add email
Franklin Schmidt <fschmidt@gmail.com>
parents: 3
diff changeset
48 </div>
a17e400ddaa1 add email
Franklin Schmidt <fschmidt@gmail.com>
parents: 3
diff changeset
49 <%
a17e400ddaa1 add email
Franklin Schmidt <fschmidt@gmail.com>
parents: 3
diff changeset
50 end
a17e400ddaa1 add email
Franklin Schmidt <fschmidt@gmail.com>
parents: 3
diff changeset
51
3
Franklin Schmidt <fschmidt@gmail.com>
parents: 0
diff changeset
52 function Shared.base_url()
Franklin Schmidt <fschmidt@gmail.com>
parents: 0
diff changeset
53 return Http.request.scheme.."://"..Http.request.headers["host"]
Franklin Schmidt <fschmidt@gmail.com>
parents: 0
diff changeset
54 end
Franklin Schmidt <fschmidt@gmail.com>
parents: 0
diff changeset
55
0
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
56 return Shared