liquid_feedback_frontend
diff app/main/initiative/_show.lua @ 272:65a1f7a01e7b
More optical enhancements and repositioning of elements
author | bsw |
---|---|
date | Wed Feb 08 00:55:17 2012 +0100 (2012-02-08) |
parents | 1fdf1e607494 |
children | 7196685f9dd7 |
line diff
1.1 --- a/app/main/initiative/_show.lua Tue Feb 07 22:30:48 2012 +0100 1.2 +++ b/app/main/initiative/_show.lua Wed Feb 08 00:55:17 2012 +0100 1.3 @@ -1,8 +1,90 @@ 1.4 local initiative = param.get("initiative", "table") 1.5 local initiator = param.get("initiator", "table") 1.6 1.7 +local initiators_members_selector = initiative:get_reference_selector("initiating_members") 1.8 + :add_field("initiator.accepted", "accepted") 1.9 + 1.10 +if not (initiator and initiator.accepted) then 1.11 + initiators_members_selector:add_where("initiator.accepted") 1.12 +end 1.13 + 1.14 +local initiators = initiators_members_selector:exec() 1.15 + 1.16 +slot.select("initiative_head", function() 1.17 + 1.18 + ui.container{ 1.19 + attr = { class = "initiative_name" }, 1.20 + content = _("Initiative i#{id}: #{name}", { id = initiative.id, name = initiative.name }) 1.21 + } 1.22 + ui.tag{ 1.23 + attr = { class = "initiator_names" }, 1.24 + content = function() 1.25 + ui.tag{ content = _"by" } 1.26 + slot.put(" ") 1.27 + for i, initiator in ipairs(initiators) do 1.28 + if i == #initiators and i > 1 then 1.29 + slot.put(" ", _"and", " ") 1.30 + elseif i > 1 then 1.31 + slot.put(", ") 1.32 + end 1.33 + ui.link{ 1.34 + text = initiator.name, 1.35 + module = "member", view = "show", id = initiator.id 1.36 + } 1.37 + end 1.38 + end 1.39 + } 1.40 + 1.41 + if initiator and initiator.accepted and not initiative.issue.fully_frozen and not initiative.issue.closed and not initiative.revoked then 1.42 + slot.put(" · ") 1.43 + ui.link{ 1.44 + attr = { class = "action" }, 1.45 + content = function() 1.46 + slot.put(_"Invite initiator") 1.47 + end, 1.48 + module = "initiative", 1.49 + view = "add_initiator", 1.50 + params = { initiative_id = initiative.id } 1.51 + } 1.52 + if #initiators > 1 then 1.53 + slot.put(" · ") 1.54 + ui.link{ 1.55 + content = function() 1.56 + slot.put(_"Remove initiator") 1.57 + end, 1.58 + module = "initiative", 1.59 + view = "remove_initiator", 1.60 + params = { initiative_id = initiative.id } 1.61 + } 1.62 + end 1.63 + end 1.64 + if initiator and initiator.accepted == false then 1.65 + slot.put(" · ") 1.66 + ui.link{ 1.67 + text = _"Cancel refuse of invitation", 1.68 + module = "initiative", 1.69 + action = "remove_initiator", 1.70 + params = { 1.71 + initiative_id = initiative.id, 1.72 + member_id = app.session.member.id 1.73 + }, 1.74 + routing = { 1.75 + ok = { 1.76 + mode = "redirect", 1.77 + module = "initiative", 1.78 + view = "show", 1.79 + id = initiative.id 1.80 + } 1.81 + } 1.82 + } 1.83 + end 1.84 + 1.85 + 1.86 +end ) 1.87 + 1.88 util.help("initiative.show") 1.89 1.90 + 1.91 if initiative.issue.ranks_available and initiative.admitted then 1.92 local class = initiative.rank == 1 and "admitted_info" or "not_admitted_info" 1.93 ui.container{