bsw@11: local timeline_selector = param.get("timeline_selector", "table") bsw@11: local event_names = param.get("event_names", "table") bsw@11: local initiatives_per_page = param.get("initiatives_per_page", atom.number) or 3 bsw@11: bsw@11: ui.paginate{ bsw@11: per_page = param.get("per_page", atom.number) or 25, bsw@11: selector = timeline_selector, bsw@11: content = function() bsw@11: local timelines = timeline_selector:exec() bsw@11: timelines:load("issue") bsw@11: timelines:load("initiative") bsw@11: timelines:load("member") bsw@11: ui.list{ bsw@11: attr = { class = "nohover" }, bsw@11: records = timelines, bsw@11: columns = { bsw@11: { bsw@11: field_attr = { style = "width: 10em;" }, bsw@11: content = function(timeline) bsw@11: ui.field.text{ bsw@11: attr = { style = "font-size: 75%; font-weight: bold; background-color: #ccc; display: block; margin-bottom: 1ex;"}, bsw@11: value = format.time(timeline.occurrence) bsw@11: } bsw/jbe@19: bsw@11: ui.field.text{ bsw@11: attr = { style = "font-size: 75%; font-weight: bold;"}, bsw@11: value = event_names[timeline.event] or timeline.event bsw@11: } bsw/jbe@19: if timeline.event == "draft_created" and timeline.count > 1 then bsw/jbe@19: ui.field.text{ bsw/jbe@19: attr = { style = "font-size: 75%;"}, bsw/jbe@19: value = _("(#{more_count} duplicates removed)", { more_count = timeline.count - 1 }) bsw/jbe@19: } bsw/jbe@19: end bsw@11: end bsw@11: }, bsw@11: { bsw@11: content = function(timeline) bsw@11: local issue bsw@11: local initiative bsw@11: if timeline.issue then bsw@11: issue = timeline.issue bsw@11: elseif timeline.initiative then bsw@11: initiative = timeline.initiative bsw@11: issue = initiative.issue bsw@11: elseif timeline.draft then bsw@11: initiative = timeline.draft.initiative bsw@11: issue = initiative.issue bsw@11: elseif timeline.suggestion then bsw@11: initiative = timeline.suggestion.initiative bsw@11: issue = initiative.issue bsw@11: end bsw@11: if issue then bsw@11: if timeline.is_interested then bsw@11: local label = _"You are interested in this issue", bsw@11: ui.image{ bsw@11: attr = { alt = label, title = label, style = "float: left; margin-right: 0.5em;" }, bsw@11: static = "icons/16/eye.png" bsw@11: } bsw@11: end bsw@11: slot.put(" ") bsw@11: ui.tag{ bsw@11: tag = "span", bsw@11: attr = { style = "font-size: 75%; font-weight: bold; background-color: #ccc; display: block; margin-bottom: 1ex;"}, bsw@11: content = issue.area.name .. ", " .. _("Issue ##{id}", { id = issue.id }) bsw@11: } bsw@11: else bsw@11: ui.tag{ bsw@11: tag = "span", bsw@11: attr = { style = "font-size: 75%; background-color: #ccc; display: block; margin-bottom: 1ex;"}, bsw@11: content = function() slot.put(" ") end bsw@11: } bsw@11: end bsw@11: bsw@11: if timeline.member then bsw@11: execute.view{ bsw@11: module = "member_image", bsw@11: view = "_show", bsw@11: params = { bsw@11: member = timeline.member, bsw@11: image_type = "avatar", bsw@11: show_dummy = true bsw@11: } bsw@11: } bsw@11: ui.link{ bsw@11: content = timeline.member.name, bsw@11: module = "member", bsw@11: view = "show", bsw@11: id = timeline.member.id bsw@11: } bsw@11: end bsw@11: if timeline.issue then bsw@11: local initiatives_selector = timeline.issue bsw@11: :get_reference_selector("initiatives") bsw@11: execute.view{ bsw@11: module = "initiative", bsw@11: view = "_list", bsw@11: params = { bsw@11: issue = timeline.issue, bsw@11: initiatives_selector = initiatives_selector, bsw@11: per_page = initiatives_per_page, bsw@11: no_sort = true, bsw@11: limit = initiatives_per_page bsw@11: } bsw@11: } bsw@11: elseif initiative then bsw@11: execute.view{ bsw@11: module = "initiative", bsw@11: view = "_list", bsw@11: params = { bsw@11: issue = initiative.issue, bsw@11: initiatives_selector = Initiative:new_selector():add_where{ "initiative.id = ?", initiative.id }, bsw@11: per_page = initiatives_per_page, bsw@11: no_sort = true bsw@11: } bsw@11: } bsw@11: end bsw@11: if timeline.suggestion then bsw@11: ui.link{ bsw@11: module = "suggestion", bsw@11: view = "show", bsw@11: id = timeline.suggestion.id, bsw@11: content = timeline.suggestion.name bsw@11: } bsw@11: end bsw@11: end bsw@11: }, bsw@11: } bsw@11: } bsw@11: end bsw@11: }