liquid_feedback_frontend
diff app/main/index/_sidebar_notifications.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 | c0fd12b97d65 |
children |
line diff
1.1 --- a/app/main/index/_sidebar_notifications.lua Thu Jun 23 03:30:57 2016 +0200 1.2 +++ b/app/main/index/_sidebar_notifications.lua Sun Jul 15 14:07:29 2018 +0200 1.3 @@ -7,6 +7,18 @@ 1.4 } 1.5 end 1.6 1.7 +local agents = Agent:new_selector() 1.8 + :add_where{ "controller_id = ?", app.session.member_id } 1.9 + :add_where{ "accepted ISNULL" } 1.10 + :exec() 1.11 +for i, agent in ipairs(agents) do 1.12 + local member = Member:by_id(agent.controlled_id) 1.13 + notification_links[#notification_links+1] = { 1.14 + module = "agent", view = "show", params = { controlled_id = agent.controlled_id }, 1.15 + text = _("Account access invitation from '#{member_name}'", { member_name = member.name }) 1.16 + } 1.17 +end 1.18 + 1.19 if config.check_delegations_interval_soft then 1.20 local member = Member:new_selector() 1.21 :add_where({ "id = ?", app.session.member_id }) 1.22 @@ -99,28 +111,19 @@ 1.23 } 1.24 end 1.25 1.26 -local mode = param.get("mode") or "view" 1.27 - 1.28 if #notification_links > 0 then 1.29 - if mode == "link" then 1.30 - slot.select("notification", function () 1.31 - local text = _"notifications" 1.32 - ui.link { 1.33 - attr = { class = "notifications", title = text }, 1.34 - module = "index", view = "notifications", 1.35 - content = function () 1.36 - ui.image { attr = { class = "icon", alt = text }, static = "icons/48/bell.png" } 1.37 - ui.tag { attr = { class = "count" }, content = #notification_links } 1.38 + ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function() 1.39 + ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function() 1.40 + ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = _"Notifications" } 1.41 + end } 1.42 + ui.container{ attr = { class = "mdl-card__content what-can-i-do-here" }, content = function() 1.43 + ui.tag{ tag = "ul", attr = { class = "ul" }, content = function() 1.44 + for i, notification_link in ipairs(notification_links) do 1.45 + ui.tag{ tag = "li", content = function() 1.46 + ui.link(notification_link) 1.47 + end } 1.48 end 1.49 - } 1.50 - end ) 1.51 - elseif mode == "view" then 1.52 - ui.tag{ tag = "ul", attr = { class = "ul" }, content = function() 1.53 - for i, notification_link in ipairs(notification_links) do 1.54 - ui.tag{ tag = "li", content = function() 1.55 - ui.link(notification_link) 1.56 - end } 1.57 - end 1.58 + end } 1.59 end } 1.60 - end 1.61 + end } 1.62 end