liquid_feedback_frontend
view app/main/member_image/show.lua @ 1558:5e7d76a32227
Hide discard vote button after voting is closed
author | bsw |
---|---|
date | Tue Nov 10 20:23:37 2020 +0100 (2020-11-10) |
parents | 8874448bbb7a |
children | dcbe505ddf24 |
line source
1 local image_type = param.get("image_type")
2 local record = MemberImage:by_pk(param.get_id(), image_type, true)
4 local dynamic = param.get("dynamic")
6 local data, content_type
8 if record then
9 data = record.data
10 assert(record.content_type, "No content-type set for image.")
11 content_type = record.content_type
13 else
14 local default_file = "avatar.jpg"
15 content_type = "image/jpeg"
16 if image_type == "photo" then
17 default_file = "icons/16/lightning.png"
18 content_type = "image/png"
19 end
21 local filename = WEBMCP_BASE_PATH .. "static/" .. default_file
23 local f = assert(io.open(filename), "Cannot open default image file")
24 data = f:read("*a")
25 f:close()
27 end
29 if not dynamic then
30 request.allow_caching()
31 end
33 slot.set_layout(nil, content_type)
34 slot.put_into("data", data)