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