liquid_feedback_frontend
annotate app/main/member/_list.lua @ 3:768faea1096d
Version alpha4
Members interested in an issue or supporting an initiative have a weight information attached. Browsing the members causing that weight is possible.
Initiatives may provide a link to an external discussion platform
Direct link on every initiative page to create an alternative initiative
Bugfix: No error when clicking "neutral", when "neutral" is currently selected
Members interested in an issue or supporting an initiative have a weight information attached. Browsing the members causing that weight is possible.
Initiatives may provide a link to an external discussion platform
Direct link on every initiative page to create an alternative initiative
Bugfix: No error when clicking "neutral", when "neutral" is currently selected
author | bsw |
---|---|
date | Mon Nov 30 12:00:00 2009 +0100 (2009-11-30) |
parents | 5c601807d397 |
children | 72c5e0ee7c98 |
rev | line source |
---|---|
bsw/jbe@0 | 1 local members_selector = param.get("members_selector", "table") |
bsw@3 | 2 local initiative = param.get("initiative", "table") |
bsw@3 | 3 local issue = param.get("issue", "table") |
bsw@3 | 4 local trustee = param.get("trustee", "table") |
bsw@3 | 5 |
bsw@3 | 6 local options = { |
bsw@3 | 7 { |
bsw@3 | 8 name = "name", |
bsw@3 | 9 label = _"A-Z", |
bsw@3 | 10 order_by = "name" |
bsw@3 | 11 }, |
bsw@3 | 12 { |
bsw@3 | 13 name = "name_desc", |
bsw@3 | 14 label = _"Z-A", |
bsw@3 | 15 order_by = "name DESC" |
bsw@3 | 16 }, |
bsw@3 | 17 } |
bsw@3 | 18 |
bsw@3 | 19 if initiative then |
bsw@3 | 20 options[#options+1] = { |
bsw@3 | 21 name = "delegations", |
bsw@3 | 22 label = _"Delegations", |
bsw@3 | 23 order_by = "weight DESC" |
bsw@3 | 24 } |
bsw@3 | 25 end |
bsw/jbe@0 | 26 |
bsw@2 | 27 ui.order{ |
bsw@2 | 28 name = "member_list", |
bsw/jbe@0 | 29 selector = members_selector, |
bsw@3 | 30 options = options, |
bsw@2 | 31 content = function() |
bsw@2 | 32 ui.paginate{ |
bsw@2 | 33 selector = members_selector, |
bsw@2 | 34 per_page = 100, |
bsw@2 | 35 content = function() |
bsw@2 | 36 ui.container{ |
bsw@2 | 37 attr = { class = "member_list" }, |
bsw@2 | 38 content = function() |
bsw@3 | 39 local members = members_selector:exec() |
bsw@3 | 40 local columns = { |
bsw@3 | 41 { |
bsw@3 | 42 label = _"Name", |
bsw@3 | 43 content = function(member) |
bsw@3 | 44 ui.link{ |
bsw@3 | 45 module = "member", |
bsw@3 | 46 view = "show", |
bsw@3 | 47 id = member.id, |
bsw@3 | 48 content = function() |
bsw@3 | 49 ui.image{ |
bsw@3 | 50 attr = { width = 48, height = 48 }, |
bsw@3 | 51 module = "member", |
bsw@3 | 52 view = "avatar", |
bsw@3 | 53 id = member.id, |
bsw@3 | 54 extension = "jpg" |
bsw@3 | 55 } |
bsw@3 | 56 end |
bsw@3 | 57 } |
bsw@3 | 58 end |
bsw@3 | 59 }, |
bsw@3 | 60 { |
bsw@3 | 61 label = _"Name", |
bsw@3 | 62 content = function(member) |
bsw@3 | 63 ui.link{ |
bsw@3 | 64 module = "member", |
bsw@3 | 65 view = "show", |
bsw@3 | 66 id = member.id, |
bsw@3 | 67 content = member.name |
bsw@3 | 68 } |
bsw@3 | 69 if member.admin then |
bsw@3 | 70 ui.image{ |
bsw@3 | 71 attr = { |
bsw@3 | 72 alt = _"Administrator", |
bsw@3 | 73 title = _"Administrator" |
bsw@3 | 74 }, |
bsw@3 | 75 static = "icons/16/cog.png" |
bsw@3 | 76 } |
bsw@3 | 77 end |
bsw@3 | 78 -- TODO performance |
bsw@3 | 79 local contact = Contact:by_pk(app.session.member.id, member.id) |
bsw@3 | 80 if contact then |
bsw@3 | 81 ui.image{ |
bsw@3 | 82 attr = { |
bsw@3 | 83 alt = _"Saved as contact", |
bsw@3 | 84 title = _"Saved as contact" |
bsw@3 | 85 }, |
bsw@3 | 86 static = "icons/16/book_edit.png" |
bsw@3 | 87 } |
bsw@3 | 88 end |
bsw@3 | 89 end |
bsw@3 | 90 } |
bsw@3 | 91 } |
bsw@3 | 92 |
bsw@3 | 93 if initiative then |
bsw@3 | 94 columns[#columns+1] = { |
bsw@3 | 95 label = _"Delegations", |
bsw@3 | 96 field_attr = { style = "text-align: right;" }, |
bsw@3 | 97 content = function(member) |
bsw@3 | 98 if member.weight > 1 then |
bsw@3 | 99 ui.link{ |
bsw@3 | 100 content = member.weight, |
bsw@3 | 101 module = "support", |
bsw@3 | 102 view = "show_incoming", |
bsw@3 | 103 params = { member_id = member.id, initiative_id = initiative.id } |
bsw@3 | 104 } |
bsw@3 | 105 end |
bsw@3 | 106 end |
bsw@3 | 107 } |
bsw@3 | 108 end |
bsw@3 | 109 |
bsw@3 | 110 --[[ ui.list{ |
bsw@3 | 111 records = members, |
bsw@3 | 112 columns = columns |
bsw@3 | 113 } |
bsw@3 | 114 --]] |
bsw@3 | 115 ---[[ |
bsw@3 | 116 for i, member in ipairs(members) do |
bsw@2 | 117 execute.view{ |
bsw@2 | 118 module = "member", |
bsw@2 | 119 view = "_show_thumb", |
bsw@3 | 120 params = { member = member, initiative = initiative, issue = issue, trustee = trustee } |
bsw/jbe@0 | 121 } |
bsw@2 | 122 end |
bsw@3 | 123 ---]] |
bsw/jbe@0 | 124 end |
bsw/jbe@0 | 125 } |
bsw@3 | 126 slot.put('<br style="clear: left;" />') |
bsw@3 | 127 if issue then |
bsw@3 | 128 ui.field.timestamp{ label = _"Last snapshot:", value = issue.snapshot } |
bsw@3 | 129 end |
bsw@3 | 130 if initiative then |
bsw@3 | 131 ui.field.timestamp{ label = _"Last snapshot:", value = initiative.issue.snapshot } |
bsw@3 | 132 end |
bsw@2 | 133 end |
bsw/jbe@0 | 134 } |
bsw/jbe@0 | 135 end |
bsw/jbe@0 | 136 } |