liquid_feedback_frontend

annotate app/main/member/_list.lua @ 12:60bed92b7434

Version beta8

Bugfix in app/main/member_show.lua related to last fix
author bsw
date Fri Jan 22 12:00:00 2010 +0100 (2010-01-22)
parents 72c5e0ee7c98
children 00d1004545f1
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@10 5 local initiator = param.get("initiator", "table")
bsw@3 6
bsw@3 7 local options = {
bsw@3 8 {
bsw@10 9 name = "newest",
bsw@10 10 label = _"Newest",
bsw@10 11 order_by = "created DESC, id DESC"
bsw@10 12 },
bsw@10 13 {
bsw@10 14 name = "oldest",
bsw@10 15 label = _"Oldest",
bsw@10 16 order_by = "created, id"
bsw@10 17 },
bsw@10 18 {
bsw@3 19 name = "name",
bsw@3 20 label = _"A-Z",
bsw@3 21 order_by = "name"
bsw@3 22 },
bsw@3 23 {
bsw@3 24 name = "name_desc",
bsw@3 25 label = _"Z-A",
bsw@3 26 order_by = "name DESC"
bsw@3 27 },
bsw@3 28 }
bsw@3 29
bsw@3 30 if initiative then
bsw@3 31 options[#options+1] = {
bsw@3 32 name = "delegations",
bsw@3 33 label = _"Delegations",
bsw@3 34 order_by = "weight DESC"
bsw@3 35 }
bsw@3 36 end
bsw/jbe@0 37
bsw@2 38 ui.order{
bsw@2 39 name = "member_list",
bsw/jbe@0 40 selector = members_selector,
bsw@3 41 options = options,
bsw@2 42 content = function()
bsw@2 43 ui.paginate{
bsw@2 44 selector = members_selector,
bsw@2 45 per_page = 100,
bsw@2 46 content = function()
bsw@2 47 ui.container{
bsw@2 48 attr = { class = "member_list" },
bsw@2 49 content = function()
bsw@3 50 local members = members_selector:exec()
bsw@3 51 local columns = {
bsw@3 52 {
bsw@3 53 label = _"Name",
bsw@3 54 content = function(member)
bsw@3 55 ui.link{
bsw@3 56 module = "member",
bsw@3 57 view = "show",
bsw@3 58 id = member.id,
bsw@3 59 content = function()
bsw@3 60 ui.image{
bsw@3 61 attr = { width = 48, height = 48 },
bsw@3 62 module = "member",
bsw@3 63 view = "avatar",
bsw@3 64 id = member.id,
bsw@3 65 extension = "jpg"
bsw@3 66 }
bsw@3 67 end
bsw@3 68 }
bsw@3 69 end
bsw@3 70 },
bsw@3 71 {
bsw@3 72 label = _"Name",
bsw@3 73 content = function(member)
bsw@3 74 ui.link{
bsw@3 75 module = "member",
bsw@3 76 view = "show",
bsw@3 77 id = member.id,
bsw@3 78 content = member.name
bsw@3 79 }
bsw@3 80 if member.admin then
bsw@3 81 ui.image{
bsw@3 82 attr = {
bsw@3 83 alt = _"Administrator",
bsw@3 84 title = _"Administrator"
bsw@3 85 },
bsw@3 86 static = "icons/16/cog.png"
bsw@3 87 }
bsw@3 88 end
bsw@3 89 -- TODO performance
bsw@3 90 local contact = Contact:by_pk(app.session.member.id, member.id)
bsw@3 91 if contact then
bsw@3 92 ui.image{
bsw@3 93 attr = {
bsw@3 94 alt = _"Saved as contact",
bsw@3 95 title = _"Saved as contact"
bsw@3 96 },
bsw@3 97 static = "icons/16/book_edit.png"
bsw@3 98 }
bsw@3 99 end
bsw@3 100 end
bsw@3 101 }
bsw@3 102 }
bsw@3 103
bsw@3 104 if initiative then
bsw@3 105 columns[#columns+1] = {
bsw@3 106 label = _"Delegations",
bsw@3 107 field_attr = { style = "text-align: right;" },
bsw@3 108 content = function(member)
bsw@3 109 if member.weight > 1 then
bsw@3 110 ui.link{
bsw@3 111 content = member.weight,
bsw@3 112 module = "support",
bsw@3 113 view = "show_incoming",
bsw@3 114 params = { member_id = member.id, initiative_id = initiative.id }
bsw@3 115 }
bsw@3 116 end
bsw@3 117 end
bsw@3 118 }
bsw@3 119 end
bsw@3 120
bsw@3 121 --[[ ui.list{
bsw@3 122 records = members,
bsw@3 123 columns = columns
bsw@3 124 }
bsw@3 125 --]]
bsw@3 126 ---[[
bsw@3 127 for i, member in ipairs(members) do
bsw@2 128 execute.view{
bsw@2 129 module = "member",
bsw@2 130 view = "_show_thumb",
bsw@10 131 params = {
bsw@10 132 member = member,
bsw@10 133 initiative = initiative,
bsw@10 134 issue = issue,
bsw@10 135 trustee = trustee,
bsw@10 136 initiator = initiator
bsw@10 137 }
bsw/jbe@0 138 }
bsw@2 139 end
bsw@3 140 ---]]
bsw/jbe@0 141 end
bsw/jbe@0 142 }
bsw@3 143 slot.put('<br style="clear: left;" />')
bsw@3 144 if issue then
bsw@3 145 ui.field.timestamp{ label = _"Last snapshot:", value = issue.snapshot }
bsw@3 146 end
bsw@3 147 if initiative then
bsw@3 148 ui.field.timestamp{ label = _"Last snapshot:", value = initiative.issue.snapshot }
bsw@3 149 end
bsw@2 150 end
bsw/jbe@0 151 }
bsw/jbe@0 152 end
bsw/jbe@0 153 }

Impressum / About Us