liquid_feedback_frontend
diff app/main/area/_sidebar_whatcanido.lua @ 1045:701a5cf6b067
Imported LiquidFeedback Frontend 3.0 branch
author | bsw |
---|---|
date | Thu Jul 10 01:19:48 2014 +0200 (2014-07-10) |
parents | |
children | 84f6e17c7ceb |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/app/main/area/_sidebar_whatcanido.lua Thu Jul 10 01:19:48 2014 +0200 1.3 @@ -0,0 +1,168 @@ 1.4 +local member = param.get ( "member", "table" ) or app.session.member 1.5 + 1.6 +local area = param.get ( "area", "table" ) 1.7 + 1.8 +local participating_trustee_id 1.9 +local participating_trustee_name 1.10 +if member then 1.11 + if area.delegation_info.first_trustee_participation then 1.12 + participating_trustee_id = area.delegation_info.first_trustee_id 1.13 + participating_trustee_name = area.delegation_info.first_trustee_name 1.14 + elseif area.delegation_info.other_trustee_participation then 1.15 + participating_trustee_id = area.delegation_info.other_trustee_id 1.16 + participating_trustee_name = area.delegation_info.other_trustee_name 1.17 + end 1.18 +end 1.19 + 1.20 +ui.sidebar ( "tab-whatcanido", function () 1.21 + 1.22 + ui.sidebarHeadWhatCanIDo() 1.23 + 1.24 + if member and not app.session.member:has_voting_right_for_unit_id(area.unit_id) then 1.25 + ui.sidebarSection( _"You are not entitled to vote in this unit" ) 1.26 + end 1.27 + 1.28 + if member and app.session.member:has_voting_right_for_unit_id(area.unit_id) then 1.29 + if not area.delegation_info.own_participation then 1.30 + ui.sidebarSection ( function () 1.31 + 1.32 + ui.heading { 1.33 + level = 3, 1.34 + content = _"I want to participate in this subject area" 1.35 + } 1.36 + ui.tag { tag = "ul", attr = { class = "ul" }, content = function () 1.37 + ui.tag { tag = "li", content = function () 1.38 + ui.tag { content = function () 1.39 + ui.link { 1.40 + module = "membership", action = "update", 1.41 + routing = { default = { 1.42 + mode = "redirect", module = "area", view = "show", id = area.id 1.43 + } }, 1.44 + params = { area_id = area.id }, 1.45 + text = _"subscribe" 1.46 + } 1.47 + end } 1.48 + end } 1.49 + end } 1.50 + end ) 1.51 + end 1.52 + 1.53 + if area.delegation_info.own_participation then 1.54 + ui.sidebarSection ( function () 1.55 + ui.image{ attr = { class = "right" }, static = "icons/48/star.png" } 1.56 + ui.heading { 1.57 + level = 3, 1.58 + content = _"You are subscribed for this subject area" 1.59 + } 1.60 + ui.tag { tag = "ul", attr = { class = "ul" }, content = function () 1.61 + ui.tag { tag = "li", content = function () 1.62 + ui.tag { content = function () 1.63 + ui.link { 1.64 + module = "membership", action = "update", 1.65 + routing = { default = { 1.66 + mode = "redirect", module = "area", view = "show", id = area.id 1.67 + } }, 1.68 + params = { area_id = area.id, delete = true }, 1.69 + text = _"unsubscribe" 1.70 + } 1.71 + end } 1.72 + end } 1.73 + end } 1.74 + end ) 1.75 + end 1.76 + 1.77 + 1.78 + ui.sidebarSection ( function () 1.79 + 1.80 + 1.81 + if not area.delegation_info.first_trustee_id then 1.82 + ui.heading{ level = 3, content = _"I want to delegate this subject area" } 1.83 + else 1.84 + ui.container { attr = { class = "right" }, content = function() 1.85 + local member = Member:by_id(area.delegation_info.first_trustee_id) 1.86 + execute.view{ 1.87 + module = "member_image", 1.88 + view = "_show", 1.89 + params = { 1.90 + member = member, 1.91 + image_type = "avatar", 1.92 + show_dummy = true 1.93 + } 1.94 + } 1.95 + end } 1.96 + ui.heading{ level = 3, content = _"You delegated this subject area" } 1.97 + end 1.98 + 1.99 + ui.tag { tag = "ul", attr = { class = "ul" }, content = function () 1.100 + if area.delegation_info.own_delegation_scope == "unit" then 1.101 + ui.tag { tag = "li", content = function () 1.102 + ui.link { 1.103 + module = "delegation", view = "show", params = { 1.104 + unit_id = area.unit_id, 1.105 + }, 1.106 + content = _("change/revoke delegation of organizational unit") 1.107 + } 1.108 + end } 1.109 + end 1.110 + 1.111 + if area.delegation_info.own_delegation_scope == nil then 1.112 + ui.tag { tag = "li", content = function () 1.113 + ui.link { 1.114 + module = "delegation", view = "show", params = { 1.115 + area_id = area.id 1.116 + }, 1.117 + content = _"choose subject area delegatee" 1.118 + } 1.119 + end } 1.120 + elseif area.delegation_info.own_delegation_scope == "area" then 1.121 + ui.tag { tag = "li", content = function () 1.122 + ui.link { 1.123 + module = "delegation", view = "show", params = { 1.124 + area_id = area.id 1.125 + }, 1.126 + content = _"change/revoke area delegation" 1.127 + } 1.128 + end } 1.129 + else 1.130 + ui.tag { tag = "li", content = function () 1.131 + ui.link { 1.132 + module = "delegation", view = "show", params = { 1.133 + area_id = area.id 1.134 + }, 1.135 + content = _"change/revoke delegation only for this subject area" 1.136 + } 1.137 + end } 1.138 + end 1.139 + end } 1.140 + end ) 1.141 + 1.142 + 1.143 + 1.144 + 1.145 + if app.session.member:has_voting_right_for_unit_id ( area.unit_id ) then 1.146 + ui.sidebarSection ( function () 1.147 + ui.heading { 1.148 + level = 3, 1.149 + content = _("I want to start a new initiative", { 1.150 + area_name = area.name 1.151 + } ) 1.152 + } 1.153 + ui.tag { tag = "ul", attr = { class = "ul" }, content = function () 1.154 + ui.tag { tag = "li", content = _"Take a look through the existing issues. Maybe someone else started a debate on your topic (and you can join it) or the topic has been decided already in the past." } 1.155 + ui.tag { tag = "li", content = function () 1.156 + ui.tag { content = function () 1.157 + ui.tag { content = _"If you cannot find any appropriate existing issue, " } 1.158 + ui.link { 1.159 + module = "initiative", view = "new", 1.160 + params = { area_id = area.id }, 1.161 + text = _"start an initiative in a new issue" 1.162 + } 1.163 + end } 1.164 + end } 1.165 + end } 1.166 + end ) 1.167 + end 1.168 + else 1.169 + end 1.170 + 1.171 +end ) 1.172 \ No newline at end of file