annotate app/main/admin/unit_edit.lua @ 585:b489613c99d5
Fixed a typo in german translation
 | author | bsw | 
 | date | Wed Jun 20 21:32:02 2012 +0200 (2012-06-20) | 
 | parents | 63d6549cc00b | 
 | children | bc6934411019 | 
 
 | rev | line source | 
| bsw@525 | 1 local id = param.get_id() | 
| bsw@525 | 2 | 
| bsw@525 | 3 local unit = Unit:by_id(id) | 
| bsw@525 | 4 | 
| bsw@525 | 5 if member then | 
| bsw@525 | 6   slot.put_into("title", encode.html(_("Unit: '#{name}'", { name = unit.name }))) | 
| bsw@525 | 7 else | 
| bsw@525 | 8   slot.put_into("title", encode.html(_"Add new unit")) | 
| bsw@525 | 9 end | 
| bsw@525 | 10 | 
| bsw@525 | 11 local units_selector = Unit:new_selector() | 
| bsw@525 | 12 | 
| bsw@525 | 13 if member then | 
| bsw@525 | 14   units_selector | 
| bsw@525 | 15     :left_join("privilege", nil, { "privilege.member_id = ? AND privilege.unit_id = unit.id", member.id }) | 
| bsw@525 | 16     :add_field("privilege.voting_right", "voting_right") | 
| bsw@525 | 17 end | 
| bsw@525 | 18 | 
| bsw@525 | 19 local units = units_selector:exec() | 
| bsw@525 | 20 | 
| bsw@525 | 21 ui.form{ | 
| bsw@525 | 22   attr = { class = "vertical" }, | 
| bsw@525 | 23   module = "admin", | 
| bsw@525 | 24   action = "member_update", | 
| bsw@525 | 25   id = member and member.id, | 
| bsw@525 | 26   record = member, | 
| bsw@525 | 27   readonly = not app.session.member.admin, | 
| bsw@525 | 28   routing = { | 
| bsw@525 | 29     default = { | 
| bsw@525 | 30       mode = "redirect", | 
| bsw@525 | 31       modules = "admin", | 
| bsw@525 | 32       view = "member_list" | 
| bsw@525 | 33     } | 
| bsw@525 | 34   }, | 
| bsw@525 | 35   content = function() | 
| bsw@525 | 36     ui.field.text{     label = _"Identification", name = "identification" } | 
| bsw@525 | 37     ui.field.text{     label = _"Notification email", name = "notify_email" } | 
| bsw@525 | 38     ui.field.boolean{  label = _"Admin?",       name = "admin" } | 
| bsw@525 | 39 | 
| bsw@525 | 40     slot.put("<br />") | 
| bsw@525 | 41 | 
| bsw@525 | 42     for i, unit in ipairs(units) do | 
| bsw@525 | 43       ui.field.boolean{ | 
| bsw@525 | 44         name = "unit_" .. unit.id, | 
| bsw@525 | 45         label = unit.name, | 
| bsw@525 | 46         value = unit.voting_right | 
| bsw@525 | 47       } | 
| bsw@525 | 48     end | 
| bsw@525 | 49     slot.put("<br /><br />") | 
| bsw@525 | 50 | 
| bsw@525 | 51     ui.field.boolean{  label = _"Send invite?",       name = "invite_member" } | 
| bsw@525 | 52     ui.submit{         text  = _"Save" } | 
| bsw@525 | 53   end | 
| bsw@525 | 54 } |