liquid_feedback_frontend
diff app/main/delegation/new.lua @ 0:3bfb2fcf7ab9
Version alpha1
| author | bsw/jbe | 
|---|---|
| date | Wed Nov 18 12:00:00 2009 +0100 (2009-11-18) | 
| parents | |
| children | 80c215dbf076 | 
   line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/app/main/delegation/new.lua Wed Nov 18 12:00:00 2009 +0100 1.3 @@ -0,0 +1,45 @@ 1.4 +local area = Area:by_id(param.get("area_id", atom.integer)) 1.5 +if area then 1.6 + slot.put_into("title", encode.html(_"Set delegation for Area '#{name}'":gsub("#{name}", area.name))) 1.7 +end 1.8 + 1.9 +local issue = Issue:by_id(param.get("issue_id", atom.integer)) 1.10 +if issue then 1.11 + slot.put_into("title", encode.html(_"Set delegation for Issue ##{number} in Area '#{area_name}'":gsub("#{number}", issue.id):gsub("#{area_name}", issue.area.name))) 1.12 +end 1.13 + 1.14 + 1.15 +local contact_members = Member:new_selector() 1.16 + :add_where{ "contact.member_id = ?", app.session.member.id } 1.17 + :join("contact", nil, "member.id = contact.other_member_id") 1.18 + :add_order_by("member.login") 1.19 + :exec() 1.20 + 1.21 + 1.22 +ui.form{ 1.23 + attr = { class = "vertical" }, 1.24 + module = "delegation", 1.25 + action = "update", 1.26 + params = { 1.27 + area_id = area and area.id or nil, 1.28 + issue_id = issue and issue.id or nil, 1.29 + }, 1.30 + routing = { 1.31 + default = { 1.32 + mode = "redirect", 1.33 + module = area and "area" or "issue", 1.34 + view = "show", 1.35 + id = area and area.id or issue.id, 1.36 + } 1.37 + }, 1.38 + content = function() 1.39 + ui.field.select{ 1.40 + label = _"Trustee", 1.41 + name = "trustee_id", 1.42 + foreign_records = contact_members, 1.43 + foreign_id = "id", 1.44 + foreign_name = "name" 1.45 + } 1.46 + ui.submit{ text = _"Save" } 1.47 + end 1.48 +} 1.49 \ No newline at end of file