annotate app/main/index/document.lua @ 1697:7cbc5a4638b8
Capitalization of some strings
author |
bsw |
date |
Thu Sep 23 17:59:48 2021 +0200 (2021-09-23) |
parents |
dcbe505ddf24 |
children |
|
rev |
line source |
bsw@401
|
1 if not config.document_dir then
|
bsw/jbe@1309
|
2 return execute.view { module = "index", view = "404" }
|
bsw@401
|
3 end
|
bsw@401
|
4
|
bsw@401
|
5 slot.put_into("title", _"Download documents")
|
bsw@401
|
6
|
bsw@401
|
7 slot.select("actions", function()
|
bsw@401
|
8 ui.link{
|
bsw@401
|
9 content = function()
|
bsw@401
|
10 slot.put(_"Cancel")
|
bsw@401
|
11 end,
|
bsw@401
|
12 module = "index",
|
bsw@401
|
13 view = "index"
|
bsw@401
|
14 }
|
bsw@401
|
15 end)
|
bsw@401
|
16
|
bsw@728
|
17 local file_list = extos.listdir(config.document_dir)
|
bsw@401
|
18
|
bsw@401
|
19 local tmp = {}
|
bsw@401
|
20 for i, filename in ipairs(file_list) do
|
bsw@401
|
21 if not filename:find("^%.") then
|
bsw@401
|
22 tmp[#tmp+1] = filename
|
bsw@401
|
23 end
|
bsw@401
|
24 end
|
bsw@401
|
25
|
bsw@401
|
26 local file_list = tmp
|
bsw@401
|
27
|
bsw@401
|
28 table.sort(file_list, function(a, b) return a > b end)
|
bsw@401
|
29
|
bsw@401
|
30 ui.list{
|
bsw@401
|
31 records = file_list,
|
bsw@401
|
32 columns = {
|
bsw@401
|
33 {
|
bsw@401
|
34 content = function(filename)
|
bsw@401
|
35 slot.put(encode.html(filename))
|
bsw@401
|
36 end
|
bsw@401
|
37 },
|
bsw@401
|
38 {
|
bsw@401
|
39 content = function(filename)
|
bsw@401
|
40 ui.link{
|
bsw@401
|
41 content = _"Download",
|
bsw@401
|
42 module = "index",
|
bsw@401
|
43 view = "document_file",
|
bsw@401
|
44 params = { filename = filename }
|
bsw@401
|
45 }
|
bsw@402
|
46 slot.put(" ")
|
bsw@402
|
47 ui.link{
|
bsw@402
|
48 content = _"Show",
|
bsw@402
|
49 module = "index",
|
bsw@402
|
50 view = "document_file",
|
bsw@402
|
51 params = { filename = filename, inline = true }
|
bsw@402
|
52 }
|
bsw@401
|
53 end
|
bsw@401
|
54 }
|
bsw@401
|
55 }
|
bsw/jbe@1309
|
56 }
|