liquid_feedback_frontend
diff app/main/timeline/index.lua @ 145:90520c9fca44
implement area filter in timeline
allows the user to ignore any area in the timeline filter.
better display in javascript off
allows the user to ignore any area in the timeline filter.
better display in javascript off
| author | Daniel Poelzleithner <poelzi@poelzi.org> |
|---|---|
| date | Thu Oct 07 00:35:48 2010 +0200 (2010-10-07) |
| parents | 7c3e8a1678fc |
| children | 77260f05fd4b |
line diff
1.1 --- a/app/main/timeline/index.lua Wed Oct 06 18:15:23 2010 +0200 1.2 +++ b/app/main/timeline/index.lua Thu Oct 07 00:35:48 2010 +0200 1.3 @@ -4,6 +4,7 @@ 1.4 } 1.5 1.6 local active_name = "" 1.7 +local areas_ignored = {} 1.8 local options_box_count = param.get("options_box_count", atom.number) or 1 1.9 if options_box_count > 10 then 1.10 options_box_count = 10 1.11 @@ -43,6 +44,7 @@ 1.12 image = { static = "icons/16/time.png" }, 1.13 attr = { class = active and "action_active" or nil }, 1.14 text = name, 1.15 + form_attr = { class = "inline" }, 1.16 module = 'timeline', 1.17 action = 'update', 1.18 params = { 1.19 @@ -280,6 +282,25 @@ 1.20 1.21 slot.put("</table>") 1.22 1.23 + local areas = Area:new_selector():add_where("active='t'"):exec() 1.24 + for i, area in ipairs(areas) do 1.25 + if param.get("option_ignore_area_"..tostring(area.id)) then 1.26 + areas_ignored[#areas_ignored+1] = area.id 1.27 + end 1.28 + end 1.29 + 1.30 + ui.multiselect{ 1.31 + style = "checkbox", 1.32 + selected_ids = areas_ignored, 1.33 + container_attr = { class = "ignore_area_list" }, 1.34 + container2_attr = { class = "ignore_area_item" }, 1.35 + label = _"Ignore Areas", 1.36 + name = "option_ignore_area[]", 1.37 + foreign_records = areas, 1.38 + foreign_id = "id", 1.39 + foreign_name = "name" 1.40 + } 1.41 + 1.42 end 1.43 } 1.44 end 1.45 @@ -342,6 +363,9 @@ 1.46 :add_field({"EXISTS(SELECT NULL FROM opinion WHERE opinion.initiative_id = initiative.id AND opinion.member_id = ? AND ((opinion.degree = 2 AND NOT fulfilled) OR (opinion.degree = -2 AND fulfilled)) LIMIT 1)", app.session.member.id }, "is_potential_supporter", group) 1.47 -- :left_join("member", nil, "member.id = timeline.member_id", group) 1.48 1.49 + if #areas_ignored > 0 then 1.50 + tmp:add_where{"area.id NOT IN ($)", areas_ignored} 1.51 + end 1.52 1.53 tmp:add_where{ "event = ?", event } 1.54