liquid_feedback_frontend
diff app/main/member/_sidebar_contacts.lua @ 1309:32cc544d5a5b
Cumulative patch for upcoming frontend version 4
| author | bsw/jbe |
|---|---|
| date | Sun Jul 15 14:07:29 2018 +0200 (2018-07-15) |
| parents | 8be69c8d99a8 |
| children |
line diff
1.1 --- a/app/main/member/_sidebar_contacts.lua Thu Jun 23 03:30:57 2016 +0200 1.2 +++ b/app/main/member/_sidebar_contacts.lua Sun Jul 15 14:07:29 2018 +0200 1.3 @@ -12,18 +12,15 @@ 1.4 order = "name" 1.5 } 1.6 1.7 -ui.sidebar( "tab-members", function() 1.8 +ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function() 1.9 + ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function() 1.10 + ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = _"Published contacts" } 1.11 + end } 1.12 1.13 - ui.sidebarHead( function() 1.14 - ui.heading { level = 2, content = _"Published contacts" } 1.15 - end ) 1.16 - 1.17 - --ui.sidebarSection( function() 1.18 - 1.19 + ui.container { attr = { class = "mdl-card__content mdl-card--border" }, content = function() 1.20 + ui.container{ content = _"Published contacts" } 1.21 if public_contacts_selector:count() == 0 then 1.22 - ui.sidebarSection( function() 1.23 - ui.field.text{ value = _"No published contacts" } 1.24 - end ) 1.25 + ui.container{ content = _"No published contacts" } 1.26 else 1.27 ui.paginate{ 1.28 selector = public_contacts_selector, 1.29 @@ -31,7 +28,7 @@ 1.30 content = function() 1.31 local contacts = public_contacts_selector:exec() 1.32 for i, contact in ipairs(contacts) do 1.33 - ui.sidebarSection( "sidebarRowNarrow", function() 1.34 + ui.container{ content = function() 1.35 execute.view{ module = "member_image", view = "_show", params = { 1.36 member_id = contact.other_member.id, class = "micro_avatar", 1.37 popup_text = contact.other_member.name, 1.38 @@ -44,45 +41,118 @@ 1.39 view = "show", 1.40 id = contact.other_member.id 1.41 } 1.42 - end ) 1.43 + if app.session.member_id == member.id then 1.44 + ui.link{ 1.45 + content = function() 1.46 + ui.tag{ tag = "i", attr = { class = "material-icons" }, content = "get_app" } 1.47 + end, 1.48 + module = "contact", 1.49 + action = "add_member", 1.50 + id = contact.other_member_id, 1.51 + params = { public = false }, 1.52 + routing = { 1.53 + default = { 1.54 + mode = "redirect", 1.55 + module = request.get_module(), 1.56 + view = request.get_view(), 1.57 + id = request.get_id_string(), 1.58 + params = request.get_param_strings() 1.59 + } 1.60 + } 1.61 + } 1.62 + ui.link{ 1.63 + content = function() 1.64 + ui.tag{ tag = "i", attr = { class = "material-icons" }, content = "delete" } 1.65 + end, 1.66 + module = "contact", 1.67 + action = "remove_member", 1.68 + id = contact.other_member_id, 1.69 + routing = { 1.70 + default = { 1.71 + mode = "redirect", 1.72 + module = request.get_module(), 1.73 + view = request.get_view(), 1.74 + id = request.get_id_string(), 1.75 + params = request.get_param_strings() 1.76 + } 1.77 + } 1.78 + } 1.79 + end 1.80 + end } 1.81 end 1.82 end 1.83 } 1.84 end 1.85 - --end ) 1.86 - 1.87 - 1.88 - if app.session.member_id and app.session.member_id == member.id 1.89 - and private_contacts_selector:count() > 0 1.90 - then 1.91 + end } 1.92 + 1.93 + if member.id == app.session.member_id then 1.94 + ui.container { attr = { class = "mdl-card__content mdl-card--border" }, content = function() 1.95 + ui.tag{ content = _"Private contacts" } 1.96 + 1.97 + if app.session.member_id and app.session.member_id == member.id 1.98 + and private_contacts_selector:count() > 0 1.99 + then 1.100 1.101 - ui.sidebarHead( function() 1.102 - ui.heading { level = 2, content = _"Private contacts" } 1.103 - end ) 1.104 - 1.105 - ui.paginate{ 1.106 - selector = private_contacts_selector, 1.107 - name = "contacts", 1.108 - content = function() 1.109 - local contacts = private_contacts_selector:exec() 1.110 - for i, contact in ipairs(contacts) do 1.111 - ui.sidebarSection( "sidebarRowNarrow", function() 1.112 - execute.view{ module = "member_image", view = "_show", params = { 1.113 - member_id = contact.other_member.id, class = "micro_avatar", 1.114 - popup_text = contact.other_member.name, 1.115 - image_type = "avatar", show_dummy = true, 1.116 - } } 1.117 - slot.put(" ") 1.118 - ui.link{ 1.119 - content = contact.other_member.name, 1.120 - module = "member", 1.121 - view = "show", 1.122 - id = contact.other_member.id 1.123 - } 1.124 - end ) 1.125 - end 1.126 + ui.paginate{ 1.127 + selector = private_contacts_selector, 1.128 + name = "contacts", 1.129 + content = function() 1.130 + local contacts = private_contacts_selector:exec() 1.131 + for i, contact in ipairs(contacts) do 1.132 + ui.container{ content = function() 1.133 + execute.view{ module = "member_image", view = "_show", params = { 1.134 + member_id = contact.other_member.id, class = "micro_avatar", 1.135 + popup_text = contact.other_member.name, 1.136 + image_type = "avatar", show_dummy = true, 1.137 + } } 1.138 + slot.put(" ") 1.139 + ui.link{ 1.140 + content = contact.other_member.name, 1.141 + module = "member", 1.142 + view = "show", 1.143 + id = contact.other_member.id 1.144 + } 1.145 + slot.put(" ") 1.146 + ui.link{ 1.147 + content = function() 1.148 + ui.tag{ tag = "i", attr = { class = "material-icons" }, content = "publish" } 1.149 + end, 1.150 + module = "contact", 1.151 + action = "add_member", 1.152 + id = contact.other_member_id, 1.153 + params = { public = true }, 1.154 + routing = { 1.155 + default = { 1.156 + mode = "redirect", 1.157 + module = request.get_module(), 1.158 + view = request.get_view(), 1.159 + id = request.get_id_string(), 1.160 + params = request.get_param_strings() 1.161 + } 1.162 + } 1.163 + } 1.164 + ui.link{ 1.165 + content = function() 1.166 + ui.tag{ tag = "i", attr = { class = "material-icons" }, content = "delete" } 1.167 + end, 1.168 + module = "contact", 1.169 + action = "remove_member", 1.170 + id = contact.other_member_id, 1.171 + routing = { 1.172 + default = { 1.173 + mode = "redirect", 1.174 + module = request.get_module(), 1.175 + view = request.get_view(), 1.176 + id = request.get_id_string(), 1.177 + params = request.get_param_strings() 1.178 + } 1.179 + } 1.180 + } 1.181 + end } 1.182 + end 1.183 + end 1.184 + } 1.185 end 1.186 - } 1.187 - 1.188 + end } 1.189 end 1.190 -end ) 1.191 \ No newline at end of file 1.192 +end }