0
|
1 local Luan = require "luan:Luan.luan"
|
|
2 local error = Luan.error
|
|
3 local Parsers = require "luan:Parsers.luan"
|
|
4 local json_string = Parsers.json_string or error()
|
|
5 local Io = require "luan:Io.luan"
|
|
6 local Http = require "luan:http/Http.luan"
|
|
7 local Link = require "site:/lib/Link.luan"
|
|
8 local Shared = require "site:/lib/Shared.luan"
|
|
9 local show_editable_link = Shared.show_editable_link or error()
|
|
10
|
|
11
|
|
12 return function()
|
|
13 local link_id = Http.request.parameters.link or error()
|
|
14 local link = Link.get_by_id(link_id)
|
|
15 local html = ` show_editable_link(link) `
|
|
16 Io.stdout = Http.response.text_writer()
|
|
17 %>
|
|
18 document.querySelector('div[link="<%=link_id%>"]').outerHTML = <%= json_string(html) %>;
|
|
19 dragInit();
|
|
20 <%
|
|
21 end
|