annotate app/main/admin/newsletter_list.lua @ 1458:3494edd607e7
Fixed nesting again part 2
 | author | 
 bsw | 
 | date | 
 Thu Oct 18 17:27:02 2018 +0200 (2018-10-18) | 
 | parents | 
 c0fd12b97d65  | 
 | children | 
 54efe6c8ae9d  | 
 
 | rev | 
   line source | 
| 
bsw@1248
 | 
     1 local newsletter = Newsletter:new_selector()
 | 
| 
bsw@1248
 | 
     2   :add_order_by("published DESC")
 | 
| 
bsw@1248
 | 
     3   :exec()
 | 
| 
bsw@1248
 | 
     4 
 | 
| 
bsw@1248
 | 
     5 ui.titleAdmin(_"Newsletter")
 | 
| 
bsw@1248
 | 
     6 
 | 
| 
bsw@1248
 | 
     7 ui.section( function()
 | 
| 
bsw@1248
 | 
     8 
 | 
| 
bsw@1248
 | 
     9   ui.sectionHead( function()
 | 
| 
bsw@1248
 | 
    10     ui.heading { level = 1, content = _"Newsletter list" }
 | 
| 
bsw@1248
 | 
    11   end )
 | 
| 
bsw@1248
 | 
    12 
 | 
| 
bsw@1248
 | 
    13   ui.sectionRow( function ()
 | 
| 
bsw@1248
 | 
    14 
 | 
| 
bsw@1248
 | 
    15     ui.list{
 | 
| 
bsw@1248
 | 
    16       records = newsletter,
 | 
| 
bsw@1248
 | 
    17       columns = {
 | 
| 
bsw@1248
 | 
    18         { label = _"Unit", content = function(r) ui.tag{ content = r.unit and r.unit.name or _"All members" } end },
 | 
| 
bsw@1248
 | 
    19         { name = "published", label = _"Published" },
 | 
| 
bsw@1248
 | 
    20         { name = "subject", label = _"Subject" },
 | 
| 
bsw@1248
 | 
    21         { label = _"sent", content = function(r) 
 | 
| 
bsw@1248
 | 
    22           if not r.sent then 
 | 
| 
bsw@1248
 | 
    23             ui.link{ text = _"Edit", module = "admin", view = "newsletter_edit", id = r.id } 
 | 
| 
bsw@1248
 | 
    24           else
 | 
| 
bsw@1248
 | 
    25             ui.tag{ content = format.timestamp(r.sent) }
 | 
| 
bsw@1248
 | 
    26           end 
 | 
| 
bsw@1248
 | 
    27         end }
 | 
| 
bsw@1248
 | 
    28       }
 | 
| 
bsw@1248
 | 
    29     }
 | 
| 
bsw@1248
 | 
    30 
 | 
| 
bsw@1248
 | 
    31   end)
 | 
| 
bsw@1248
 | 
    32 end)
 |