liquid_feedback_frontend
changeset 525:63d6549cc00b
Delegation chain preview improved, better visualisation of current context, code cleanup
line diff
1.1 --- a/app/main/_filter_view/30_navigation.lua Tue Apr 17 00:07:04 2012 +0200 1.2 +++ b/app/main/_filter_view/30_navigation.lua Fri May 18 19:07:07 2012 +0200 1.3 @@ -3,35 +3,21 @@ 1.4 slot.select('navigation', function() 1.5 1.6 ui.link{ 1.7 - attr = { class = "logolf" }, 1.8 - content = _"Home", 1.9 + content = function() 1.10 + ui.tag{ attr = { class = "logolf" }, content = _"LiquidFeedback" } 1.11 + slot.put(" · ") 1.12 + ui.tag{ content = config.instance_name } 1.13 + end, 1.14 module = 'index', 1.15 view = 'index' 1.16 } 1.17 - 1.18 - if app.session.member_id then 1.19 - ui.link{ 1.20 - content = _"Units", 1.21 - module = 'unit', 1.22 - view = 'list' 1.23 - } 1.24 - ui.link{ 1.25 - content = _"Members", 1.26 - module = 'member', 1.27 - view = 'list' 1.28 - } 1.29 - ui.link{ 1.30 - content = _"Contacts", 1.31 - module = 'contact', 1.32 - view = 'list' 1.33 - } 1.34 - end 1.35 + ui.link{ 1.36 + content = _"Search", 1.37 + module = 'index', 1.38 + view = 'search' 1.39 + } 1.40 1.41 - ui.link{ 1.42 - content = _"Search", 1.43 - module = 'index', 1.44 - view = 'search' 1.45 - } 1.46 + 1.47 1.48 if config.public_access and app.session.member == nil then 1.49 ui.link{ 1.50 @@ -59,46 +45,36 @@ 1.51 } 1.52 else 1.53 1.54 - ui.container{ attr = { class = "member_info" }, content = function() 1.55 - ui.link{ 1.56 - content = function() 1.57 - execute.view{ 1.58 - module = "member_image", 1.59 - view = "_show", 1.60 - params = { 1.61 - member = app.session.member, 1.62 - image_type = "avatar", 1.63 - show_dummy = true, 1.64 - class = "micro_avatar", 1.65 - } 1.66 - } 1.67 - ui.tag{ content = app.session.member.name } 1.68 - end, 1.69 - module = "member", 1.70 - view = "show", 1.71 - id = app.session.member_id 1.72 - } 1.73 - 1.74 - ui.link{ 1.75 - text = _"Settings", 1.76 - module = "member", 1.77 - view = "settings" 1.78 - } 1.79 + ui.container{ attr = { class = "navigation_right" }, content = function() 1.80 1.81 if app.session.member_id then 1.82 - ui.link{ 1.83 - -- image = { static = "icons/16/stop.png" }, 1.84 - text = _"Logout", 1.85 - module = 'index', 1.86 - action = 'logout', 1.87 - routing = { 1.88 - default = { 1.89 - mode = "redirect", 1.90 - module = "index", 1.91 - view = "index" 1.92 + ui.container{ attr = { class = "member_menu" }, content = function() 1.93 + ui.container{ attr = { class = "title" }, content = function() 1.94 + ui.link{ 1.95 + content = function() 1.96 + execute.view{ 1.97 + module = "member_image", 1.98 + view = "_show", 1.99 + params = { 1.100 + member = app.session.member, 1.101 + image_type = "avatar", 1.102 + show_dummy = true, 1.103 + class = "micro_avatar", 1.104 + } 1.105 + } 1.106 + ui.tag{ content = app.session.member.name } 1.107 + end, 1.108 + module = "member", 1.109 + view = "menu" 1.110 } 1.111 + end } 1.112 + ui.container{ 1.113 + attr = { id = "member_menu" }, 1.114 + content = function() 1.115 + execute.view{ module = "member", view = "_menu" } 1.116 + end 1.117 } 1.118 - } 1.119 + end } 1.120 end 1.121 1.122 end }
2.1 --- a/app/main/_layout/default.html Tue Apr 17 00:07:04 2012 +0200 2.2 +++ b/app/main/_layout/default.html Fri May 18 19:07:07 2012 +0200 2.3 @@ -42,28 +42,28 @@ 2.4 <div class="logo" id="logo"> 2.5 <!-- WEBMCP SLOT logo --> 2.6 </div> 2.7 + <div class="page_head" id="head"> 2.8 + <!-- WEBMCP SLOT head --> 2.9 + <div class="title" id="title"> 2.10 + <!-- WEBMCP SLOT title --> 2.11 + </div> 2.12 + <div class="title2" id="title2"> 2.13 + <!-- WEBMCP SLOT title2 --> 2.14 + </div> 2.15 + <div class="actions" id="actions"> 2.16 + <div class="interest vote_info" id="interest"> 2.17 + <!-- WEBMCP SLOT interest --> 2.18 + </div> 2.19 + <!-- WEBMCP SLOT actions --> 2.20 + <div style="clear: left;"></div> 2.21 + </div> 2.22 + </div> 2.23 <div class="help_hidden" id="help_hidden"> 2.24 <!-- WEBMCP SLOT help_hidden --> 2.25 </div> 2.26 - <div class="title" id="title"> 2.27 - <!-- WEBMCP SLOT title --> 2.28 - </div> 2.29 - <div class="title2" id="title2"> 2.30 - <!-- WEBMCP SLOT title2 --> 2.31 - </div> 2.32 - <div class="actions" id="actions"> 2.33 - <div class="interest vote_info" id="interest"> 2.34 - <!-- WEBMCP SLOT interest --> 2.35 - </div> 2.36 - <!-- WEBMCP SLOT actions --> 2.37 - <div style="clear: left;"></div> 2.38 - </div> 2.39 <div class="initiatives_list" id="initiatives_list"> 2.40 <!-- WEBMCP SLOT initiatives_list --> 2.41 </div> 2.42 - <div class="initiative_head" id="initiative_head"> 2.43 - <!-- WEBMCP SLOT initiative_head --> 2.44 - </div> 2.45 <div class="support vote_info" id="support"> 2.46 <!-- WEBMCP SLOT support --> 2.47 </div>
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/app/main/admin/unit_edit.lua Fri May 18 19:07:07 2012 +0200 3.3 @@ -0,0 +1,54 @@ 3.4 +local id = param.get_id() 3.5 + 3.6 +local unit = Unit:by_id(id) 3.7 + 3.8 +if member then 3.9 + slot.put_into("title", encode.html(_("Unit: '#{name}'", { name = unit.name }))) 3.10 +else 3.11 + slot.put_into("title", encode.html(_"Add new unit")) 3.12 +end 3.13 + 3.14 +local units_selector = Unit:new_selector() 3.15 + 3.16 +if member then 3.17 + units_selector 3.18 + :left_join("privilege", nil, { "privilege.member_id = ? AND privilege.unit_id = unit.id", member.id }) 3.19 + :add_field("privilege.voting_right", "voting_right") 3.20 +end 3.21 + 3.22 +local units = units_selector:exec() 3.23 + 3.24 +ui.form{ 3.25 + attr = { class = "vertical" }, 3.26 + module = "admin", 3.27 + action = "member_update", 3.28 + id = member and member.id, 3.29 + record = member, 3.30 + readonly = not app.session.member.admin, 3.31 + routing = { 3.32 + default = { 3.33 + mode = "redirect", 3.34 + modules = "admin", 3.35 + view = "member_list" 3.36 + } 3.37 + }, 3.38 + content = function() 3.39 + ui.field.text{ label = _"Identification", name = "identification" } 3.40 + ui.field.text{ label = _"Notification email", name = "notify_email" } 3.41 + ui.field.boolean{ label = _"Admin?", name = "admin" } 3.42 + 3.43 + slot.put("<br />") 3.44 + 3.45 + for i, unit in ipairs(units) do 3.46 + ui.field.boolean{ 3.47 + name = "unit_" .. unit.id, 3.48 + label = unit.name, 3.49 + value = unit.voting_right 3.50 + } 3.51 + end 3.52 + slot.put("<br /><br />") 3.53 + 3.54 + ui.field.boolean{ label = _"Send invite?", name = "invite_member" } 3.55 + ui.submit{ text = _"Save" } 3.56 + end 3.57 +}
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 4.2 +++ b/app/main/area/_head.lua Fri May 18 19:07:07 2012 +0200 4.3 @@ -0,0 +1,85 @@ 4.4 +local area = param.get("area", "table") 4.5 + 4.6 +execute.view{ module = "unit", view = "_head", params = { unit = area.unit } } 4.7 + 4.8 +slot.select("head", function() 4.9 + 4.10 + ui.container{ attr = { class = "area_head" }, content = function() 4.11 + 4.12 + execute.view{ module = "delegation", view = "_info", params = { area = area } } 4.13 + 4.14 + ui.container{ attr = { class = "title" }, content = function() 4.15 + -- area name 4.16 + ui.link{ 4.17 + module = "area", view = "show", id = area.id, 4.18 + attr = { class = "area_name" }, content = area.name 4.19 + } 4.20 + end } 4.21 + 4.22 + ui.container{ attr = { class = "content" }, content = function() 4.23 + 4.24 + -- actions (members with appropriate voting right only) 4.25 + if app.session.member_id then 4.26 + 4.27 + -- membership 4.28 + local membership = Membership:by_pk(area.id, app.session.member.id) 4.29 + 4.30 + if membership then 4.31 + 4.32 + ui.tag{ content = _"You are member" } 4.33 + 4.34 + slot.put(" ") 4.35 + 4.36 + ui.tag{ content = function() 4.37 + slot.put("(") 4.38 + ui.link{ 4.39 + text = _"Withdraw", 4.40 + module = "membership", 4.41 + action = "update", 4.42 + params = { area_id = area.id, delete = true }, 4.43 + routing = { default = { mode = "redirect", module = "area", view = "show", id = area.id } } 4.44 + } 4.45 + slot.put(")") 4.46 + end } 4.47 + 4.48 + slot.put(" · ") 4.49 + 4.50 + elseif app.session.member:has_voting_right_for_unit_id(area.unit_id) then 4.51 + ui.link{ 4.52 + text = _"Become a member", 4.53 + module = "membership", 4.54 + action = "update", 4.55 + params = { area_id = area.id }, 4.56 + routing = { 4.57 + default = { 4.58 + mode = "redirect", 4.59 + module = "area", 4.60 + view = "show", 4.61 + id = area.id 4.62 + } 4.63 + } 4.64 + } 4.65 + 4.66 + slot.put(" · ") 4.67 + 4.68 + end 4.69 + 4.70 + -- create new issue 4.71 + if app.session.member:has_voting_right_for_unit_id(area.unit_id) then 4.72 + ui.link{ 4.73 + content = function() 4.74 + slot.put(_"Create new issue") 4.75 + end, 4.76 + module = "initiative", 4.77 + view = "new", 4.78 + params = { area_id = area.id } 4.79 + } 4.80 + end 4.81 + 4.82 + end 4.83 + 4.84 + end } 4.85 + 4.86 + end } 4.87 + 4.88 +end) 4.89 \ No newline at end of file
5.1 --- a/app/main/area/show.lua Tue Apr 17 00:07:04 2012 +0200 5.2 +++ b/app/main/area/show.lua Fri May 18 19:07:07 2012 +0200 5.3 @@ -13,24 +13,7 @@ 5.4 end 5.5 5.6 5.7 -slot.select("title", function() 5.8 - ui.link{ 5.9 - content = area.name, 5.10 - module = "area", view = "show", id = area.id 5.11 - } 5.12 - 5.13 - if not config.single_unit_id then 5.14 - slot.put(" · ") 5.15 - ui.link{ 5.16 - content = area.unit.name, 5.17 - module = "unit", 5.18 - view = "show", 5.19 - id = area.unit_id 5.20 - } 5.21 - end 5.22 - 5.23 - 5.24 -end) 5.25 +execute.view{ module = "area", view = "_head", params = { area = area } } 5.26 5.27 ui.container{ 5.28 attr = { class = "vertical"}, 5.29 @@ -40,35 +23,7 @@ 5.30 } 5.31 5.32 5.33 -if app.session.member_id then 5.34 - execute.view{ 5.35 - module = "membership", 5.36 - view = "_show_box", 5.37 - params = { area = area } 5.38 - } 5.39 5.40 - execute.view{ 5.41 - module = "delegation", 5.42 - view = "_show_box", 5.43 - params = { area_id = area.id } 5.44 - } 5.45 - 5.46 - if app.session.member:has_voting_right_for_unit_id(area.unit_id) then 5.47 - slot.select("actions", function() 5.48 - ui.link{ 5.49 - content = function() 5.50 - ui.image{ static = "icons/16/folder_add.png" } 5.51 - slot.put(_"Create new issue") 5.52 - end, 5.53 - module = "initiative", 5.54 - view = "new", 5.55 - params = { area_id = area.id } 5.56 - } 5.57 - end) 5.58 - end 5.59 - 5.60 - 5.61 -end 5.62 5.63 if app.session.member then 5.64 execute.view{
6.1 --- a/app/main/area/show_tab.lua Tue Apr 17 00:07:04 2012 +0200 6.2 +++ b/app/main/area/show_tab.lua Fri May 18 19:07:07 2012 +0200 6.3 @@ -50,7 +50,7 @@ 6.4 tabs[#tabs+1] = 6.5 { 6.6 name = "members", 6.7 - label = _"Members" .. " (" .. tostring(members_selector:count()) .. ")", 6.8 + label = _"Participants" .. " (" .. tostring(members_selector:count()) .. ")", 6.9 icon = { static = "icons/16/group.png" }, 6.10 module = "member", 6.11 view = "_list",
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 7.2 +++ b/app/main/delegation/_info.lua Fri May 18 19:07:07 2012 +0200 7.3 @@ -0,0 +1,188 @@ 7.4 +local unit = param.get("unit", "table") 7.5 +local area = param.get("area", "table") 7.6 +local issue = param.get("issue", "table") 7.7 + 7.8 +local unit_id = unit and unit.id or nil 7.9 +local area_id = area and area.id or nil 7.10 +local issue_id = issue and issue.id or nil 7.11 + 7.12 +local info 7.13 +local delegation_text 7.14 + 7.15 +if unit then 7.16 + unit:load_delegation_info_once_for_member_id(app.session.member_id) 7.17 + info = unit.delegation_info 7.18 + delegation_text = _"Delegate unit" 7.19 +end 7.20 + 7.21 +if area then 7.22 + area:load_delegation_info_once_for_member_id(app.session.member_id) 7.23 + info = area.delegation_info 7.24 + delegation_text = _"Delegate area" 7.25 +end 7.26 + 7.27 +if issue then 7.28 + issue:load_delegation_info_once_for_member_id(app.session.member_id) 7.29 + info = issue.delegation_info 7.30 + delegation_text = _"Delegate issue" 7.31 +end 7.32 + 7.33 +ui.link{ 7.34 + module = "delegation", view = "show", params = { 7.35 + unit_id = unit_id, 7.36 + area_id = area_id, 7.37 + issue_id = issue_id 7.38 + }, 7.39 + attr = { class = "delegation_info" }, content = function() 7.40 + 7.41 + 7.42 + local participant_occured = false 7.43 + 7.44 + if info.own_participation or info.first_trustee_id then 7.45 + 7.46 + local class = "micro_avatar" 7.47 + if info.own_participation then 7.48 + participant_occured = true 7.49 + class = class .. " highlighted" 7.50 + end 7.51 + 7.52 + execute.view{ module = "member_image", view = "_show", params = { 7.53 + member = app.session.member, class = class, popup_text = app.session.member.name, 7.54 + image_type = "avatar", show_dummy = true, 7.55 + } } 7.56 + 7.57 + end 7.58 + 7.59 + if not info.first_trustee_id and (not issue or not issue.closed) then 7.60 + slot.put(" ") 7.61 + ui.tag{ attr = { class = "link" }, content = delegation_text } 7.62 + end 7.63 + 7.64 + if not (issue and issue.state == "voting" and info.own_participation) then 7.65 + 7.66 + if info.first_trustee_id then 7.67 + 7.68 + local text = _"delegates to" 7.69 + ui.image{ 7.70 + attr = { class = "delegation_arrow", alt = text, title = text }, 7.71 + static = "delegation_arrow_24_horizontal.png" 7.72 + } 7.73 + 7.74 + local class = "micro_avatar" 7.75 + if not participant_occured and info.first_trustee_participation then 7.76 + participant_occured = true 7.77 + class = class .. " highlighted" 7.78 + end 7.79 + 7.80 + execute.view{ module = "member_image", view = "_show", params = { 7.81 + member_id = info.first_trustee_id, class = class, popup_text = info.first_trustee_name, 7.82 + image_type = "avatar", show_dummy = true, 7.83 + } } 7.84 + 7.85 + end 7.86 + 7.87 + if info.first_trustee_ellipsis then 7.88 + 7.89 + local text = _"delegates to" 7.90 + ui.image{ 7.91 + attr = { class = "delegation_arrow", alt = text, title = text }, 7.92 + static = "delegation_arrow_24_horizontal.png" 7.93 + } 7.94 + 7.95 + slot.put("...") 7.96 + 7.97 + end 7.98 + 7.99 + if info.other_trustee_id then 7.100 + 7.101 + local text = _"delegates to" 7.102 + ui.image{ 7.103 + attr = { class = "delegation_arrow", alt = text, title = text }, 7.104 + static = "delegation_arrow_24_horizontal.png" 7.105 + } 7.106 + 7.107 + local class = "micro_avatar" 7.108 + if not participant_occured and info.other_trustee_participation then 7.109 + participant_occured = true 7.110 + class = class .. " highlighted" 7.111 + end 7.112 + 7.113 + execute.view{ module = "member_image", view = "_show", params = { 7.114 + member_id = info.other_trustee_id, class = class, popup_text = info.other_trustee_name, 7.115 + image_type = "avatar", show_dummy = true, 7.116 + } } 7.117 + 7.118 + end 7.119 + 7.120 + if info.other_trustee_ellipsis then 7.121 + 7.122 + local text = _"delegates to" 7.123 + ui.image{ 7.124 + attr = { class = "delegation_arrow", alt = text, title = text }, 7.125 + static = "delegation_arrow_24_horizontal.png" 7.126 + } 7.127 + 7.128 + slot.put("...") 7.129 + 7.130 + end 7.131 + 7.132 + local trailing_ellipsis = info.other_trustee_ellipsis or 7.133 + (info.first_trustee_ellipsis and not info.other_trustee_id) 7.134 + 7.135 + if info.delegation_loop == "own" then 7.136 + 7.137 + local text = _"delegates to" 7.138 + ui.image{ 7.139 + attr = { class = "delegation_arrow", alt = text, title = text }, 7.140 + static = "delegation_arrow_24_horizontal.png" 7.141 + } 7.142 + 7.143 + execute.view{ module = "member_image", view = "_show", params = { 7.144 + member = app.session.member, class = "micro_avatar", popup_text = app.session.member.name, 7.145 + image_type = "avatar", show_dummy = true, 7.146 + } } 7.147 + 7.148 + elseif info.delegation_loop == "first" then 7.149 + if info.first_trustee_ellipsis then 7.150 + if not trailing_ellipsis then 7.151 + 7.152 + local text = _"delegates to" 7.153 + ui.image{ 7.154 + attr = { class = "delegation_arrow", alt = text, title = text }, 7.155 + static = "delegation_arrow_24_horizontal.png" 7.156 + } 7.157 + 7.158 + slot.put("...") 7.159 + end 7.160 + 7.161 + else 7.162 + 7.163 + local text = _"delegates to" 7.164 + ui.image{ 7.165 + attr = { class = "delegation_arrow", alt = text, title = text }, 7.166 + static = "delegation_arrow_24_horizontal.png" 7.167 + } 7.168 + 7.169 + execute.view{ module = "member_image", view = "_show", params = { 7.170 + member_id = info.first_trustee_id, class = "micro_avatar", popup_text = info.first_trustee_name, 7.171 + image_type = "avatar", show_dummy = true, 7.172 + } } 7.173 + end 7.174 + 7.175 + 7.176 + elseif info.delegation_loop and not trailing_ellipsis then 7.177 + local text = _"delegates to" 7.178 + ui.image{ 7.179 + attr = { class = "delegation_arrow", alt = text, title = text }, 7.180 + static = "delegation_arrow_24_horizontal.png" 7.181 + } 7.182 + 7.183 + slot.put("...") 7.184 + end 7.185 + 7.186 + end 7.187 + 7.188 + end 7.189 + 7.190 +} 7.191 +
8.1 --- a/app/main/delegation/_show_box.lua Tue Apr 17 00:07:04 2012 +0200 8.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 8.3 @@ -1,275 +0,0 @@ 8.4 -function change_delegation(scope, unit_id, area_id, issue, delegation, initiative_id) 8.5 - local check_unit_id 8.6 - if unit_id then 8.7 - check_unit_id = unit_id 8.8 - elseif area_id then 8.9 - local area = Area:by_id(area_id) 8.10 - check_unit_id = area.unit_id 8.11 - else 8.12 - local area = Area:by_id(issue.area_id) 8.13 - check_unit_id = area.unit_id 8.14 - end 8.15 - 8.16 - if not app.session.member:has_voting_right_for_unit_id(check_unit_id) then 8.17 - return 8.18 - end 8.19 - 8.20 - local image 8.21 - local text 8.22 - if scope == "unit" and delegation and delegation.unit_id then 8.23 - image = { static = "icons/16/table_go.png" } 8.24 - text = config.single_unit_id and _"Change global delegation" or _"Change unit delegation" 8.25 - elseif scope == "unit" and not (delegation and delegation.unit_id) then 8.26 - image = { static = "icons/16/table_go.png" } 8.27 - text = config.single_unit_id and _"Set global delegation" or _"Set unit delegation" 8.28 - elseif scope == "area" and delegation and delegation.area_id then 8.29 - image = { static = "icons/16/table_go.png" } 8.30 - text = _"Change area delegation" 8.31 - elseif scope == "area" and not (delegation and delegation.area_id) then 8.32 - image = { static = "icons/16/table_go.png" } 8.33 - text = _"Set area delegation" 8.34 - elseif scope == "issue" then 8.35 - if delegation and delegation.issue_id then 8.36 - image = { static = "icons/16/table_go.png" } 8.37 - text = _"Change issue delegation" 8.38 - elseif issue.state ~= "finished" and issue.state ~= "cancelled" then 8.39 - image = { static = "icons/16/table_go.png" } 8.40 - text = _"Set issue delegation" 8.41 - end 8.42 - end 8.43 - ui.container{ 8.44 - attr = { 8.45 - class = "change_delegation", 8.46 - }, 8.47 - content = function() 8.48 - ui.link{ 8.49 - image = image, 8.50 - text = text, 8.51 - module = "delegation", 8.52 - view = "new", 8.53 - params = { 8.54 - issue_id = issue and issue.id or nil, 8.55 - initiative_id = initiative_id or nil, 8.56 - area_id = area_id, 8.57 - unit_id = unit_id 8.58 - }, 8.59 - } 8.60 - if delegation then 8.61 - ui.link{ 8.62 - image = { static = "icons/16/delete.png" }, 8.63 - text = _"Revoke", 8.64 - module = "delegation", 8.65 - action = "update", 8.66 - params = { issue_id = delegation.issue_id, area_id = delegation.area_id, unit_id = delegation.unit_id, delete = true }, 8.67 - routing = { 8.68 - default = { 8.69 - mode = "redirect", 8.70 - module = request.get_module(), 8.71 - view = request.get_view(), 8.72 - id = param.get_id_cgi(), 8.73 - params = param.get_all_cgi() 8.74 - } 8.75 - } 8.76 - } 8.77 - end 8.78 - end 8.79 - } 8.80 -end 8.81 - 8.82 -local delegation 8.83 -local unit_id 8.84 -local area_id 8.85 -local issue_id 8.86 -local initiative_id 8.87 - 8.88 -local scope = "unit" 8.89 - 8.90 -unit_id = param.get("unit_id", atom.integer) 8.91 - 8.92 -local inline = param.get("inline", atom.boolean) 8.93 - 8.94 -if param.get("initiative_id", atom.integer) then 8.95 - initiative_id = param.get("initiative_id", atom.integer) 8.96 - issue_id = Initiative:by_id(initiative_id).issue_id 8.97 - scope = "issue" 8.98 -end 8.99 - 8.100 -if param.get("issue_id", atom.integer) then 8.101 - issue_id = param.get("issue_id", atom.integer) 8.102 - scope = "issue" 8.103 -end 8.104 - 8.105 -if param.get("area_id", atom.integer) then 8.106 - area_id = param.get("area_id", atom.integer) 8.107 - scope = "area" 8.108 -end 8.109 - 8.110 - 8.111 - 8.112 -local delegation 8.113 -local issue 8.114 - 8.115 -if issue_id then 8.116 - issue = Issue:by_id(issue_id) 8.117 - delegation = Delegation:by_pk(app.session.member.id, nil, nil, issue_id) 8.118 - if not delegation then 8.119 - delegation = Delegation:by_pk(app.session.member.id, nil, issue.area_id) 8.120 - end 8.121 - if not delegation then 8.122 - delegation = Delegation:by_pk(app.session.member.id, issue.area.unit_id) 8.123 - end 8.124 -elseif area_id then 8.125 - delegation = Delegation:by_pk(app.session.member.id, nil, area_id) 8.126 - if not delegation then 8.127 - local area = Area:by_id(area_id) 8.128 - delegation = Delegation:by_pk(app.session.member.id, area.unit_id) 8.129 - end 8.130 -end 8.131 - 8.132 -if not delegation then 8.133 - delegation = Delegation:by_pk(app.session.member.id, unit_id) 8.134 -end 8.135 - 8.136 -local slot_name = "actions" 8.137 - 8.138 -if inline then 8.139 - slot_name = "default" 8.140 -end 8.141 - 8.142 -slot.select(slot_name, function() 8.143 - 8.144 - if delegation then 8.145 - ui.container{ 8.146 - attr = { class = "delegation vote_info"}, 8.147 - content = function() 8.148 - ui.container{ 8.149 - attr = { 8.150 - title = _"Click for details", 8.151 - class = "head head_active", 8.152 - style = "cursor: pointer;", 8.153 - onclick = "document.getElementById('delegation_content').style.display = 'block';" 8.154 - }, 8.155 - content = function() 8.156 - if delegation.trustee_id then 8.157 - ui.image{ 8.158 - static = "icons/16/table_go.png" 8.159 - } 8.160 - local member = Member:new_selector() 8.161 - :reset_fields() 8.162 - :add_field("name", "delegation_name") 8.163 - :add_where({ "id = ?", delegation.trustee_id }) 8.164 - :single_object_mode() 8.165 - :exec() 8.166 - if delegation.issue_id then 8.167 - slot.put( _("Issue delegated to '#{name}'", { name = member.delegation_name }) ) 8.168 - elseif delegation.area_id then 8.169 - slot.put( _("Area delegated to '#{name}'", { name = member.delegation_name }) ) 8.170 - else 8.171 - if config.single_unit_id then 8.172 - slot.put( _("Global delegation set to '#{name}'", { name = member.delegation_name }) ) 8.173 - else 8.174 - slot.put( _("Unit delegated to '#{name}'", { name = member.delegation_name }) ) 8.175 - end 8.176 - end 8.177 - 8.178 - else 8.179 - ui.image{ 8.180 - static = "icons/16/table_go_crossed.png" 8.181 - } 8.182 - if delegation.issue_id then 8.183 - slot.put(_"Delegation turned off for issue") 8.184 - elseif delegation.area_id then 8.185 - slot.put(_"Delegation turned off for area") 8.186 - end 8.187 - end 8.188 - ui.image{ 8.189 - static = "icons/16/dropdown.png" 8.190 - } 8.191 - end 8.192 - } 8.193 - ui.container{ 8.194 - attr = { class = "content", id = "delegation_content" }, 8.195 - content = function() 8.196 - ui.container{ 8.197 - attr = { 8.198 - class = "close", 8.199 - style = "cursor: pointer;", 8.200 - onclick = "document.getElementById('delegation_content').style.display = 'none';" 8.201 - }, 8.202 - content = function() 8.203 - ui.image{ static = "icons/16/cross.png" } 8.204 - end 8.205 - } 8.206 - 8.207 - local delegation_chain = Member:new_selector() 8.208 - :add_field("delegation_chain.*") 8.209 - :join("delegation_chain(" .. tostring(app.session.member.id) .. ", " .. tostring(unit_id or "NULL") .. ", " .. tostring(area_id or "NULL") .. ", " .. tostring(issue_id or "NULL") .. ")", "delegation_chain", "member.id = delegation_chain.member_id") 8.210 - :add_order_by("index") 8.211 - :exec() 8.212 - 8.213 - if not issue or (issue.state ~= "finished" and issue.state ~= "cancelled") then 8.214 - change_delegation(scope, unit_id, area_id, issue, delegation, initiative_id) 8.215 - slot.put("<br style='clear: left'/>") 8.216 - end 8.217 - 8.218 - for i, record in ipairs(delegation_chain) do 8.219 - local style 8.220 - local overridden = (not issue or issue.state ~= 'voting') and record.overridden 8.221 - if record.scope_in then 8.222 - ui.container{ 8.223 - attr = { class = "delegation_info" }, 8.224 - content = function() 8.225 - if not overridden then 8.226 - ui.image{ 8.227 - attr = { class = "delegation_arrow" }, 8.228 - static = "delegation_arrow_24_vertical.png" 8.229 - } 8.230 - else 8.231 - ui.image{ 8.232 - attr = { class = "delegation_arrow delegation_arrow_overridden" }, 8.233 - static = "delegation_arrow_24_vertical.png" 8.234 - } 8.235 - end 8.236 - ui.container{ 8.237 - attr = { class = "delegation_scope" .. (overridden and " delegation_scope_overridden" or "") }, 8.238 - content = function() 8.239 - if record.scope_in == "unit" then 8.240 - slot.put(config.single_object_mode and _"Global delegation" or _"Unit delegation") 8.241 - elseif record.scope_in == "area" then 8.242 - slot.put(_"Area delegation") 8.243 - elseif record.scope_in == "issue" then 8.244 - slot.put(_"Issue delegation") 8.245 - end 8.246 - end 8.247 - } 8.248 - end 8.249 - } 8.250 - end 8.251 - ui.container{ 8.252 - attr = { class = overridden and "delegation_overridden" or "" }, 8.253 - content = function() 8.254 - execute.view{ 8.255 - module = "member", 8.256 - view = "_show_thumb", 8.257 - params = { member = record } 8.258 - } 8.259 - end 8.260 - } 8.261 - if (not issue or issue.state ~= 'voting') and record.participation and not record.overridden then 8.262 - ui.container{ 8.263 - attr = { class = "delegation_participation" }, 8.264 - content = function() 8.265 - slot.put(_"This member is participating, the rest of delegation chain is suspended while discussing") 8.266 - end 8.267 - } 8.268 - end 8.269 - slot.put("<br style='clear: left'/>") 8.270 - end 8.271 - end 8.272 - } 8.273 - end 8.274 - } 8.275 - else 8.276 - change_delegation(scope, unit_id, area_id, issue, nil, initiative_id) 8.277 - end 8.278 -end)
9.1 --- a/app/main/delegation/new.lua Tue Apr 17 00:07:04 2012 +0200 9.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 9.3 @@ -1,178 +0,0 @@ 9.4 -local voting_right_unit_id 9.5 - 9.6 -local unit = Unit:by_id(param.get("unit_id", atom.integer)) 9.7 -if unit then 9.8 - voting_right_unit_id = unit.id 9.9 - slot.put_into("title", encode.html(config.single_unit_id and _"Set global delegation" or _"Set unit delegation")) 9.10 - util.help("delegation.new.unit") 9.11 -end 9.12 - 9.13 -local area = Area:by_id(param.get("area_id", atom.integer)) 9.14 -if area then 9.15 - voting_right_unit_id = area.unit_id 9.16 - slot.put_into("title", encode.html(_"Set delegation for Area '#{name}'":gsub("#{name}", area.name))) 9.17 - util.help("delegation.new.area") 9.18 -end 9.19 - 9.20 -local issue = Issue:by_id(param.get("issue_id", atom.integer)) 9.21 -if issue then 9.22 - voting_right_unit_id = issue.area.unit_id 9.23 - slot.put_into("title", encode.html(_"Set delegation for Issue ##{number} in Area '#{area_name}'":gsub("#{number}", issue.id):gsub("#{area_name}", issue.area.name))) 9.24 - util.help("delegation.new.issue") 9.25 -end 9.26 - 9.27 -local initiative = Initiative:by_id(param.get("initiative_id", atom.integer)) 9.28 - 9.29 -slot.select("actions", function() 9.30 - if issue then 9.31 - ui.link{ 9.32 - module = "issue", 9.33 - view = "show", 9.34 - id = issue.id, 9.35 - content = function() 9.36 - ui.image{ static = "icons/16/cancel.png" } 9.37 - slot.put(_"Cancel") 9.38 - end, 9.39 - } 9.40 - elseif area then 9.41 - ui.link{ 9.42 - module = "area", 9.43 - view = "show", 9.44 - id = area.id, 9.45 - content = function() 9.46 - ui.image{ static = "icons/16/cancel.png" } 9.47 - slot.put(_"Cancel") 9.48 - end, 9.49 - } 9.50 - else 9.51 - ui.link{ 9.52 - module = "index", 9.53 - view = "index", 9.54 - content = function() 9.55 - ui.image{ static = "icons/16/cancel.png" } 9.56 - slot.put(_"Cancel") 9.57 - end, 9.58 - } 9.59 - end 9.60 -end) 9.61 - 9.62 - 9.63 -local contact_members = Member:build_selector{ 9.64 - is_contact_of_member_id = app.session.member_id, 9.65 - voting_right_for_unit_id = voting_right_unit_id, 9.66 - order = "name" 9.67 -}:exec() 9.68 - 9.69 -ui.form{ 9.70 - attr = { class = "vertical" }, 9.71 - module = "delegation", 9.72 - action = "update", 9.73 - params = { 9.74 - unit_id = unit and unit.id or nil, 9.75 - area_id = area and area.id or nil, 9.76 - issue_id = issue and issue.id or nil, 9.77 - }, 9.78 - routing = { 9.79 - default = { 9.80 - mode = "redirect", 9.81 - module = area and "area" or initiative and "initiative" or issue and "issue" or "unit", 9.82 - view = "show", 9.83 - id = area and area.id or initiative and initiative.id or issue and issue.id or unit.id 9.84 - } 9.85 - }, 9.86 - content = function() 9.87 - local records 9.88 - 9.89 - if issue then 9.90 - local delegate_name = "" 9.91 - local scope = "no delegation set" 9.92 - local area_delegation = Delegation:by_pk(app.session.member_id, nil, issue.area_id) 9.93 - if area_delegation then 9.94 - delegate_name = area_delegation.trustee and area_delegation.trustee.name or _"abandoned" 9.95 - scope = _"area" 9.96 - else 9.97 - local unit_delegation = Delegation:by_pk(app.session.member_id, issue.area.unit_id) 9.98 - if unit_delegation then 9.99 - delegate_name = unit_delegation.trustee.name 9.100 - scope = config.single_unit_id and _"global" or _"unit" 9.101 - end 9.102 - end 9.103 - local text_apply 9.104 - local text_abandon 9.105 - if config.single_unit_id then 9.106 - text_apply = _("Apply global or area delegation for this issue (Currently: #{delegate_name} [#{scope}])", { delegate_name = delegate_name, scope = scope }) 9.107 - text_abandon = _"Abandon unit and area delegations for this issue" 9.108 - else 9.109 - text_apply = _("Apply unit or area delegation for this issue (Currently: #{delegate_name} [#{scope}])", { delegate_name = delegate_name, scope = scope }) 9.110 - text_abandon = _"Abandon unit and area delegations for this issue" 9.111 - end 9.112 - records = { 9.113 - { id = -1, name = text_apply }, 9.114 - { id = 0, name = text_abandon } 9.115 - } 9.116 - elseif area then 9.117 - local delegate_name = "" 9.118 - local scope = "no delegation set" 9.119 - local unit_delegation = Delegation:by_pk(app.session.member_id, area.unit_id) 9.120 - if unit_delegation then 9.121 - delegate_name = unit_delegation.trustee.name 9.122 - scope = config.single_unit_id and _"global" or _"unit" 9.123 - end 9.124 - local text_apply 9.125 - local text_abandon 9.126 - if config.single_unit_id then 9.127 - text_apply = _("Apply global delegation for this area (Currently: #{delegate_name} [#{scope}])", { delegate_name = delegate_name, scope = scope }) 9.128 - text_abandon = _"Abandon global delegation for this area" 9.129 - else 9.130 - text_apply = _("Apply unit delegation for this area (Currently: #{delegate_name} [#{scope}])", { delegate_name = delegate_name, scope = scope }) 9.131 - text_abandon = _"Abandon unit delegation for this area" 9.132 - end 9.133 - records = { 9.134 - { 9.135 - id = -1, 9.136 - name = text_apply 9.137 - }, 9.138 - { 9.139 - id = 0, 9.140 - name = text_abandon 9.141 - } 9.142 - } 9.143 - 9.144 - else 9.145 - records = { 9.146 - { 9.147 - id = -1, 9.148 - name = _"No delegation" 9.149 - } 9.150 - } 9.151 - 9.152 - end 9.153 - -- add saved members 9.154 - records[#records+1] = {id="_", name= "--- " .. _"Saved contacts" .. " ---"} 9.155 - for i, record in ipairs(contact_members) do 9.156 - records[#records+1] = record 9.157 - end 9.158 - -- add initiative authors 9.159 - if initiative then 9.160 - records[#records+1] = {id="_", name= "--- " .. _"Initiators" .. " ---"} 9.161 - for i,record in ipairs(initiative.initiators) do 9.162 - records[#records+1] = record.member 9.163 - end 9.164 - end 9.165 - 9.166 - disabled_records = {} 9.167 - disabled_records["_"] = true 9.168 - disabled_records[app.session.member_id] = true 9.169 - 9.170 - ui.field.select{ 9.171 - label = _"Trustee", 9.172 - name = "trustee_id", 9.173 - foreign_records = records, 9.174 - foreign_id = "id", 9.175 - foreign_name = "name", 9.176 - disabled_records = disabled_records 9.177 - } 9.178 - 9.179 - ui.submit{ text = _"Save" } 9.180 - end 9.181 -}
10.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 10.2 +++ b/app/main/delegation/show.lua Fri May 18 19:07:07 2012 +0200 10.3 @@ -0,0 +1,314 @@ 10.4 +local voting_right_unit_id 10.5 + 10.6 +local unit = Unit:by_id(param.get("unit_id", atom.integer)) 10.7 +if unit then 10.8 + voting_right_unit_id = unit.id 10.9 + slot.put_into("title", encode.html(config.single_unit_id and _"Set global delegation" or _"Set unit delegation")) 10.10 + util.help("delegation.new.unit") 10.11 +end 10.12 + 10.13 +local area = Area:by_id(param.get("area_id", atom.integer)) 10.14 +if area then 10.15 + voting_right_unit_id = area.unit_id 10.16 + slot.put_into("title", encode.html(_"Set delegation for Area '#{name}'":gsub("#{name}", area.name))) 10.17 + util.help("delegation.new.area") 10.18 +end 10.19 + 10.20 +local issue = Issue:by_id(param.get("issue_id", atom.integer)) 10.21 +if issue then 10.22 + voting_right_unit_id = issue.area.unit_id 10.23 + slot.put_into("title", encode.html(_"Set delegation for Issue ##{number} in Area '#{area_name}'":gsub("#{number}", issue.id):gsub("#{area_name}", issue.area.name))) 10.24 + util.help("delegation.new.issue") 10.25 +end 10.26 + 10.27 +local initiative = Initiative:by_id(param.get("initiative_id", atom.integer)) 10.28 + 10.29 +slot.select("actions", function() 10.30 + if issue then 10.31 + ui.link{ 10.32 + module = "issue", 10.33 + view = "show", 10.34 + id = issue.id, 10.35 + content = function() 10.36 + ui.image{ static = "icons/16/cancel.png" } 10.37 + slot.put(_"Cancel") 10.38 + end, 10.39 + } 10.40 + elseif area then 10.41 + ui.link{ 10.42 + module = "area", 10.43 + view = "show", 10.44 + id = area.id, 10.45 + content = function() 10.46 + ui.image{ static = "icons/16/cancel.png" } 10.47 + slot.put(_"Cancel") 10.48 + end, 10.49 + } 10.50 + else 10.51 + ui.link{ 10.52 + module = "index", 10.53 + view = "index", 10.54 + content = function() 10.55 + ui.image{ static = "icons/16/cancel.png" } 10.56 + slot.put(_"Cancel") 10.57 + end, 10.58 + } 10.59 + end 10.60 +end) 10.61 + 10.62 + 10.63 +local contact_members = Member:build_selector{ 10.64 + is_contact_of_member_id = app.session.member_id, 10.65 + voting_right_for_unit_id = voting_right_unit_id, 10.66 + order = "name" 10.67 +}:exec() 10.68 + 10.69 +ui.form{ 10.70 + attr = { class = "vertical" }, 10.71 + module = "delegation", 10.72 + action = "update", 10.73 + params = { 10.74 + unit_id = unit and unit.id or nil, 10.75 + area_id = area and area.id or nil, 10.76 + issue_id = issue and issue.id or nil, 10.77 + }, 10.78 + routing = { 10.79 + default = { 10.80 + mode = "redirect", 10.81 + module = area and "area" or initiative and "initiative" or issue and "issue" or "unit", 10.82 + view = "show", 10.83 + id = area and area.id or initiative and initiative.id or issue and issue.id or unit.id 10.84 + } 10.85 + }, 10.86 + content = function() 10.87 + local records 10.88 + 10.89 + if issue then 10.90 + local delegate_name = "" 10.91 + local scope = "no delegation set" 10.92 + local area_delegation = Delegation:by_pk(app.session.member_id, nil, issue.area_id) 10.93 + if area_delegation then 10.94 + delegate_name = area_delegation.trustee and area_delegation.trustee.name or _"abandoned" 10.95 + scope = _"area" 10.96 + else 10.97 + local unit_delegation = Delegation:by_pk(app.session.member_id, issue.area.unit_id) 10.98 + if unit_delegation then 10.99 + delegate_name = unit_delegation.trustee.name 10.100 + scope = config.single_unit_id and _"global" or _"unit" 10.101 + end 10.102 + end 10.103 + local text_apply 10.104 + local text_abandon 10.105 + if config.single_unit_id then 10.106 + text_apply = _("Apply global or area delegation for this issue (Currently: #{delegate_name} [#{scope}])", { delegate_name = delegate_name, scope = scope }) 10.107 + text_abandon = _"Abandon unit and area delegations for this issue" 10.108 + else 10.109 + text_apply = _("Apply unit or area delegation for this issue (Currently: #{delegate_name} [#{scope}])", { delegate_name = delegate_name, scope = scope }) 10.110 + text_abandon = _"Abandon unit and area delegations for this issue" 10.111 + end 10.112 + records = { 10.113 + { id = -1, name = text_apply }, 10.114 + { id = 0, name = text_abandon } 10.115 + } 10.116 + elseif area then 10.117 + local delegate_name = "" 10.118 + local scope = "no delegation set" 10.119 + local unit_delegation = Delegation:by_pk(app.session.member_id, area.unit_id) 10.120 + if unit_delegation then 10.121 + delegate_name = unit_delegation.trustee.name 10.122 + scope = config.single_unit_id and _"global" or _"unit" 10.123 + end 10.124 + local text_apply 10.125 + local text_abandon 10.126 + if config.single_unit_id then 10.127 + text_apply = _("Apply global delegation for this area (Currently: #{delegate_name} [#{scope}])", { delegate_name = delegate_name, scope = scope }) 10.128 + text_abandon = _"Abandon global delegation for this area" 10.129 + else 10.130 + text_apply = _("Apply unit delegation for this area (Currently: #{delegate_name} [#{scope}])", { delegate_name = delegate_name, scope = scope }) 10.131 + text_abandon = _"Abandon unit delegation for this area" 10.132 + end 10.133 + records = { 10.134 + { 10.135 + id = -1, 10.136 + name = text_apply 10.137 + }, 10.138 + { 10.139 + id = 0, 10.140 + name = text_abandon 10.141 + } 10.142 + } 10.143 + 10.144 + else 10.145 + records = { 10.146 + { 10.147 + id = -1, 10.148 + name = _"No delegation" 10.149 + } 10.150 + } 10.151 + 10.152 + end 10.153 + -- add saved members 10.154 + records[#records+1] = {id="_", name= "--- " .. _"Saved contacts" .. " ---"} 10.155 + for i, record in ipairs(contact_members) do 10.156 + records[#records+1] = record 10.157 + end 10.158 + -- add initiative authors 10.159 + if initiative then 10.160 + records[#records+1] = {id="_", name= "--- " .. _"Initiators" .. " ---"} 10.161 + for i,record in ipairs(initiative.initiators) do 10.162 + records[#records+1] = record.member 10.163 + end 10.164 + end 10.165 + 10.166 + disabled_records = {} 10.167 + disabled_records["_"] = true 10.168 + disabled_records[app.session.member_id] = true 10.169 + 10.170 + ui.field.select{ 10.171 + label = _"Trustee", 10.172 + name = "trustee_id", 10.173 + foreign_records = records, 10.174 + foreign_id = "id", 10.175 + foreign_name = "name", 10.176 + disabled_records = disabled_records 10.177 + } 10.178 + 10.179 + ui.submit{ text = _"Save" } 10.180 + end 10.181 +} 10.182 + 10.183 + 10.184 + 10.185 +-- ------------------------ 10.186 + 10.187 + 10.188 + 10.189 + 10.190 +local delegation 10.191 +local unit_id 10.192 +local area_id 10.193 +local issue_id 10.194 +local initiative_id 10.195 + 10.196 +local scope = "unit" 10.197 + 10.198 +unit_id = param.get("unit_id", atom.integer) 10.199 + 10.200 +local inline = param.get("inline", atom.boolean) 10.201 + 10.202 +if param.get("initiative_id", atom.integer) then 10.203 + initiative_id = param.get("initiative_id", atom.integer) 10.204 + issue_id = Initiative:by_id(initiative_id).issue_id 10.205 + scope = "issue" 10.206 +end 10.207 + 10.208 +if param.get("issue_id", atom.integer) then 10.209 + issue_id = param.get("issue_id", atom.integer) 10.210 + scope = "issue" 10.211 +end 10.212 + 10.213 +if param.get("area_id", atom.integer) then 10.214 + area_id = param.get("area_id", atom.integer) 10.215 + scope = "area" 10.216 +end 10.217 + 10.218 + 10.219 + 10.220 +local delegation 10.221 +local issue 10.222 + 10.223 +if issue_id then 10.224 + issue = Issue:by_id(issue_id) 10.225 + delegation = Delegation:by_pk(app.session.member.id, nil, nil, issue_id) 10.226 + if not delegation then 10.227 + delegation = Delegation:by_pk(app.session.member.id, nil, issue.area_id) 10.228 + end 10.229 + if not delegation then 10.230 + delegation = Delegation:by_pk(app.session.member.id, issue.area.unit_id) 10.231 + end 10.232 +elseif area_id then 10.233 + delegation = Delegation:by_pk(app.session.member.id, nil, area_id) 10.234 + if not delegation then 10.235 + local area = Area:by_id(area_id) 10.236 + delegation = Delegation:by_pk(app.session.member.id, area.unit_id) 10.237 + end 10.238 +end 10.239 + 10.240 +if not delegation then 10.241 + delegation = Delegation:by_pk(app.session.member.id, unit_id) 10.242 +end 10.243 + 10.244 +local slot_name = "actions" 10.245 + 10.246 +if inline then 10.247 + slot_name = "default" 10.248 +end 10.249 + 10.250 +if delegation then 10.251 + 10.252 + if not delegation.trustee_id then 10.253 + ui.image{ 10.254 + static = "icons/16/table_go_crossed.png" 10.255 + } 10.256 + if delegation.issue_id then 10.257 + slot.put(_"Delegation turned off for issue") 10.258 + elseif delegation.area_id then 10.259 + slot.put(_"Delegation turned off for area") 10.260 + end 10.261 + end 10.262 + 10.263 + local delegation_chain = Member:new_selector() 10.264 + :add_field("delegation_chain.*") 10.265 + :join("delegation_chain(" .. tostring(app.session.member.id) .. ", " .. tostring(unit_id or "NULL") .. ", " .. tostring(area_id or "NULL") .. ", " .. tostring(issue_id or "NULL") .. ")", "delegation_chain", "member.id = delegation_chain.member_id") 10.266 + :add_order_by("index") 10.267 + :exec() 10.268 + 10.269 + for i, record in ipairs(delegation_chain) do 10.270 + local style 10.271 + local overridden = (not issue or issue.state ~= 'voting') and record.overridden 10.272 + if record.scope_in then 10.273 + if not overridden then 10.274 + ui.image{ 10.275 + attr = { class = "delegation_arrow" }, 10.276 + static = "delegation_arrow_24_vertical.png" 10.277 + } 10.278 + else 10.279 + ui.image{ 10.280 + attr = { class = "delegation_arrow delegation_arrow_overridden" }, 10.281 + static = "delegation_arrow_24_vertical.png" 10.282 + } 10.283 + end 10.284 + ui.tag{ 10.285 + attr = { class = "delegation_scope" .. (overridden and " delegation_scope_overridden" or "") }, 10.286 + content = function() 10.287 + if record.scope_in == "unit" then 10.288 + slot.put(config.single_object_mode and _"Global delegation" or _"Unit delegation") 10.289 + elseif record.scope_in == "area" then 10.290 + slot.put(_"Area delegation") 10.291 + elseif record.scope_in == "issue" then 10.292 + slot.put(_"Issue delegation") 10.293 + end 10.294 + end 10.295 + } 10.296 + end 10.297 + ui.container{ 10.298 + attr = { class = overridden and "delegation_overridden" or "" }, 10.299 + content = function() 10.300 + execute.view{ 10.301 + module = "member", 10.302 + view = "_show_thumb", 10.303 + params = { member = record } 10.304 + } 10.305 + end 10.306 + } 10.307 + if (not issue or issue.state ~= 'voting') and record.participation and not record.overridden then 10.308 + ui.container{ 10.309 + attr = { class = "delegation_participation" }, 10.310 + content = function() 10.311 + slot.put(_"This member is participating, the rest of delegation chain is suspended while discussing") 10.312 + end 10.313 + } 10.314 + end 10.315 + slot.put("<br style='clear: left'/>") 10.316 + end 10.317 +end 10.318 \ No newline at end of file
11.1 --- a/app/main/event/_list.lua Tue Apr 17 00:07:04 2012 +0200 11.2 +++ b/app/main/event/_list.lua Fri May 18 19:07:07 2012 +0200 11.3 @@ -65,6 +65,59 @@ 11.4 elseif event.is_interested_by_delegation_to_member_id then 11.5 class = class .. " interested_by_delegation" 11.6 end 11.7 + 11.8 + ui.container{ attr = { class = "issue_policy_info" }, content = function() 11.9 + if (app.session.member_id or config.public_access == "pseudonym") and event.member_id then 11.10 + if app.session.member_id then 11.11 + ui.link{ 11.12 + content = function() 11.13 + execute.view{ 11.14 + module = "member_image", 11.15 + view = "_show", 11.16 + params = { 11.17 + member = event.member, 11.18 + image_type = "avatar", 11.19 + show_dummy = true, 11.20 + class = "micro_avatar", 11.21 + popup_text = text 11.22 + } 11.23 + } 11.24 + end, 11.25 + module = "member", view = "show", id = event.member_id 11.26 + } 11.27 + slot.put(" ") 11.28 + end 11.29 + ui.link{ 11.30 + text = event.member.name, 11.31 + module = "member", view = "show", id = event.member_id 11.32 + } 11.33 + slot.put(" · ") 11.34 + end 11.35 + local event_name = event.event_name 11.36 + local event_image 11.37 + if event.event == "issue_state_changed" then 11.38 + if event.state == "discussion" then 11.39 + event_name = _"Discussion started" 11.40 + event_image = "comments.png" 11.41 + elseif event.state == "verification" then 11.42 + event_name = _"Verification started" 11.43 + event_image = "lock.png" 11.44 + elseif event.state == "voting" then 11.45 + event_name = _"Voting started" 11.46 + event_image = "email_open.png" 11.47 + else 11.48 + event_name = event.state_name 11.49 + end 11.50 + if event_image then 11.51 + ui.image{ static = "icons/16/" .. event_image } 11.52 + slot.put(" ") 11.53 + end 11.54 + end 11.55 + ui.tag{ attr = { class = "event_name" }, content = event_name } 11.56 + slot.put(" · ") 11.57 + ui.tag{ attr = { class = "time" }, content = format.time(event.occurrence) } 11.58 + end } 11.59 + 11.60 ui.container{ attr = { class = class }, content = function() 11.61 11.62 ui.container { attr = { class = "issue_info" }, content = function() 11.63 @@ -147,57 +200,6 @@ 11.64 ui.tag{ content = event.issue.area.unit.name } 11.65 end } 11.66 11.67 - ui.container{ attr = { class = "issue_policy_info" }, content = function() 11.68 - if (app.session.member_id or config.public_access == "pseudonym") and event.member_id then 11.69 - if app.session.member_id then 11.70 - ui.link{ 11.71 - content = function() 11.72 - execute.view{ 11.73 - module = "member_image", 11.74 - view = "_show", 11.75 - params = { 11.76 - member = event.member, 11.77 - image_type = "avatar", 11.78 - show_dummy = true, 11.79 - class = "micro_avatar", 11.80 - popup_text = text 11.81 - } 11.82 - } 11.83 - end, 11.84 - module = "member", view = "show", id = event.member_id 11.85 - } 11.86 - slot.put(" ") 11.87 - end 11.88 - ui.link{ 11.89 - text = event.member.name, 11.90 - module = "member", view = "show", id = event.member_id 11.91 - } 11.92 - slot.put(" · ") 11.93 - end 11.94 - local event_name = event.event_name 11.95 - local event_image 11.96 - if event.event == "issue_state_changed" then 11.97 - if event.state == "discussion" then 11.98 - event_name = _"Discussion started" 11.99 - event_image = "comments.png" 11.100 - elseif event.state == "verification" then 11.101 - event_name = _"Verification started" 11.102 - event_image = "lock.png" 11.103 - elseif event.state == "voting" then 11.104 - event_name = _"Voting started" 11.105 - event_image = "email_open.png" 11.106 - else 11.107 - event_name = event.state_name 11.108 - end 11.109 - if event_image then 11.110 - ui.image{ static = "icons/16/" .. event_image } 11.111 - slot.put(" ") 11.112 - end 11.113 - end 11.114 - ui.tag{ attr = { class = "event_name" }, content = event_name } 11.115 - slot.put(" · ") 11.116 - ui.tag{ attr = { class = "time" }, content = format.time(event.occurrence) } 11.117 - end } 11.118 11.119 end } 11.120
12.1 --- a/app/main/index/_lang_chooser.lua Tue Apr 17 00:07:04 2012 +0200 12.2 +++ b/app/main/index/_lang_chooser.lua Fri May 18 19:07:07 2012 +0200 12.3 @@ -1,31 +0,0 @@ 12.4 -slot.select("title", function() 12.5 - ui.container{ 12.6 - attr = { class = "lang_chooser" }, 12.7 - content = function() 12.8 - for i, lang in ipairs{"en", "de", "eo"} do 12.9 - ui.link{ 12.10 - content = function() 12.11 - ui.image{ 12.12 - static = "lang/" .. lang .. ".png", 12.13 - attr = { style = "margin-left: 0.5em;", alt = lang, title = lang } 12.14 - } 12.15 - end, 12.16 - text = _('Select language "#{langcode}"', { langcode = lang }), 12.17 - module = "index", 12.18 - action = "set_lang", 12.19 - params = { lang = lang }, 12.20 - routing = { 12.21 - default = { 12.22 - mode = "redirect", 12.23 - module = request.get_module(), 12.24 - view = request.get_view(), 12.25 - id = param.get_id_cgi(), 12.26 - params = param.get_all_cgi() 12.27 - } 12.28 - } 12.29 - } 12.30 - end 12.31 - end 12.32 - } 12.33 -end) 12.34 -
13.1 --- a/app/main/index/index.lua Tue Apr 17 00:07:04 2012 +0200 13.2 +++ b/app/main/index/index.lua Fri May 18 19:07:07 2012 +0200 13.3 @@ -1,7 +1,3 @@ 13.4 -execute.view{ module = "index", view = "_lang_chooser" } 13.5 - 13.6 -slot.put_into("title", encode.html(config.app_title)) 13.7 - 13.8 if app.session.member_id then 13.9 util.help("index.index", _"Home") 13.10 13.11 @@ -74,7 +70,6 @@ 13.12 issues_selector = closed_issues_selector 13.13 } 13.14 } 13.15 - 13.16 ui.tabs(tabs) 13.17 13.18 else
14.1 --- a/app/main/initiative/_show.lua Tue Apr 17 00:07:04 2012 +0200 14.2 +++ b/app/main/initiative/_show.lua Fri May 18 19:07:07 2012 +0200 14.3 @@ -14,121 +14,125 @@ 14.4 14.5 14.6 local initiatives_selector = initiative.issue:get_reference_selector("initiatives") 14.7 -slot.select("initiatives_list", function() 14.8 +slot.select("head", function() 14.9 execute.view{ 14.10 - module = "initiative", 14.11 - view = "_list", 14.12 + module = "issue", 14.13 + view = "_show", 14.14 params = { 14.15 issue = initiative.issue, 14.16 - initiatives_selector = initiatives_selector, 14.17 - no_sort = true, highlight_initiative = initiative, limit = 3 14.18 + initiative_limit = 3 14.19 } 14.20 } 14.21 end) 14.22 14.23 -slot.select("initiative_head", function() 14.24 +ui.container{ attr = { class = "initiative_head" }, content = function() 14.25 14.26 ui.container{ 14.27 - attr = { class = "initiative_name" }, 14.28 + attr = { class = "title" }, 14.29 content = _("Initiative i#{id}: #{name}", { id = initiative.id, name = initiative.name }) 14.30 } 14.31 14.32 - if app.session.member_id or config.public_access == "pseudonym" or config.public_access == "full" then 14.33 - ui.tag{ 14.34 - attr = { class = "initiator_names" }, 14.35 - content = function() 14.36 - for i, initiator in ipairs(initiators) do 14.37 - slot.put(" ") 14.38 - if app.session.member_id then 14.39 + ui.container{ attr = { class = "content" }, content = function() 14.40 + if app.session.member_id or config.public_access == "pseudonym" or config.public_access == "full" then 14.41 + ui.tag{ 14.42 + attr = { class = "initiator_names" }, 14.43 + content = function() 14.44 + for i, initiator in ipairs(initiators) do 14.45 + slot.put(" ") 14.46 + if app.session.member_id then 14.47 + ui.link{ 14.48 + content = function () 14.49 + execute.view{ 14.50 + module = "member_image", 14.51 + view = "_show", 14.52 + params = { 14.53 + member = initiator, 14.54 + image_type = "avatar", 14.55 + show_dummy = true, 14.56 + class = "micro_avatar", 14.57 + popup_text = text 14.58 + } 14.59 + } 14.60 + end, 14.61 + module = "member", view = "show", id = initiator.id 14.62 + } 14.63 + slot.put(" ") 14.64 + end 14.65 ui.link{ 14.66 - content = function () 14.67 - execute.view{ 14.68 - module = "member_image", 14.69 - view = "_show", 14.70 - params = { 14.71 - member = initiator, 14.72 - image_type = "avatar", 14.73 - show_dummy = true, 14.74 - class = "micro_avatar", 14.75 - popup_text = text 14.76 - } 14.77 - } 14.78 - end, 14.79 + text = initiator.name, 14.80 module = "member", view = "show", id = initiator.id 14.81 } 14.82 - slot.put(" ") 14.83 - end 14.84 - ui.link{ 14.85 - text = initiator.name, 14.86 - module = "member", view = "show", id = initiator.id 14.87 - } 14.88 - if not initiator.accepted then 14.89 - ui.tag{ attr = { title = _"Not accepted yet" }, content = "?" } 14.90 + if not initiator.accepted then 14.91 + ui.tag{ attr = { title = _"Not accepted yet" }, content = "?" } 14.92 + end 14.93 end 14.94 end 14.95 - end 14.96 - } 14.97 - end 14.98 - 14.99 - if initiator and initiator.accepted and not initiative.issue.fully_frozen and not initiative.issue.closed and not initiative.revoked then 14.100 - slot.put(" · ") 14.101 - ui.link{ 14.102 - attr = { class = "action" }, 14.103 - content = function() 14.104 - slot.put(_"Invite initiator") 14.105 - end, 14.106 - module = "initiative", 14.107 - view = "add_initiator", 14.108 - params = { initiative_id = initiative.id } 14.109 - } 14.110 - if #initiators > 1 then 14.111 - slot.put(" · ") 14.112 - ui.link{ 14.113 - content = function() 14.114 - slot.put(_"Remove initiator") 14.115 - end, 14.116 - module = "initiative", 14.117 - view = "remove_initiator", 14.118 - params = { initiative_id = initiative.id } 14.119 } 14.120 end 14.121 - end 14.122 - if initiator and initiator.accepted == false then 14.123 + 14.124 + if initiator and initiator.accepted and not initiative.issue.fully_frozen and not initiative.issue.closed and not initiative.revoked then 14.125 slot.put(" · ") 14.126 ui.link{ 14.127 - text = _"Cancel refuse of invitation", 14.128 + attr = { class = "action" }, 14.129 + content = function() 14.130 + slot.put(_"Invite initiator") 14.131 + end, 14.132 module = "initiative", 14.133 - action = "remove_initiator", 14.134 - params = { 14.135 - initiative_id = initiative.id, 14.136 - member_id = app.session.member.id 14.137 - }, 14.138 - routing = { 14.139 - ok = { 14.140 - mode = "redirect", 14.141 - module = "initiative", 14.142 - view = "show", 14.143 - id = initiative.id 14.144 + view = "add_initiator", 14.145 + params = { initiative_id = initiative.id } 14.146 + } 14.147 + if #initiators > 1 then 14.148 + slot.put(" · ") 14.149 + ui.link{ 14.150 + content = function() 14.151 + slot.put(_"Remove initiator") 14.152 + end, 14.153 + module = "initiative", 14.154 + view = "remove_initiator", 14.155 + params = { initiative_id = initiative.id } 14.156 + } 14.157 + end 14.158 + end 14.159 + if initiator and initiator.accepted == false then 14.160 + slot.put(" · ") 14.161 + ui.link{ 14.162 + text = _"Cancel refuse of invitation", 14.163 + module = "initiative", 14.164 + action = "remove_initiator", 14.165 + params = { 14.166 + initiative_id = initiative.id, 14.167 + member_id = app.session.member.id 14.168 + }, 14.169 + routing = { 14.170 + ok = { 14.171 + mode = "redirect", 14.172 + module = "initiative", 14.173 + view = "show", 14.174 + id = initiative.id 14.175 + } 14.176 } 14.177 } 14.178 + end 14.179 + end } 14.180 + ui.container{ attr = { class = "content" }, content = function() 14.181 + if app.session.member_id then 14.182 + execute.view{ 14.183 + module = "supporter", 14.184 + view = "_show_box", 14.185 + params = { 14.186 + initiative = initiative 14.187 + } 14.188 } 14.189 - end 14.190 - if app.session.member_id then 14.191 - execute.view{ 14.192 - module = "supporter", 14.193 - view = "_show_box", 14.194 - params = { 14.195 - initiative = initiative 14.196 - } 14.197 - } 14.198 - end 14.199 + end 14.200 14.201 -end ) 14.202 + end } 14.203 + 14.204 +end } 14.205 14.206 14.207 util.help("initiative.show") 14.208 14.209 -slot.select("initiative_head", function() 14.210 +--slot.select("initiative_head", function() 14.211 14.212 if initiative.issue.ranks_available and initiative.admitted then 14.213 local class = initiative.winner and "admitted_info" or "not_admitted_info" 14.214 @@ -199,7 +203,7 @@ 14.215 content = _("This issue has been cancelled. It failed the quorum of #{quorum}.", { quorum = format.percentage(policy.issue_quorum_num / policy.issue_quorum_den) }) 14.216 } 14.217 end 14.218 -end) 14.219 +--end) 14.220 14.221 if initiator and initiator.accepted == nil and not initiative.issue.half_frozen and not initiative.issue.closed then 14.222 ui.container{
15.1 --- a/app/main/initiative/_suggestions.lua Tue Apr 17 00:07:04 2012 +0200 15.2 +++ b/app/main/initiative/_suggestions.lua Fri May 18 19:07:07 2012 +0200 15.3 @@ -1,31 +1,5 @@ 15.4 local initiative = param.get("initiative", "table") 15.5 15.6 -if app.session.member_id 15.7 - and not initiative.issue.half_frozen 15.8 - and not initiative.issue.closed 15.9 - and not initiative.revoked 15.10 - and app.session.member:has_voting_right_for_unit_id(initiative.issue.area.unit_id) 15.11 -then 15.12 - ui.link{ 15.13 - content = function() 15.14 - ui.image{ static = "icons/16/comment_add.png" } 15.15 - slot.put(_"Add new suggestion") 15.16 - end, 15.17 - module = "suggestion", 15.18 - view = "new", 15.19 - params = { 15.20 - initiative_id = initiative.id 15.21 - } 15.22 - } 15.23 -end 15.24 + 15.25 15.26 -execute.view{ 15.27 - module = "suggestion", 15.28 - view = "_list", 15.29 - params = { 15.30 - initiative = initiative, 15.31 - suggestions_selector = initiative:get_reference_selector("suggestions"), 15.32 - tab_id = param.get("tab_id") 15.33 - } 15.34 -} 15.35
16.1 --- a/app/main/initiative/show.lua Tue Apr 17 00:07:04 2012 +0200 16.2 +++ b/app/main/initiative/show.lua Fri May 18 19:07:07 2012 +0200 16.3 @@ -10,7 +10,7 @@ 16.4 16.5 execute.view{ 16.6 module = "issue", 16.7 - view = "_show_head", 16.8 + view = "_head", 16.9 params = { issue = initiative.issue, 16.10 initiative = initiative } 16.11 }
17.1 --- a/app/main/initiative/show_tab.lua Tue Apr 17 00:07:04 2012 +0200 17.2 +++ b/app/main/initiative/show_tab.lua Fri May 18 19:07:07 2012 +0200 17.3 @@ -52,10 +52,12 @@ 17.4 name = "suggestions", 17.5 label = _"Suggestions" .. " (" .. tostring(suggestion_count) .. ")", 17.6 icon = { static = "icons/16/comments.png" }, 17.7 - module = "initiative", 17.8 - view = "_suggestions", 17.9 + module = "suggestion", 17.10 + view = "_list", 17.11 params = { 17.12 - initiative = initiative 17.13 + initiative = initiative, 17.14 + suggestions_selector = initiative:get_reference_selector("suggestions"), 17.15 + tab_id = param.get("tab_id") 17.16 } 17.17 } 17.18
18.1 --- a/app/main/interest/_show_box.lua Tue Apr 17 00:07:04 2012 +0200 18.2 +++ b/app/main/interest/_show_box.lua Fri May 18 19:07:07 2012 +0200 18.3 @@ -5,46 +5,31 @@ 18.4 local interest = Interest:by_pk(issue.id, app.session.member.id) 18.5 local membership = Membership:by_pk(issue.area_id, app.session.member_id) 18.6 18.7 -slot.select("interest", function() 18.8 - if interest then 18.9 +if interest then 18.10 18.11 - ui.container{ 18.12 - content = function() 18.13 - ui.container{ 18.14 - attr = { 18.15 - class = "head head_active", 18.16 - }, 18.17 - content = function() 18.18 - ui.image{ 18.19 - static = "icons/16/eye.png" 18.20 - } 18.21 - slot.put(_"Your are interested") 18.22 - 18.23 - end 18.24 - } 18.25 + ui.tag{ content = _"Your are interested" } 18.26 + slot.put(" ") 18.27 18.28 - if issue.state ~= "finished" and issue.state ~= "cancelled" and issue.state ~= "voting" then 18.29 - ui.link{ 18.30 - image = { static = "icons/16/cross.png" }, 18.31 - text = _"Withdraw interest", 18.32 - module = "interest", 18.33 - action = "update", 18.34 - params = { issue_id = issue.id, delete = true }, 18.35 - routing = { default = { mode = "redirect", module = initiative and "initiative" or "issue", view = "show", id = initiative and initiative.id or issue.id } } 18.36 - } 18.37 - end 18.38 - end 18.39 + if issue.state ~= "finished" and issue.state ~= "cancelled" and issue.state ~= "voting" then 18.40 + slot.put("(") 18.41 + ui.link{ 18.42 + text = _"Withdraw", 18.43 + module = "interest", 18.44 + action = "update", 18.45 + params = { issue_id = issue.id, delete = true }, 18.46 + routing = { default = { mode = "redirect", module = initiative and "initiative" or "issue", view = "show", id = initiative and initiative.id or issue.id } } 18.47 } 18.48 - elseif app.session.member:has_voting_right_for_unit_id(issue.area.unit_id) then 18.49 - if not issue.closed and not issue.fully_frozen then 18.50 - ui.link{ 18.51 - image = { static = "icons/16/user_add.png" }, 18.52 - text = _"Add my interest", 18.53 - module = "interest", 18.54 - action = "update", 18.55 - params = { issue_id = issue.id }, 18.56 - routing = { default = { mode = "redirect", module = initiative and "initiative" or "issue", view = "show", id = initiative and initiative.id or issue.id } } 18.57 - } 18.58 - end 18.59 + slot.put(") ") 18.60 end 18.61 -end) 18.62 +elseif app.session.member:has_voting_right_for_unit_id(issue.area.unit_id) then 18.63 + if not issue.closed and not issue.fully_frozen then 18.64 + ui.link{ 18.65 + text = _"Add my interest", 18.66 + module = "interest", 18.67 + action = "update", 18.68 + params = { issue_id = issue.id }, 18.69 + routing = { default = { mode = "redirect", module = initiative and "initiative" or "issue", view = "show", id = initiative and initiative.id or issue.id } } 18.70 + } 18.71 + slot.put(" ") 18.72 + end 18.73 +end
19.1 --- a/app/main/issue/_details.lua Tue Apr 17 00:07:04 2012 +0200 19.2 +++ b/app/main/issue/_details.lua Fri May 18 19:07:07 2012 +0200 19.3 @@ -14,10 +14,12 @@ 19.4 label = _"Issue quorum", 19.5 value = format.percentage(policy.issue_quorum_num / policy.issue_quorum_den) 19.6 } 19.7 - ui.field.text{ 19.8 - label = _"Currently required", 19.9 - value = math.ceil(issue.population * policy.issue_quorum_num / policy.issue_quorum_den) 19.10 - } 19.11 + if issue.population then 19.12 + ui.field.text{ 19.13 + label = _"Currently required", 19.14 + value = math.ceil(issue.population * policy.issue_quorum_num / policy.issue_quorum_den) 19.15 + } 19.16 + end 19.17 ui.field.timestamp{ label = _"Accepted at", name = "accepted" } 19.18 ui.field.text{ label = _"Discussion time", value = issue.discussion_time } 19.19 ui.field.timestamp{ label = _"Half frozen at", name = "half_frozen" } 19.20 @@ -26,10 +28,12 @@ 19.21 label = _"Initiative quorum", 19.22 value = format.percentage(policy.initiative_quorum_num / policy.initiative_quorum_den) 19.23 } 19.24 - ui.field.text{ 19.25 - label = _"Currently required", 19.26 - value = math.ceil(issue.population * (issue.policy.initiative_quorum_num / issue.policy.initiative_quorum_den)), 19.27 - } 19.28 + if issue.population then 19.29 + ui.field.text{ 19.30 + label = _"Currently required", 19.31 + value = math.ceil(issue.population * (issue.policy.initiative_quorum_num / issue.policy.initiative_quorum_den)), 19.32 + } 19.33 + end 19.34 ui.field.timestamp{ label = _"Fully frozen at", name = "fully_frozen" } 19.35 ui.field.text{ label = _"Voting time", value = issue.voting_time } 19.36 ui.field.timestamp{ label = _"Closed", name = "closed" }
20.1 --- a/app/main/issue/_filters.lua Tue Apr 17 00:07:04 2012 +0200 20.2 +++ b/app/main/issue/_filters.lua Fri May 18 19:07:07 2012 +0200 20.3 @@ -6,6 +6,115 @@ 20.4 20.5 local filters = {} 20.6 20.7 +local filter = { name = "filter" } 20.8 + 20.9 +if state ~= "closed" then 20.10 + filter[#filter+1] = { 20.11 + name = "any", 20.12 + label = _"Any phase", 20.13 + selector_modifier = function(selector) end 20.14 + } 20.15 +end 20.16 + 20.17 +if not state then 20.18 + filter[#filter+1] = { 20.19 + name = "open", 20.20 + label = _"Open", 20.21 + selector_modifier = function(selector) 20.22 + selector:add_where("issue.closed ISNULL") 20.23 + end 20.24 + } 20.25 +end 20.26 + 20.27 +if not state or state == "open" then 20.28 + filter[#filter+1] = { 20.29 + name = "new", 20.30 + label = _"New", 20.31 + selector_modifier = function(selector) 20.32 + selector:add_where("issue.accepted ISNULL AND issue.closed ISNULL") 20.33 + end 20.34 + } 20.35 + filter[#filter+1] = { 20.36 + name = "accepted", 20.37 + label = _"Discussion", 20.38 + selector_modifier = function(selector) 20.39 + selector:add_where("issue.accepted NOTNULL AND issue.half_frozen ISNULL AND issue.closed ISNULL") 20.40 + end 20.41 + } 20.42 + filter[#filter+1] = { 20.43 + name = "half_frozen", 20.44 + label = _"Frozen", 20.45 + selector_modifier = function(selector) 20.46 + selector:add_where("issue.half_frozen NOTNULL AND issue.fully_frozen ISNULL") 20.47 + end 20.48 + } 20.49 + filter[#filter+1] = { 20.50 + name = "frozen", 20.51 + label = _"Voting", 20.52 + selector_modifier = function(selector) 20.53 + selector:add_where("issue.fully_frozen NOTNULL AND issue.closed ISNULL") 20.54 + filter_voting = true 20.55 + end 20.56 + } 20.57 +end 20.58 + 20.59 +if not state then 20.60 + filter[#filter+1] = { 20.61 + name = "finished", 20.62 + label = _"Finished", 20.63 + selector_modifier = function(selector) 20.64 + selector:add_where("issue.closed NOTNULL AND issue.fully_frozen NOTNULL") 20.65 + end 20.66 + } 20.67 + filter[#filter+1] = { 20.68 + name = "cancelled", 20.69 + label = _"Cancelled", 20.70 + selector_modifier = function(selector) 20.71 + selector:add_where("issue.closed NOTNULL AND issue.fully_frozen ISNULL") 20.72 + end 20.73 + } 20.74 +end 20.75 + 20.76 +if state == "closed" then 20.77 + filter[#filter+1] = { 20.78 + name = "any", 20.79 + label = _"Any state", 20.80 + selector_modifier = function(selector) end 20.81 + } 20.82 + 20.83 + filter[#filter+1] = { 20.84 + name = "finished", 20.85 + label = _"Finished", 20.86 + selector_modifier = function(selector) 20.87 + selector:add_where("issue.state IN ('finished_with_winner', 'finished_without_winner')") 20.88 + end 20.89 + } 20.90 + filter[#filter+1] = { 20.91 + name = "finished_with_winner", 20.92 + label = _"with winner", 20.93 + selector_modifier = function(selector) 20.94 + selector:add_where("issue.state = 'finished_with_winner'") 20.95 + end 20.96 + } 20.97 + filter[#filter+1] = { 20.98 + name = "finished_without_winner", 20.99 + label = _"without winner", 20.100 + selector_modifier = function(selector) 20.101 + selector:add_where("issue.state = 'finished_without_winner'") 20.102 + end 20.103 + } 20.104 + filter[#filter+1] = { 20.105 + name = "cancelled", 20.106 + label = _"Cancelled", 20.107 + selector_modifier = function(selector) 20.108 + selector:add_where("issue.state NOT IN ('finished_with_winner', 'finished_without_winner')") 20.109 + end 20.110 + } 20.111 +end 20.112 + 20.113 +filters[#filters+1] = filter 20.114 + 20.115 + 20.116 if member then 20.117 local filter = { 20.118 name = "filter_interest", 20.119 @@ -133,114 +242,6 @@ 20.120 20.121 end 20.122 20.123 -local filter = { name = "filter" } 20.124 - 20.125 -if state ~= "closed" then 20.126 - filter[#filter+1] = { 20.127 - name = "any", 20.128 - label = _"Any phase", 20.129 - selector_modifier = function(selector) end 20.130 - } 20.131 -end 20.132 - 20.133 -if not state then 20.134 - filter[#filter+1] = { 20.135 - name = "open", 20.136 - label = _"Open", 20.137 - selector_modifier = function(selector) 20.138 - selector:add_where("issue.closed ISNULL") 20.139 - end 20.140 - } 20.141 -end 20.142 - 20.143 -if not state or state == "open" then 20.144 - filter[#filter+1] = { 20.145 - name = "new", 20.146 - label = _"New", 20.147 - selector_modifier = function(selector) 20.148 - selector:add_where("issue.accepted ISNULL AND issue.closed ISNULL") 20.149 - end 20.150 - } 20.151 - filter[#filter+1] = { 20.152 - name = "accepted", 20.153 - label = _"Discussion", 20.154 - selector_modifier = function(selector) 20.155 - selector:add_where("issue.accepted NOTNULL AND issue.half_frozen ISNULL AND issue.closed ISNULL") 20.156 - end 20.157 - } 20.158 - filter[#filter+1] = { 20.159 - name = "half_frozen", 20.160 - label = _"Frozen", 20.161 - selector_modifier = function(selector) 20.162 - selector:add_where("issue.half_frozen NOTNULL AND issue.fully_frozen ISNULL") 20.163 - end 20.164 - } 20.165 - filter[#filter+1] = { 20.166 - name = "frozen", 20.167 - label = _"Voting", 20.168 - selector_modifier = function(selector) 20.169 - selector:add_where("issue.fully_frozen NOTNULL AND issue.closed ISNULL") 20.170 - filter_voting = true 20.171 - end 20.172 - } 20.173 -end 20.174 - 20.175 -if not state then 20.176 - filter[#filter+1] = { 20.177 - name = "finished", 20.178 - label = _"Finished", 20.179 - selector_modifier = function(selector) 20.180 - selector:add_where("issue.closed NOTNULL AND issue.fully_frozen NOTNULL") 20.181 - end 20.182 - } 20.183 - filter[#filter+1] = { 20.184 - name = "cancelled", 20.185 - label = _"Cancelled", 20.186 - selector_modifier = function(selector) 20.187 - selector:add_where("issue.closed NOTNULL AND issue.fully_frozen ISNULL") 20.188 - end 20.189 - } 20.190 -end 20.191 - 20.192 -if state == "closed" then 20.193 - filter[#filter+1] = { 20.194 - name = "any", 20.195 - label = _"Any state", 20.196 - selector_modifier = function(selector) end 20.197 - } 20.198 - 20.199 - filter[#filter+1] = { 20.200 - name = "finished", 20.201 - label = _"Finished", 20.202 - selector_modifier = function(selector) 20.203 - selector:add_where("issue.state IN ('finished_with_winner', 'finished_without_winner')") 20.204 - end 20.205 - } 20.206 - filter[#filter+1] = { 20.207 - name = "finished_with_winner", 20.208 - label = _"with winner", 20.209 - selector_modifier = function(selector) 20.210 - selector:add_where("issue.state = 'finished_with_winner'") 20.211 - end 20.212 - } 20.213 - filter[#filter+1] = { 20.214 - name = "finished_without_winner", 20.215 - label = _"without winner", 20.216 - selector_modifier = function(selector) 20.217 - selector:add_where("issue.state = 'finished_without_winner'") 20.218 - end 20.219 - } 20.220 - filter[#filter+1] = { 20.221 - name = "cancelled", 20.222 - label = _"Cancelled", 20.223 - selector_modifier = function(selector) 20.224 - selector:add_where("issue.state NOT IN ('finished_with_winner', 'finished_without_winner')") 20.225 - end 20.226 - } 20.227 -end 20.228 - 20.229 -filters[#filters+1] = filter 20.230 - 20.231 --[[ 20.232 if not param.get("no_sort", atom.boolean) then 20.233
21.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 21.2 +++ b/app/main/issue/_head.lua Fri May 18 19:07:07 2012 +0200 21.3 @@ -0,0 +1,3 @@ 21.4 +local issue = param.get("issue", "table") 21.5 + 21.6 +execute.view{ module = "area", view = "_head", params = { area = issue.area } }
22.1 --- a/app/main/issue/_list.lua Tue Apr 17 00:07:04 2012 +0200 22.2 +++ b/app/main/issue/_list.lua Fri May 18 19:07:07 2012 +0200 22.3 @@ -12,17 +12,6 @@ 22.4 issues_selector:add_where("issue.closed NOTNULL") 22.5 end 22.6 22.7 -if app.session.member_id then 22.8 - issues_selector 22.9 - :left_join("interest", "_interest", { "_interest.issue_id = issue.id AND _interest.member_id = ?", member.id } ) 22.10 - :add_field("(_interest.member_id NOTNULL)", "is_interested") 22.11 - issues_selector 22.12 - :left_join("delegating_interest_snapshot", "_delegating_interest", { "_delegating_interest.issue_id = issue.id AND _delegating_interest.member_id = ? AND _delegating_interest.event = issue.latest_snapshot_event", member.id } ) 22.13 - :add_field("_delegating_interest.delegate_member_ids[1]", "is_interested_by_delegation_to_member_id") 22.14 - :add_field("_delegating_interest.delegate_member_ids[array_upper(_delegating_interest.delegate_member_ids, 1)]", "is_interested_via_member_id") 22.15 - :add_field("array_length(_delegating_interest.delegate_member_ids, 1)", "delegation_chain_length") 22.16 -end 22.17 - 22.18 ui.add_partial_param_names{ 22.19 "filter", 22.20 "filter_open", 22.21 @@ -42,159 +31,14 @@ 22.22 content = function() 22.23 local highlight_string = param.get("highlight_string", "string") 22.24 local issues = issues or issues_selector:exec() 22.25 + issues:load('policy') 22.26 -- issues:load(initiatives) 22.27 ui.container{ attr = { class = "issues" }, content = function() 22.28 22.29 for i, issue in ipairs(issues) do 22.30 22.31 - local class = "issue" 22.32 - if issue.is_interested then 22.33 - class = class .. " interested" 22.34 - elseif issue.is_interested_by_delegation_to_member_id then 22.35 - class = class .. " interested_by_delegation" 22.36 - end 22.37 - ui.container{ attr = { class = class }, content = function() 22.38 - 22.39 - ui.container{ attr = { class = "issue_info" }, content = function() 22.40 - 22.41 - if issue.is_interested then 22.42 - ui.tag{ 22.43 - tag = "div", attr = { class = "interest_by_delegation"}, 22.44 - content = function() 22.45 - local text = "You are interested in this issue" 22.46 - ui.image{ attr = { alt = text, title = text }, static = "icons/16/eye.png" } 22.47 - end 22.48 - } 22.49 - 22.50 - elseif issue.is_interested_by_delegation_to_member_id then 22.51 - ui.tag{ 22.52 - tag = "div", attr = { class = "interest_by_delegation"}, 22.53 - content = function() 22.54 - local member = Member:by_id(issue.is_interested_by_delegation_to_member_id) 22.55 - local text = _"delegated to" 22.56 - ui.image{ 22.57 - attr = { class = "delegation_arrow", alt = text, title = text }, 22.58 - static = "delegation_arrow_24_horizontal.png" 22.59 - } 22.60 - execute.view{ 22.61 - module = "member_image", 22.62 - view = "_show", 22.63 - params = { 22.64 - member = member, 22.65 - image_type = "avatar", 22.66 - show_dummy = true, 22.67 - class = "micro_avatar", 22.68 - popup_text = member.name 22.69 - } 22.70 - } 22.71 - if issue.is_interested_by_delegation_to_member_id ~= issue.is_interested_via_member_id then 22.72 - if issue.delegation_chain_length > 2 then 22.73 - local text = _"delegated to" 22.74 - ui.image{ 22.75 - attr = { class = "delegation_arrow", alt = text, title = text }, 22.76 - static = "delegation_arrow_24_horizontal.png" 22.77 - } 22.78 - ui.tag{ content = "..." } 22.79 - end 22.80 - local text = _"delegated to" 22.81 - ui.image{ 22.82 - attr = { class = "delegation_arrow", alt = text, title = text }, 22.83 - static = "delegation_arrow_24_horizontal.png" 22.84 - } 22.85 - local member = Member:by_id(issue.is_interested_via_member_id) 22.86 - execute.view{ 22.87 - module = "member_image", 22.88 - view = "_show", 22.89 - params = { 22.90 - member = member, 22.91 - image_type = "avatar", 22.92 - show_dummy = true, 22.93 - class = "micro_avatar", 22.94 - popup_text = member.name 22.95 - } 22.96 - } 22.97 - end 22.98 - end 22.99 - } 22.100 - end 22.101 - 22.102 - ui.tag{ 22.103 - tag = "div", 22.104 - content = function() 22.105 - ui.link{ 22.106 - attr = { class = "issue_id" }, 22.107 - text = _("Issue ##{id}", { id = tostring(issue.id) }), 22.108 - module = "issue", 22.109 - view = "show", 22.110 - id = issue.id 22.111 - } 22.112 - 22.113 - slot.put(" · ") 22.114 - ui.tag{ content = issue.policy.name } 22.115 - slot.put(" · ") 22.116 - ui.tag{ content = issue.area.name } 22.117 - slot.put(" · ") 22.118 - ui.tag{ content = issue.area.unit.name } 22.119 - 22.120 - end 22.121 - } 22.122 - ui.tag{ 22.123 - attr = { class = "issue_policy_info" }, 22.124 - tag = "div", 22.125 - content = function() 22.126 - 22.127 - ui.tag{ attr = { class = "event_name" }, content = issue.state_name } 22.128 - 22.129 - if issue.state_time_left then 22.130 - slot.put(" · ") 22.131 - if issue.state_time_left:sub(1,1) == "-" then 22.132 - if issue.state == "new" then 22.133 - ui.tag{ content = _("Discussion starts soon") } 22.134 - elseif issue.state == "discussion" then 22.135 - ui.tag{ content = _("Verification starts soon") } 22.136 - elseif issue.state == "frozen" then 22.137 - ui.tag{ content = _("Voting starts soon") } 22.138 - elseif issue.state == "voting" then 22.139 - ui.tag{ content = _("Counting starts soon") } 22.140 - end 22.141 - else 22.142 - ui.tag{ content = _("#{time_left} left", { time_left = issue.state_time_left:gsub("days", _"days"):gsub("day", _"day") }) } 22.143 - end 22.144 - end 22.145 - 22.146 - end 22.147 - } 22.148 - 22.149 - 22.150 - if issue.old_state then 22.151 - ui.field.text{ value = format.time(issue.sort) } 22.152 - ui.field.text{ value = Issue:get_state_name_for_state(issue.old_state) .. " > " .. Issue:get_state_name_for_state(issue.new_state) } 22.153 - else 22.154 - end 22.155 - end } 22.156 - 22.157 - ui.container{ attr = { class = "initiative_list" }, content = function() 22.158 - 22.159 - local initiatives_selector = issue:get_reference_selector("initiatives") 22.160 - local highlight_string = param.get("highlight_string") 22.161 - if highlight_string then 22.162 - initiatives_selector:add_field( {'"highlight"("initiative"."name", ?)', highlight_string }, "name_highlighted") 22.163 - end 22.164 - execute.view{ 22.165 - module = "initiative", 22.166 - view = "_list", 22.167 - params = { 22.168 - issue = issue, 22.169 - initiatives_selector = initiatives_selector, 22.170 - highlight_string = highlight_string, 22.171 - per_page = app.session.member_id and tonumber(app.session.member:get_setting_value("initiatives_preview_limit") or 3) or 3, 22.172 - no_sort = true, 22.173 - limit = app.session.member_id and tonumber(app.session.member:get_setting_value("initiatives_preview_limit") or 3) or 3, 22.174 - for_member = for_member 22.175 - } 22.176 - } 22.177 - end } 22.178 - end } 22.179 + execute.view{ module = "issue", view = "_show", params = { issue = issue, for_listing = true } } 22.180 + 22.181 end 22.182 end } 22.183 end
23.1 --- a/app/main/issue/_list_initiatives.lua Tue Apr 17 00:07:04 2012 +0200 23.2 +++ b/app/main/issue/_list_initiatives.lua Fri May 18 19:07:07 2012 +0200 23.3 @@ -1,18 +1,2 @@ 23.4 local issue = param.get("issue", "table") 23.5 23.6 -ui.container{ 23.7 - attr = { class = "box issue_initiative_list" }, 23.8 - content = function() 23.9 - execute.view{ 23.10 - module = "initiative", 23.11 - view = "_list", 23.12 - params = { 23.13 - initiatives_selector = issue:get_reference_selector("initiatives"), 23.14 - issue = issue, 23.15 - no_sort = true 23.16 - } 23.17 - } 23.18 - end 23.19 -} 23.20 - 23.21 -slot.put("<br />")
24.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 24.2 +++ b/app/main/issue/_pad.lua Fri May 18 19:07:07 2012 +0200 24.3 @@ -0,0 +1,8 @@ 24.4 +local issue = param.get("issue", "table") 24.5 + 24.6 +ui.tag{ tag = "iframe", attr = { 24.7 + width = "800", 24.8 + height = "500", 24.9 + src = issue.etherpad_url 24.10 +} } 24.11 +
25.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 25.2 +++ b/app/main/issue/_show.lua Fri May 18 19:07:07 2012 +0200 25.3 @@ -0,0 +1,175 @@ 25.4 +local issue = param.get("issue", "table") 25.5 +local initiative_limit = param.get("initiative_limit", atom.integer) 25.6 +local for_listing = param.get("for_listing", atom.boolean) 25.7 + 25.8 +local direct_voter 25.9 +if app.session.member_id then 25.10 + direct_voter = DirectVoter:by_pk(issue.id, app.session.member.id) 25.11 +end 25.12 + 25.13 +local voteable = app.session.member_id and issue.state == 'voting' and 25.14 + app.session.member:has_voting_right_for_unit_id(issue.area.unit_id) 25.15 + 25.16 +local vote_link_text = direct_voter and _"Change vote" or "Vote now" 25.17 + 25.18 + 25.19 +local class = "issue" 25.20 +if issue.is_interested then 25.21 + class = class .. " interested" 25.22 +elseif issue.is_interested_by_delegation_to_member_id then 25.23 + class = class .. " interested_by_delegation" 25.24 +end 25.25 + 25.26 +ui.container{ attr = { class = class }, content = function() 25.27 + 25.28 + execute.view{ module = "delegation", view = "_info", params = { issue = issue } } 25.29 + 25.30 + if for_listing then 25.31 + ui.container{ attr = { class = "context" }, content = function() 25.32 + ui.tag{ content = issue.area.unit.name } 25.33 + slot.put(" · ") 25.34 + ui.tag{ content = issue.area.name } 25.35 + end } 25.36 + end 25.37 + ui.container{ attr = { class = "title" }, content = function() 25.38 + 25.39 + ui.link{ 25.40 + attr = { class = "issue_id" }, 25.41 + text = _("#{policy_name} ##{issue_id}", { 25.42 + policy_name = issue.policy.name, 25.43 + issue_id = issue.id 25.44 + }), 25.45 + module = "issue", 25.46 + view = "show", 25.47 + id = issue.id 25.48 + } 25.49 + end } 25.50 + 25.51 + ui.tag{ 25.52 + attr = { class = "content issue_policy_info" }, 25.53 + tag = "div", 25.54 + content = function() 25.55 + 25.56 + ui.tag{ attr = { class = "event_name" }, content = issue.state_name } 25.57 + 25.58 + if issue.state_time_left then 25.59 + slot.put(" · ") 25.60 + if issue.state_time_left:sub(1,1) == "-" then 25.61 + if issue.state == "new" then 25.62 + ui.tag{ content = _("Discussion starts soon") } 25.63 + elseif issue.state == "discussion" then 25.64 + ui.tag{ content = _("Verification starts soon") } 25.65 + elseif issue.state == "frozen" then 25.66 + ui.tag{ content = _("Voting starts soon") } 25.67 + elseif issue.state == "voting" then 25.68 + ui.tag{ content = _("Counting starts soon") } 25.69 + end 25.70 + else 25.71 + ui.tag{ content = _("#{time_left} left", { time_left = issue.state_time_left:gsub("days", _"days"):gsub("day", _"day") }) } 25.72 + end 25.73 + end 25.74 + 25.75 + end 25.76 + } 25.77 + 25.78 + ui.container{ 25.79 + attr = { class = "content actions" }, content = function() 25.80 + 25.81 + if voteable then 25.82 + ui.link{ 25.83 + content = vote_link_text, 25.84 + module = "vote", 25.85 + view = "list", 25.86 + params = { issue_id = issue.id } 25.87 + } 25.88 + slot.put(" · ") 25.89 + end 25.90 + 25.91 + if app.session.member_id then 25.92 + execute.view{ 25.93 + module = "interest", 25.94 + view = "_show_box", 25.95 + params = { issue = issue, initiative = initiative } 25.96 + } 25.97 + slot.put(" · ") 25.98 + end 25.99 + 25.100 + if config.issue_discussion_url_func then 25.101 + local url = config.issue_discussion_url_func(issue) 25.102 + ui.link{ 25.103 + attr = { target = "_blank" }, 25.104 + external = url, 25.105 + content = _"Discussion on issue" 25.106 + } 25.107 + slot.put(" · ") 25.108 + end 25.109 + 25.110 + if config.etherpad and app.session.member then 25.111 + ui.link{ 25.112 + attr = { target = "_blank" }, 25.113 + external = issue.etherpad_url, 25.114 + content = _"Issue pad" 25.115 + } 25.116 + slot.put(" · ") 25.117 + end 25.118 + 25.119 + 25.120 + if app.session.member_id and app.session.member:has_voting_right_for_unit_id(issue.area.unit_id) then 25.121 + if not issue.fully_frozen and not issue.closed then 25.122 + ui.link{ 25.123 + attr = { class = "action" }, 25.124 + text = _"Create alternative initiative", 25.125 + module = "initiative", 25.126 + view = "new", 25.127 + params = { issue_id = issue.id } 25.128 + } 25.129 + end 25.130 + end 25.131 + 25.132 + end } 25.133 + 25.134 + if not for_listing then 25.135 + 25.136 + if voteable then 25.137 + ui.container{ 25.138 + attr = { class = "voting_active_info" }, 25.139 + content = function() 25.140 + slot.put(_"Voting for this issue is currently running!") 25.141 + slot.put(" ") 25.142 + if app.session.member_id then 25.143 + ui.link{ 25.144 + content = vote_link_text, 25.145 + module = "vote", 25.146 + view = "list", 25.147 + params = { issue_id = issue.id } 25.148 + } 25.149 + end 25.150 + end 25.151 + } 25.152 + end 25.153 + 25.154 + end 25.155 + 25.156 + ui.container{ attr = { class = "initiative_list" }, content = function() 25.157 + 25.158 + local initiatives_selector = issue:get_reference_selector("initiatives") 25.159 + local highlight_string = param.get("highlight_string") 25.160 + if highlight_string then 25.161 + initiatives_selector:add_field( {'"highlight"("initiative"."name", ?)', highlight_string }, "name_highlighted") 25.162 + end 25.163 + execute.view{ 25.164 + module = "initiative", 25.165 + view = "_list", 25.166 + params = { 25.167 + issue = issue, 25.168 + initiatives_selector = initiatives_selector, 25.169 + highlight_string = highlight_string, 25.170 + per_page = initiative_limit, 25.171 + no_sort = true, 25.172 + limit = initiative_limit, 25.173 + for_member = for_member 25.174 + } 25.175 + } 25.176 + end } 25.177 +end } 25.178 +
26.1 --- a/app/main/issue/_show_head.lua Tue Apr 17 00:07:04 2012 +0200 26.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 26.3 @@ -1,188 +0,0 @@ 26.4 -local issue = param.get("issue", "table") 26.5 -local initiative = param.get("initiative", "table") 26.6 - 26.7 -local direct_voter 26.8 - 26.9 -if app.session.member_id then 26.10 - direct_voter = DirectVoter:by_pk(issue.id, app.session.member.id) 26.11 -end 26.12 - 26.13 -if config.feature_rss_enabled then 26.14 - util.html_rss_head{ title = _"Initiatives in this issue (last created first)", module = "initiative", view = "list_rss", params = { issue_id = issue.id } } 26.15 - util.html_rss_head{ title = _"Initiatives in this issue (last updated first)", module = "initiative", view = "list_rss", params = { issue_id = issue.id, order = "last_updated" } } 26.16 -end 26.17 - 26.18 -slot.select("title", function() 26.19 - ui.link{ 26.20 - content = _("Issue ##{id}", { id = issue.id }), 26.21 - module = "issue", 26.22 - view = "show", 26.23 - id = issue.id 26.24 - } 26.25 - slot.put(" · ") 26.26 - ui.link{ 26.27 - content = issue.area.name, 26.28 - module = "area", 26.29 - view = "show", 26.30 - id = issue.area.id 26.31 - } 26.32 - if not config.single_unit_id then 26.33 - slot.put(" · ") 26.34 - ui.link{ 26.35 - content = issue.area.unit.name, 26.36 - module = "unit", 26.37 - view = "show", 26.38 - id = issue.area.unit_id 26.39 - } 26.40 - end 26.41 -end) 26.42 - 26.43 - 26.44 -slot.select("title2", function() 26.45 - ui.tag{ 26.46 - tag = "div", 26.47 - attr = { class = "issue_policy_info" }, 26.48 - content = function() 26.49 - 26.50 - ui.link{ 26.51 - text = issue.policy.name, 26.52 - module = "policy", 26.53 - view = "show", 26.54 - id = issue.policy.id 26.55 - } 26.56 - 26.57 - slot.put(" · ") 26.58 - ui.tag{ content = issue.state_name } 26.59 - 26.60 - if issue.state_time_left then 26.61 - slot.put(" · ") 26.62 - if issue.state_time_left:sub(1,1) == "-" then 26.63 - if issue.state == "new" then 26.64 - ui.tag{ content = _("Discussion starts soon") } 26.65 - elseif issue.state == "discussion" then 26.66 - ui.tag{ content = _("Verification starts soon") } 26.67 - elseif issue.state == "frozen" then 26.68 - ui.tag{ content = _("Voting starts soon") } 26.69 - elseif issue.state == "voting" then 26.70 - ui.tag{ content = _("Counting starts soon") } 26.71 - end 26.72 - else 26.73 - ui.tag{ content = _("#{time_left} left", { time_left = issue.state_time_left:gsub("days", _"days"):gsub("day", _"day") }) } 26.74 - end 26.75 - end 26.76 - 26.77 - end 26.78 - } 26.79 - 26.80 - 26.81 -end) 26.82 - 26.83 -slot.select("actions", function() 26.84 - 26.85 - if app.session.member_id then 26.86 - 26.87 - if issue.state == 'voting' and app.session.member:has_voting_right_for_unit_id(issue.area.unit_id) then 26.88 - local text 26.89 - if not direct_voter then 26.90 - text = _"Vote now" 26.91 - else 26.92 - text = _"Change vote" 26.93 - end 26.94 - ui.link{ 26.95 - content = function() 26.96 - ui.image{ static = "icons/16/email_open.png" } 26.97 - slot.put(text) 26.98 - end, 26.99 - module = "vote", 26.100 - view = "list", 26.101 - params = { issue_id = issue.id } 26.102 - } 26.103 - end 26.104 - 26.105 - execute.view{ 26.106 - module = "interest", 26.107 - view = "_show_box", 26.108 - params = { issue = issue, initiative = initiative } 26.109 - } 26.110 - 26.111 - if not issue.closed then 26.112 - execute.view{ 26.113 - module = "delegation", 26.114 - view = "_show_box", 26.115 - params = { issue_id = issue.id, 26.116 - initiative_id = initiative and initiative.id or nil} 26.117 - } 26.118 - end 26.119 - 26.120 - end 26.121 - 26.122 - if config.issue_discussion_url_func then 26.123 - local url = config.issue_discussion_url_func(issue) 26.124 - ui.link{ 26.125 - attr = { target = "_blank" }, 26.126 - external = url, 26.127 - content = function() 26.128 - ui.image{ static = "icons/16/comments.png" } 26.129 - slot.put(_"Discussion on issue") 26.130 - end, 26.131 - } 26.132 - end 26.133 - 26.134 - if config.etherpad and app.session.member then 26.135 - local url = config.etherpad.base_url .. "p/" .. config.etherpad.group_id .. "$Issue" .. issue.id 26.136 - ui.link{ 26.137 - attr = { target = "_blank" }, 26.138 - external = url, 26.139 - content = function() 26.140 - ui.image{ static = "icons/16/comments.png" } 26.141 - slot.put(_"Issue pad") 26.142 - end, 26.143 - } 26.144 - end 26.145 - 26.146 -end) 26.147 - 26.148 -if app.session.member_id and app.session.member:has_voting_right_for_unit_id(issue.area.unit_id) then 26.149 - slot.select("actions", function() 26.150 - if not issue.fully_frozen and not issue.closed then 26.151 - ui.link{ 26.152 - image = { static = "icons/16/script_add.png" }, 26.153 - attr = { class = "action" }, 26.154 - text = _"Create alternative initiative", 26.155 - module = "initiative", 26.156 - view = "new", 26.157 - params = { issue_id = issue.id } 26.158 - } 26.159 - end 26.160 - end) 26.161 -end 26.162 - 26.163 -local issue = param.get("issue", "table") 26.164 - 26.165 -if config.public_access_issue_head and not app.session.member_id then 26.166 - config.public_access_issue_head(issue) 26.167 -end 26.168 - 26.169 -if app.session.member_id and issue.state == 'voting' and not direct_voter 26.170 - and app.session.member:has_voting_right_for_unit_id(issue.area.unit_id) 26.171 -then 26.172 - ui.container{ 26.173 - attr = { class = "voting_active_info" }, 26.174 - content = function() 26.175 - slot.put(_"Voting for this issue is currently running!") 26.176 - slot.put(" ") 26.177 - if app.session.member_id then 26.178 - ui.link{ 26.179 - content = function() 26.180 - slot.put(_"Vote now") 26.181 - end, 26.182 - module = "vote", 26.183 - view = "list", 26.184 - params = { issue_id = issue.id } 26.185 - } 26.186 - end 26.187 - end 26.188 - } 26.189 - slot.put("<br />") 26.190 -end 26.191 -
27.1 --- a/app/main/issue/show.lua Tue Apr 17 00:07:04 2012 +0200 27.2 +++ b/app/main/issue/show.lua Fri May 18 19:07:07 2012 +0200 27.3 @@ -5,27 +5,11 @@ 27.4 end 27.5 27.6 execute.view{ 27.7 - module = "issue", 27.8 - view = "_show_head", 27.9 - params = { issue = issue } 27.10 + module = "area", 27.11 + view = "_head", 27.12 + params = { area = issue.area } 27.13 } 27.14 27.15 ---[[ 27.16 -if not issue.fully_frozen and not issue.closed then 27.17 - slot.select("actions", function() 27.18 - ui.link{ 27.19 - content = function() 27.20 - ui.image{ static = "icons/16/script_add.png" } 27.21 - slot.put(_"Create alternative initiative") 27.22 - end, 27.23 - module = "initiative", 27.24 - view = "new", 27.25 - params = { issue_id = issue.id } 27.26 - } 27.27 - end) 27.28 -end 27.29 ---]] 27.30 - 27.31 util.help("issue.show") 27.32 27.33 if issue.state == "cancelled" then 27.34 @@ -36,6 +20,10 @@ 27.35 } 27.36 end 27.37 27.38 +slot.select("head", function() 27.39 + execute.view{ module = "issue", view = "_show", params = { issue = issue } } 27.40 +end ) 27.41 + 27.42 27.43 execute.view{ 27.44 module = "issue",
28.1 --- a/app/main/issue/show_tab.lua Tue Apr 17 00:07:04 2012 +0200 28.2 +++ b/app/main/issue/show_tab.lua Fri May 18 19:07:07 2012 +0200 28.3 @@ -18,25 +18,11 @@ 28.4 static_params = { issue_id = issue.id }, 28.5 } 28.6 28.7 -tabs[#tabs+1] = 28.8 - { 28.9 - name = "initiatives", 28.10 - label = _"Initiatives", 28.11 - icon = { static = "icons/16/script.png" }, 28.12 - module = "issue", 28.13 - view = "_list_initiatives", 28.14 - params = { 28.15 - issue = issue 28.16 - } 28.17 - } 28.18 - 28.19 - 28.20 if app.session.member_id then 28.21 tabs[#tabs+1] = 28.22 { 28.23 name = "interested_members", 28.24 - label = _"Members" .. " (" .. tostring(interested_members_selector:count()) .. ")" , 28.25 - icon = { static = "icons/16/eye.png" }, 28.26 + label = _"Interested" .. " (" .. tostring(interested_members_selector:count()) .. ")" , 28.27 module = "member", 28.28 view = "_list", 28.29 params = { 28.30 @@ -49,7 +35,6 @@ 28.31 { 28.32 name = "delegations", 28.33 label = _"Delegations" .. " (" .. tostring(delegations_selector:count()) .. ")" , 28.34 - icon = { static = "icons/16/table_go.png" }, 28.35 module = "delegation", 28.36 view = "_list", 28.37 params = { delegations_selector = delegations_selector } 28.38 @@ -60,11 +45,21 @@ 28.39 { 28.40 name = "details", 28.41 label = _"Details", 28.42 - icon = { static = "icons/16/magnifier.png" }, 28.43 module = "issue", 28.44 view = "_details", 28.45 params = { issue = issue } 28.46 } 28.47 + 28.48 +if config.etherpad then 28.49 + tabs[#tabs+1] = 28.50 + { 28.51 + name = "pad", 28.52 + label = _"Pad", 28.53 + module = "issue", 28.54 + view = "_pad", 28.55 + params = { issue = issue } 28.56 + } 28.57 +end 28.58 28.59 ui.tabs(tabs) 28.60
29.1 --- a/app/main/member/_area_list.lua Tue Apr 17 00:07:04 2012 +0200 29.2 +++ b/app/main/member/_area_list.lua Fri May 18 19:07:07 2012 +0200 29.3 @@ -1,7 +1,33 @@ 29.4 local member = param.get("member", "table") 29.5 local for_member = param.get("for_member", atom.boolean) 29.6 +local filter_unit = param.get_all_cgi()["filter_unit"] or "personal" 29.7 29.8 -local units = member.units_with_voting_right 29.9 +ui.container{ attr = { class = "ui_filter_head" }, content = function() 29.10 + 29.11 + ui.link{ 29.12 + attr = { class = filter_unit == "personal" and "ui_tabs_link active" or nil }, 29.13 + text = _"With voting right", 29.14 + module = "index", view = "index", params = { filter_unit = "personal" } 29.15 + } 29.16 + 29.17 + slot.put(" ") 29.18 + 29.19 + ui.link{ 29.20 + attr = { class = filter_unit == "global" and "active" or nil }, 29.21 + text = _"All units", 29.22 + module = "index", view = "index", params = { filter_unit = "global" } 29.23 + } 29.24 +end } 29.25 + 29.26 +slot.put("<br />") 29.27 + 29.28 + 29.29 +if filter_unit == "global" then 29.30 + execute.view{ module = "unit", view = "_list" } 29.31 + return 29.32 +end 29.33 + 29.34 +local units = Unit:new_selector():exec() 29.35 29.36 for i, unit in ipairs(units) do 29.37 local trustee_member = Member:new_selector() 29.38 @@ -18,7 +44,7 @@ 29.39 local area_count = areas_selector:count() 29.40 29.41 ui.container{ attr = { class = "member_area_list" }, content = function() 29.42 - ui.container{ attr = { class = "unit_head" }, content = function() 29.43 + ui.container{ attr = { class = "xunit_head" }, content = function() 29.44 ui.link{ 29.45 text = unit.name, 29.46 module = "unit", view = "show", id = unit.id 29.47 @@ -49,7 +75,7 @@ 29.48 module = "area", view = "_list", 29.49 params = { areas_selector = areas_selector, hide_membership = true } 29.50 } 29.51 - else 29.52 + elseif member:has_voting_right_for_unit_id(unit.id) then 29.53 if for_member then 29.54 ui.container{ attr = { class = "voting_priv_info" }, content = _"This member has voting privileges for this unit, but you ist not member of any of its areas." } 29.55 else 29.56 @@ -77,3 +103,5 @@ 29.57 end } 29.58 29.59 end 29.60 + 29.61 +
30.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 30.2 +++ b/app/main/member/_menu.lua Fri May 18 19:07:07 2012 +0200 30.3 @@ -0,0 +1,104 @@ 30.4 +ui.tag{ tag = "ul", content = function() 30.5 + 30.6 + ui.tag{ tag = "li", content = function() 30.7 + 30.8 + ui.link{ 30.9 + text = _"Show profile", 30.10 + module = "member", 30.11 + view = "show", 30.12 + id = app.session.member_id 30.13 + } 30.14 + 30.15 + end } 30.16 + 30.17 + ui.tag{ tag = "li", content = function() 30.18 + 30.19 + ui.link{ 30.20 + content = function() 30.21 + slot.put(_"Edit profile") 30.22 + end, 30.23 + module = "member", 30.24 + view = "edit" 30.25 + } 30.26 + 30.27 + end } 30.28 + 30.29 + ui.tag{ tag = "li", content = function() 30.30 + 30.31 + ui.link{ 30.32 + content = function() 30.33 + slot.put(_"Upload avatar/photo") 30.34 + end, 30.35 + module = "member", 30.36 + view = "edit_images" 30.37 + } 30.38 + 30.39 + end } 30.40 + 30.41 + ui.tag{ tag = "li", content = function() 30.42 + 30.43 + ui.link{ 30.44 + content = _"Contacts", 30.45 + module = 'contact', 30.46 + view = 'list' 30.47 + } 30.48 + 30.49 + end } 30.50 + 30.51 + ui.tag{ tag = "li", content = function() 30.52 + 30.53 + ui.link{ 30.54 + text = _"Settings", 30.55 + module = "member", 30.56 + view = "settings" 30.57 + } 30.58 + 30.59 + end } 30.60 + 30.61 + ui.tag{ tag = "li", content = function() 30.62 + 30.63 + ui.link{ 30.64 + text = _"Logout", 30.65 + module = 'index', 30.66 + action = 'logout', 30.67 + routing = { 30.68 + default = { 30.69 + mode = "redirect", 30.70 + module = "index", 30.71 + view = "index" 30.72 + } 30.73 + } 30.74 + } 30.75 + end } 30.76 + 30.77 + ui.tag{ tag = "li", content = function() 30.78 + ui.tag{ tag = "span", content = _"Select language" } 30.79 + end } 30.80 + 30.81 + for i, lang in ipairs{"en", "de", "eo"} do 30.82 + ui.tag{ tag = "li", content = function() 30.83 + ui.link{ 30.84 + content = function() 30.85 + ui.image{ 30.86 + static = "lang/" .. lang .. ".png", 30.87 + } 30.88 + ui.tag{ content = _('Select language "#{langcode}"', { langcode = lang }) } 30.89 + end, 30.90 + module = "index", 30.91 + action = "set_lang", 30.92 + params = { lang = lang }, 30.93 + routing = { 30.94 + default = { 30.95 + mode = "redirect", 30.96 + module = request.get_module(), 30.97 + view = request.get_view(), 30.98 + id = param.get_id_cgi(), 30.99 + params = param.get_all_cgi() 30.100 + } 30.101 + } 30.102 + } 30.103 + end } 30.104 + end 30.105 + 30.106 +end } 30.107 +
31.1 --- a/app/main/member/_profile.lua Tue Apr 17 00:07:04 2012 +0200 31.2 +++ b/app/main/member/_profile.lua Fri May 18 19:07:07 2012 +0200 31.3 @@ -9,28 +9,6 @@ 31.4 end 31.5 end 31.6 31.7 ---slot.select("actions", function() 31.8 - 31.9 - if app.session.member and app.session.member_id == member.id then 31.10 - ui.link{ 31.11 - content = function() 31.12 - slot.put(_"Edit my profile") 31.13 - end, 31.14 - module = "member", 31.15 - view = "edit" 31.16 - } 31.17 - slot.put(" ") 31.18 - ui.link{ 31.19 - content = function() 31.20 - slot.put(_"Upload images") 31.21 - end, 31.22 - module = "member", 31.23 - view = "edit_images" 31.24 - } 31.25 - slot.put("<br /><br />") 31.26 - end 31.27 ---end) 31.28 - 31.29 ui.form{ 31.30 attr = { class = "box member vertical" }, 31.31 record = member,
32.1 --- a/app/main/member/_show.lua Tue Apr 17 00:07:04 2012 +0200 32.2 +++ b/app/main/member/_show.lua Fri May 18 19:07:07 2012 +0200 32.3 @@ -1,8 +1,246 @@ 32.4 -execute.view{ 32.5 +local show_as_homepage = param.get("show_as_homepage", atom.boolean) 32.6 + 32.7 +local member = param.get("member", "table") 32.8 + 32.9 +local tabs = { 32.10 module = "member", 32.11 view = "show_tab", 32.12 - params = { 32.13 - member = param.get("member", "table"), 32.14 - show_as_homepage = param.get("show_as_homepage", atom.boolean) 32.15 + static_params = { 32.16 + member_id = member.id, 32.17 + show_as_homepage = show_as_homepage 32.18 } 32.19 -} 32.20 \ No newline at end of file 32.21 +} 32.22 + 32.23 +if show_as_homepage and app.session.member_id == member.id then 32.24 + 32.25 + if app.session.member.notify_email_unconfirmed then 32.26 + tabs[#tabs+1] = { 32.27 + class = "yellow", 32.28 + name = "email_unconfirmed", 32.29 + label = _"Email unconfirmed", 32.30 + module = "member", 32.31 + view = "_email_unconfirmed", 32.32 + params = {} 32.33 + } 32.34 + end 32.35 + 32.36 + if app.session.member.notify_level == nil then 32.37 + tabs[#tabs+1] = { 32.38 + class = "yellow", 32.39 + name = "notify_level_not_set", 32.40 + label = _"Notifications", 32.41 + module = "member", 32.42 + view = "_notify_level_not_set" 32.43 + } 32.44 + end 32.45 + 32.46 + local broken_delegations = Delegation:new_selector() 32.47 + :join("issue", nil, "issue.id = delegation.issue_id AND issue.closed ISNULL") 32.48 + :join("member", nil, "delegation.trustee_id = member.id") 32.49 + :add_where{"delegation.truster_id = ?", member.id} 32.50 + :add_where{"member.active = 'f' OR (member.last_activity IS NULL OR age(member.last_activity) > ?::interval)", config.delegation_warning_time } 32.51 + 32.52 + if broken_delegations:count() > 0 then 32.53 + tabs[#tabs+1] = { 32.54 + class = "red", 32.55 + name = "broken_delegations", 32.56 + label = _"Delegation problems" .. " (" .. tostring(broken_delegations:count()) .. ")", 32.57 + icon = { static = "icons/16/table_go.png" }, 32.58 + module = "delegation", 32.59 + view = "_list", 32.60 + params = { delegations_selector = broken_delegations, outgoing = true }, 32.61 + } 32.62 + end 32.63 + 32.64 + local selector = Issue:new_selector() 32.65 + :join("area", nil, "area.id = issue.area_id") 32.66 + :join("privilege", nil, { "privilege.unit_id = area.unit_id AND privilege.member_id = ? AND privilege.voting_right", app.session.member_id }) 32.67 + :left_join("direct_voter", nil, { "direct_voter.issue_id = issue.id AND direct_voter.member_id = ?", app.session.member.id }) 32.68 + :left_join("interest", nil, { "interest.issue_id = issue.id AND interest.member_id = ?", app.session.member.id }) 32.69 + :left_join("membership", nil, { "membership.area_id = area.id AND membership.member_id = ? ", app.session.member.id }) 32.70 + :add_where{ "direct_voter.member_id ISNULL" } 32.71 + :add_where{ "interest.member_id NOTNULL OR membership.member_id NOTNULL" } 32.72 + :add_where{ "issue.fully_frozen NOTNULL" } 32.73 + :add_where{ "issue.closed ISNULL" } 32.74 + :add_order_by{ "issue.fully_frozen + issue.voting_time ASC" } 32.75 + 32.76 + local count = selector:count() 32.77 + if count > 0 then 32.78 + tabs[#tabs+1] = { 32.79 + class = "yellow", 32.80 + name = "not_voted_issues", 32.81 + label = _"Now in voting" .. " (" .. tostring(count) .. ")", 32.82 + icon = { static = "icons/16/email_open.png" }, 32.83 + module = "issue", 32.84 + view = "_list", 32.85 + params = { 32.86 + issues_selector = selector, 32.87 + no_filter = true 32.88 + } 32.89 + } 32.90 + end 32.91 + 32.92 + local initiator_invites_selector = Initiative:new_selector() 32.93 + :join("issue", "_issue_state", "_issue_state.id = initiative.issue_id") 32.94 + :join("initiator", nil, { "initiator.initiative_id = initiative.id AND initiator.member_id = ? AND initiator.accepted ISNULL", app.session.member.id }) 32.95 + :add_where("_issue_state.closed ISNULL AND _issue_state.half_frozen ISNULL") 32.96 + 32.97 + if initiator_invites_selector:count() > 0 then 32.98 + tabs[#tabs+1] = { 32.99 + class = "yellow", 32.100 + name = "initiator_invites", 32.101 + label = _"Initiator invites" .. " (" .. tostring(initiator_invites_selector:count()) .. ")", 32.102 + icon = { static = "icons/16/user_add.png" }, 32.103 + module = "index", 32.104 + view = "_initiator_invites", 32.105 + params = { 32.106 + initiatives_selector = initiator_invites_selector 32.107 + } 32.108 + } 32.109 + end 32.110 + 32.111 + local updated_drafts_selector = Initiative:new_selector() 32.112 + :join("issue", "_issue_state", "_issue_state.id = initiative.issue_id AND _issue_state.closed ISNULL AND _issue_state.fully_frozen ISNULL") 32.113 + :join("current_draft", "_current_draft", "_current_draft.initiative_id = initiative.id") 32.114 + :join("supporter", "supporter", { "supporter.member_id = ? AND supporter.initiative_id = initiative.id AND supporter.draft_id < _current_draft.id", app.session.member_id }) 32.115 + :add_where("initiative.revoked ISNULL") 32.116 + 32.117 + if updated_drafts_selector:count() > 0 then 32.118 + tabs[#tabs+1] = { 32.119 + class = "yellow", 32.120 + name = "updated_drafts", 32.121 + label = _"Updated drafts" .. " (" .. tostring(updated_drafts_selector:count()) .. ")", 32.122 + icon = { static = "icons/16/script.png" }, 32.123 + module = "index", 32.124 + view = "_updated_drafts", 32.125 + params = { 32.126 + initiatives_selector = updated_drafts_selector 32.127 + } 32.128 + } 32.129 + end 32.130 +end 32.131 + 32.132 +if not show_as_homepage then 32.133 + tabs[#tabs+1] = { 32.134 + name = "profile", 32.135 + label = _"Profile", 32.136 + icon = { static = "icons/16/application_form.png" }, 32.137 + module = "member", 32.138 + view = "_profile", 32.139 + params = { member = member }, 32.140 + } 32.141 +end 32.142 + 32.143 + 32.144 +local areas_selector = member:get_reference_selector("areas") 32.145 +tabs[#tabs+1] = { 32.146 + name = "areas", 32.147 + label = _"Units", 32.148 + icon = { static = "icons/16/package.png" }, 32.149 + module = "member", 32.150 + view = "_area_list", 32.151 + params = { areas_selector = areas_selector, member = member, for_member = not show_as_homepage }, 32.152 +} 32.153 + 32.154 +if show_as_homepage then 32.155 + tabs[#tabs+1] = { 32.156 + name = "timeline", 32.157 + label = _"Events", 32.158 + module = "member", 32.159 + view = "_event_list", 32.160 + params = { } 32.161 + } 32.162 +else 32.163 + tabs[#tabs+1] = { 32.164 + name = "timeline", 32.165 + label = _"Events", 32.166 + module = "event", 32.167 + view = "_list", 32.168 + params = { for_member = member } 32.169 + } 32.170 +end 32.171 + 32.172 +tabs[#tabs+1] = { 32.173 + name = "open", 32.174 + label = _"Open issues", 32.175 + module = "issue", 32.176 + view = "_list", 32.177 + link_params = { 32.178 + filter_interest = not show_as_homepage and "issue" or nil, 32.179 + }, 32.180 + params = { 32.181 + for_state = "open", 32.182 + for_member = not show_as_homepage and member or nil, 32.183 + issues_selector = Issue:new_selector() 32.184 + :add_where("issue.closed ISNULL") 32.185 + :add_order_by("coalesce(issue.fully_frozen + issue.voting_time, issue.half_frozen + issue.verification_time, issue.accepted + issue.discussion_time, issue.created + issue.admission_time) - now()") 32.186 + } 32.187 +} 32.188 + 32.189 +tabs[#tabs+1] = { 32.190 + name = "closed", 32.191 + label = _"Closed issues", 32.192 + module = "issue", 32.193 + view = "_list", 32.194 + link_params = { 32.195 + filter_interest = not show_as_homepage and "issue" or nil, 32.196 + }, 32.197 + params = { 32.198 + for_state = "closed", 32.199 + for_member = not show_as_homepage and member or nil, 32.200 + issues_selector = Issue:new_selector() 32.201 + :add_where("issue.closed NOTNULL") 32.202 + :add_order_by("issue.closed DESC") 32.203 + 32.204 + } 32.205 +} 32.206 + 32.207 +if show_as_homepage then 32.208 + tabs[#tabs+1] = { 32.209 + name = "members", 32.210 + label = _"Members", 32.211 + module = 'member', 32.212 + view = '_list', 32.213 + params = { members_selector = Member:new_selector() } 32.214 + } 32.215 +end 32.216 + 32.217 + 32.218 + 32.219 +if not show_as_homepage then 32.220 + local outgoing_delegations_selector = member:get_reference_selector("outgoing_delegations") 32.221 + :left_join("issue", "_member_showtab_issue", "_member_showtab_issue.id = delegation.issue_id") 32.222 + :add_where("_member_showtab_issue.closed ISNULL") 32.223 + tabs[#tabs+1] = { 32.224 + name = "outgoing_delegations", 32.225 + label = _"Outgoing delegations" .. " (" .. tostring(outgoing_delegations_selector:count()) .. ")", 32.226 + icon = { static = "icons/16/table_go.png" }, 32.227 + module = "delegation", 32.228 + view = "_list", 32.229 + params = { delegations_selector = outgoing_delegations_selector, outgoing = true }, 32.230 + } 32.231 + 32.232 + local incoming_delegations_selector = member:get_reference_selector("incoming_delegations") 32.233 + :left_join("issue", "_member_showtab_issue", "_member_showtab_issue.id = delegation.issue_id") 32.234 + :add_where("_member_showtab_issue.closed ISNULL") 32.235 + tabs[#tabs+1] = { 32.236 + name = "incoming_delegations", 32.237 + label = _"Incoming delegations" .. " (" .. tostring(incoming_delegations_selector:count()) .. ")", 32.238 + icon = { static = "icons/16/table_go.png" }, 32.239 + module = "delegation", 32.240 + view = "_list", 32.241 + params = { delegations_selector = incoming_delegations_selector, incoming = true }, 32.242 + } 32.243 + 32.244 + local contacts_selector = member:get_reference_selector("saved_members"):add_where("public") 32.245 + tabs[#tabs+1] = { 32.246 + name = "contacts", 32.247 + label = _"Contacts" .. " (" .. tostring(contacts_selector:count()) .. ")", 32.248 + icon = { static = "icons/16/book_edit.png" }, 32.249 + module = "member", 32.250 + view = "_list", 32.251 + params = { members_selector = contacts_selector }, 32.252 + } 32.253 +end 32.254 + 32.255 +ui.tabs(tabs)
33.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 33.2 +++ b/app/main/member/menu.lua Fri May 18 19:07:07 2012 +0200 33.3 @@ -0,0 +1,11 @@ 33.4 +if not app.session.member_id then 33.5 + error("access denied") 33.6 +end 33.7 + 33.8 +app.html_title.title = _("Member menu") 33.9 + 33.10 +execute.view{ 33.11 + module = "member", 33.12 + view = "_menu" 33.13 +} 33.14 +
34.1 --- a/app/main/member/show.lua Tue Apr 17 00:07:04 2012 +0200 34.2 +++ b/app/main/member/show.lua Fri May 18 19:07:07 2012 +0200 34.3 @@ -23,7 +23,6 @@ 34.4 slot.select("actions", function() 34.5 ui.link{ 34.6 content = function() 34.7 - ui.image{ static = "icons/16/clock_edit.png" } 34.8 slot.put(encode.html(_"Show member history")) 34.9 end, 34.10 module = "member", 34.11 @@ -39,6 +38,7 @@ 34.12 slot.put(" ") 34.13 end 34.14 if not (member.id == app.session.member.id) then 34.15 + slot.put(" · ") 34.16 --TODO performance 34.17 local contact = Contact:by_pk(app.session.member.id, member.id) 34.18 if contact then 34.19 @@ -47,7 +47,6 @@ 34.20 content = _"You have saved this member as contact." 34.21 } 34.22 ui.link{ 34.23 - image = { static = "icons/16/book_delete.png" }, 34.24 text = _"Remove from contacts", 34.25 module = "contact", 34.26 action = "remove_member", 34.27 @@ -64,7 +63,6 @@ 34.28 } 34.29 elseif member.activated then 34.30 ui.link{ 34.31 - image = { static = "icons/16/book_add.png" }, 34.32 text = _"Add to my contacts", 34.33 module = "contact", 34.34 action = "add_member", 34.35 @@ -82,11 +80,13 @@ 34.36 end 34.37 end 34.38 local ignored_member = IgnoredMember:by_pk(app.session.member.id, member.id) 34.39 + slot.put(" · ") 34.40 if ignored_member then 34.41 ui.container{ 34.42 attr = { class = "interest" }, 34.43 content = _"You have ignored this member" 34.44 } 34.45 + slot.put(" · ") 34.46 ui.link{ 34.47 text = _"Stop ignoring member", 34.48 module = "member",
35.1 --- a/app/main/member/show_tab.lua Tue Apr 17 00:07:04 2012 +0200 35.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 35.3 @@ -1,265 +0,0 @@ 35.4 -local show_as_homepage = param.get("show_as_homepage", atom.boolean) 35.5 - 35.6 -local member 35.7 - 35.8 -if request.get_json_request_slots() then 35.9 - member = Member:by_id(param.get("member_id")) 35.10 -else 35.11 - member = param.get("member", "table") 35.12 -end 35.13 - 35.14 -local tabs = { 35.15 - module = "member", 35.16 - view = "show_tab", 35.17 - static_params = { 35.18 - member_id = member.id, 35.19 - show_as_homepage = show_as_homepage 35.20 - } 35.21 -} 35.22 - 35.23 -if show_as_homepage and app.session.member_id == member.id then 35.24 - 35.25 - if app.session.member.notify_email_unconfirmed then 35.26 - tabs[#tabs+1] = { 35.27 - class = "yellow", 35.28 - name = "email_unconfirmed", 35.29 - label = _"Email unconfirmed", 35.30 - module = "member", 35.31 - view = "_email_unconfirmed", 35.32 - params = {} 35.33 - } 35.34 - end 35.35 - 35.36 - if app.session.member.notify_level == nil then 35.37 - tabs[#tabs+1] = { 35.38 - class = "yellow", 35.39 - name = "notify_level_not_set", 35.40 - label = _"Notifications", 35.41 - module = "member", 35.42 - view = "_notify_level_not_set" 35.43 - } 35.44 - end 35.45 - 35.46 - --[[ 35.47 - if config.motd_intern then 35.48 - tabs[#tabs+1] = { 35.49 - class = "yellow", 35.50 - name = "motd", 35.51 - label = _"Message of the day", 35.52 - module = "index", 35.53 - view = "_motd", 35.54 - params = {} 35.55 - } 35.56 - end 35.57 - --]] 35.58 - 35.59 - local broken_delegations = Delegation:new_selector() 35.60 - :join("issue", nil, "issue.id = delegation.issue_id AND issue.closed ISNULL") 35.61 - :join("member", nil, "delegation.trustee_id = member.id") 35.62 - :add_where{"delegation.truster_id = ?", member.id} 35.63 - :add_where{"member.active = 'f' OR (member.last_activity IS NULL OR age(member.last_activity) > ?::interval)", config.delegation_warning_time } 35.64 - 35.65 - if broken_delegations:count() > 0 then 35.66 - tabs[#tabs+1] = { 35.67 - class = "red", 35.68 - name = "broken_delegations", 35.69 - label = _"Delegation problems" .. " (" .. tostring(broken_delegations:count()) .. ")", 35.70 - icon = { static = "icons/16/table_go.png" }, 35.71 - module = "delegation", 35.72 - view = "_list", 35.73 - params = { delegations_selector = broken_delegations, outgoing = true }, 35.74 - } 35.75 - end 35.76 - 35.77 - local selector = Area:new_selector() 35.78 - :reset_fields() 35.79 - :join("privilege", nil, { "privilege.unit_id = area.unit_id AND privilege.member_id = ? AND privilege.voting_right", app.session.member_id }) 35.80 - :add_field("area.id", nil, { "grouped" }) 35.81 - :add_field("area.name", nil, { "grouped" }) 35.82 - :add_field("membership.member_id NOTNULL", "is_member", { "grouped" }) 35.83 - :add_field("count(issue.id)", "issues_to_vote_count") 35.84 - :add_field("count(interest.member_id)", "interested_issues_to_vote_count") 35.85 - :add_field("count(interest.member_id NOTNULL OR interest.member_id NOTNULL)", "issues_to_vote_count_sum") 35.86 - :join("issue", nil, "issue.area_id = area.id AND issue.fully_frozen NOTNULL AND issue.closed ISNULL") 35.87 - :left_join("direct_voter", nil, { "direct_voter.issue_id = issue.id AND direct_voter.member_id = ?", app.session.member.id }) 35.88 - :add_where{ "direct_voter.member_id ISNULL" } 35.89 - :left_join("interest", nil, { "interest.issue_id = issue.id AND interest.member_id = ?", app.session.member.id }) 35.90 - :left_join("membership", nil, { "membership.area_id = area.id AND membership.member_id = ? ", app.session.member.id }) 35.91 - 35.92 - local not_voted_areas = {} 35.93 - local issues_to_vote_count = 0 35.94 - for i, area in ipairs(selector:exec()) do 35.95 - if area.is_member or area.interested_issues_to_vote_count > 0 then 35.96 - not_voted_areas[#not_voted_areas+1] = area 35.97 - end 35.98 - if area.is_member then 35.99 - issues_to_vote_count = issues_to_vote_count + area.issues_to_vote_count_sum 35.100 - end 35.101 - end 35.102 - 35.103 - if issues_to_vote_count > 0 then 35.104 - tabs[#tabs+1] = { 35.105 - class = "yellow", 35.106 - name = "not_voted_issues", 35.107 - label = _"Not voted issues" .. " (" .. tostring(issues_to_vote_count) .. ")", 35.108 - icon = { static = "icons/16/email_open.png" }, 35.109 - module = "index", 35.110 - view = "_not_voted_issues", 35.111 - params = { 35.112 - areas = not_voted_areas 35.113 - } 35.114 - } 35.115 - end 35.116 - 35.117 - local initiator_invites_selector = Initiative:new_selector() 35.118 - :join("issue", "_issue_state", "_issue_state.id = initiative.issue_id") 35.119 - :join("initiator", nil, { "initiator.initiative_id = initiative.id AND initiator.member_id = ? AND initiator.accepted ISNULL", app.session.member.id }) 35.120 - :add_where("_issue_state.closed ISNULL AND _issue_state.half_frozen ISNULL") 35.121 - 35.122 - if initiator_invites_selector:count() > 0 then 35.123 - tabs[#tabs+1] = { 35.124 - class = "yellow", 35.125 - name = "initiator_invites", 35.126 - label = _"Initiator invites" .. " (" .. tostring(initiator_invites_selector:count()) .. ")", 35.127 - icon = { static = "icons/16/user_add.png" }, 35.128 - module = "index", 35.129 - view = "_initiator_invites", 35.130 - params = { 35.131 - initiatives_selector = initiator_invites_selector 35.132 - } 35.133 - } 35.134 - end 35.135 - 35.136 - local updated_drafts_selector = Initiative:new_selector() 35.137 - :join("issue", "_issue_state", "_issue_state.id = initiative.issue_id AND _issue_state.closed ISNULL AND _issue_state.fully_frozen ISNULL") 35.138 - :join("current_draft", "_current_draft", "_current_draft.initiative_id = initiative.id") 35.139 - :join("supporter", "supporter", { "supporter.member_id = ? AND supporter.initiative_id = initiative.id AND supporter.draft_id < _current_draft.id", app.session.member_id }) 35.140 - :add_where("initiative.revoked ISNULL") 35.141 - 35.142 - if updated_drafts_selector:count() > 0 then 35.143 - tabs[#tabs+1] = { 35.144 - class = "yellow", 35.145 - name = "updated_drafts", 35.146 - label = _"Updated drafts" .. " (" .. tostring(updated_drafts_selector:count()) .. ")", 35.147 - icon = { static = "icons/16/script.png" }, 35.148 - module = "index", 35.149 - view = "_updated_drafts", 35.150 - params = { 35.151 - initiatives_selector = updated_drafts_selector 35.152 - } 35.153 - } 35.154 - end 35.155 -end 35.156 - 35.157 -if not show_as_homepage then 35.158 - tabs[#tabs+1] = { 35.159 - name = "profile", 35.160 - label = _"Profile", 35.161 - icon = { static = "icons/16/application_form.png" }, 35.162 - module = "member", 35.163 - view = "_profile", 35.164 - params = { member = member }, 35.165 - } 35.166 -end 35.167 - 35.168 - 35.169 -local areas_selector = member:get_reference_selector("areas") 35.170 -tabs[#tabs+1] = { 35.171 - name = "areas", 35.172 - label = _"Areas", 35.173 - icon = { static = "icons/16/package.png" }, 35.174 - module = "member", 35.175 - view = "_area_list", 35.176 - params = { areas_selector = areas_selector, member = member, for_member = not show_as_homepage }, 35.177 -} 35.178 - 35.179 -if show_as_homepage then 35.180 - tabs[#tabs+1] = { 35.181 - name = "timeline", 35.182 - label = _"Events", 35.183 - module = "member", 35.184 - view = "_event_list", 35.185 - params = { } 35.186 - } 35.187 -else 35.188 - tabs[#tabs+1] = { 35.189 - name = "timeline", 35.190 - label = _"Events", 35.191 - module = "event", 35.192 - view = "_list", 35.193 - params = { for_member = member } 35.194 - } 35.195 -end 35.196 - 35.197 -tabs[#tabs+1] = { 35.198 - name = "open", 35.199 - label = _"Open issues", 35.200 - module = "issue", 35.201 - view = "_list", 35.202 - link_params = { 35.203 - filter_interest = not show_as_homepage and "issue" or nil, 35.204 - }, 35.205 - params = { 35.206 - for_state = "open", 35.207 - for_member = not show_as_homepage and member or nil, 35.208 - issues_selector = Issue:new_selector() 35.209 - :add_where("issue.closed ISNULL") 35.210 - :add_order_by("coalesce(issue.fully_frozen + issue.voting_time, issue.half_frozen + issue.verification_time, issue.accepted + issue.discussion_time, issue.created + issue.admission_time) - now()") 35.211 - } 35.212 -} 35.213 - 35.214 -tabs[#tabs+1] = { 35.215 - name = "closed", 35.216 - label = _"Closed issues", 35.217 - module = "issue", 35.218 - view = "_list", 35.219 - link_params = { 35.220 - filter_interest = not show_as_homepage and "issue" or nil, 35.221 - }, 35.222 - params = { 35.223 - for_state = "closed", 35.224 - for_member = not show_as_homepage and member or nil, 35.225 - issues_selector = Issue:new_selector() 35.226 - :add_where("issue.closed NOTNULL") 35.227 - :add_order_by("issue.closed DESC") 35.228 - 35.229 - } 35.230 -} 35.231 - 35.232 -if not show_as_homepage then 35.233 - local outgoing_delegations_selector = member:get_reference_selector("outgoing_delegations") 35.234 - :left_join("issue", "_member_showtab_issue", "_member_showtab_issue.id = delegation.issue_id") 35.235 - :add_where("_member_showtab_issue.closed ISNULL") 35.236 - tabs[#tabs+1] = { 35.237 - name = "outgoing_delegations", 35.238 - label = _"Outgoing delegations" .. " (" .. tostring(outgoing_delegations_selector:count()) .. ")", 35.239 - icon = { static = "icons/16/table_go.png" }, 35.240 - module = "delegation", 35.241 - view = "_list", 35.242 - params = { delegations_selector = outgoing_delegations_selector, outgoing = true }, 35.243 - } 35.244 - 35.245 - local incoming_delegations_selector = member:get_reference_selector("incoming_delegations") 35.246 - :left_join("issue", "_member_showtab_issue", "_member_showtab_issue.id = delegation.issue_id") 35.247 - :add_where("_member_showtab_issue.closed ISNULL") 35.248 - tabs[#tabs+1] = { 35.249 - name = "incoming_delegations", 35.250 - label = _"Incoming delegations" .. " (" .. tostring(incoming_delegations_selector:count()) .. ")", 35.251 - icon = { static = "icons/16/table_go.png" }, 35.252 - module = "delegation", 35.253 - view = "_list", 35.254 - params = { delegations_selector = incoming_delegations_selector, incoming = true }, 35.255 - } 35.256 - 35.257 - local contacts_selector = member:get_reference_selector("saved_members"):add_where("public") 35.258 - tabs[#tabs+1] = { 35.259 - name = "contacts", 35.260 - label = _"Contacts" .. " (" .. tostring(contacts_selector:count()) .. ")", 35.261 - icon = { static = "icons/16/book_edit.png" }, 35.262 - module = "member", 35.263 - view = "_list", 35.264 - params = { members_selector = contacts_selector }, 35.265 - } 35.266 -end 35.267 - 35.268 -ui.tabs(tabs)
36.1 --- a/app/main/member_image/_show.lua Tue Apr 17 00:07:04 2012 +0200 36.2 +++ b/app/main/member_image/_show.lua Fri May 18 19:07:07 2012 +0200 36.3 @@ -1,4 +1,6 @@ 36.4 local member = param.get("member", "table") 36.5 +local member_id = member and member.id or param.get("member_id", atom.integer) 36.6 + 36.7 local image_type = param.get("image_type") 36.8 local show_dummy = param.get("show_dummy", atom.boolean) 36.9 local class = param.get("class") 36.10 @@ -10,6 +12,7 @@ 36.11 class = "" 36.12 end 36.13 36.14 +--[[ 36.15 local image = member:get_reference_selector("images") 36.16 :add_where{ "image_type = ?", image_type } 36.17 :optional_object_mode() 36.18 @@ -28,16 +31,19 @@ 36.19 external = encode.url{ static = (config.member_image_default_file[image_type] or 'icons/16/lightning.png')}, 36.20 } 36.21 else 36.22 +--]] 36.23 ui.image{ 36.24 attr = { title = popup_text, class = "member_image member_image_" .. image_type .. class }, 36.25 module = "member_image", 36.26 view = "show", 36.27 extension = "jpg", 36.28 - id = member.id, 36.29 + id = member_id, 36.30 params = { 36.31 image_type = image_type 36.32 } 36.33 } 36.34 + --[[ 36.35 end 36.36 end 36.37 end 36.38 +--]] 36.39 \ No newline at end of file
37.1 --- a/app/main/membership/_show_box.lua Tue Apr 17 00:07:04 2012 +0200 37.2 +++ b/app/main/membership/_show_box.lua Fri May 18 19:07:07 2012 +0200 37.3 @@ -2,46 +2,43 @@ 37.4 37.5 local membership = Membership:by_pk(area.id, app.session.member.id) 37.6 37.7 -slot.select("interest", function() 37.8 +if membership then 37.9 37.10 - if membership then 37.11 + ui.container{ 37.12 + attr = { 37.13 + class = "head head_active", 37.14 + }, 37.15 + content = function() 37.16 + ui.image{ 37.17 + static = "icons/16/user_green.png" 37.18 + } 37.19 + slot.put(_"You are member") 37.20 + end 37.21 + } 37.22 37.23 - ui.container{ 37.24 - attr = { 37.25 - class = "head head_active", 37.26 - }, 37.27 - content = function() 37.28 - ui.image{ 37.29 - static = "icons/16/user_green.png" 37.30 - } 37.31 - slot.put(_"You are member") 37.32 - end 37.33 - } 37.34 - 37.35 - ui.link{ 37.36 - image = { static = "icons/16/cross.png" }, 37.37 - text = _"Withdraw membership", 37.38 - module = "membership", 37.39 - action = "update", 37.40 - params = { area_id = area.id, delete = true }, 37.41 - routing = { default = { mode = "redirect", module = "area", view = "show", id = area.id } } 37.42 - } 37.43 - elseif app.session.member:has_voting_right_for_unit_id(area.unit_id) then 37.44 - ui.link{ 37.45 - image = { static = "icons/16/user_add.png" }, 37.46 - text = _"Become a member", 37.47 - module = "membership", 37.48 - action = "update", 37.49 - params = { area_id = area.id }, 37.50 - routing = { 37.51 - default = { 37.52 - mode = "redirect", 37.53 - module = "area", 37.54 - view = "show", 37.55 - id = area.id 37.56 - } 37.57 + ui.link{ 37.58 + image = { static = "icons/16/cross.png" }, 37.59 + text = _"Withdraw membership", 37.60 + module = "membership", 37.61 + action = "update", 37.62 + params = { area_id = area.id, delete = true }, 37.63 + routing = { default = { mode = "redirect", module = "area", view = "show", id = area.id } } 37.64 + } 37.65 +elseif app.session.member:has_voting_right_for_unit_id(area.unit_id) then 37.66 + ui.link{ 37.67 + image = { static = "icons/16/user_add.png" }, 37.68 + text = _"Become a member", 37.69 + module = "membership", 37.70 + action = "update", 37.71 + params = { area_id = area.id }, 37.72 + routing = { 37.73 + default = { 37.74 + mode = "redirect", 37.75 + module = "area", 37.76 + view = "show", 37.77 + id = area.id 37.78 } 37.79 } 37.80 - end 37.81 + } 37.82 +end 37.83 37.84 -end)
38.1 --- a/app/main/supporter/_show_box.lua Tue Apr 17 00:07:04 2012 +0200 38.2 +++ b/app/main/supporter/_show_box.lua Fri May 18 19:07:07 2012 +0200 38.3 @@ -3,180 +3,181 @@ 38.4 -- TODO performance 38.5 local initiator = Initiator:by_pk(initiative.id, app.session.member.id) 38.6 38.7 -ui.partial{ 38.8 - module = "initiative", 38.9 - view = "show_support", 38.10 - id = initiative.id, 38.11 - target = "initiative_" .. tostring(initiative.id) .. "_support", 38.12 - content = function() 38.13 - 38.14 - ui.container{ 38.15 - attr = { class = "actions" }, 38.16 - content = function() 38.17 - 38.18 - local initiative = param.get("initiative", "table") 38.19 - local supporter = Supporter:by_pk(initiative.id, app.session.member.id) 38.20 +local initiative = param.get("initiative", "table") 38.21 +local supporter = Supporter:by_pk(initiative.id, app.session.member.id) 38.22 38.23 - local partial = { 38.24 - routing = { 38.25 - default = { 38.26 - mode = "redirect", 38.27 - module = "initiative", 38.28 - view = "show_support", 38.29 - id = initiative.id 38.30 - } 38.31 - } 38.32 - } 38.33 +local partial = { 38.34 + routing = { 38.35 + default = { 38.36 + mode = "redirect", 38.37 + module = "initiative", 38.38 + view = "show_support", 38.39 + id = initiative.id 38.40 + } 38.41 + } 38.42 +} 38.43 38.44 - local routing = { 38.45 - default = { 38.46 - mode = "redirect", 38.47 - module = request.get_module(), 38.48 - view = request.get_view(), 38.49 - id = param.get_id_cgi(), 38.50 - params = param.get_all_cgi() 38.51 - } 38.52 - } 38.53 +local routing = { 38.54 + default = { 38.55 + mode = "redirect", 38.56 + module = request.get_module(), 38.57 + view = request.get_view(), 38.58 + id = param.get_id_cgi(), 38.59 + params = param.get_all_cgi() 38.60 + } 38.61 +} 38.62 38.63 - if not initiative.issue.fully_frozen and not initiative.issue.closed then 38.64 - if supporter then 38.65 - if not supporter:has_critical_opinion() then 38.66 - ui.container{ attr = { class = "supporter" }, content = function() 38.67 - ui.image{ 38.68 - static = "icons/16/thumb_up_green.png" 38.69 - } 38.70 - slot.put(_"Your are supporter") 38.71 - end } 38.72 - else 38.73 - ui.tag{ attr = { class = "potential_supporter" }, content = function() 38.74 - ui.image{ 38.75 - static = "icons/16/thumb_up.png" 38.76 - } 38.77 - slot.put(_"Your are potential supporter") 38.78 - end } 38.79 - end 38.80 - ui.link{ 38.81 - image = { static = "icons/16/cross.png" }, 38.82 - text = _"Withdraw support", 38.83 - module = "initiative", 38.84 - action = "remove_support", 38.85 - id = initiative.id, 38.86 - routing = routing, 38.87 - partial = partial 38.88 - } 38.89 - elseif not initiative.revoked and app.session.member:has_voting_right_for_unit_id(initiative.issue.area.unit_id) then 38.90 - local params = param.get_all_cgi() 38.91 - params.dyn = nil 38.92 - ui.link{ 38.93 - image = { static = "icons/16/thumb_up_green.png" }, 38.94 - text = _"Support this initiative", 38.95 - module = "initiative", 38.96 - action = "add_support", 38.97 - id = initiative.id, 38.98 - routing = routing, 38.99 - partial = partial 38.100 - } 38.101 - end 38.102 - end 38.103 +if not initiative.issue.fully_frozen and not initiative.issue.closed then 38.104 + if supporter then 38.105 + if not supporter:has_critical_opinion() then 38.106 + ui.tag{ content = function() 38.107 + ui.image{ 38.108 + static = "icons/16/thumb_up_green.png" 38.109 + } 38.110 + slot.put(_"Your are supporter") 38.111 + end } 38.112 + else 38.113 + ui.tag{ attr = { class = "potential_supporter" }, content = function() 38.114 + ui.image{ 38.115 + static = "icons/16/thumb_up.png" 38.116 + } 38.117 + slot.put(_"Your are potential supporter") 38.118 + end } 38.119 + end 38.120 + slot.put(" (") 38.121 + ui.link{ 38.122 + text = _"Withdraw", 38.123 + module = "initiative", 38.124 + action = "remove_support", 38.125 + id = initiative.id, 38.126 + routing = routing, 38.127 + partial = partial 38.128 + } 38.129 + slot.put(") ") 38.130 + elseif not initiative.revoked and app.session.member:has_voting_right_for_unit_id(initiative.issue.area.unit_id) then 38.131 + local params = param.get_all_cgi() 38.132 + params.dyn = nil 38.133 + ui.link{ 38.134 + text = _"Support this initiative", 38.135 + module = "initiative", 38.136 + action = "add_support", 38.137 + id = initiative.id, 38.138 + routing = routing, 38.139 + partial = partial 38.140 + } 38.141 + slot.put(" ") 38.142 + end 38.143 +end 38.144 38.145 +if app.session.member_id 38.146 + and not initiative.issue.half_frozen 38.147 + and not initiative.issue.closed 38.148 + and not initiative.revoked 38.149 + and app.session.member:has_voting_right_for_unit_id(initiative.issue.area.unit_id) 38.150 +then 38.151 + ui.link{ 38.152 + content = function() 38.153 + slot.put(_"Add suggestion") 38.154 + end, 38.155 + module = "suggestion", 38.156 + view = "new", 38.157 + params = { 38.158 + initiative_id = initiative.id 38.159 + } 38.160 + } 38.161 + slot.put(" ") 38.162 +end 38.163 38.164 - if (initiative.discussion_url and #initiative.discussion_url > 0) then 38.165 - if initiative.discussion_url:find("^https?://") then 38.166 - if initiative.discussion_url and #initiative.discussion_url > 0 then 38.167 - ui.link{ 38.168 - attr = { 38.169 - target = "_blank", 38.170 - title = _"Discussion with initiators" 38.171 - }, 38.172 - image = { static = "icons/16/comments.png" }, 38.173 - text = _"Discuss with initiators", 38.174 - external = initiative.discussion_url 38.175 - } 38.176 - end 38.177 - else 38.178 - slot.put(encode.html(initiative.discussion_url)) 38.179 - end 38.180 - end 38.181 - if initiator and initiator.accepted and not initiative.issue.half_frozen and not initiative.issue.closed and not initiative.revoked then 38.182 - ui.link{ 38.183 - image = { static = "icons/16/comments.png" }, 38.184 - text = _"change discussion URL", 38.185 - module = "initiative", 38.186 - view = "edit", 38.187 - id = initiative.id 38.188 - } 38.189 - end 38.190 - if initiator and initiator.accepted and not initiative.issue.half_frozen and not initiative.issue.closed and not initiative.revoked then 38.191 - ui.link{ 38.192 - content = function() 38.193 - ui.image{ static = "icons/16/script_add.png" } 38.194 - slot.put(_"Edit draft") 38.195 - end, 38.196 - module = "draft", 38.197 - view = "new", 38.198 - params = { initiative_id = initiative.id } 38.199 - } 38.200 - end 38.201 +if (initiative.discussion_url and #initiative.discussion_url > 0) then 38.202 + if initiative.discussion_url:find("^https?://") then 38.203 + if initiative.discussion_url and #initiative.discussion_url > 0 then 38.204 + ui.link{ 38.205 + attr = { 38.206 + target = "_blank", 38.207 + title = _"Discussion with initiators" 38.208 + }, 38.209 + text = _"Discuss with initiators", 38.210 + external = initiative.discussion_url 38.211 + } 38.212 + slot.put(" ") 38.213 + end 38.214 + else 38.215 + slot.put(encode.html(initiative.discussion_url)) 38.216 + end 38.217 +end 38.218 +if initiator and initiator.accepted and not initiative.issue.half_frozen and not initiative.issue.closed and not initiative.revoked then 38.219 + ui.link{ 38.220 + image = { static = "icons/16/comments.png" }, 38.221 + text = _"change discussion URL", 38.222 + module = "initiative", 38.223 + view = "edit", 38.224 + id = initiative.id 38.225 + } 38.226 + slot.put(" ") 38.227 +end 38.228 +if initiator and initiator.accepted and not initiative.issue.half_frozen and not initiative.issue.closed and not initiative.revoked then 38.229 + ui.link{ 38.230 + content = function() 38.231 + ui.image{ static = "icons/16/script_add.png" } 38.232 + slot.put(_"Edit draft") 38.233 + end, 38.234 + module = "draft", 38.235 + view = "new", 38.236 + params = { initiative_id = initiative.id } 38.237 + } 38.238 + slot.put(" ") 38.239 +end 38.240 38.241 - if initiator and initiator.accepted and not initiative.issue.half_frozen and not initiative.issue.closed and not initiative.revoked then 38.242 - ui.link{ 38.243 - content = function() 38.244 - ui.image{ static = "icons/16/script_delete.png" } 38.245 - slot.put(_"Revoke initiative") 38.246 - end, 38.247 - module = "initiative", 38.248 - view = "revoke", 38.249 - id = initiative.id 38.250 - } 38.251 - end 38.252 - 38.253 - if not initiative.issue.closed then 38.254 - local ignored_initiative = IgnoredInitiative:by_pk(app.session.member.id, initiative.id) 38.255 - if ignored_initiative then 38.256 - ui.container{ 38.257 - attr = { class = "interest" }, 38.258 - content = _"You have ignored this initiative" 38.259 - } 38.260 - ui.link{ 38.261 - text = _"Stop ignoring initiative", 38.262 - module = "initiative", 38.263 - action = "update_ignore", 38.264 - id = initiative.id, 38.265 - params = { delete = true }, 38.266 - routing = { 38.267 - default = { 38.268 - mode = "redirect", 38.269 - module = request.get_module(), 38.270 - view = request.get_view(), 38.271 - id = param.get_id_cgi(), 38.272 - params = param.get_all_cgi() 38.273 - } 38.274 - } 38.275 - } 38.276 - else 38.277 - ui.link{ 38.278 - attr = { class = "interest" }, 38.279 - text = _"Ignore initiative", 38.280 - module = "initiative", 38.281 - action = "update_ignore", 38.282 - id = initiative.id, 38.283 - routing = { 38.284 - default = { 38.285 - mode = "redirect", 38.286 - module = request.get_module(), 38.287 - view = request.get_view(), 38.288 - id = param.get_id_cgi(), 38.289 - params = param.get_all_cgi() 38.290 - } 38.291 - } 38.292 - } 38.293 - end 38.294 - end 38.295 - 38.296 - end 38.297 +if initiator and initiator.accepted and not initiative.issue.half_frozen and not initiative.issue.closed and not initiative.revoked then 38.298 + ui.link{ 38.299 + content = function() 38.300 + ui.image{ static = "icons/16/script_delete.png" } 38.301 + slot.put(_"Revoke initiative") 38.302 + end, 38.303 + module = "initiative", 38.304 + view = "revoke", 38.305 + id = initiative.id 38.306 + } 38.307 + slot.put(" ") 38.308 +end 38.309 + 38.310 +if not initiative.issue.closed then 38.311 + local ignored_initiative = IgnoredInitiative:by_pk(app.session.member.id, initiative.id) 38.312 + if ignored_initiative then 38.313 + ui.tag{ 38.314 + content = _"You have ignored this initiative" 38.315 } 38.316 - 38.317 - 38.318 - slot.put("<div style='clear: left;'></div>") 38.319 + ui.link{ 38.320 + text = _"Stop ignoring initiative", 38.321 + module = "initiative", 38.322 + action = "update_ignore", 38.323 + id = initiative.id, 38.324 + params = { delete = true }, 38.325 + routing = { 38.326 + default = { 38.327 + mode = "redirect", 38.328 + module = request.get_module(), 38.329 + view = request.get_view(), 38.330 + id = param.get_id_cgi(), 38.331 + params = param.get_all_cgi() 38.332 + } 38.333 + } 38.334 + } 38.335 + else 38.336 + ui.link{ 38.337 + text = _"Ignore initiative", 38.338 + module = "initiative", 38.339 + action = "update_ignore", 38.340 + id = initiative.id, 38.341 + routing = { 38.342 + default = { 38.343 + mode = "redirect", 38.344 + module = request.get_module(), 38.345 + view = request.get_view(), 38.346 + id = param.get_id_cgi(), 38.347 + params = param.get_all_cgi() 38.348 + } 38.349 + } 38.350 + } 38.351 end 38.352 -} 38.353 +end
39.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 39.2 +++ b/app/main/unit/_head.lua Fri May 18 19:07:07 2012 +0200 39.3 @@ -0,0 +1,31 @@ 39.4 +local unit = param.get("unit", "table") 39.5 + 39.6 +slot.select("head", function() 39.7 + 39.8 + ui.container{ attr = { class = "unit_head" }, content = function() 39.9 + 39.10 + execute.view{ module = "delegation", view = "_info", params = { unit = unit } } 39.11 + 39.12 + ui.container{ attr = { class = "title" }, content = function() 39.13 + if not config.single_unit_id then 39.14 + ui.link{ 39.15 + module = "unit", view = "show", id = unit.id, 39.16 + attr = { class = "unit_name" }, content = unit.name 39.17 + } 39.18 + else 39.19 + ui.link{ 39.20 + module = "unit", view = "show", id = unit.id, 39.21 + attr = { class = "unit_name" }, content = config.app_title 39.22 + } 39.23 + end 39.24 + end } 39.25 + 39.26 + ui.container{ attr = { class = "content" }, content = function() 39.27 + 39.28 + ui.tag{ content = "1234 Stimmberechtigte" } 39.29 + 39.30 + end } 39.31 + 39.32 + end } 39.33 + 39.34 +end ) 39.35 \ No newline at end of file
40.1 --- a/app/main/unit/show.lua Tue Apr 17 00:07:04 2012 +0200 40.2 +++ b/app/main/unit/show.lua Fri May 18 19:07:07 2012 +0200 40.3 @@ -2,11 +2,7 @@ 40.4 40.5 local unit = Unit:by_id(unit_id) 40.6 40.7 -if not config.single_unit_id then 40.8 - slot.put_into("title", unit.name) 40.9 -else 40.10 - slot.put_into("title", encode.html(config.app_title)) 40.11 -end 40.12 +execute.view{ module = "unit", view = "_head", params = { unit = unit } } 40.13 40.14 if config.single_unit_id and not app.session.member_id and config.motd_public then 40.15 local help_text = config.motd_public 40.16 @@ -20,15 +16,6 @@ 40.17 40.18 util.help("unit.show", _"Unit") 40.19 40.20 -if app.session.member_id then 40.21 - execute.view{ 40.22 - module = "delegation", 40.23 - view = "_show_box", 40.24 - params = { unit_id = unit_id } 40.25 - } 40.26 -end 40.27 - 40.28 - 40.29 local areas_selector = Area:build_selector{ active = true, unit_id = unit_id } 40.30 areas_selector:add_order_by("member_weight DESC") 40.31 40.32 @@ -101,8 +88,8 @@ 40.33 40.34 if app.session.member_id then 40.35 tabs[#tabs+1] = { 40.36 - name = "members", 40.37 - label = _"Members", 40.38 + name = "eligible_voters", 40.39 + label = _"Eligible voters", 40.40 module = "member", 40.41 view = "_list", 40.42 params = { members_selector = members_selector }
41.1 --- a/config/default.lua Tue Apr 17 00:07:04 2012 +0200 41.2 +++ b/config/default.lua Fri May 18 19:07:07 2012 +0200 41.3 @@ -1,7 +1,20 @@ 41.4 +-- forward compatibility for webmcp 1.2 41.5 +if not os.pfilter then 41.6 + os.pfilter = extos.pfilter 41.7 +end 41.8 +if not os.listdir then 41.9 + os.listdir = extos.listdir 41.10 +end 41.11 +if not os.crypt then 41.12 + os.crypt = extos.crypt 41.13 +end 41.14 + 41.15 config.app_name = "LiquidFeedback" 41.16 config.app_version = "2.beta4" 41.17 41.18 -config.app_title = config.app_name .. " (" .. request.get_config_name() .. " environment)" 41.19 +config.instance_name = request.get_config_name() 41.20 + 41.21 +config.app_title = config.app_name .. " " .. config.instance_name 41.22 41.23 config.app_logo = nil 41.24 41.25 @@ -75,13 +88,13 @@ 41.26 -- functions and to disable garbage collection during the request, to 41.27 -- increase speed: 41.28 -- 41.29 --- require 'webmcp_accelerator' 41.30 --- collectgarbage("stop") 41.31 +require 'webmcp_accelerator' 41.32 +collectgarbage("stop") 41.33 41.34 -- open and set default database handle 41.35 db = assert(mondelefant.connect{ 41.36 engine='postgresql', 41.37 - dbname='liquid_feedback_p' 41.38 + dbname='liquid_feedback' 41.39 }) 41.40 at_exit(function() 41.41 db:close()
42.1 --- a/config/development.lua Tue Apr 17 00:07:04 2012 +0200 42.2 +++ b/config/development.lua Fri May 18 19:07:07 2012 +0200 42.3 @@ -44,8 +44,8 @@ 42.4 --) 42.5 42.6 config.etherpad = { 42.7 - base_url = "http://localhost:9001/", 42.8 - api_base = "http://localhost:9001/", 42.9 + base_url = "http://10.8.33.34:9001/", 42.10 + api_base = "http://10.8.33.34:9001/", 42.11 api_key = "g5XAVrRb5EgPuEqIdVrRNt2Juipx3PoH", 42.12 group_id = "g.7WDKN3StkEyuWkyN", 42.13 cookie_path = "/"
43.1 --- a/config/example.lua Tue Apr 17 00:07:04 2012 +0200 43.2 +++ b/config/example.lua Fri May 18 19:07:07 2012 +0200 43.3 @@ -4,6 +4,8 @@ 43.4 config.app_name = "LiquidFeedback" 43.5 config.app_version = "2.beta1" 43.6 43.7 +config.instance_name = request.get_config_name() 43.8 + 43.9 config.app_title = config.app_name .. " (" .. request.get_config_name() .. " environment)" 43.10 43.11 config.app_logo = nil
44.1 --- a/model/area.lua Tue Apr 17 00:07:04 2012 +0200 44.2 +++ b/model/area.lua Fri May 18 19:07:07 2012 +0200 44.3 @@ -58,6 +58,59 @@ 44.4 ref = 'allowed_policies' 44.5 } 44.6 44.7 +Area:add_reference{ 44.8 + mode = "11", 44.9 + to = mondelefant.class_prototype, 44.10 + this_key = "id", 44.11 + that_key = "area_id", 44.12 + ref = "delegation_info", 44.13 + back_ref = "area", 44.14 + selector_generator = function(list, options) 44.15 + assert(options.member_id, "member_id mandatory for delegation_info") 44.16 + local ids = { sep = ", " } 44.17 + for i, object in ipairs(list) do 44.18 + local id = object.id 44.19 + if id ~= nil then 44.20 + ids[#ids+1] = {"?", id} 44.21 + end 44.22 + end 44.23 + local sub_selector = Area:get_db_conn():new_selector() 44.24 + if #ids == 0 then 44.25 + return sub_selector:empty_list_mode() 44.26 + end 44.27 + sub_selector:from("area") 44.28 + sub_selector:add_field("area.id", "area_id") 44.29 + sub_selector:add_field{ '(delegation_info(?, null, area.id, null)).*', options.member_id } 44.30 + sub_selector:add_where{ 'area.id IN ($)', ids } 44.31 + 44.32 + local selector = Area:get_db_conn():new_selector() 44.33 + selector:add_from(sub_selector, "delegation_info") 44.34 + selector:left_join("member", "first_trustee", "first_trustee.id = delegation_info.first_trustee_id") 44.35 + selector:left_join("member", "other_trustee", "other_trustee.id = delegation_info.other_trustee_id") 44.36 + selector:add_field("delegation_info.*") 44.37 + selector:add_field("first_trustee.name", "first_trustee_name") 44.38 + selector:add_field("other_trustee.name", "other_trustee_name") 44.39 + return selector 44.40 + end 44.41 +} 44.42 + 44.43 +function Area.list:load_delegation_info_once_for_member_id(member_id) 44.44 + if self._delegation_info_loaded_for_member_id ~= member_id then 44.45 + self:load("delegation_info", { member_id = member_id }) 44.46 + for i, area in ipairs(self) do 44.47 + area._delegation_info_loaded_for_member_id = member_id 44.48 + end 44.49 + self._delegation_info_loaded_for_member_id = member_id 44.50 + end 44.51 +end 44.52 + 44.53 +function Area.object:load_delegation_info_once_for_member_id(member_id) 44.54 + if self._delegation_info_loaded_for_member_id ~= member_id then 44.55 + self:load("delegation_info", { member_id = member_id }) 44.56 + self._delegation_info_loaded_for_member_id = member_id 44.57 + end 44.58 +end 44.59 + 44.60 function Area.object_get:default_policy() 44.61 return Policy:new_selector() 44.62 :join("allowed_policy", nil, "allowed_policy.policy_id = policy.id")
45.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 45.2 +++ b/model/delegation_info.lua Fri May 18 19:07:07 2012 +0200 45.3 @@ -0,0 +1,1 @@ 45.4 +DelegationInfo = mondelefant.new_class()
46.1 --- a/model/issue.lua Tue Apr 17 00:07:04 2012 +0200 46.2 +++ b/model/issue.lua Fri May 18 19:07:07 2012 +0200 46.3 @@ -108,6 +108,58 @@ 46.4 ref = 'direct_voters' 46.5 } 46.6 46.7 +Issue:add_reference{ 46.8 + mode = "11", 46.9 + to = mondelefant.class_prototype, 46.10 + this_key = "id", 46.11 + that_key = "issue_id", 46.12 + ref = "delegation_info", 46.13 + back_ref = "issue", 46.14 + selector_generator = function(list, options) 46.15 + assert(options.member_id, "member_id mandatory for delegation_info") 46.16 + local ids = { sep = ", " } 46.17 + for i, object in ipairs(list) do 46.18 + local id = object.id 46.19 + if id ~= nil then 46.20 + ids[#ids+1] = {"?", id} 46.21 + end 46.22 + end 46.23 + local sub_selector = Issue:get_db_conn():new_selector() 46.24 + if #ids == 0 then 46.25 + return sub_selector:empty_list_mode() 46.26 + end 46.27 + sub_selector:from("issue") 46.28 + sub_selector:add_field("issue.id", "issue_id") 46.29 + sub_selector:add_field{ '(delegation_info(?, null, null, issue.id)).*', options.member_id } 46.30 + sub_selector:add_where{ 'issue.id IN ($)', ids } 46.31 + 46.32 + local selector = Issue:get_db_conn():new_selector() 46.33 + selector:add_from(sub_selector, "delegation_info") 46.34 + selector:left_join("member", "first_trustee", "first_trustee.id = delegation_info.first_trustee_id") 46.35 + selector:left_join("member", "other_trustee", "other_trustee.id = delegation_info.other_trustee_id") 46.36 + selector:add_field("delegation_info.*") 46.37 + selector:add_field("first_trustee.name", "first_trustee_name") 46.38 + selector:add_field("other_trustee.name", "other_trustee_name") 46.39 + return selector 46.40 + end 46.41 +} 46.42 + 46.43 +function Issue.list:load_delegation_info_once_for_member_id(member_id) 46.44 + if self._delegation_info_loaded_for_member_id ~= member_id then 46.45 + self:load("delegation_info", { member_id = member_id }) 46.46 + for i, issue in ipairs(self) do 46.47 + issue._delegation_info_loaded_for_member_id = member_id 46.48 + end 46.49 + self._delegation_info_loaded_for_member_id = member_id 46.50 + end 46.51 +end 46.52 + 46.53 +function Issue.object:load_delegation_info_once_for_member_id(member_id) 46.54 + if self._delegation_info_loaded_for_member_id ~= member_id then 46.55 + self:load("delegation_info", { member_id = member_id }) 46.56 + self._delegation_info_loaded_for_member_id = member_id 46.57 + end 46.58 +end 46.59 46.60 46.61 function Issue:get_state_name_for_state(value) 46.62 @@ -238,4 +290,8 @@ 46.63 state_names[#state_names+1] = Issue:get_state_name_for_state(state) 46.64 end 46.65 return table.concat(state_names, ", ") 46.66 +end 46.67 + 46.68 +function Issue.object_get:etherpad_url() 46.69 + return config.etherpad.base_url .. "p/" .. config.etherpad.group_id .. "$Issue" .. self.id 46.70 end 46.71 \ No newline at end of file
47.1 --- a/model/member.lua Tue Apr 17 00:07:04 2012 +0200 47.2 +++ b/model/member.lua Fri May 18 19:07:07 2012 +0200 47.3 @@ -493,3 +493,12 @@ 47.4 :for_share() 47.5 :exec()) and true or false 47.6 end 47.7 + 47.8 +function Member.object:get_delegatee_member(unit_id, area_id, issue_id) 47.9 + local selector = Member:new_selector() 47.10 + if unit_id then 47.11 + selector:join("delegation", nil, { "delegation.trustee_id = member.id AND delegation.scope = 'unit' AND delegation.unit_id = ? AND delegation.truster_id = ?", unit_id, self.id }) 47.12 + end 47.13 + selector:optional_object_mode() 47.14 + return selector:exec() 47.15 +end 47.16 \ No newline at end of file
48.1 --- a/model/unit.lua Tue Apr 17 00:07:04 2012 +0200 48.2 +++ b/model/unit.lua Fri May 18 19:07:07 2012 +0200 48.3 @@ -21,6 +21,61 @@ 48.4 ref = 'members' 48.5 } 48.6 48.7 +Unit:add_reference{ 48.8 + mode = "11", 48.9 + to = mondelefant.class_prototype, 48.10 + this_key = "id", 48.11 + that_key = "unit_id", 48.12 + ref = "delegation_info", 48.13 + back_ref = "unit", 48.14 + selector_generator = function(list, options) 48.15 + assert(options.member_id, "member_id mandatory for delegation_info") 48.16 + local ids = { sep = ", " } 48.17 + for i, object in ipairs(list) do 48.18 + local id = object.id 48.19 + if id ~= nil then 48.20 + ids[#ids+1] = {"?", id} 48.21 + end 48.22 + end 48.23 + local sub_selector = Unit:get_db_conn():new_selector() 48.24 + if #ids == 0 then 48.25 + return sub_selector:empty_list_mode() 48.26 + end 48.27 + sub_selector:from("unit") 48.28 + sub_selector:add_field("unit.id", "unit_id") 48.29 + sub_selector:add_field{ '(delegation_info(?, unit.id, null, null)).*', options.member_id } 48.30 + sub_selector:add_where{ 'unit.id IN ($)', ids } 48.31 + 48.32 + local selector = Unit:get_db_conn():new_selector() 48.33 + selector:add_from(sub_selector, "delegation_info") 48.34 + selector:left_join("member", "first_trustee", "first_trustee.id = delegation_info.first_trustee_id") 48.35 + selector:left_join("member", "other_trustee", "other_trustee.id = delegation_info.other_trustee_id") 48.36 + selector:add_field("delegation_info.*") 48.37 + selector:add_field("first_trustee.name", "first_trustee_name") 48.38 + selector:add_field("other_trustee.name", "other_trustee_name") 48.39 + return selector 48.40 + end 48.41 +} 48.42 + 48.43 +function Unit.list:load_delegation_info_once_for_member_id(member_id) 48.44 + if self._delegation_info_loaded_for_member_id ~= member_id then 48.45 + self:load("delegation_info", { member_id = member_id }) 48.46 + for i, unit in ipairs(self) do 48.47 + unit._delegation_info_loaded_for_member_id = member_id 48.48 + end 48.49 + self._delegation_info_loaded_for_member_id = member_id 48.50 + end 48.51 +end 48.52 + 48.53 +function Unit.object:load_delegation_info_once_for_member_id(member_id) 48.54 + if self._delegation_info_loaded_for_member_id ~= member_id then 48.55 + self:load("delegation_info", { member_id = member_id }) 48.56 + self._delegation_info_loaded_for_member_id = member_id 48.57 + end 48.58 +end 48.59 + 48.60 + 48.61 + 48.62 function recursive_add_child_units(units, parent_unit) 48.63 parent_unit.childs = {} 48.64 for i, unit in ipairs(units) do
49.1 --- a/static/style.css Tue Apr 17 00:07:04 2012 +0200 49.2 +++ b/static/style.css Fri May 18 19:07:07 2012 +0200 49.3 @@ -179,6 +179,7 @@ 49.4 font-weight: bold; 49.5 } 49.6 49.7 +.topbar .instance_name, 49.8 .topbar a { 49.9 color: #eee; 49.10 line-height: 30px; 49.11 @@ -194,12 +195,13 @@ 49.12 line-height: 200%; 49.13 } 49.14 49.15 -.navigation img { 49.16 +.topbar img { 49.17 margin-right: 0.5em; 49.18 vertical-align: middle; 49.19 } 49.20 49.21 -.navigation a { 49.22 +.topbar a, 49.23 +.topbar .member_menu span { 49.24 padding: 0 0.5em; 49.25 float: left; 49.26 display: block; 49.27 @@ -210,79 +212,159 @@ 49.28 display: inline; 49.29 } 49.30 49.31 -.topbar .member_info { 49.32 +.topbar .navigation_right { 49.33 float: right; 49.34 padding-right: 1%; 49.35 } 49.36 49.37 +.member_menu { 49.38 + float: right; 49.39 +} 49.40 + 49.41 +#member_menu { 49.42 + position: absolute; 49.43 + right: 20px; 49.44 + top: 19px; 49.45 +} 49.46 + 49.47 +#member_menu { 49.48 + display: none; 49.49 +} 49.50 + 49.51 +.member_menu:hover #member_menu { 49.52 + display: block; 49.53 +} 49.54 + 49.55 +#member_menu ul { 49.56 + list-style: none; 49.57 +} 49.58 + 49.59 +#member_menu li span { 49.60 + background-color: #333; 49.61 + line-height: 200%; 49.62 + display: block; 49.63 + width: 15em; 49.64 + color: #fff; 49.65 +} 49.66 + 49.67 + 49.68 + 49.69 +#member_menu li a { 49.70 + background-color: #333; 49.71 + line-height: 200%; 49.72 + display: block; 49.73 + width: 15em; 49.74 +} 49.75 + 49.76 +#member_menu a:hover { 49.77 + background-color: #eee; 49.78 + color: #000; 49.79 +} 49.80 + 49.81 + 49.82 /************************************************************************* 49.83 * Title of current page including path and actions 49.84 */ 49.85 49.86 -.title, 49.87 -.title2, 49.88 -.actions { 49.89 - background-color: #f2f2f2; 49.90 - margin-left: 1%; 49.91 - margin-right: 1%; 49.92 - border-left: 1px solid #bbb; 49.93 - border-right: 1px solid #bbb; 49.94 +.slot_title { 49.95 + font-size: 120%; 49.96 + font-weight: bold; 49.97 + margin-left: 10px; 49.98 + margin-right: 10px; 49.99 + margin-top: 1ex; 49.100 +} 49.101 + 49.102 +.slot_actions { 49.103 + margin-left: 10px; 49.104 + margin-top: 0.5ex; 49.105 + margin-bottom: 1ex; 49.106 +} 49.107 + 49.108 +.page_head { 49.109 + background-color: #fff; 49.110 + margin: 0px 10px 0 10px; 49.111 + border: 1px solid #aaa; 49.112 + border-radius: 0 0 8px 8px; 49.113 + box-shadow: #777 0px 5px 5px -5px; 49.114 } 49.115 49.116 -.actions { 49.117 - border-bottom: 1px solid #bbb; 49.118 + 49.119 +.page_head .area_head, 49.120 +.page_head .issue { 49.121 + border-top: 1px solid #000; 49.122 } 49.123 49.124 -.initiative_head .actions { 49.125 - border: none; 49.126 - box-shadow: none; 49.127 - -moz-box-shadow: none; 49.128 - -webkit-box-shadow: none; 49.129 +.page_head .unit_head .title, 49.130 +.page_head .area_head .title, 49.131 +.issue .context, 49.132 +.issue .title, 49.133 +.initiative_head .title { 49.134 + margin: 8px; 49.135 +} 49.136 + 49.137 +.page_head .unit_head .content, 49.138 +.page_head .area_head .content, 49.139 +.issue .content, 49.140 +.initiative_head .content { 49.141 + margin: 0px 8px 8px 8px; 49.142 +} 49.143 + 49.144 +.issue .content.actions { 49.145 + margin-bottom: 2.5ex; 49.146 } 49.147 49.148 49.149 -.slot_initiatives_list { 49.150 - margin-top: 1ex; 49.151 - margin-left: 1%; 49.152 - margin-right: 1%; 49.153 - background-color: #fcfcfc; 49.154 - border-radius: 8px; 49.155 - clear: left; 49.156 - border: 1px solid #aaa; 49.157 - padding-top: 1ex; 49.158 - padding-bottom: 1ex; 49.159 + 49.160 +.page_head .unit_head .title, 49.161 +.page_head .area_head .title, 49.162 +.issue .title, 49.163 +.initiative_head .title { 49.164 + font-weight: bold; 49.165 + font-size: 120%; 49.166 } 49.167 49.168 -.title { 49.169 - box-shadow: inset #888 0px 5px 6px -5px; 49.170 - -moz-box-shadow: inset #888 0px 5px 6px -5px;; 49.171 - -webkit-box-shadow: inset #888 0px 5px 6px -5px;; 49.172 +.page_head .unit_head .title .extra, 49.173 +.page_head .area_head .title .extra, 49.174 +.issue .title .extra { 49.175 + margin-left: 0.7em; 49.176 + font-size: 75%; 49.177 +} 49.178 + 49.179 + 49.180 +.initiative_head { 49.181 + margin-top: 10px; 49.182 } 49.183 49.184 -.title { 49.185 - color: #000; 49.186 - padding: 1.5ex 1ex 0 1ex; 49.187 + 49.188 +.delegation_info { 49.189 + float: right; 49.190 + text-decoration: none; 49.191 + padding: 5px; 49.192 + border-radius: 0px 5px 0px 5px; 49.193 } 49.194 49.195 -.title div { 49.196 - font-size: 125%; 49.197 - line-height: 110%; 49.198 +.delegation_arrow { 49.199 + vertical-align: middle; 49.200 } 49.201 49.202 -.title a { 49.203 - color: #000; 49.204 +.delegation_info .link { 49.205 + text-decoration: underline; 49.206 + color: #aaa; 49.207 +} 49.208 + 49.209 +.delegation_info:hover { 49.210 + background-color: #ddd; 49.211 } 49.212 49.213 -.title .member_image { 49.214 - margin-right: 0.7em; 49.215 - vertical-align: middle; 49.216 - border-radius: 7px; 49.217 +.delegation_info .micro_avatar { 49.218 + border: 2px solid #fff; 49.219 } 49.220 49.221 -.slot_title2 { 49.222 - padding: 1ex 1ex 0 1ex; 49.223 +.delegation_info .micro_avatar.highlighted { 49.224 + border: 2px solid #fa0; 49.225 } 49.226 49.227 + 49.228 .member_list .member_image_avatar { 49.229 float: left; 49.230 margin-right: 0.5em; 49.231 @@ -294,66 +376,6 @@ 49.232 vertical-align: middle; 49.233 } 49.234 49.235 -.actions { 49.236 - font-size: 75%; 49.237 - line-height: 220%; 49.238 - padding-top: 2ex; 49.239 - padding-bottom: 1ex; 49.240 -} 49.241 - 49.242 -.actions { 49.243 - border-radius: 0 0 8px 8px; 49.244 -} 49.245 - 49.246 -.actions .interest, 49.247 -.actions .delegation, 49.248 -.actions a { 49.249 - margin-left: 1ex; 49.250 -} 49.251 - 49.252 -.actions a { 49.253 - margin-top: 1px; 49.254 - margin-bottom: 1px; 49.255 -} 49.256 - 49.257 -.actions .interest a, 49.258 -.actions .delegation a { 49.259 - margin: 0; 49.260 -} 49.261 - 49.262 -.initiative_head .actions { 49.263 - background-color: #fff; 49.264 - margin: 0px; 49.265 -} 49.266 - 49.267 -.actions a { 49.268 - padding-right: 0.3em; 49.269 -} 49.270 - 49.271 -.slot_initiative_head { 49.272 - margin-left: 1%; 49.273 - margin-right: 1%; 49.274 - margin-top: 2ex; 49.275 -} 49.276 - 49.277 -.initiative_name { 49.278 - font-weight: bold; 49.279 - font-size: 125%; 49.280 -} 49.281 -.actions a { 49.282 - float: left; 49.283 -} 49.284 - 49.285 -.actions a:hover { 49.286 - background-color: #d7d7d7; 49.287 -} 49.288 - 49.289 -.actions img { 49.290 - padding-left: 0.2em; 49.291 - padding-right: 0.2em; 49.292 - vertical-align: middle; 49.293 -} 49.294 - 49.295 .logo { 49.296 float: right; 49.297 margin-right: 1%; 49.298 @@ -365,153 +387,6 @@ 49.299 } 49.300 49.301 /************************************************************************* 49.302 - * vote info / delegation 49.303 - */ 49.304 - 49.305 -.interest, 49.306 -.slot_support, 49.307 -.delegation { 49.308 - float: left; 49.309 - position: relative; 49.310 - z-index: 1; 49.311 -} 49.312 - 49.313 -.interest img, 49.314 -.slot_support img, 49.315 -.delegation img { 49.316 - padding-left: 0.2em; 49.317 - padding-right: 0.2em; 49.318 -} 49.319 -.actions .supporter, 49.320 -.actions .potential_supporter, 49.321 -.vote_info .head { 49.322 - float: left; 49.323 -} 49.324 - 49.325 -.actions .supporter, 49.326 -.actions .potential_supporter, 49.327 -.actions .interest .head { 49.328 - padding-right: 0.3em; 49.329 -} 49.330 - 49.331 -.delegation .head_active, 49.332 -.interest .head_active, 49.333 -.actions .supporter, 49.334 -.actions .potential_supporter { 49.335 - border-radius: 5px; 49.336 - border: 1px solid #5f6675; 49.337 -} 49.338 - 49.339 -.delegation .head_active, 49.340 -.interest .head_active { 49.341 - background-color: #cdf; 49.342 -} 49.343 - 49.344 -.actions .supporter { 49.345 - background-color: #cdf; 49.346 -} 49.347 - 49.348 -.actions .potential_supporter { 49.349 - background-color: #cdf; 49.350 -} 49.351 - 49.352 -.slot_support .head_initiator { 49.353 - background-color: #f2f2f2; 49.354 - border-radius: 5px; 49.355 -} 49.356 - 49.357 -.delegation .change_delegation { 49.358 - margin-bottom: 2ex; 49.359 -} 49.360 - 49.361 -.delegation .change_delegation a { 49.362 - display: inline; 49.363 - float: none; 49.364 - padding: 1ex; 49.365 -} 49.366 - 49.367 -.delegation .delegation_participation { 49.368 - margin-left: 20.5em; 49.369 - margin-top: 3ex; 49.370 - font-style: italic; 49.371 - font-size: 80%; 49.372 -} 49.373 - 49.374 -.slot_actions .change_delegation { 49.375 - float: left; 49.376 -} 49.377 - 49.378 -.vote_info .close { 49.379 - position: absolute; 49.380 - top: 0; 49.381 - right: 0; 49.382 - padding: 1ex; 49.383 - display: block; 49.384 -} 49.385 - 49.386 -.vote_info .content { 49.387 - font-size: 133%; 49.388 - line-height: 100%; 49.389 - top: 2.8ex; 49.390 - display: none; 49.391 - position: absolute; 49.392 - z-index: 10; 49.393 - background-color: #cdf; 49.394 - border-radius: 0 5px 5px 5px; 49.395 - padding: 1em; 49.396 - width: 35em; 49.397 - border: 1px solid #5f6675; 49.398 - border-top: none; 49.399 -} 49.400 - 49.401 -.delegation_arrow { 49.402 - vertical-align: middle; 49.403 -} 49.404 - 49.405 -.vote_info .delegation_arrow { 49.406 - margin-top: 1ex; 49.407 - margin-bottom: 1ex; 49.408 -} 49.409 - 49.410 -.vote_info .delegation_arrow_overridden { 49.411 - opacity: 0.4; 49.412 -} 49.413 - 49.414 -.vote_info .delegation_scope_overridden { 49.415 - color: #777; 49.416 -} 49.417 - 49.418 -.vote_info .delegation_scope { 49.419 - display: inline; 49.420 -} 49.421 - 49.422 -.vote_info .delegation_info { 49.423 -} 49.424 - 49.425 -.vote_info a { 49.426 - padding-right: 0; 49.427 -} 49.428 - 49.429 -.vote_info .member_thumb { 49.430 - clear: left; 49.431 - background: #fff; 49.432 -} 49.433 - 49.434 -.delegation_overridden .member_thumb { 49.435 - opacity: 0.4; 49.436 -} 49.437 - 49.438 -.delegation .revoke { 49.439 - margin: 0.5ex; 49.440 - float: right; 49.441 -} 49.442 - 49.443 -.delegation .revoke img { 49.444 - vertical-align: middle; 49.445 -} 49.446 - 49.447 - 49.448 -/************************************************************************* 49.449 * Main content 49.450 */ 49.451 49.452 @@ -1000,26 +875,26 @@ 49.453 } 49.454 49.455 .issues .issue { 49.456 + margin-top: 10px; 49.457 background-color: #fcfcfc; 49.458 overflow: hidden; 49.459 - margin-bottom: 2ex; 49.460 border: 1px solid #aaa; 49.461 border-radius: 8px; 49.462 } 49.463 49.464 -.issues .issue.interested, 49.465 -.issues .issue.interest_by_delegation { 49.466 +.issue.interested, 49.467 +.issue.interest_by_delegation { 49.468 border: 1px solid #b2cdff; 49.469 } 49.470 49.471 -.issues .issue .issue_info { 49.472 +.issue .issue_info { 49.473 padding: 1ex 1ex 0.3ex 1ex; 49.474 line-height: 140%; 49.475 margin-bottom: 1ex; 49.476 } 49.477 49.478 -.issues .issue.interested .issue_info, 49.479 -.issues .issue.interested_by_delegation .issue_info { 49.480 +.issue.interested .issue_info, 49.481 +.issue.interested_by_delegation .issue_info { 49.482 background-color: #dfeaff; 49.483 background-image: linear-gradient(top, #dfeaff 0%, #fcfcfc 66%); 49.484 background-image: -o-linear-gradient(top, #dfeaff 0%, #fcfcfc 66%); 49.485 @@ -1029,11 +904,11 @@ 49.486 } 49.487 49.488 .event_list .event .issue_id, 49.489 -.issues .issue .issue_info .issue_id { 49.490 +.issue .issue_info .issue_id { 49.491 font-size: 125%; 49.492 } 49.493 49.494 -.issues .issue .suggestion { 49.495 +.issue .suggestion { 49.496 margin-left: 1ex; 49.497 margin-bottom: 1ex; 49.498 font-weight: bold; 49.499 @@ -1051,11 +926,11 @@ 49.500 vertical-align: middle; 49.501 } 49.502 49.503 -.issues .issue .interest_by_delegation { 49.504 +.issue .interest_by_delegation { 49.505 float: right; 49.506 } 49.507 49.508 -.issues .issue .initiative_list a { 49.509 +.issue .initiative_list a.highlighted { 49.510 font-weight: bold; 49.511 } 49.512 49.513 @@ -1111,7 +986,7 @@ 49.514 margin-bottom: 1ex; 49.515 } 49.516 49.517 -.issues tr tr { 49.518 +.issue tr tr { 49.519 border: none; 49.520 background: none; 49.521 } 49.522 @@ -1311,10 +1186,10 @@ 49.523 .public_access_issue_head { 49.524 background-color: #fffbce; 49.525 padding: 1ex; 49.526 - margin-top: 2ex; 49.527 + margin-top: 1ex; 49.528 margin-bottom: 2ex; 49.529 - border-radius: 8px; 49.530 - border: 1px solid #ffe900; 49.531 + border-top: 1px solid #ffe900; 49.532 + border-bottom: 1px solid #ffe900; 49.533 } 49.534 49.535 .suggestion_fulfilled { 49.536 @@ -1492,7 +1367,7 @@ 49.537 cursor: pointer; 49.538 } 49.539 49.540 -#voting .grabber { 49.541 +#voting .movable { 49.542 vertical-align: middle; 49.543 cursor: move; 49.544 } 49.545 @@ -1547,10 +1422,13 @@ 49.546 49.547 /* shadows */ 49.548 49.549 -.box, 49.550 -.slot_initiative_head { 49.551 +.initiative_head, 49.552 +.box { 49.553 border: 1px solid #aaa; 49.554 border-radius: 8px; 49.555 +} 49.556 + 49.557 +.box { 49.558 padding: 1ex; 49.559 } 49.560 49.561 @@ -1560,8 +1438,6 @@ 49.562 } 49.563 49.564 .slot_initiatives_list, 49.565 -.actions, 49.566 -.issues .issue, 49.567 .ui_tabs_links a, 49.568 .draft_content, 49.569 .help, 49.570 @@ -1570,11 +1446,11 @@ 49.571 .ui_filter a.active, 49.572 .vote_info .content, 49.573 .member_area_list, 49.574 -.box, 49.575 -.slot_initiative_head { 49.576 +.box { 49.577 box-shadow: #777 0px 5px 5px -5px; 49.578 -mox-box-shadow: #777 0px 5px 5px -5px; 49.579 -webkit-box-shadow: #777 0px 5px 5px -5px; 49.580 + clear: both; 49.581 } 49.582 49.583 .member_area_list .box {