liquid_feedback_frontend
view app/main/index/_sidebar_members.lua @ 1360:7fbe8b516c2b
Fixed syntax error
author | bsw |
---|---|
date | Mon Aug 06 13:59:24 2018 +0200 (2018-08-06) |
parents | 32cc544d5a5b |
children | a964cf74e02f |
line source
1 local limit = 50
3 if not app.session:has_access("all_pseudonymous") then
4 return
5 end
7 local unit_id = request.get_param{ name = "unit" }
8 if unit_id == "all" then
9 unit_id = nil
10 end
12 local selector = Member:new_selector()
13 :add_where("active")
14 :add_order_by("last_login DESC NULLS LAST, id DESC")
16 if unit_id then
17 selector:join("privilege", nil, "privilege.member_id = member.id")
18 selector:add_where{ "privilege.unit_id = ?", unit_id }
19 end
21 local member_count = selector:count()
23 selector:limit(limit)
26 ui.container{ attr = { class = "mdl-card mdl-shadow--2dp mdl-card__fullwidth" }, content = function()
28 ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function()
29 local text
30 if unit_id then
31 text = _("Eligible members (#{count})", { count = selector:count() })
32 else
33 text = _("Registered members (#{count})", { count = selector:count() })
34 end
35 ui.container{
36 attr = { class = "mdl-card__title-text" },
37 content = text
38 }
39 end }
41 ui.container{ attr = { class = "mdl-card__content" }, content = function()
42 execute.view {
43 module = 'member', view = '_list', params = {
44 members_selector = selector,
45 no_filter = true, no_paginate = true,
46 member_class = "sidebarRow sidebarRowNarrow"
47 }
48 }
49 end }
51 if member_count > limit then
52 ui.container{ attr = { class = "mdl-card__actions mdl-card--border" }, content = function()
53 ui.link {
54 attr = { class = "mdl-button mdl-js-button" },
55 text = _"Show full member list",
56 module = "member", view = "list"
57 }
58 end }
59 end
60 end }