Mercurial Hosting > chat
comparison src/lib/Shared.luan @ 34:62d04ca486dd
UI
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 12 Nov 2024 16:08:24 -0700 |
parents | e2b7f6393dab |
children | 27c41f22d2a9 |
comparison
equal
deleted
inserted
replaced
33:e2b7f6393dab | 34:62d04ca486dd |
---|---|
92 end | 92 end |
93 | 93 |
94 function Shared.post_html(post) | 94 function Shared.post_html(post) |
95 local author_id = post.author_id | 95 local author_id = post.author_id |
96 local user = current_user() or error() | 96 local user = current_user() or error() |
97 local mine = user.id == author_id | |
98 local author = get_user_by_id(author_id) | 97 local author = get_user_by_id(author_id) |
99 local id = post.id | 98 local id = post.id |
100 %> | 99 %> |
101 <div post="<%=id%>"> | 100 <div post="<%=id%>"> |
102 <div who> | 101 <div who="<%=author.id%>"> |
103 <span author><%=author.email%></span> | 102 <span author><%=author.email%></span> |
104 <span when fix><%=post.date%></span> | 103 <span right> |
105 <% if mine then %> | 104 <span when fix><%=post.date%></span> |
106 <span pulldown> | 105 <span pulldown> |
107 <img onclick="clickMenu(this)" src="/images/more_vert.svg"> | 106 <img onclick="clickMenu(this)" src="/images/more_vert.svg"> |
108 <div> | 107 <div> |
109 <span onclick="editPost('<%=id%>')">Edit</span> | 108 <span onclick="editPost('<%=id%>')">Edit</span> |
110 <span onclick="deletePost('<%=id%>')">Delete</span> | 109 <span onclick="deletePost('<%=id%>')">Delete</span> |
111 </div> | 110 </div> |
112 <span> | 111 </span> |
113 <% end %> | 112 </span> |
114 </div> | 113 </div> |
115 <div text fix><%= html_encode(post.content) %></div> | 114 <div text fix><%= html_encode(post.content) %></div> |
116 </div> | 115 </div> |
117 <% | 116 <% |
118 end | 117 end |
126 if is_first then | 125 if is_first then |
127 is_first = false | 126 is_first = false |
128 else | 127 else |
129 %>, <% | 128 %>, <% |
130 end | 129 end |
131 %><%= other_user.email %><span online="<%= other_user.id %>"></span><% | 130 %><span email><%= other_user.email %></span><span online="<%= other_user.id %>"></span><% |
132 end | 131 end |
133 end | 132 end |
134 end | 133 end |
135 Shared.chat_other_users_html = chat_other_users_html | 134 Shared.chat_other_users_html = chat_other_users_html |
136 | 135 |