36 lines
1 KiB
Lua
36 lines
1 KiB
Lua
|
|
local util = require("util")
|
||
|
|
local tile = require('page/partial/tile')
|
||
|
|
|
||
|
|
--if not app.cache['experiences.html'] and util.count(app.cache.items) > 0 then
|
||
|
|
-- print("processing! " .. util.count(app.cache.items) .. " items")
|
||
|
|
-- app.cache['experiences.html'] = util.memoize(
|
||
|
|
-- function()
|
||
|
|
-- local data = util.merge({tiles=''},{ opts = app.opts })
|
||
|
|
-- foreach(app.cache.items, function(k,v)
|
||
|
|
-- data.tiles = data.tiles .. tile( util.flatten(v,"item") )
|
||
|
|
-- end)
|
||
|
|
-- local html = util.template( LoadAsset("page/experiences.html"),data)
|
||
|
|
-- return html
|
||
|
|
-- end,
|
||
|
|
-- 60*5 -- re-run every 5 mins (otherwise return cache)
|
||
|
|
-- )
|
||
|
|
--end
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
if util.count(app.cache.items) == 0 then
|
||
|
|
SetStatus(200)
|
||
|
|
SetHeader('Content-Type', 'text/html; charset=utf-8')
|
||
|
|
local html = util.template( [[
|
||
|
|
${header}
|
||
|
|
<br/>
|
||
|
|
<h2>Indexing files: please try again in few seconds</h2>
|
||
|
|
${footer}
|
||
|
|
]],data)
|
||
|
|
Write( html )
|
||
|
|
else
|
||
|
|
SetStatus(200)
|
||
|
|
SetHeader('Content-Type', 'text/html; charset=utf-8')
|
||
|
|
--Write( app.cache['experiences.html']() )
|
||
|
|
end
|