annotate app/main/member_image/_show.lua @ 1364:291db816e078
Fixed record access
 | author | 
 bsw | 
 | date | 
 Mon Aug 06 14:14:02 2018 +0200 (2018-08-06) | 
 | parents | 
 32cc544d5a5b  | 
 | children | 
 70121e414479  | 
 
 | rev | 
   line source | 
| 
bsw/jbe@4
 | 
     1 local member = param.get("member", "table")
 | 
| 
bsw@525
 | 
     2 local member_id = member and member.id or param.get("member_id", atom.integer)
 | 
| 
bsw@525
 | 
     3 
 | 
| 
bsw/jbe@4
 | 
     4 local image_type = param.get("image_type")
 | 
| 
bsw@274
 | 
     5 local class = param.get("class")
 | 
| 
bsw@274
 | 
     6 local popup_text = param.get("popup_text")
 | 
| 
bsw@274
 | 
     7 
 | 
| 
bsw@1148
 | 
     8 local force_update = param.get("force_update", atom.boolean)
 | 
| 
bsw@1148
 | 
     9 
 | 
| 
bsw@274
 | 
    10 if class then
 | 
| 
bsw@274
 | 
    11   class = " " .. class
 | 
| 
bsw@274
 | 
    12 else
 | 
| 
bsw@274
 | 
    13   class = ""
 | 
| 
bsw@274
 | 
    14 end
 | 
| 
bsw/jbe@4
 | 
    15 
 | 
| 
bsw@720
 | 
    16 if config.fastpath_url_func then
 | 
| 
bsw@720
 | 
    17   ui.image{
 | 
| 
bsw/jbe@1309
 | 
    18     attr = { title = popup_text, class = "mdl-chip__contact member_image member_image_" .. image_type .. class },
 | 
| 
bsw@721
 | 
    19     external = config.fastpath_url_func(member_id, image_type)
 | 
| 
bsw@720
 | 
    20   }
 | 
| 
bsw@720
 | 
    21 else
 | 
| 
bsw/jbe@1309
 | 
    22   local c = "mdl-chip__contact "
 | 
| 
bsw/jbe@1309
 | 
    23   if image_type == "photo" then
 | 
| 
bsw/jbe@1309
 | 
    24     c = ""
 | 
| 
bsw/jbe@1309
 | 
    25   end
 | 
| 
bsw@720
 | 
    26   ui.image{
 | 
| 
bsw/jbe@1309
 | 
    27     attr = { title = popup_text, class = c .. "member_image member_image_" .. image_type .. class },
 | 
| 
bsw@720
 | 
    28     module = "member_image",
 | 
| 
bsw@720
 | 
    29     view = "show",
 | 
| 
bsw@720
 | 
    30     extension = "jpg",
 | 
| 
bsw@720
 | 
    31     id = member_id,
 | 
| 
bsw@720
 | 
    32     params = {
 | 
| 
bsw@1148
 | 
    33       image_type = image_type,
 | 
| 
bsw@1148
 | 
    34       dynamic = force_update and os.time() or nil
 | 
| 
bsw/jbe@4
 | 
    35     }
 | 
| 
bsw@720
 | 
    36   }
 | 
| 
bsw/jbe@4
 | 
    37 end
 |