# HG changeset patch # User Daniel Poelzleithner # Date 1286404548 -7200 # Node ID 90520c9fca445f00fed49c282873203b9de90b53 # Parent 7c3e8a1678fc61734d908853512d40675230a041 implement area filter in timeline allows the user to ignore any area in the timeline filter. better display in javascript off diff -r 7c3e8a1678fc -r 90520c9fca44 app/main/timeline/_action/update.lua --- a/app/main/timeline/_action/update.lua Wed Oct 06 18:15:23 2010 +0200 +++ b/app/main/timeline/_action/update.lua Thu Oct 07 00:35:48 2010 +0200 @@ -28,6 +28,10 @@ end end +if param.get_list("option_ignore_area", atom.string) then + options_string = options_string.." ignore_area:"..table.concat(param.get_list("option_ignore_area", atom.string), "|") +end + if not options_string then options_string = "issue_created:* issue_finished_after_voting:* issue_accepted:* issue_voting_started:* suggestion_created:* issue_canceled:* initiative_created:* issue_finished_without_voting:* draft_created:* initiative_revoked:* issue_half_frozen:* " end diff -r 7c3e8a1678fc -r 90520c9fca44 app/main/timeline/_list.lua --- a/app/main/timeline/_list.lua Wed Oct 06 18:15:23 2010 +0200 +++ b/app/main/timeline/_list.lua Thu Oct 07 00:35:48 2010 +0200 @@ -17,6 +17,7 @@ ui.paginate{ per_page = param.get("per_page", atom.number) or 25, selector = timeline_selector, + container_attr = { class = "ui_paginate timeline_results" }, content = function() local timelines = timeline_selector:exec() timelines:load("issue") diff -r 7c3e8a1678fc -r 90520c9fca44 app/main/timeline/index.lua --- a/app/main/timeline/index.lua Wed Oct 06 18:15:23 2010 +0200 +++ b/app/main/timeline/index.lua Thu Oct 07 00:35:48 2010 +0200 @@ -4,6 +4,7 @@ } local active_name = "" +local areas_ignored = {} local options_box_count = param.get("options_box_count", atom.number) or 1 if options_box_count > 10 then options_box_count = 10 @@ -43,6 +44,7 @@ image = { static = "icons/16/time.png" }, attr = { class = active and "action_active" or nil }, text = name, + form_attr = { class = "inline" }, module = 'timeline', action = 'update', params = { @@ -280,6 +282,25 @@ slot.put("") + local areas = Area:new_selector():add_where("active='t'"):exec() + for i, area in ipairs(areas) do + if param.get("option_ignore_area_"..tostring(area.id)) then + areas_ignored[#areas_ignored+1] = area.id + end + end + + ui.multiselect{ + style = "checkbox", + selected_ids = areas_ignored, + container_attr = { class = "ignore_area_list" }, + container2_attr = { class = "ignore_area_item" }, + label = _"Ignore Areas", + name = "option_ignore_area[]", + foreign_records = areas, + foreign_id = "id", + foreign_name = "name" + } + end } end @@ -342,6 +363,9 @@ :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) -- :left_join("member", nil, "member.id = timeline.member_id", group) + if #areas_ignored > 0 then + tmp:add_where{"area.id NOT IN ($)", areas_ignored} + end tmp:add_where{ "event = ?", event } diff -r 7c3e8a1678fc -r 90520c9fca44 locale/translations.de.lua --- a/locale/translations.de.lua Wed Oct 06 18:15:23 2010 +0200 +++ b/locale/translations.de.lua Thu Oct 07 00:35:48 2010 +0200 @@ -183,6 +183,7 @@ ["Id"] = "Id"; ["Ident number"] = "Ident-Nummer"; ["If this link is not working, please open following url in your web browser:\n\n"] = "Sollte der Link nicht funktionieren, öffne bitte die folgenden URL in Deinem Web-Browser:\n\n"; +["Ignore Areas"] = "Ignoriere Bereiche"; ["Images"] = "Bilder"; ["In discussion"] = "In Diskussion"; ["Incoming delegations"] = "Eingehende Delegationen"; diff -r 7c3e8a1678fc -r 90520c9fca44 locale/translations.en.lua --- a/locale/translations.en.lua Wed Oct 06 18:15:23 2010 +0200 +++ b/locale/translations.en.lua Thu Oct 07 00:35:48 2010 +0200 @@ -183,6 +183,7 @@ ["Id"] = false; ["Ident number"] = false; ["If this link is not working, please open following url in your web browser:\n\n"] = false; +["Ignore Areas"] = false; ["Images"] = false; ["In discussion"] = false; ["Incoming delegations"] = false; diff -r 7c3e8a1678fc -r 90520c9fca44 static/style.css --- a/static/style.css Wed Oct 06 18:15:23 2010 +0200 +++ b/static/style.css Thu Oct 07 00:35:48 2010 +0200 @@ -70,6 +70,9 @@ font-size: 125%; } +.inline { + display: inline; +} /************************************************************************* * Notices, warnings and errors @@ -1176,4 +1179,49 @@ cursor: move; } +/************************************************************************* + * timeline + */ +div.ignore_area_list { + float: left; + width: 90%; + margin: 20px 0 1em 0; +} +div.ignore_area_list > +label.ui_field_label { + text-align: left ; + width: 100%; + border-bottom:1px solid #000000; + color: #000000; + font-size:75%; + font-weight:bold; + vertical-align:bottom; + text-transform:none; + padding:0.5ex 0.5em +} + +div.ignore_area_item { + clear: none; + float: left; + width: 20em; + margin: 0.1ex 0.5em; +} + +div.ignore_area_item > input { + float: none; + clear: none; + display: inline; +} + +div.ignore_area_item > +label.ui_field_label { + float: none; + clear: none; + text-align: left; + display: inline; +} + +div.timeline_results { + clear: both; +}