2023-08-12 17:40:38 (UTC-03:00)
Marcel Rodrigues <marcelgmr@gmail.com>
list user projects
diff --git a/skopos.lua b/skopos.lua index 0e2304d..c7e83ce 100644 --- a/skopos.lua +++ b/skopos.lua @@ -131,7 +131,8 @@ function App:routes() if user == nil then return "/login?after="..req.path, 303 end local other = self.model:get_user(nick) if other == nil then return "not found", 404 end - local env = {title=self.title, user=user, other=other} + local projs = self.model:get_user_projects(other.id) + local env = {title=self.title, user=user, other=other, projs=projs} return lud.template.render_file("view/user.html", env) end}, -- invites diff --git a/view/user.html b/view/user.html index 532e94e..0e6341a 100644 --- a/view/user.html +++ b/view/user.html @@ -5,6 +5,14 @@ <title>{{$title}}</title> <style> .centered { text-align: center; } + .proj-list li { + list-style: none; + display: inline-block; + padding: 5px 8px; + border-radius: 5px; + border-width: 3px; + border-style: solid; + } % include view/menu.css </style> </head> @@ -14,5 +22,16 @@ <p><strong>nick:</strong> {{$other.nick}}</p> <p><strong>name:</strong> {{$other.name}}</p> <p><strong>invited by:</strong> {{$other.invited_by or "(root)"}}</p> + <p><strong>projects:</strong> + <ul class="proj-list"> + % for proj in $projs do + % if $proj.is_active ~= 0 then + <li style="border-color: {{$proj.color}};"> + <a href="/p/{{$proj.name}}">{{$proj.name}}</a> + </li> + % end + % end + </ul> + </p> </body> </html>