liquid_feedback_frontend
view app/main/contact/list.lua @ 252:eb6d04201f81
Show evil browser notice as inlined warning instead of opening an evil popup
| author | Ingo Bormuth <mail@ibormuth.de> | 
|---|---|
| date | Fri Dec 30 04:02:37 2011 +0100 (2011-12-30) | 
| parents | 72d8f5faa2e5 | 
| children | 418b590fa9ed | 
 line source
     1 local contacts_selector = Contact:build_selector{
     2   member_id = app.session.member_id,
     3   order = "name"
     4 }
     7 slot.put_into("title", _"Contacts")
    10 util.help("contact.list")
    13 ui.paginate{
    14   selector = contacts_selector,
    15   content = function()
    16     local contacts = contacts_selector:exec()
    17     if #contacts == 0 then
    18       ui.field.text{ value = _"You didn't save any member as contact yet." }
    19     else
    20       ui.list{
    21         records = contacts,
    22         columns = {
    23           {
    24             label = _"Name",
    25             content = function(record)
    26               ui.link{
    27                 text = record.other_member.name,
    28                 module = "member",
    29                 view = "show",
    30                 id = record.other_member_id
    31               }
    32             end
    33           },
    34           {
    35             label = _"Published",
    36             content = function(record)
    37               ui.field.boolean{ value = record.public }
    38             end
    39           },
    40           {
    41             content = function(record)
    42               if record.public then
    43                 ui.link{
    44                   attr = { class = "action" },
    45                   text = _"Hide",
    46                   module = "contact",
    47                   action = "add_member",
    48                   id = record.other_member_id,
    49                   params = { public = false },
    50                   routing = {
    51                     default = {
    52                       mode = "redirect",
    53                       module = request.get_module(),
    54                       view = request.get_view(),
    55                       id = param.get_id_cgi(),
    56                       params = param.get_all_cgi()
    57                     }
    58                   }
    59                 }
    60               else
    61                 ui.link{
    62                   attr = { class = "action" },
    63                   text = _"Publish",
    64                   module = "contact",
    65                   action = "add_member",
    66                   id = record.other_member_id,
    67                   params = { public = true },
    68                   routing = {
    69                     default = {
    70                       mode = "redirect",
    71                       module = request.get_module(),
    72                       view = request.get_view(),
    73                       id = param.get_id_cgi(),
    74                       params = param.get_all_cgi()
    75                     }
    76                   }
    77                 }
    78               end
    79             end
    80           },
    81           {
    82             content = function(record)
    83               ui.link{
    84                 attr = { class = "action" },
    85                 text = _"Remove",
    86                 module = "contact",
    87                 action = "remove_member",
    88                 id = record.other_member_id,
    89                 routing = {
    90                   default = {
    91                     mode = "redirect",
    92                     module = request.get_module(),
    93                     view = request.get_view(),
    94                     id = param.get_id_cgi(),
    95                     params = param.get_all_cgi()
    96                   }
    97                 }
    98               }
    99             end
   100           },
   101         }
   102       }
   103     end
   104   end
   105 }
