liquid_feedback_frontend
view app/main/member/_show_thumb.lua @ 36:f543b8bf57a1
single entry change for testing
| author | Dinu Gherman | 
|---|---|
| date | Thu Mar 04 22:10:14 2010 +0100 (2010-03-04) | 
| parents | 00d1004545f1 | 
| children | 0849be391140 | 
 line source
     1 local initiator = param.get("initiator", "table")
     2 local member = param.get("member", "table")
     4 local issue = param.get("issue", "table")
     5 local initiative = param.get("initiative", "table")
     6 local trustee = param.get("trustee", "table")
     8 local name
     9 if member.name_highlighted then
    10   name = encode.highlight(member.name_highlighted)
    11 else
    12   name = encode.html(member.name)
    13 end
    15 local container_class = "member_thumb"
    16 if initiator and member.accepted ~= true then
    17   container_class = container_class .. " not_accepted"
    18 end
    20 if member.is_informed == false then
    21   container_class = container_class .. " not_informed"
    22 end
    24 ui.container{
    25   attr = { class = container_class },
    26   content = function()
    27     ui.container{
    28       attr = { class = "flags" },
    29       content = function()
    31         if member.grade then
    32           ui.link{
    33             module = "vote",
    34             view = "list",
    35             params = {
    36               issue_id = initiative.issue.id,
    37               member_id = member.id,
    38             },
    39             content = function()
    40               if member.grade > 0 then
    41                 ui.image{
    42                   attr = { 
    43                     alt   = _"Voted yes",
    44                     title = _"Voted yes"
    45                   },
    46                   static = "icons/16/thumb_up_green.png"
    47                 }
    48               elseif member.grade < 0 then
    49                 ui.image{
    50                   attr = { 
    51                     alt   = _"Voted no",
    52                     title = _"Voted no"
    53                   },
    54                   static = "icons/16/thumb_down_red.png"
    55                 }
    56               else
    57                 ui.image{
    58                   attr = { 
    59                     alt   = _"Abstention",
    60                     title = _"Abstention"
    61                   },
    62                   static = "icons/16/bullet_yellow.png"
    63                 }
    64               end
    65             end
    66           }
    67         end
    69         local weight = 0
    70         if member.weight then
    71           weight = member.weight
    72         end
    73         if member.voter_weight then
    74           weight = member.voter_weight
    75         end
    76         if (issue or initiative) and weight > 1 then
    77           local module
    78           if issue then
    79             module = "interest"
    80           elseif initiative then
    81             if member.voter_weight then
    82                module = "vote"
    83             else
    84               module = "supporter"
    85             end
    86           end
    87           ui.link{
    88             attr = { title = _"Number of incoming delegations, follow link to see more details" },
    89             content = _("+ #{weight}", { weight = weight - 1 }),
    90             module = module,
    91             view = "show_incoming",
    92             params = { 
    93               member_id = member.id, 
    94               initiative_id = initiative and initiative.id or nil,
    95               issue_id = issue and issue.id or nil
    96             }
    97           }
    98         end
   100         if initiator and initiator.accepted then
   101           if member.accepted == nil then
   102             slot.put(_"Invited")
   103           elseif member.accepted == false then
   104             slot.put(_"Rejected")
   105           end
   106         end
   108         if member.is_informed == false then
   109           local text = _"Member has not approved latest draft"
   110           ui.image{
   111             attr = { alt = text, title = text },
   112             static = "icons/16/help_yellow.png"
   113           }
   114         end
   116         if member.admin then
   117           ui.image{
   118             attr = { 
   119               alt   = _"Member is administrator",
   120               title = _"Member is administrator"
   121             },
   122             static = "icons/16/cog.png"
   123           }
   124         end
   126         -- TODO performance
   127         local contact = Contact:by_pk(app.session.member.id, member.id)
   128         if contact then
   129           ui.image{
   130             attr = { 
   131               alt   = _"You have saved this member as contact",
   132               title = _"You have saved this member as contact"
   133             },
   134             static = "icons/16/bullet_disk.png"
   135           }
   136         end
   137       end
   138     }
   140     ui.link{
   141       attr = { title = _"Show member" },
   142       module = "member",
   143       view = "show",
   144       id = member.id,
   145       content = function()
   146         execute.view{
   147           module = "member_image",
   148           view = "_show",
   149           params = {
   150             member = member,
   151             image_type = "avatar",
   152             show_dummy = true
   153           }
   154         }
   155         ui.container{
   156           attr = { class = "member_name" },
   157           content = function()
   158             slot.put(name)
   159           end
   160         }
   161       end
   162     }
   163   end
   164 }
