liquid_feedback_frontend

annotate app/main/contact/list.lua @ 1145:904f6807f7fa

Added support for upcoming moonbridge bases WebMCP
author bsw
date Sat Mar 21 15:26:39 2015 +0100 (2015-03-21)
parents 701a5cf6b067
children 32cc544d5a5b
rev   line source
bsw@198 1 local contacts_selector = Contact:build_selector{
bsw@198 2 member_id = app.session.member_id,
bsw@198 3 order = "name"
bsw@198 4 }
bsw@198 5
bsw@564 6 ui.title(_"Contacts")
bsw/jbe@0 7
bsw@198 8
bsw@198 9 ui.paginate{
bsw@198 10 selector = contacts_selector,
bsw@198 11 content = function()
bsw@198 12 local contacts = contacts_selector:exec()
bsw@198 13 if #contacts == 0 then
jbe@233 14 ui.field.text{ value = _"You didn't save any member as contact yet." }
bsw@198 15 else
bsw@198 16 ui.list{
bsw@198 17 records = contacts,
bsw@198 18 columns = {
bsw@198 19 {
bsw@198 20 label = _"Name",
bsw@198 21 content = function(record)
bsw@198 22 ui.link{
bsw@198 23 text = record.other_member.name,
bsw@198 24 module = "member",
bsw@198 25 view = "show",
bsw@198 26 id = record.other_member_id
bsw@198 27 }
bsw@198 28 end
bsw@198 29 },
bsw@198 30 {
bsw@198 31 label = _"Published",
bsw@198 32 content = function(record)
bsw@198 33 ui.field.boolean{ value = record.public }
bsw@198 34 end
bsw@198 35 },
bsw@198 36 {
bsw@198 37 content = function(record)
bsw@198 38 if record.public then
bsw@198 39 ui.link{
bsw@198 40 attr = { class = "action" },
bsw@198 41 text = _"Hide",
bsw@198 42 module = "contact",
bsw@198 43 action = "add_member",
bsw@198 44 id = record.other_member_id,
bsw@198 45 params = { public = false },
bsw@198 46 routing = {
bsw@198 47 default = {
bsw@198 48 mode = "redirect",
bsw@198 49 module = request.get_module(),
bsw@198 50 view = request.get_view(),
bsw@1145 51 id = request.get_id_string(),
bsw@1145 52 params = request.get_param_strings()
bsw@198 53 }
bsw@198 54 }
bsw@198 55 }
bsw@198 56 else
bsw@198 57 ui.link{
bsw@198 58 attr = { class = "action" },
bsw@198 59 text = _"Publish",
bsw@198 60 module = "contact",
bsw@198 61 action = "add_member",
bsw@198 62 id = record.other_member_id,
bsw@198 63 params = { public = true },
bsw@198 64 routing = {
bsw@198 65 default = {
bsw@198 66 mode = "redirect",
bsw@198 67 module = request.get_module(),
bsw@198 68 view = request.get_view(),
bsw@1145 69 id = request.get_id_string(),
bsw@1145 70 params = request.get_param_strings()
bsw@198 71 }
bsw@198 72 }
bsw@198 73 }
bsw@198 74 end
bsw@198 75 end
bsw@198 76 },
bsw@198 77 {
bsw@198 78 content = function(record)
bsw@198 79 ui.link{
bsw@198 80 attr = { class = "action" },
bsw@198 81 text = _"Remove",
bsw@198 82 module = "contact",
bsw@198 83 action = "remove_member",
bsw@198 84 id = record.other_member_id,
bsw@198 85 routing = {
bsw@198 86 default = {
bsw@198 87 mode = "redirect",
bsw@198 88 module = request.get_module(),
bsw@198 89 view = request.get_view(),
bsw@1145 90 id = request.get_id_string(),
bsw@1145 91 params = request.get_param_strings()
bsw@198 92 }
bsw@198 93 }
bsw@198 94 }
bsw@198 95 end
bsw@198 96 },
bsw@198 97 }
bsw@198 98 }
bsw@198 99 end
bsw@198 100 end
bsw/jbe@0 101 }

Impressum / About Us