Mercurial Hosting > hghosting
view src/admin/index.html.luan @ 5:a09d8bcdc0f9
lower case repos
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Wed, 18 May 2022 00:21:44 -0600 |
parents | 028e74c8889d |
children | a7187a447835 |
line wrap: on
line source
local Luan = require "luan:Luan.luan" local error = Luan.error local ipairs = Luan.ipairs or error() local Io = require "luan:Io.luan" local Http = require "luan:http/Http.luan" local Shared = require "site:/lib/Shared.luan" local head = Shared.head or error() local header = Shared.admin_header or error() local get_user = Shared.get_user or error() local config = Shared.config or error() local user_repos = Shared.user_repos or error() return function() local user = get_user() Io.stdout = Http.response.text_writer() %> <!doctype html> <html> <head> <% head() %> <title>Your Mercurial Repositories</title> <script> function deleteRepo(name) { if( confirm('Are you sure that you want to delete repo "'+name+'"?') ) location = "delete.html?repo="+name; } </script> </head> <body> <% header() %> <div content> <h1>Repositories of <%=user%></h1> <% for _, repo in ipairs(user_repos[user] or {}) do local name = repo.name %> <p> <a href="/repo/<%=name%>/"><%=name%></a> <% if repo.admins[user] then %> - <a href="edit.html?repo=<%=name%>">edit</a> - <a href="javascript:deleteRepo('<%=name%>')">delete</a> <% end %> </p> <% end %> <hr> <h2>Add Repository</h2> <form action="add.html"> <p> <label prompt>Repo name</label> <input type=text name=repo required> </p> <p> <input type=submit value="Add Repo"> </p> </form> <% if config.private==nil or config.private[user] then %> <hr> <p><a href="/private/">/private/</a></p> <% end %> </div> </body> </html> <% end