bsw/jbe@0: local members_selector = param.get("members_selector", "table") bsw@3: local initiative = param.get("initiative", "table") bsw@3: local issue = param.get("issue", "table") bsw@3: local trustee = param.get("trustee", "table") bsw@3: bsw@3: local options = { bsw@3: { bsw@3: name = "name", bsw@3: label = _"A-Z", bsw@3: order_by = "name" bsw@3: }, bsw@3: { bsw@3: name = "name_desc", bsw@3: label = _"Z-A", bsw@3: order_by = "name DESC" bsw@3: }, bsw@3: } bsw@3: bsw@3: if initiative then bsw@3: options[#options+1] = { bsw@3: name = "delegations", bsw@3: label = _"Delegations", bsw@3: order_by = "weight DESC" bsw@3: } bsw@3: end bsw/jbe@0: bsw@2: ui.order{ bsw@2: name = "member_list", bsw/jbe@0: selector = members_selector, bsw@3: options = options, bsw@2: content = function() bsw@2: ui.paginate{ bsw@2: selector = members_selector, bsw@2: per_page = 100, bsw@2: content = function() bsw@2: ui.container{ bsw@2: attr = { class = "member_list" }, bsw@2: content = function() bsw@3: local members = members_selector:exec() bsw@3: local columns = { bsw@3: { bsw@3: label = _"Name", bsw@3: content = function(member) bsw@3: ui.link{ bsw@3: module = "member", bsw@3: view = "show", bsw@3: id = member.id, bsw@3: content = function() bsw@3: ui.image{ bsw@3: attr = { width = 48, height = 48 }, bsw@3: module = "member", bsw@3: view = "avatar", bsw@3: id = member.id, bsw@3: extension = "jpg" bsw@3: } bsw@3: end bsw@3: } bsw@3: end bsw@3: }, bsw@3: { bsw@3: label = _"Name", bsw@3: content = function(member) bsw@3: ui.link{ bsw@3: module = "member", bsw@3: view = "show", bsw@3: id = member.id, bsw@3: content = member.name bsw@3: } bsw@3: if member.admin then bsw@3: ui.image{ bsw@3: attr = { bsw@3: alt = _"Administrator", bsw@3: title = _"Administrator" bsw@3: }, bsw@3: static = "icons/16/cog.png" bsw@3: } bsw@3: end bsw@3: -- TODO performance bsw@3: local contact = Contact:by_pk(app.session.member.id, member.id) bsw@3: if contact then bsw@3: ui.image{ bsw@3: attr = { bsw@3: alt = _"Saved as contact", bsw@3: title = _"Saved as contact" bsw@3: }, bsw@3: static = "icons/16/book_edit.png" bsw@3: } bsw@3: end bsw@3: end bsw@3: } bsw@3: } bsw@3: bsw@3: if initiative then bsw@3: columns[#columns+1] = { bsw@3: label = _"Delegations", bsw@3: field_attr = { style = "text-align: right;" }, bsw@3: content = function(member) bsw@3: if member.weight > 1 then bsw@3: ui.link{ bsw@3: content = member.weight, bsw@3: module = "support", bsw@3: view = "show_incoming", bsw@3: params = { member_id = member.id, initiative_id = initiative.id } bsw@3: } bsw@3: end bsw@3: end bsw@3: } bsw@3: end bsw@3: bsw@3: --[[ ui.list{ bsw@3: records = members, bsw@3: columns = columns bsw@3: } bsw@3: --]] bsw@3: ---[[ bsw@3: for i, member in ipairs(members) do bsw@2: execute.view{ bsw@2: module = "member", bsw@2: view = "_show_thumb", bsw@3: params = { member = member, initiative = initiative, issue = issue, trustee = trustee } bsw/jbe@0: } bsw@2: end bsw@3: ---]] bsw/jbe@0: end bsw/jbe@0: } bsw@3: slot.put('
') bsw@3: if issue then bsw@3: ui.field.timestamp{ label = _"Last snapshot:", value = issue.snapshot } bsw@3: end bsw@3: if initiative then bsw@3: ui.field.timestamp{ label = _"Last snapshot:", value = initiative.issue.snapshot } bsw@3: end bsw@2: end bsw/jbe@0: } bsw/jbe@0: end bsw/jbe@0: }