liquid_feedback_frontend

annotate app/main/timeline/_list.lua @ 159:5d797c6706d5

implement quorum display

show the initiative quorum as a small 1px line in bargraph
allow to update your support on the diff page
better linked title in diff page
show absolute quorum numbers in detail pages of issue and initiative
author Daniel Poelzleithner <poelzi@poelzi.org>
date Sat Oct 09 03:42:48 2010 +0200 (2010-10-09)
parents 90520c9fca44
children d37dce888225
rev   line source
bsw@11 1 local timeline_selector = param.get("timeline_selector", "table")
bsw@11 2 local event_names = param.get("event_names", "table")
bsw@11 3 local initiatives_per_page = param.get("initiatives_per_page", atom.number) or 3
bsw@11 4
poelzi@136 5
poelzi@136 6 -- test if selector is valid
poelzi@136 7 local test_selector = timeline_selector:get_db_conn():new_selector()
poelzi@136 8 test_selector:add_field('count(1)')
poelzi@136 9 test_selector:add_from(timeline_selector)
poelzi@136 10 test_selector:single_object_mode()
poelzi@136 11
poelzi@136 12 err, x = test_selector:try_exec()
bsw/jbe@19 13
poelzi@136 14 if err then
poelzi@136 15 slot.put_into("error", _"Invalid query")
poelzi@136 16 else
poelzi@136 17 ui.paginate{
poelzi@136 18 per_page = param.get("per_page", atom.number) or 25,
poelzi@136 19 selector = timeline_selector,
poelzi@145 20 container_attr = { class = "ui_paginate timeline_results" },
poelzi@136 21 content = function()
poelzi@136 22 local timelines = timeline_selector:exec()
poelzi@136 23 timelines:load("issue")
poelzi@136 24 timelines:load("initiative")
poelzi@136 25 timelines:load("member")
poelzi@136 26 ui.list{
poelzi@136 27 attr = { class = "nohover" },
poelzi@136 28 records = timelines,
poelzi@136 29 columns = {
poelzi@136 30 {
poelzi@136 31 field_attr = { style = "width: 10em;" },
poelzi@136 32 content = function(timeline)
bsw/jbe@19 33 ui.field.text{
poelzi@136 34 attr = { style = "font-size: 75%; font-weight: bold; background-color: #ccc; display: block; margin-bottom: 1ex;"},
poelzi@136 35 value = format.time(timeline.occurrence)
bsw/jbe@19 36 }
poelzi@136 37
poelzi@136 38 ui.field.text{
poelzi@136 39 attr = { style = "font-size: 75%; font-weight: bold;"},
poelzi@136 40 value = event_names[timeline.event] or timeline.event
poelzi@136 41 }
poelzi@136 42 if timeline.event == "draft_created" and timeline.count > 1 then
poelzi@136 43 ui.field.text{
poelzi@136 44 attr = { style = "font-size: 75%;"},
poelzi@136 45 value = _("(#{more_count} duplicates removed)", { more_count = timeline.count - 1 })
bsw@11 46 }
bsw@11 47 end
bsw@11 48 end
poelzi@136 49 },
poelzi@136 50 {
poelzi@136 51 content = function(timeline)
poelzi@136 52 local issue
poelzi@136 53 local initiative
poelzi@136 54 if timeline.issue then
poelzi@136 55 issue = timeline.issue
poelzi@136 56 elseif timeline.initiative then
poelzi@136 57 initiative = timeline.initiative
poelzi@136 58 issue = initiative.issue
poelzi@136 59 elseif timeline.draft then
poelzi@136 60 initiative = timeline.draft.initiative
poelzi@136 61 issue = initiative.issue
poelzi@136 62 elseif timeline.suggestion then
poelzi@136 63 initiative = timeline.suggestion.initiative
poelzi@136 64 issue = initiative.issue
poelzi@136 65 end
poelzi@136 66 if issue then
poelzi@136 67 if timeline.is_interested then
poelzi@136 68 local label = _"You are interested in this issue",
poelzi@136 69 ui.image{
poelzi@136 70 attr = { alt = label, title = label, style = "float: left; margin-right: 0.5em;" },
poelzi@136 71 static = "icons/16/eye.png"
poelzi@136 72 }
poelzi@136 73 end
poelzi@136 74 slot.put(" ")
poelzi@136 75 ui.tag{
poelzi@136 76 tag = "span",
poelzi@136 77 attr = { style = "font-size: 75%; font-weight: bold; background-color: #ccc; display: block; margin-bottom: 1ex;"},
poelzi@136 78 content = issue.area.name .. ", " .. _("Issue ##{id}", { id = issue.id })
poelzi@136 79 }
poelzi@136 80 else
poelzi@136 81 ui.tag{
poelzi@136 82 tag = "span",
poelzi@136 83 attr = { style = "font-size: 75%; background-color: #ccc; display: block; margin-bottom: 1ex;"},
poelzi@136 84 content = function() slot.put("&nbsp;") end
poelzi@136 85 }
poelzi@136 86 end
poelzi@136 87
poelzi@136 88 if timeline.member then
poelzi@136 89 execute.view{
poelzi@136 90 module = "member_image",
poelzi@136 91 view = "_show",
poelzi@136 92 params = {
poelzi@136 93 member = timeline.member,
poelzi@136 94 image_type = "avatar",
poelzi@136 95 show_dummy = true
poelzi@136 96 }
bsw@11 97 }
poelzi@136 98 ui.link{
poelzi@136 99 content = timeline.member.name,
poelzi@136 100 module = "member",
poelzi@136 101 view = "show",
poelzi@136 102 id = timeline.member.id
poelzi@136 103 }
poelzi@136 104 end
poelzi@136 105 if timeline.issue then
poelzi@136 106 local initiatives_selector = timeline.issue
poelzi@136 107 :get_reference_selector("initiatives")
poelzi@136 108 execute.view{
poelzi@136 109 module = "initiative",
poelzi@136 110 view = "_list",
poelzi@136 111 params = {
poelzi@136 112 issue = timeline.issue,
poelzi@136 113 initiatives_selector = initiatives_selector,
poelzi@136 114 per_page = initiatives_per_page,
poelzi@136 115 no_sort = true,
poelzi@136 116 limit = initiatives_per_page
poelzi@136 117 }
bsw@11 118 }
poelzi@136 119 elseif initiative then
poelzi@136 120 execute.view{
poelzi@136 121 module = "initiative",
poelzi@136 122 view = "_list",
poelzi@136 123 params = {
poelzi@136 124 issue = initiative.issue,
poelzi@136 125 initiatives_selector = Initiative:new_selector():add_where{ "initiative.id = ?", initiative.id },
poelzi@136 126 per_page = initiatives_per_page,
poelzi@136 127 no_sort = true
poelzi@136 128 }
poelzi@136 129 }
poelzi@136 130 end
poelzi@136 131 if timeline.suggestion then
poelzi@136 132 ui.link{
poelzi@136 133 module = "suggestion",
poelzi@136 134 view = "show",
poelzi@136 135 id = timeline.suggestion.id,
poelzi@136 136 content = timeline.suggestion.name
poelzi@136 137 }
poelzi@136 138 end
bsw@11 139 end
poelzi@136 140 },
poelzi@136 141 }
bsw@11 142 }
poelzi@136 143 end
poelzi@136 144 }
poelzi@136 145 end

Impressum / About Us