liquid_feedback_frontend

annotate app/main/timeline/_list.lua @ 18:fc9e748660c8

Added tag beta9 for changeset 76a83a88367a
author jbe
date Tue Feb 02 00:31:06 2010 +0100 (2010-02-02)
parents 77d58efe99fd
children 00d1004545f1
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
bsw@11 5 ui.paginate{
bsw@11 6 per_page = param.get("per_page", atom.number) or 25,
bsw@11 7 selector = timeline_selector,
bsw@11 8 content = function()
bsw@11 9 local timelines = timeline_selector:exec()
bsw@11 10 timelines:load("issue")
bsw@11 11 timelines:load("initiative")
bsw@11 12 timelines:load("member")
bsw@11 13 ui.list{
bsw@11 14 attr = { class = "nohover" },
bsw@11 15 records = timelines,
bsw@11 16 columns = {
bsw@11 17 {
bsw@11 18 field_attr = { style = "width: 10em;" },
bsw@11 19 content = function(timeline)
bsw@11 20 ui.field.text{
bsw@11 21 attr = { style = "font-size: 75%; font-weight: bold; background-color: #ccc; display: block; margin-bottom: 1ex;"},
bsw@11 22 value = format.time(timeline.occurrence)
bsw@11 23 }
bsw@11 24 ui.field.text{
bsw@11 25 attr = { style = "font-size: 75%; font-weight: bold;"},
bsw@11 26 value = event_names[timeline.event] or timeline.event
bsw@11 27 }
bsw@11 28 end
bsw@11 29 },
bsw@11 30 {
bsw@11 31 content = function(timeline)
bsw@11 32 local issue
bsw@11 33 local initiative
bsw@11 34 if timeline.issue then
bsw@11 35 issue = timeline.issue
bsw@11 36 elseif timeline.initiative then
bsw@11 37 initiative = timeline.initiative
bsw@11 38 issue = initiative.issue
bsw@11 39 elseif timeline.draft then
bsw@11 40 initiative = timeline.draft.initiative
bsw@11 41 issue = initiative.issue
bsw@11 42 elseif timeline.suggestion then
bsw@11 43 initiative = timeline.suggestion.initiative
bsw@11 44 issue = initiative.issue
bsw@11 45 end
bsw@11 46 if issue then
bsw@11 47 if timeline.is_interested then
bsw@11 48 local label = _"You are interested in this issue",
bsw@11 49 ui.image{
bsw@11 50 attr = { alt = label, title = label, style = "float: left; margin-right: 0.5em;" },
bsw@11 51 static = "icons/16/eye.png"
bsw@11 52 }
bsw@11 53 end
bsw@11 54 slot.put(" ")
bsw@11 55 ui.tag{
bsw@11 56 tag = "span",
bsw@11 57 attr = { style = "font-size: 75%; font-weight: bold; background-color: #ccc; display: block; margin-bottom: 1ex;"},
bsw@11 58 content = issue.area.name .. ", " .. _("Issue ##{id}", { id = issue.id })
bsw@11 59 }
bsw@11 60 else
bsw@11 61 ui.tag{
bsw@11 62 tag = "span",
bsw@11 63 attr = { style = "font-size: 75%; background-color: #ccc; display: block; margin-bottom: 1ex;"},
bsw@11 64 content = function() slot.put(" ") end
bsw@11 65 }
bsw@11 66 end
bsw@11 67
bsw@11 68 if timeline.member then
bsw@11 69 execute.view{
bsw@11 70 module = "member_image",
bsw@11 71 view = "_show",
bsw@11 72 params = {
bsw@11 73 member = timeline.member,
bsw@11 74 image_type = "avatar",
bsw@11 75 show_dummy = true
bsw@11 76 }
bsw@11 77 }
bsw@11 78 ui.link{
bsw@11 79 content = timeline.member.name,
bsw@11 80 module = "member",
bsw@11 81 view = "show",
bsw@11 82 id = timeline.member.id
bsw@11 83 }
bsw@11 84 end
bsw@11 85 if timeline.issue then
bsw@11 86 local initiatives_selector = timeline.issue
bsw@11 87 :get_reference_selector("initiatives")
bsw@11 88 execute.view{
bsw@11 89 module = "initiative",
bsw@11 90 view = "_list",
bsw@11 91 params = {
bsw@11 92 issue = timeline.issue,
bsw@11 93 initiatives_selector = initiatives_selector,
bsw@11 94 per_page = initiatives_per_page,
bsw@11 95 no_sort = true,
bsw@11 96 limit = initiatives_per_page
bsw@11 97 }
bsw@11 98 }
bsw@11 99 elseif initiative then
bsw@11 100 execute.view{
bsw@11 101 module = "initiative",
bsw@11 102 view = "_list",
bsw@11 103 params = {
bsw@11 104 issue = initiative.issue,
bsw@11 105 initiatives_selector = Initiative:new_selector():add_where{ "initiative.id = ?", initiative.id },
bsw@11 106 per_page = initiatives_per_page,
bsw@11 107 no_sort = true
bsw@11 108 }
bsw@11 109 }
bsw@11 110 end
bsw@11 111 if timeline.suggestion then
bsw@11 112 ui.link{
bsw@11 113 module = "suggestion",
bsw@11 114 view = "show",
bsw@11 115 id = timeline.suggestion.id,
bsw@11 116 content = timeline.suggestion.name
bsw@11 117 }
bsw@11 118 end
bsw@11 119 end
bsw@11 120 },
bsw@11 121 }
bsw@11 122 }
bsw@11 123 end
bsw@11 124 }

Impressum / About Us