liquid_feedback_frontend
diff app/main/lf2/_areas.lua @ 215:1dab81353eb1
More enhancements for second generation frontend
author | bsw |
---|---|
date | Sat Mar 05 15:34:17 2011 +0100 (2011-03-05) |
parents | 3e4ad069847a |
children |
line diff
1.1 --- a/app/main/lf2/_areas.lua Thu Mar 03 23:47:35 2011 +0100 1.2 +++ b/app/main/lf2/_areas.lua Sat Mar 05 15:34:17 2011 +0100 1.3 @@ -1,6 +1,7 @@ 1.4 local areas = param.get("areas_selector", "table"):exec() 1.5 local current_area_id = param.get("current_area_id", atom.integer) 1.6 local head_content = param.get("head_content", "function") 1.7 +local current_phase = param.get("current_phase") 1.8 1.9 if #areas == 0 then 1.10 return 1.11 @@ -8,34 +9,32 @@ 1.12 1.13 areas:load("membership_for_member", { member_id = app.session.member_id}, "membership") 1.14 1.15 -ui.box{ class = "areas", row_count = #areas + 1, content = function() 1.16 - if head_content then 1.17 - ui.box_row{ class = "head", content = function() ui.box_col{ class = "head", content = function() 1.18 - ui.link{ content = head_content, module = "lf2", view = "index" } 1.19 - end } end } 1.20 +for i, area in ipairs(areas) do 1.21 + local delegation = Delegation:by_pk(app.session.member_id, area.id) 1.22 + 1.23 + local class = "area" 1.24 + if (current_area_id and area.id == current_area_id) 1.25 + or (not current_area_id and area.membership) 1.26 + then 1.27 + class = class .. " active" 1.28 end 1.29 - 1.30 - for i, area in ipairs(areas) do 1.31 - local delegation = Delegation:by_pk(app.session.member_id, area.id) 1.32 - 1.33 - local class = "area" 1.34 - if (current_area_id and area.id == current_area_id) 1.35 - or (not current_area_id and area.membership) 1.36 - then 1.37 - class = class .. " active" 1.38 + ui.box_row{ 1.39 + class = class, 1.40 + content = function() 1.41 + ui.box_col{ class = "name", content = function() 1.42 + if delegation then 1.43 + execute.view{ module = "lf2", view = "_avatars", params = { 1.44 + members = { delegation.trustee }, size = "small" 1.45 + } } 1.46 + end 1.47 + ui.link{ 1.48 + module = "lf2", view = "area", id = area.id, params = { 1.49 + phase = current_phase, order = current_order 1.50 + }, 1.51 + text = area.name 1.52 + } 1.53 + end } 1.54 end 1.55 - ui.box_row{ 1.56 - class = class, 1.57 - content = function() 1.58 - ui.box_col{ class = "name", content = function() 1.59 - if delegation then 1.60 - execute.view{ module = "lf2", view = "_avatars", params = { members = { delegation.trustee }, size = "small" } } 1.61 - end 1.62 - ui.link{ module = "lf2", view = "area", id = area.id, text = area.name } 1.63 - end } 1.64 - end 1.65 - } 1.66 - 1.67 - end 1.68 - 1.69 -end } 1.70 + } 1.71 + 1.72 +end