liquid_feedback_frontend

diff app/main/lf2/initiative.lua @ 215:1dab81353eb1

More enhancements for second generation frontend
author bsw
date Sat Mar 05 15:34:17 2011 +0100 (2011-03-05)
parents acf92c2d33f4
children 4f6e6b213fb8
line diff
     1.1 --- a/app/main/lf2/initiative.lua	Thu Mar 03 23:47:35 2011 +0100
     1.2 +++ b/app/main/lf2/initiative.lua	Sat Mar 05 15:34:17 2011 +0100
     1.3 @@ -24,16 +24,15 @@
     1.4  local alternative_initiatives = initiative.issue.initiatives
     1.5  alternative_initiatives:load("initiating_members", nil, "initiating_members")
     1.6  
     1.7 +local support = Supporter:by_pk(initiative.id, app.session.member.id)
     1.8 +
     1.9 +app.topnav_phase = issue.phase
    1.10 +
    1.11  
    1.12  slot.select("sidebar", function()
    1.13    
    1.14 -  execute.view{ module = "lf2", view = "_sidebar_issue", params = { issue = issue, initiative_id = initiative.id } }
    1.15 -  
    1.16 -  execute.view{ module = "lf2", view = "_sidebar_initiatives", params = {
    1.17 -    initiatives = alternative_initiatives,
    1.18 -    head_content = function() ui.tag{ content = _"Alternative initiatives" } end
    1.19 -  } }
    1.20 -  
    1.21 +  execute.view{ module = "lf2", view = "_sidebar_issue", params = { issue = issue, initiative_id = initiative.id, alternative_initiatives = alternative_initiatives } }
    1.22 +
    1.23    execute.view{ module = "lf2", view = "_sidebar_drafts", params = {
    1.24      initiative = initiative
    1.25    } }
    1.26 @@ -45,52 +44,80 @@
    1.27  ui.box{
    1.28    content = function()
    1.29  
    1.30 -    ui.box_row{ class = "initiative head", content = function() ui.box_col { content = function()
    1.31 +    ui.box_row{ class = "initiative head2", content = function() ui.box_col { content = function()
    1.32        execute.view{ module = "lf2", view = "_initiative", params = { initiative = initiative } }
    1.33      end } end }
    1.34      
    1.35 -    ui.box_row{ class = "head2", content = function() ui.box_col{ content = function()
    1.36 +    ui.box_row{ class = "head", content = function() ui.box_col{ content = function()
    1.37 +      if initiative.issue.closed then
    1.38 +        if initiative.issue.accepted then
    1.39 +          if initiative.admitted then
    1.40 +            if initiative.agreed then
    1.41 +              if initiative.rank == 1 then
    1.42 +                ui.image{ static = "lf2/icon_award_gold.png" }
    1.43 +                slot.put(" ")
    1.44 +                ui.tag{ content = _"Approved" }
    1.45 +             else
    1.46 +                ui.image{ static = "lf2/icon_award_silver.png" }
    1.47 +                slot.put(" ")
    1.48 +                ui.tag{ content = _("Not approved (rank #{rank})", { rank = initiative.rank }) }
    1.49 +              end
    1.50 +            else
    1.51 +            ui.image{ static = "lf2/icon_cross.png" }
    1.52 +            slot.put(" ")
    1.53 +            ui.tag{ content = _"Initiative not approved" }
    1.54 +            end
    1.55 +          else
    1.56 +            ui.image{ static = "lf2/icon_cross.png" }
    1.57 +            slot.put(" ")
    1.58 +            ui.tag{ content = _"Initiative not admitted" }
    1.59 +          end
    1.60 +        else
    1.61 +        ui.image{ static = "lf2/icon_cross.png" }
    1.62 +        slot.put(" ")
    1.63 +        ui.tag{ content = _"Issue not accepted" }
    1.64 +        end
    1.65 +        slot.put(" ")
    1.66 +      end
    1.67 +
    1.68        if initiative.issue.fully_frozen and initiative.issue.closed then
    1.69 -        ui.link{ external = "#votes", text = _("#{vote_count} votes", { vote_count = #voting_members }) }
    1.70 +        if initiative.admitted and initiative.issue.ranks_available then
    1.71 +          slot.put(" &middot ")
    1.72 +          ui.link{ external = "#votes", text = _("#{vote_count}+#{delegated_weight} votes", { vote_count = #voting_members, delegated_weight = initiative.issue.voter_count - #voting_members }) }
    1.73 +        end
    1.74 +      end
    1.75 +      if initiative.issue.closed then
    1.76          slot.put(" · ")
    1.77        end
    1.78        ui.link{ external = "#suggestions", text = _("#{suggestion_count} suggestions", { suggestion_count = 23 })  }
    1.79        slot.put(" · ")
    1.80 -      ui.link{ external = "#supporters", text = _("#{supporter_count} supporters", { supporter_count = #supporting_members }) }
    1.81 +      ui.link{ external = "#supporters", text = _("#{supporter_count}+#{delegated_weight} supporters", { supporter_count = #supporting_members, delegated_weight = initiative.supporter_count - #supporting_members }) }
    1.82      end } end }
    1.83  
    1.84 +    execute.view{ module = "lf2", view = "_initiative_support", params = {
    1.85 +      initiative = initiative
    1.86 +    } }
    1.87 +
    1.88 +    ui.box_row{ class = "subhead", content = function() ui.box_col{ class = "head", content = _"Current draft" } end }
    1.89      ui.box_row{ content = function() ui.box_col{ content = function()
    1.90        execute.view{ module = "lf2", view = "_draft", params = { draft = draft } }
    1.91      end } end }
    1.92 -  end
    1.93 -}
    1.94  
    1.95 -if initiative.issue.fully_frozen and initiative.issue.closed then
    1.96 -  ui.boxhead{ name = "votes", content = _"Votes" }
    1.97 -  ui.box{
    1.98 -    content = function()
    1.99 +    if initiative.issue.fully_frozen and initiative.issue.closed then
   1.100 +      ui.box_row{ class = "subhead", content = function() ui.box_col{ class = "head", content = _"Voters" } end }
   1.101        ui.box_row{ content = function() ui.box_col{ content = function()
   1.102          execute.view{ module = "lf2", view = "_avatars", params = { members = voting_members } }
   1.103        end } end }
   1.104      end
   1.105 -  }
   1.106 -end
   1.107  
   1.108 -ui.boxhead{ name = "suggestions", content = _"Suggestions" }
   1.109 -ui.box{
   1.110 -  content = function()
   1.111 +    ui.box_row{ class = "subhead", content = function() ui.box_col{ class = "head", content = _"Suggestions" } end }
   1.112      ui.box_row{ content = function() ui.box_col{ content = function()
   1.113        slot.put("suggestions")
   1.114      end } end }
   1.115 -  end
   1.116 -}
   1.117 -    
   1.118 -ui.boxhead{ name = "supporters", content = _"Supporters" }
   1.119 -ui.box{
   1.120 -  content = function()
   1.121 +
   1.122 +    ui.box_row{ class = "subhead", content = function() ui.box_col{ class = "head", content = _"Supporters" } end }
   1.123      ui.box_row{ content = function() ui.box_col{ content = function()
   1.124        execute.view{ module = "lf2", view = "_avatars", params = { members = supporting_members } }
   1.125      end } end }
   1.126 -  end
   1.127 -}
   1.128 -    
   1.129 +
   1.130 +end }

Impressum / About Us