Commits

Daniel Poelzleithner committed 90520c9

implement area filter in timeline

allows the user to ignore any area in the timeline filter.
better display in javascript off

  • Participants
  • Parent commits 7c3e8a1

Comments (0)

Files changed (6)

app/main/timeline/_action/update.lua

   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

app/main/timeline/_list.lua

   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")

app/main/timeline/index.lua

 }
 
 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
       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 = {
 
         slot.put("</table>")
 
+        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
         :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 }
 

locale/translations.de.lua

 ["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";

locale/translations.en.lua

 ["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;
   font-size: 125%;
 }
 
+.inline {
+  display: inline;
+}
 
 /*************************************************************************
  * Notices, warnings and errors
   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;
+}