liquid_feedback_frontend
view app/main/index/document.lua @ 716:a53b4485a3d3
Fixed preloading of initiative data for issue head
| author | bsw | 
|---|---|
| date | Wed Jun 27 12:31:14 2012 +0200 (2012-06-27) | 
| parents | a42bc1f0ed45 | 
| children | f49cdfb72567 | 
 line source
     1 if not config.document_dir then
     2   error("feature not enabled")
     3 end
     5 slot.put_into("title", _"Download documents")
     7 slot.select("actions", function()
     8   ui.link{
     9     content = function()
    10         ui.image{ static = "icons/16/cancel.png" }
    11         slot.put(_"Cancel")
    12     end,
    13     module = "index",
    14     view = "index"
    15   }
    16 end)
    18 util.help("index.document", _"Download documents")
    20 local file_list = os.listdir(config.document_dir)
    22 local tmp = {}
    23 for i, filename in ipairs(file_list) do
    24   if not filename:find("^%.") then
    25     tmp[#tmp+1] = filename
    26   end
    27 end
    29 local file_list = tmp
    31 table.sort(file_list, function(a, b) return a > b end)
    33 ui.list{
    34   records = file_list,
    35   columns = {
    36     {
    37       content = function(filename)
    38         slot.put(encode.html(filename))
    39       end
    40     },
    41     {
    42       content = function(filename)
    43         ui.link{
    44           content = _"Download",
    45           module = "index",
    46           view = "document_file",
    47           params = { filename = filename }
    48         }
    49         slot.put(" ")
    50         ui.link{
    51           content = _"Show",
    52           module = "index",
    53           view = "document_file",
    54           params = { filename = filename, inline = true }
    55         }
    56       end
    57     }
    58   }
    59 }
