liquid_feedback_frontend
changeset 1060:d6ab5f231178
Fixed error when displaying initiatives in polling mode, made inline help for phases available
author | bsw |
---|---|
date | Wed Jul 16 21:50:26 2014 +0200 (2014-07-16) |
parents | 3f52e99b444d |
children | 7188f8a45b3d |
files | app/main/issue/_sidebar_state.lua |
line diff
1.1 --- a/app/main/issue/_sidebar_state.lua Wed Jul 16 21:49:21 2014 +0200 1.2 +++ b/app/main/issue/_sidebar_state.lua Wed Jul 16 21:50:26 2014 +0200 1.3 @@ -42,7 +42,10 @@ 1.4 ) 1.5 1.6 if not failed then 1.7 - ui.sidebarSection( "sidebarRowNarrow" .. (current and " highlightedx" or ""), function() 1.8 + ui.link{ attr = { 1.9 + onclick = "$('#phase-help-" .. state .. "').toggle();return false;", 1.10 + class = "sidebarRow sidebarRowNarrow", 1.11 + }, content = function() 1.12 1.13 local state_names = { 1.14 admission = _"Admission", 1.15 @@ -65,8 +68,12 @@ 1.16 den = policy.initiative_quorum_den 1.17 end 1.18 1.19 - if den == 100 then 1.20 - return _("#{percentage}%", { percentage = num }) 1.21 + if num == nil or den == nil then 1.22 + return 0 1.23 + end 1.24 + 1.25 + if den == 100 or den == 10 then 1.26 + return _("#{percentage}%", { percentage = num * 100 / den }) 1.27 else 1.28 return num .. "/" .. den 1.29 end 1.30 @@ -104,7 +111,9 @@ 1.31 text = _("failed #{quorum}", { quorum = quorum }) 1.32 end 1.33 if phase_success then 1.34 - if quorum then 1.35 + if quorum == 0 then 1.36 + text = _"without quorum" 1.37 + elseif quorum then 1.38 text = _("reached #{quorum}", { quorum = quorum }) 1.39 else 1.40 text = _"finished" 1.41 @@ -136,19 +145,16 @@ 1.42 slot.put(" ") 1.43 ui.tag{ content = state_name } 1.44 end } 1.45 - 1.46 + 1.47 local help_texts = { 1.48 - admission = _"As soon as one initiative of this issue reaches #{quorum} support, the issue will go into discussion phase.", 1.49 + admission = _("As soon as one initiative of this issue reaches #{quorum} support, the issue will go into discussion phase.", { quorum = quorum_text(issue.policy, 1) }), 1.50 discussion = _"During the discussion phase the issue is debated between initiators while the initiatives are improved by suggestions from the supporters.", 1.51 - verification = _"During the verification phase the initiative drafts cannot be changed anymore.", 1.52 + verification = _("During the verification phase the initiative drafts cannot be changed anymore. Initiatives needs to reach a quorum of #{quorum} to become admitted for voting.", { quorum = quorum_text(issue.policy, 2) }), 1.53 voting = _"On this issue can be voted now." 1.54 } 1.55 - if current then 1.56 - -- ui.container { content = help_texts[state] } 1.57 - end 1.58 - 1.59 + ui.container { attr = { id = "phase-help-" .. state, style = "display: none;" }, content = help_texts[state] } 1.60 1.61 - end ) 1.62 + end } 1.63 end 1.64 1.65 if not phase_success and not current and not current_occured then