liquid_feedback_frontend
annotate app/main/index/download.lua @ 1714:11cb89cd2a92
Nicer wording
author | bsw |
---|---|
date | Mon Sep 27 12:40:19 2021 +0200 (2021-09-27) |
parents | 32cc544d5a5b |
children |
rev | line source |
---|---|
bsw/jbe@6 | 1 if not config.download_dir then |
bsw/jbe@1309 | 2 return execute.view { module = "index", view = "404" } |
bsw/jbe@6 | 3 end |
bsw/jbe@6 | 4 |
bsw@728 | 5 local file_list = extos.listdir(config.download_dir) |
bsw/jbe@6 | 6 |
bsw/jbe@6 | 7 local tmp = {} |
bsw/jbe@6 | 8 for i, filename in ipairs(file_list) do |
bsw/jbe@6 | 9 if not filename:find("^%.") then |
bsw/jbe@6 | 10 tmp[#tmp+1] = filename |
bsw/jbe@6 | 11 end |
bsw/jbe@6 | 12 end |
bsw/jbe@6 | 13 |
bsw/jbe@6 | 14 local file_list = tmp |
bsw/jbe@6 | 15 |
bsw/jbe@6 | 16 table.sort(file_list, function(a, b) return a > b end) |
bsw/jbe@6 | 17 |
bsw@1059 | 18 |
bsw@1059 | 19 ui.title(_"Download database export") |
bsw@1059 | 20 |
bsw@1059 | 21 ui.section( function() |
bsw@1059 | 22 |
bsw@1059 | 23 ui.sectionHead( function() |
bsw@1059 | 24 ui.heading { level = 1, content = _"Download database export" } |
bsw@1059 | 25 end ) |
bsw@1059 | 26 |
bsw@1059 | 27 if config.download_use_terms then |
bsw@1059 | 28 ui.sectionRow( function() |
bsw@1059 | 29 ui.container{ |
bsw@1059 | 30 attr = { class = "wiki use_terms" }, |
bsw@1059 | 31 content = function() |
bsw@1059 | 32 slot.put(config.download_use_terms) |
bsw@1059 | 33 end |
bsw@1059 | 34 } |
bsw@1059 | 35 end ) |
bsw@1059 | 36 end |
bsw@1059 | 37 |
bsw@1059 | 38 ui.sectionRow( function() |
bsw@1059 | 39 |
bsw@1059 | 40 ui.list{ |
bsw@1059 | 41 records = file_list, |
bsw@1059 | 42 columns = { |
bsw@1059 | 43 { |
bsw@1059 | 44 content = function(filename) |
bsw@1059 | 45 ui.tag{ content = filename } |
bsw@1059 | 46 end |
bsw@1059 | 47 }, |
bsw@1059 | 48 { |
bsw@1059 | 49 content = function(filename) |
bsw@1059 | 50 ui.link{ |
bsw@1059 | 51 content = _"Download", |
bsw@1059 | 52 module = "index", |
bsw@1059 | 53 view = "download_file", |
bsw@1059 | 54 params = { filename = filename } |
bsw@1059 | 55 } |
bsw@1059 | 56 end |
bsw/jbe@6 | 57 } |
bsw@1059 | 58 } |
bsw/jbe@6 | 59 } |
bsw@1059 | 60 end) |
bsw/jbe@1309 | 61 end) |