liquid_feedback_frontend
view app/main/member/show.lua @ 768:b219676f1093
Optical enhancements
| author | bsw | 
|---|---|
| date | Thu Jun 28 23:19:41 2012 +0200 (2012-06-28) | 
| parents | 2ad52d0067eb | 
| children | ea2449916c12 | 
 line source
     1 local member = Member:by_id(param.get_id())
     3 if not member or not member.activated then
     4   error("access denied")
     5 end
     7 app.html_title.title = member.name
     8 app.html_title.subtitle = _("Member")
    10 slot.select("head", function()
    11   ui.container{
    12     attr = { class = "title" },
    13     content = _("Member '#{member}'", { member =  member.name })
    14   }
    16   ui.container{ attr = { class = "actions" }, content = function()
    18     if member.id == app.session.member_id then
    19       ui.link{
    20         content = function()
    21           slot.put(encode.html(_"Edit profile"))
    22         end,
    23         module  = "member",
    24         view    = "edit"
    25       }
    26       slot.put(" · ")
    27       ui.link{
    28         content = function()
    29           slot.put(encode.html(_"Upload avatar/photo"))
    30         end,
    31         module  = "member",
    32         view    = "edit_images"
    33       }
    34       slot.put(" · ")
    35     end
    36     ui.link{
    37       content = function()
    38         slot.put(encode.html(_"Show member history"))
    39       end,
    40       module  = "member",
    41       view    = "history",
    42       id      = member.id
    43     }
    44     if not member.active then
    45       slot.put(" · ")
    46       ui.tag{
    47         attr = { class = "interest deactivated_member_info" },
    48         content = _"This member is inactive"
    49       }
    50     end
    51     if member.locked then
    52       slot.put(" · ")
    53       ui.tag{
    54         attr = { class = "interest deactivated_member_info" },
    55         content = _"This member is locked"
    56       }
    57     end
    58     if not (member.id == app.session.member.id) then
    59       slot.put(" · ")
    60       --TODO performance
    61       local contact = Contact:by_pk(app.session.member.id, member.id)
    62       if contact then
    63         ui.link{
    64           text   = _"Remove from contacts",
    65           module = "contact",
    66           action = "remove_member",
    67           id     = contact.other_member_id,
    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       elseif member.activated then
    79         ui.link{
    80           text    = _"Add to my contacts",
    81           module  = "contact",
    82           action  = "add_member",
    83           id      = member.id,
    84           routing = {
    85             default = {
    86               mode = "redirect",
    87               module = request.get_module(),
    88               view = request.get_view(),
    89               id = param.get_id_cgi(),
    90               params = param.get_all_cgi()
    91             }
    92           }
    93         }
    94       end
    95     end
    96     local ignored_member = IgnoredMember:by_pk(app.session.member.id, member.id)
    97     slot.put(" · ")
    98     if ignored_member then
    99       ui.tag{
   100         attr = { class = "interest" },
   101         content = _"You have ignored this member"
   102       }
   103       slot.put(" · ")
   104       ui.link{
   105         text   = _"Stop ignoring member",
   106         module = "member",
   107         action = "update_ignore_member",
   108         id     = member.id,
   109         params = { delete = true },
   110         routing = {
   111           default = {
   112             mode = "redirect",
   113             module = request.get_module(),
   114             view = request.get_view(),
   115             id = param.get_id_cgi(),
   116             params = param.get_all_cgi()
   117           }
   118         }
   119       }
   120     elseif member.activated then
   121       ui.link{
   122         attr = { class = "interest" },
   123         text    = _"Ignore member",
   124         module  = "member",
   125         action  = "update_ignore_member",
   126         id      = member.id,
   127         routing = {
   128           default = {
   129             mode = "redirect",
   130             module = request.get_module(),
   131             view = request.get_view(),
   132             id = param.get_id_cgi(),
   133             params = param.get_all_cgi()
   134           }
   135         }
   136       }
   137     end
   138   end }
   139 end)
   141 util.help("member.show", _"Member page")
   143 execute.view{
   144   module = "member",
   145   view = "_show",
   146   params = { member = member }
   147 }
