liquid_feedback_frontend

diff app/main/contact/_list.lua @ 0:3bfb2fcf7ab9

Version alpha1
author bsw/jbe
date Wed Nov 18 12:00:00 2009 +0100 (2009-11-18)
parents
children 80c215dbf076
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/app/main/contact/_list.lua	Wed Nov 18 12:00:00 2009 +0100
     1.3 @@ -0,0 +1,132 @@
     1.4 +
     1.5 +local contacts_selector = Contact:new_selector()
     1.6 +  :add_where{ "member_id = ?", app.session.member.id }
     1.7 +  :join("member", nil, "member.id = contact.other_member_id")
     1.8 +  :add_order_by("member.login")
     1.9 +
    1.10 +ui.paginate{
    1.11 +  selector = contacts_selector,
    1.12 +  content = function()
    1.13 +    local contacts = contacts_selector:exec()
    1.14 +    if #contacts == 0 then
    1.15 +      ui.field.text{ value = _"You didn't saved any member as contact yet." }
    1.16 +    else
    1.17 +      ui.list{
    1.18 +        records = contacts,
    1.19 +        columns = {
    1.20 +          {
    1.21 +            label = _"Login",
    1.22 +            content = function(record)
    1.23 +              ui.link{
    1.24 +                text = record.other_member.login,
    1.25 +                module = "member",
    1.26 +                view = "show",
    1.27 +                id = record.other_member_id
    1.28 +              }
    1.29 +            end
    1.30 +          },
    1.31 +          {
    1.32 +            label = _"Name",
    1.33 +            content = function(record)
    1.34 +              ui.link{
    1.35 +                text = record.other_member.name,
    1.36 +                module = "member",
    1.37 +                view = "show",
    1.38 +                id = record.other_member_id
    1.39 +              }
    1.40 +            end
    1.41 +          },
    1.42 +          {
    1.43 +            label = _"Published",
    1.44 +            content = function(record)
    1.45 +              ui.field.boolean{ value = record.public }
    1.46 +            end
    1.47 +          },
    1.48 +          {
    1.49 +            content = function(record)
    1.50 +              if record.public then
    1.51 +                ui.link{
    1.52 +                  attr = { class = "action" },
    1.53 +                  text = _"Hide",
    1.54 +                  module = "contact",
    1.55 +                  action = "add_member",
    1.56 +                  id = record.other_member_id,
    1.57 +                  params = { public = false },
    1.58 +                  routing = {
    1.59 +                    default = {
    1.60 +                      mode = "redirect",
    1.61 +                      module = request.get_module(),
    1.62 +                      view = request.get_view(),
    1.63 +                      id = param.get_id_cgi(),
    1.64 +                      params = param.get_all_cgi()
    1.65 +                    }
    1.66 +                  }
    1.67 +                }
    1.68 +              else
    1.69 +                ui.link{
    1.70 +                  attr = { class = "action" },
    1.71 +                  text = _"Publish",
    1.72 +                  module = "contact",
    1.73 +                  action = "add_member",
    1.74 +                  id = record.other_member_id,
    1.75 +                  params = { public = true },
    1.76 +                  routing = {
    1.77 +                    default = {
    1.78 +                      mode = "redirect",
    1.79 +                      module = request.get_module(),
    1.80 +                      view = request.get_view(),
    1.81 +                      id = param.get_id_cgi(),
    1.82 +                      params = param.get_all_cgi()
    1.83 +                    }
    1.84 +                  }
    1.85 +                }
    1.86 +              end
    1.87 +            end
    1.88 +          },
    1.89 +          {
    1.90 +            content = function(record)
    1.91 +              ui.link{
    1.92 +                attr = { class = "action" },
    1.93 +                text = _"Remove",
    1.94 +                module = "contact",
    1.95 +                action = "remove_member",
    1.96 +                id = record.other_member_id,
    1.97 +                routing = {
    1.98 +                  default = {
    1.99 +                    mode = "redirect",
   1.100 +                    module = request.get_module(),
   1.101 +                    view = request.get_view(),
   1.102 +                    id = param.get_id_cgi(),
   1.103 +                    params = param.get_all_cgi()
   1.104 +                  }
   1.105 +                }
   1.106 +              }
   1.107 +            end
   1.108 +          },
   1.109 +          {
   1.110 +            content = function(record)
   1.111 +              ui.link{
   1.112 +                attr = { class = "action" },
   1.113 +                text = _"Global delegation",
   1.114 +                module = "delegation",
   1.115 +                action = "update",
   1.116 +                params = { 
   1.117 +                  trustee_id = record.other_member_id,
   1.118 +                },
   1.119 +                routing = {
   1.120 +                  default = {
   1.121 +                    mode = "redirect",
   1.122 +                    module = request.get_module(),
   1.123 +                    view = request.get_view(),
   1.124 +                    id = param.get_id_cgi(),
   1.125 +                    params = param.get_all_cgi()
   1.126 +                  }
   1.127 +                }
   1.128 +              }
   1.129 +            end
   1.130 +          }
   1.131 +        }
   1.132 +      }
   1.133 +    end
   1.134 +  end
   1.135 +}
   1.136 \ No newline at end of file

Impressum / About Us