liquid_feedback_frontend
view app/main/member/_show_thumb.lua @ 11:77d58efe99fd
Version beta7
Important security fixes:
- Added missing HTML encoding to postal address of member
- Link to discussion URL only if it starts with http(s)://
Other bugfixes:
- Fixed wrong display of 2nd level delegating voters for an initiative
- Do not display invited initiators as initiators while voting
- Added missing translation
New features:
- Public message of the day
- Both direct and indirect supporter count is shown in tab heads
- Support shown in initiative lists
Language chooser at the login page has been added (again)
Important security fixes:
- Added missing HTML encoding to postal address of member
- Link to discussion URL only if it starts with http(s)://
Other bugfixes:
- Fixed wrong display of 2nd level delegating voters for an initiative
- Do not display invited initiators as initiators while voting
- Added missing translation
New features:
- Public message of the day
- Both direct and indirect supporter count is shown in tab heads
- Support shown in initiative lists
Language chooser at the login page has been added (again)
| author | bsw | 
|---|---|
| date | Fri Jan 22 12:00:00 2010 +0100 (2010-01-22) | 
| parents | 72c5e0ee7c98 | 
| children | 00d1004545f1 | 
 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 ui.container{
    21   attr = { class = container_class },
    22   content = function()
    23     ui.container{
    24       attr = { class = "flags" },
    25       content = function()
    26         local weight = 0
    27         if member.weight then
    28           weight = member.weight
    29         end
    30         if member.voter_weight then
    31           weight = member.voter_weight
    32         end
    33         if (issue or initiative) and weight > 1 then
    34           local module
    35           if issue then
    36             module = "interest"
    37           elseif initiative then
    38             if member.voter_weight then
    39                module = "vote"
    40             else
    41               module = "supporter"
    42             end
    43           end
    44           ui.link{
    45             attr = { title = _"Number of incoming delegations, follow link to see more details" },
    46             content = _("+ #{weight}", { weight = weight - 1 }),
    47             module = module,
    48             view = "show_incoming",
    49             params = { 
    50               member_id = member.id, 
    51               initiative_id = initiative and initiative.id or nil,
    52               issue_id = issue and issue.id or nil
    53             }
    54           }
    55         else
    56           slot.put(" ")
    57         end
    58         if initiator and initiator.accepted then
    59           if member.accepted == nil then
    60             slot.put(_"Invited")
    61           elseif member.accepted == false then
    62             slot.put(_"Rejected")
    63           end
    64         end
    65         if member.grade then
    66           ui.container{
    67             content = function()
    68               if member.grade > 0 then
    69                 ui.image{
    70                   attr = { 
    71                     alt   = _"Voted yes",
    72                     title = _"Voted yes"
    73                   },
    74                   static = "icons/16/thumb_up_green.png"
    75                 }
    76               elseif member.grade < 0 then
    77                 ui.image{
    78                   attr = { 
    79                     alt   = _"Voted no",
    80                     title = _"Voted no"
    81                   },
    82                   static = "icons/16/thumb_down_red.png"
    83                 }
    84               else
    85                 ui.image{
    86                   attr = { 
    87                     alt   = _"Abstention",
    88                     title = _"Abstention"
    89                   },
    90                   static = "icons/16/bullet_yellow.png"
    91                 }
    92               end
    93             end
    94           }
    95         end
    96         if member.admin then
    97           ui.image{
    98             attr = { 
    99               alt   = _"Member is administrator",
   100               title = _"Member is administrator"
   101             },
   102             static = "icons/16/cog.png"
   103           }
   104         end
   105         -- TODO performance
   106         local contact = Contact:by_pk(app.session.member.id, member.id)
   107         if contact then
   108           ui.image{
   109             attr = { 
   110               alt   = _"You have saved this member as contact",
   111               title = _"You have saved this member as contact"
   112             },
   113             static = "icons/16/bullet_disk.png"
   114           }
   115         end
   116       end
   117     }
   119     ui.link{
   120       attr = { title = _"Show member" },
   121       module = "member",
   122       view = "show",
   123       id = member.id,
   124       content = function()
   125         execute.view{
   126           module = "member_image",
   127           view = "_show",
   128           params = {
   129             member = member,
   130             image_type = "avatar",
   131             show_dummy = true
   132           }
   133         }
   134         ui.container{
   135           attr = { class = "member_name" },
   136           content = function()
   137             slot.put(name)
   138           end
   139         }
   140       end
   141     }
   142   end
   143 }
