liquid_feedback_frontend
annotate app/main/timeline/_list.lua @ 81:134fce4bede3
Cache for rendered wiki texts; Accountless API keys; Reverse id order for initiative API
- Support for caching html version of drafts
- Using pre-rendered html versions of help messages
- Added Support for api keys not connected to an account
- Added order option "id_desc" to initiative API
- Support for caching html version of drafts
- Using pre-rendered html versions of help messages
- Added Support for api keys not connected to an account
- Added order option "id_desc" to initiative API
author | bsw |
---|---|
date | Sat Jul 24 17:22:05 2010 +0200 (2010-07-24) |
parents | 00d1004545f1 |
children | 166fd10c7e81 |
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/jbe@19 | 24 |
bsw@11 | 25 ui.field.text{ |
bsw@11 | 26 attr = { style = "font-size: 75%; font-weight: bold;"}, |
bsw@11 | 27 value = event_names[timeline.event] or timeline.event |
bsw@11 | 28 } |
bsw/jbe@19 | 29 if timeline.event == "draft_created" and timeline.count > 1 then |
bsw/jbe@19 | 30 ui.field.text{ |
bsw/jbe@19 | 31 attr = { style = "font-size: 75%;"}, |
bsw/jbe@19 | 32 value = _("(#{more_count} duplicates removed)", { more_count = timeline.count - 1 }) |
bsw/jbe@19 | 33 } |
bsw/jbe@19 | 34 end |
bsw@11 | 35 end |
bsw@11 | 36 }, |
bsw@11 | 37 { |
bsw@11 | 38 content = function(timeline) |
bsw@11 | 39 local issue |
bsw@11 | 40 local initiative |
bsw@11 | 41 if timeline.issue then |
bsw@11 | 42 issue = timeline.issue |
bsw@11 | 43 elseif timeline.initiative then |
bsw@11 | 44 initiative = timeline.initiative |
bsw@11 | 45 issue = initiative.issue |
bsw@11 | 46 elseif timeline.draft then |
bsw@11 | 47 initiative = timeline.draft.initiative |
bsw@11 | 48 issue = initiative.issue |
bsw@11 | 49 elseif timeline.suggestion then |
bsw@11 | 50 initiative = timeline.suggestion.initiative |
bsw@11 | 51 issue = initiative.issue |
bsw@11 | 52 end |
bsw@11 | 53 if issue then |
bsw@11 | 54 if timeline.is_interested then |
bsw@11 | 55 local label = _"You are interested in this issue", |
bsw@11 | 56 ui.image{ |
bsw@11 | 57 attr = { alt = label, title = label, style = "float: left; margin-right: 0.5em;" }, |
bsw@11 | 58 static = "icons/16/eye.png" |
bsw@11 | 59 } |
bsw@11 | 60 end |
bsw@11 | 61 slot.put(" ") |
bsw@11 | 62 ui.tag{ |
bsw@11 | 63 tag = "span", |
bsw@11 | 64 attr = { style = "font-size: 75%; font-weight: bold; background-color: #ccc; display: block; margin-bottom: 1ex;"}, |
bsw@11 | 65 content = issue.area.name .. ", " .. _("Issue ##{id}", { id = issue.id }) |
bsw@11 | 66 } |
bsw@11 | 67 else |
bsw@11 | 68 ui.tag{ |
bsw@11 | 69 tag = "span", |
bsw@11 | 70 attr = { style = "font-size: 75%; background-color: #ccc; display: block; margin-bottom: 1ex;"}, |
bsw@11 | 71 content = function() slot.put(" ") end |
bsw@11 | 72 } |
bsw@11 | 73 end |
bsw@11 | 74 |
bsw@11 | 75 if timeline.member then |
bsw@11 | 76 execute.view{ |
bsw@11 | 77 module = "member_image", |
bsw@11 | 78 view = "_show", |
bsw@11 | 79 params = { |
bsw@11 | 80 member = timeline.member, |
bsw@11 | 81 image_type = "avatar", |
bsw@11 | 82 show_dummy = true |
bsw@11 | 83 } |
bsw@11 | 84 } |
bsw@11 | 85 ui.link{ |
bsw@11 | 86 content = timeline.member.name, |
bsw@11 | 87 module = "member", |
bsw@11 | 88 view = "show", |
bsw@11 | 89 id = timeline.member.id |
bsw@11 | 90 } |
bsw@11 | 91 end |
bsw@11 | 92 if timeline.issue then |
bsw@11 | 93 local initiatives_selector = timeline.issue |
bsw@11 | 94 :get_reference_selector("initiatives") |
bsw@11 | 95 execute.view{ |
bsw@11 | 96 module = "initiative", |
bsw@11 | 97 view = "_list", |
bsw@11 | 98 params = { |
bsw@11 | 99 issue = timeline.issue, |
bsw@11 | 100 initiatives_selector = initiatives_selector, |
bsw@11 | 101 per_page = initiatives_per_page, |
bsw@11 | 102 no_sort = true, |
bsw@11 | 103 limit = initiatives_per_page |
bsw@11 | 104 } |
bsw@11 | 105 } |
bsw@11 | 106 elseif initiative then |
bsw@11 | 107 execute.view{ |
bsw@11 | 108 module = "initiative", |
bsw@11 | 109 view = "_list", |
bsw@11 | 110 params = { |
bsw@11 | 111 issue = initiative.issue, |
bsw@11 | 112 initiatives_selector = Initiative:new_selector():add_where{ "initiative.id = ?", initiative.id }, |
bsw@11 | 113 per_page = initiatives_per_page, |
bsw@11 | 114 no_sort = true |
bsw@11 | 115 } |
bsw@11 | 116 } |
bsw@11 | 117 end |
bsw@11 | 118 if timeline.suggestion then |
bsw@11 | 119 ui.link{ |
bsw@11 | 120 module = "suggestion", |
bsw@11 | 121 view = "show", |
bsw@11 | 122 id = timeline.suggestion.id, |
bsw@11 | 123 content = timeline.suggestion.name |
bsw@11 | 124 } |
bsw@11 | 125 end |
bsw@11 | 126 end |
bsw@11 | 127 }, |
bsw@11 | 128 } |
bsw@11 | 129 } |
bsw@11 | 130 end |
bsw@11 | 131 } |