liquid_feedback_frontend
changeset 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 |
files | app/main/timeline/_action/update.lua app/main/timeline/_list.lua app/main/timeline/index.lua locale/translations.de.lua locale/translations.en.lua static/style.css |
line diff
1.1 --- a/app/main/timeline/_action/update.lua Wed Oct 06 18:15:23 2010 +0200 1.2 +++ b/app/main/timeline/_action/update.lua Thu Oct 07 00:35:48 2010 +0200 1.3 @@ -28,6 +28,10 @@ 1.4 end 1.5 end 1.6 1.7 +if param.get_list("option_ignore_area", atom.string) then 1.8 + options_string = options_string.." ignore_area:"..table.concat(param.get_list("option_ignore_area", atom.string), "|") 1.9 +end 1.10 + 1.11 if not options_string then 1.12 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:* " 1.13 end
2.1 --- a/app/main/timeline/_list.lua Wed Oct 06 18:15:23 2010 +0200 2.2 +++ b/app/main/timeline/_list.lua Thu Oct 07 00:35:48 2010 +0200 2.3 @@ -17,6 +17,7 @@ 2.4 ui.paginate{ 2.5 per_page = param.get("per_page", atom.number) or 25, 2.6 selector = timeline_selector, 2.7 + container_attr = { class = "ui_paginate timeline_results" }, 2.8 content = function() 2.9 local timelines = timeline_selector:exec() 2.10 timelines:load("issue")
3.1 --- a/app/main/timeline/index.lua Wed Oct 06 18:15:23 2010 +0200 3.2 +++ b/app/main/timeline/index.lua Thu Oct 07 00:35:48 2010 +0200 3.3 @@ -4,6 +4,7 @@ 3.4 } 3.5 3.6 local active_name = "" 3.7 +local areas_ignored = {} 3.8 local options_box_count = param.get("options_box_count", atom.number) or 1 3.9 if options_box_count > 10 then 3.10 options_box_count = 10 3.11 @@ -43,6 +44,7 @@ 3.12 image = { static = "icons/16/time.png" }, 3.13 attr = { class = active and "action_active" or nil }, 3.14 text = name, 3.15 + form_attr = { class = "inline" }, 3.16 module = 'timeline', 3.17 action = 'update', 3.18 params = { 3.19 @@ -280,6 +282,25 @@ 3.20 3.21 slot.put("</table>") 3.22 3.23 + local areas = Area:new_selector():add_where("active='t'"):exec() 3.24 + for i, area in ipairs(areas) do 3.25 + if param.get("option_ignore_area_"..tostring(area.id)) then 3.26 + areas_ignored[#areas_ignored+1] = area.id 3.27 + end 3.28 + end 3.29 + 3.30 + ui.multiselect{ 3.31 + style = "checkbox", 3.32 + selected_ids = areas_ignored, 3.33 + container_attr = { class = "ignore_area_list" }, 3.34 + container2_attr = { class = "ignore_area_item" }, 3.35 + label = _"Ignore Areas", 3.36 + name = "option_ignore_area[]", 3.37 + foreign_records = areas, 3.38 + foreign_id = "id", 3.39 + foreign_name = "name" 3.40 + } 3.41 + 3.42 end 3.43 } 3.44 end 3.45 @@ -342,6 +363,9 @@ 3.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) 3.47 -- :left_join("member", nil, "member.id = timeline.member_id", group) 3.48 3.49 + if #areas_ignored > 0 then 3.50 + tmp:add_where{"area.id NOT IN ($)", areas_ignored} 3.51 + end 3.52 3.53 tmp:add_where{ "event = ?", event } 3.54
4.1 --- a/locale/translations.de.lua Wed Oct 06 18:15:23 2010 +0200 4.2 +++ b/locale/translations.de.lua Thu Oct 07 00:35:48 2010 +0200 4.3 @@ -183,6 +183,7 @@ 4.4 ["Id"] = "Id"; 4.5 ["Ident number"] = "Ident-Nummer"; 4.6 ["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"; 4.7 +["Ignore Areas"] = "Ignoriere Bereiche"; 4.8 ["Images"] = "Bilder"; 4.9 ["In discussion"] = "In Diskussion"; 4.10 ["Incoming delegations"] = "Eingehende Delegationen";
5.1 --- a/locale/translations.en.lua Wed Oct 06 18:15:23 2010 +0200 5.2 +++ b/locale/translations.en.lua Thu Oct 07 00:35:48 2010 +0200 5.3 @@ -183,6 +183,7 @@ 5.4 ["Id"] = false; 5.5 ["Ident number"] = false; 5.6 ["If this link is not working, please open following url in your web browser:\n\n"] = false; 5.7 +["Ignore Areas"] = false; 5.8 ["Images"] = false; 5.9 ["In discussion"] = false; 5.10 ["Incoming delegations"] = false;
6.1 --- a/static/style.css Wed Oct 06 18:15:23 2010 +0200 6.2 +++ b/static/style.css Thu Oct 07 00:35:48 2010 +0200 6.3 @@ -70,6 +70,9 @@ 6.4 font-size: 125%; 6.5 } 6.6 6.7 +.inline { 6.8 + display: inline; 6.9 +} 6.10 6.11 /************************************************************************* 6.12 * Notices, warnings and errors 6.13 @@ -1176,4 +1179,49 @@ 6.14 cursor: move; 6.15 } 6.16 6.17 +/************************************************************************* 6.18 + * timeline 6.19 + */ 6.20 +div.ignore_area_list { 6.21 + float: left; 6.22 + width: 90%; 6.23 + margin: 20px 0 1em 0; 6.24 +} 6.25 6.26 +div.ignore_area_list > 6.27 +label.ui_field_label { 6.28 + text-align: left ; 6.29 + width: 100%; 6.30 + border-bottom:1px solid #000000; 6.31 + color: #000000; 6.32 + font-size:75%; 6.33 + font-weight:bold; 6.34 + vertical-align:bottom; 6.35 + text-transform:none; 6.36 + padding:0.5ex 0.5em 6.37 +} 6.38 + 6.39 +div.ignore_area_item { 6.40 + clear: none; 6.41 + float: left; 6.42 + width: 20em; 6.43 + margin: 0.1ex 0.5em; 6.44 +} 6.45 + 6.46 +div.ignore_area_item > input { 6.47 + float: none; 6.48 + clear: none; 6.49 + display: inline; 6.50 +} 6.51 + 6.52 +div.ignore_area_item > 6.53 +label.ui_field_label { 6.54 + float: none; 6.55 + clear: none; 6.56 + text-align: left; 6.57 + display: inline; 6.58 +} 6.59 + 6.60 +div.timeline_results { 6.61 + clear: both; 6.62 +}