annotate app/main/membership/_show_box.lua @ 894:b51f9500a9b2
Added has_polling_right_for_unit_id function to member model
 | author | bsw | 
 | date | Mon Aug 20 03:52:17 2012 +0200 (2012-08-20) | 
 | parents | 63d6549cc00b | 
 | children |  | 
 
 | rev | line source | 
| bsw/jbe@0 | 1 local area = param.get("area", "table") | 
| bsw/jbe@0 | 2 | 
| bsw/jbe@4 | 3 local membership = Membership:by_pk(area.id, app.session.member.id) | 
| bsw/jbe@4 | 4 | 
| bsw@525 | 5 if membership then | 
| bsw/jbe@0 | 6 | 
| bsw@525 | 7   ui.container{ | 
| bsw@525 | 8     attr = { | 
| bsw@525 | 9       class = "head head_active", | 
| bsw@525 | 10     }, | 
| bsw@525 | 11     content = function() | 
| bsw@525 | 12       ui.image{ | 
| bsw@525 | 13         static = "icons/16/user_green.png" | 
| bsw@525 | 14       } | 
| bsw@525 | 15       slot.put(_"You are member") | 
| bsw@525 | 16     end | 
| bsw@525 | 17   } | 
| bsw/jbe@4 | 18 | 
| bsw@525 | 19   ui.link{ | 
| bsw@525 | 20     image  = { static = "icons/16/cross.png" }, | 
| bsw@525 | 21     text    = _"Withdraw membership", | 
| bsw@525 | 22     module  = "membership", | 
| bsw@525 | 23     action  = "update", | 
| bsw@525 | 24     params  = { area_id = area.id, delete = true }, | 
| bsw@525 | 25     routing = { default = { mode = "redirect", module = "area", view = "show", id = area.id } } | 
| bsw@525 | 26   } | 
| bsw@525 | 27 elseif app.session.member:has_voting_right_for_unit_id(area.unit_id) then | 
| bsw@525 | 28   ui.link{ | 
| bsw@525 | 29     image  = { static = "icons/16/user_add.png" }, | 
| bsw@525 | 30     text   = _"Become a member", | 
| bsw@525 | 31     module = "membership", | 
| bsw@525 | 32     action = "update", | 
| bsw@525 | 33     params = { area_id = area.id }, | 
| bsw@525 | 34     routing = { | 
| bsw@525 | 35       default = { | 
| bsw@525 | 36         mode = "redirect", | 
| bsw@525 | 37         module = "area", | 
| bsw@525 | 38         view = "show", | 
| bsw@525 | 39         id = area.id | 
| bsw/jbe@4 | 40       } | 
| bsw/jbe@4 | 41     } | 
| bsw@525 | 42   } | 
| bsw@525 | 43 end | 
| bsw/jbe@4 | 44 |