liquid_feedback_frontend

diff app/main/lf2/interest.lua @ 216:4f6e6b213fb8

Cleanup on second generation frontend code and stylesheet
author bsw
date Mon Mar 07 12:15:22 2011 +0100 (2011-03-07)
parents 1dab81353eb1
children 73dbc9e2bfd4
line diff
     1.1 --- a/app/main/lf2/interest.lua	Sat Mar 05 15:34:17 2011 +0100
     1.2 +++ b/app/main/lf2/interest.lua	Mon Mar 07 12:15:22 2011 +0100
     1.3 @@ -1,20 +1,27 @@
     1.4  slot.set_layout("lf2")
     1.5  
     1.6 +slot.put_into("leftright_pre", '<div class="sidebar_right">')
     1.7 +slot.put_into("leftright_post", '</div>')
     1.8  
     1.9 -local issue = Issue:by_id(param.get_id())
    1.10 -local member = Member:by_id(param.get("member", atom.integer))
    1.11 +local issue = Issue:by_id(param.get("issue_id", atom.integer))
    1.12 +local member = Member:by_id(param.get("member_id", atom.integer))
    1.13  
    1.14  local area = issue.area
    1.15  
    1.16  -- TODO broken
    1.17  --issue:load("interested_members_snapshot", {}, "interested_members")
    1.18 -issue:load("delegating_interest_snapshot_for_member", { member_id = app.session.member_id }, "delegating_interest")
    1.19 -issue:load("interest_for_member", { member_id = app.session.member_id }, "interest")
    1.20 -issue:load("outgoing_delegations_for_member", { member_id = app.session.member_id }, "outgoing_delegations")
    1.21 +issue:load("delegating_interest_snapshot_for_member", { member_id = member.id }, "delegating_interest")
    1.22 +issue:load("interest_for_member", { member_id = member.id }, "interest")
    1.23 +issue:load("outgoing_delegations_for_member", { member_id = member.id }, "outgoing_delegations")
    1.24 +issue:load("trusters_for_member", { member_id = member.id }, "trusters")
    1.25  
    1.26  local initiatives = issue.initiatives
    1.27  
    1.28 -local interested_members = issue.interested_members
    1.29 +local supported_initiatives = Initiative:new_selector()
    1.30 +  :add_where{ "initiative.issue_id = ?", issue.id }
    1.31 +  :join("supporter", nil, { "supporter.initiative_id = initiative.id AND supporter.member_id = ?", member.id })
    1.32 +  :exec()
    1.33 +
    1.34  
    1.35  local interest = issue.interest
    1.36  
    1.37 @@ -22,7 +29,7 @@
    1.38  
    1.39  local trustees = Member:new_selector()
    1.40    :add_field("delegation_chain.*")
    1.41 -  :join("delegation_chain(" .. tostring(app.session.member.id) .. ", " .. tostring(area_id or "NULL") .. ", " .. tostring(issue_id or "NULL") .. ")", "delegation_chain", "member.id = delegation_chain.member_id")
    1.42 +  :join("delegation_chain(" .. tostring(member.id) .. ", " .. tostring(issue.area_id or "NULL") .. ", " .. tostring(issue_id or "NULL") .. ")", "delegation_chain", "member.id = delegation_chain.member_id")
    1.43    :add_order_by("index")
    1.44    :exec()
    1.45          
    1.46 @@ -45,17 +52,54 @@
    1.47  app.topnav_area_id = issue.area_id
    1.48  
    1.49  slot.select("sidebar", function()
    1.50 -  execute.view{ module = "lf2", view = "_sidebar_unit", params = { current_area_id = issue.area_id } }
    1.51 +  execute.view{ module = "lf2", view = "_sidebar_issue", params = { issue = issue, alternative_initiatives = initiatives } }
    1.52 +
    1.53  end)
    1.54  
    1.55 -execute.view{ module = "lf2", view = "_area", params = { area = area } }
    1.56 -
    1.57 -execute.view{ module = "lf2", view = "_issues", params = { issues = { issue } } }
    1.58 +ui.box{ content = function()
    1.59 +  ui.box_row{ class = "head", content = function() ui.box_col{ class = "head", content = function()
    1.60 +    ui.link{ module = "lf2", view = "member", id = member.id, content = function()
    1.61 +      ui.avatar(member)
    1.62 +      slot.put(" ")
    1.63 +      ui.tag{ content = member.name }
    1.64 +    end }
    1.65 +  end } end }
    1.66 +  if not member.active then
    1.67 +    ui.box_row{ class = "head", content = function() ui.box_col{ class = "head", content = function()
    1.68 +      ui.tag{ content = _"Member is deactivated" }
    1.69 +    end } end }
    1.70 +  end
    1.71 +  ui.box_row{ content = function() ui.box_col{ content = function()
    1.72 +    if interest then
    1.73 +      ui.image{ static = "lf2/icon_star.png" }
    1.74 +      slot.put(" ")
    1.75 +      ui.tag{ content = _"Member is interested in this issue" }
    1.76 +    elseif delegating_interest then
    1.77 +      ui.image{ static = "lf2/icon_delegated_star.png" }
    1.78 +      slot.put(" ")
    1.79 +      ui.tag{ content = _"Someone in members delegation chain is interested" }
    1.80 +    else
    1.81 +      ui.image{ static = "lf2/icon_star_grey.png" }
    1.82 +      slot.put(" ")
    1.83 +      ui.tag{ content = _"Member is not interested" }
    1.84 +    end
    1.85 +  end } end }
    1.86 +  if #trustees > 1 then
    1.87 +    ui.box_row{ content = function() ui.box_col{ content = function()
    1.88 +      execute.view{ module = "lf2", view = "_avatars", params = { members = trustees, arrows = true, size = "small", issue_id = issue.id } }
    1.89 +    end } end }
    1.90 +  end
    1.91  
    1.92 --- TODO bugfix for not working reference loader
    1.93 -interested_members = issue:get_reference_selector("interested_members_snapshot"):exec()
    1.94 +  ui.box_row{ class = "subhead", content = function() ui.box_col{ class = "head", content = _"Statement about issue" } end }  
    1.95 +
    1.96 +  ui.box_row{ class = "subhead", content = function() ui.box_col{ class = "head", content = _"Supported initiatives" } end }
    1.97 +  execute.view{ module = "lf2", view = "_initiatives", params = { initiatives = supported_initiatives } }
    1.98  
    1.99 -execute.view{ module = "lf2", view = "_interested", params = {
   1.100 -  interested_members = interested_members
   1.101 -} }
   1.102 +  ui.box_row{ class = "subhead", content = function() ui.box_col{ class = "head", content = _"Incoming delegations" } end }
   1.103 +  ui.box_row{ content = function() ui.box_col{ content = function()
   1.104 +    execute.view{ module = "lf2", view = "_avatars", params = { members = issue.trusters, size = "small", issue_id = issue.id } }
   1.105 +  end } end }
   1.106  
   1.107 +
   1.108 +end }
   1.109 +

Impressum / About Us