# HG changeset patch # User bsw # Date 1337535781 -7200 # Node ID 5ca9de94cb1317d9ecea8c1a11cd425bbf7aebae # Parent 305329da1c75784b7beb191a9111d16a444df7db Delegation preview when setting delegation, optical enhancements, typos fixed diff -r 305329da1c75 -r 5ca9de94cb13 app/main/area/_head.lua --- a/app/main/area/_head.lua Fri May 18 21:03:10 2012 +0200 +++ b/app/main/area/_head.lua Sun May 20 19:43:01 2012 +0200 @@ -1,5 +1,9 @@ local area = param.get("area", "table") +local show_content = param.get("show_content", atom.boolean) + +area:load_delegation_info_once_for_member_id(app.session.member_id) + execute.view{ module = "unit", view = "_head", params = { unit = area.unit } } ui.container{ attr = { class = "area_head" }, content = function() @@ -14,27 +18,49 @@ } end } - ui.container{ attr = { class = "content" }, content = function() + if show_content then + + ui.container{ attr = { class = "content" }, content = function() - -- actions (members with appropriate voting right only) - if app.session.member_id then + -- actions (members with appropriate voting right only) + if app.session.member_id then - -- membership - local membership = Membership:by_pk(area.id, app.session.member.id) + -- membership + local membership = Membership:by_pk(area.id, app.session.member.id) - if membership then - - ui.tag{ content = _"You are participating in this area" } - - slot.put(" ") - - ui.tag{ content = function() - slot.put("(") + if membership then + + ui.tag{ content = _"You are participating in this area" } + + slot.put(" ") + + ui.tag{ content = function() + slot.put("(") + ui.link{ + text = _"Withdraw", + module = "membership", + action = "update", + params = { area_id = area.id, delete = true }, + routing = { + default = { + mode = "redirect", + module = request.get_module(), + view = request.get_view(), + id = param.get_id_cgi(), + params = param.get_all_cgi() + } + } + } + slot.put(")") + end } + + + elseif app.session.member:has_voting_right_for_unit_id(area.unit_id) then ui.link{ - text = _"Withdraw", - module = "membership", - action = "update", - params = { area_id = area.id, delete = true }, + text = _"Participate in this area", + module = "membership", + action = "update", + params = { area_id = area.id }, routing = { default = { mode = "redirect", @@ -45,46 +71,35 @@ } } } - slot.put(")") - end } - + + end + + slot.put(" · ") + if area.delegation_info.own_delegation_scope ~= "area" then + ui.link{ text = _"Delegate area", module = "delegation", view = "show", params = { area_id = area.id } } + else + ui.link{ text = _"Change area delegation", module = "delegation", view = "show", params = { area_id = area.id } } + end slot.put(" · ") - elseif app.session.member:has_voting_right_for_unit_id(area.unit_id) then - ui.link{ - text = _"Participate in this area", - module = "membership", - action = "update", - params = { area_id = area.id }, - routing = { - default = { - mode = "redirect", - module = request.get_module(), - view = request.get_view(), - id = param.get_id_cgi(), - params = param.get_all_cgi() - } + -- create new issue + if app.session.member:has_voting_right_for_unit_id(area.unit_id) then + ui.link{ + content = function() + slot.put(_"Create new issue") + end, + module = "initiative", + view = "new", + params = { area_id = area.id } } - } - - slot.put(" · ") + end end - -- create new issue - if app.session.member:has_voting_right_for_unit_id(area.unit_id) then - ui.link{ - content = function() - slot.put(_"Create new issue") - end, - module = "initiative", - view = "new", - params = { area_id = area.id } - } - end + end } - end + else + slot.put("
") + end - end } - end } \ No newline at end of file diff -r 305329da1c75 -r 5ca9de94cb13 app/main/area/show.lua --- a/app/main/area/show.lua Fri May 18 21:03:10 2012 +0200 +++ b/app/main/area/show.lua Sun May 20 19:43:01 2012 +0200 @@ -14,7 +14,7 @@ slot.select("head", function() - execute.view{ module = "area", view = "_head", params = { area = area } } + execute.view{ module = "area", view = "_head", params = { area = area, show_content = true } } end) ui.container{ diff -r 305329da1c75 -r 5ca9de94cb13 app/main/delegation/_action/update.lua --- a/app/main/delegation/_action/update.lua Fri May 18 21:03:10 2012 +0200 +++ b/app/main/delegation/_action/update.lua Sun May 20 19:43:01 2012 +0200 @@ -12,24 +12,23 @@ area_id = nil end +local preview = param.get("preview") + +if preview == "1" then + request.redirect{ module = "delegation", view = "show", params = { + unit_id = unit_id, area_id = area_id, issue_id = issue_id, preview_trustee_id = trustee_id + } } + return +end + + local delegation = Delegation:by_pk(truster_id, unit_id, area_id, issue_id) if param.get("delete") or trustee_id == -1 then if delegation then - delegation:destroy() - ---[[ - if issue_id then - slot.put_into("notice", _"Your delegation for this issue has been deleted.") - elseif area_id then - slot.put_into("notice", _"Your delegation for this area has been deleted.") - else - slot.put_into("notice", _"Your delegation for this unit has been deleted.") - end ---]] end else @@ -82,14 +81,6 @@ end delegation:save() ---[[ - if issue_id then - slot.put_into("notice", _"Your delegation for this issue has been updated.") - elseif area_id then - slot.put_into("notice", _"Your delegation for this area has been updated.") - else - slot.put_into("notice", _"Your delegation for this unit has been updated.") - end ---]] + end diff -r 305329da1c75 -r 5ca9de94cb13 app/main/delegation/_info.lua --- a/app/main/delegation/_info.lua Fri May 18 21:03:10 2012 +0200 +++ b/app/main/delegation/_info.lua Sun May 20 19:43:01 2012 +0200 @@ -14,7 +14,6 @@ local delegation_text if unit then - unit:load_delegation_info_once_for_member_id(app.session.member_id) info = unit.delegation_info delegation_text = _"Delegate unit" end @@ -31,136 +30,107 @@ delegation_text = _"Delegate issue" end -ui.link{ - module = "delegation", view = "show", params = { - unit_id = unit_id, - area_id = area_id, - issue_id = issue_id - }, - attr = { class = "delegation_info" }, content = function() - +if info.own_participation or info.first_trustee_id then - local participant_occured = false - - if info.own_participation or info.first_trustee_id then - - local class = "micro_avatar" - if info.own_participation then - participant_occured = true - class = class .. " highlighted" - end + ui.link{ + module = "delegation", view = "show", params = { + unit_id = unit_id, + area_id = area_id, + issue_id = issue_id + }, + attr = { class = "delegation_info" }, content = function() - execute.view{ module = "member_image", view = "_show", params = { - member = app.session.member, class = class, popup_text = app.session.member.name, - image_type = "avatar", show_dummy = true, - } } - end - - if not info.first_trustee_id and (not issue or not issue.closed) then - slot.put(" ") - ui.tag{ attr = { class = "link" }, content = delegation_text } - end - - if not (issue and issue.state == "voting" and info.own_participation) then + local participant_occured = false - if info.first_trustee_id then - - local text = _"delegates to" - ui.image{ - attr = { class = "delegation_arrow", alt = text, title = text }, - static = "delegation_arrow_24_horizontal.png" - } - + if info.own_participation or info.first_trustee_id then + local class = "micro_avatar" - if not participant_occured and info.first_trustee_participation then + if info.own_participation then participant_occured = true class = class .. " highlighted" end execute.view{ module = "member_image", view = "_show", params = { - member_id = info.first_trustee_id, class = class, popup_text = info.first_trustee_name, - image_type = "avatar", show_dummy = true, - } } - - end - - if info.first_trustee_ellipsis then - - local text = _"delegates to" - ui.image{ - attr = { class = "delegation_arrow", alt = text, title = text }, - static = "delegation_arrow_24_horizontal.png" - } - - slot.put("...") - - end - - if info.other_trustee_id then - - local text = _"delegates to" - ui.image{ - attr = { class = "delegation_arrow", alt = text, title = text }, - static = "delegation_arrow_24_horizontal.png" - } - - local class = "micro_avatar" - if not participant_occured and info.other_trustee_participation then - participant_occured = true - class = class .. " highlighted" - end - - execute.view{ module = "member_image", view = "_show", params = { - member_id = info.other_trustee_id, class = class, popup_text = info.other_trustee_name, + member = app.session.member, class = class, popup_text = app.session.member.name, image_type = "avatar", show_dummy = true, } } end - - if info.other_trustee_ellipsis then - local text = _"delegates to" - ui.image{ - attr = { class = "delegation_arrow", alt = text, title = text }, - static = "delegation_arrow_24_horizontal.png" - } + if not (issue and issue.state == "voting" and info.own_participation) then + + if info.first_trustee_id then + + local text = _"delegates to" + ui.image{ + attr = { class = "delegation_arrow", alt = text, title = text }, + static = "delegation_arrow_24_horizontal.png" + } - slot.put("...") - - end - - local trailing_ellipsis = info.other_trustee_ellipsis or - (info.first_trustee_ellipsis and not info.other_trustee_id) - - if info.delegation_loop == "own" then + local class = "micro_avatar" + if not participant_occured and info.first_trustee_participation then + participant_occured = true + class = class .. " highlighted" + end + + execute.view{ module = "member_image", view = "_show", params = { + member_id = info.first_trustee_id, class = class, popup_text = info.first_trustee_name, + image_type = "avatar", show_dummy = true, + } } + + end + + if info.first_trustee_ellipsis then + + local text = _"delegates to" + ui.image{ + attr = { class = "delegation_arrow", alt = text, title = text }, + static = "delegation_arrow_24_horizontal.png" + } + + slot.put("...") + + end - local text = _"delegates to" - ui.image{ - attr = { class = "delegation_arrow", alt = text, title = text }, - static = "delegation_arrow_24_horizontal.png" - } + if info.other_trustee_id then + + local text = _"delegates to" + ui.image{ + attr = { class = "delegation_arrow", alt = text, title = text }, + static = "delegation_arrow_24_horizontal.png" + } - execute.view{ module = "member_image", view = "_show", params = { - member = app.session.member, class = "micro_avatar", popup_text = app.session.member.name, - image_type = "avatar", show_dummy = true, - } } + local class = "micro_avatar" + if not participant_occured and info.other_trustee_participation then + participant_occured = true + class = class .. " highlighted" + end + + execute.view{ module = "member_image", view = "_show", params = { + member_id = info.other_trustee_id, class = class, popup_text = info.other_trustee_name, + image_type = "avatar", show_dummy = true, + } } - elseif info.delegation_loop == "first" then - if info.first_trustee_ellipsis then - if not trailing_ellipsis then + end + + if info.other_trustee_ellipsis then + + local text = _"delegates to" + ui.image{ + attr = { class = "delegation_arrow", alt = text, title = text }, + static = "delegation_arrow_24_horizontal.png" + } - local text = _"delegates to" - ui.image{ - attr = { class = "delegation_arrow", alt = text, title = text }, - static = "delegation_arrow_24_horizontal.png" - } - - slot.put("...") - end - - else - + slot.put("...") + + end + + local trailing_ellipsis = info.other_trustee_ellipsis or + (info.first_trustee_ellipsis and not info.other_trustee_id) + + if info.delegation_loop == "own" then + local text = _"delegates to" ui.image{ attr = { class = "delegation_arrow", alt = text, title = text }, @@ -168,25 +138,52 @@ } execute.view{ module = "member_image", view = "_show", params = { - member_id = info.first_trustee_id, class = "micro_avatar", popup_text = info.first_trustee_name, + member = app.session.member, class = "micro_avatar", popup_text = app.session.member.name, image_type = "avatar", show_dummy = true, } } + + elseif info.delegation_loop == "first" then + if info.first_trustee_ellipsis then + if not trailing_ellipsis then + + local text = _"delegates to" + ui.image{ + attr = { class = "delegation_arrow", alt = text, title = text }, + static = "delegation_arrow_24_horizontal.png" + } + + slot.put("...") + end + + else + + local text = _"delegates to" + ui.image{ + attr = { class = "delegation_arrow", alt = text, title = text }, + static = "delegation_arrow_24_horizontal.png" + } + + execute.view{ module = "member_image", view = "_show", params = { + member_id = info.first_trustee_id, class = "micro_avatar", popup_text = info.first_trustee_name, + image_type = "avatar", show_dummy = true, + } } + end + + + elseif info.delegation_loop and not trailing_ellipsis then + local text = _"delegates to" + ui.image{ + attr = { class = "delegation_arrow", alt = text, title = text }, + static = "delegation_arrow_24_horizontal.png" + } + + slot.put("...") end - - - elseif info.delegation_loop and not trailing_ellipsis then - local text = _"delegates to" - ui.image{ - attr = { class = "delegation_arrow", alt = text, title = text }, - static = "delegation_arrow_24_horizontal.png" - } - slot.put("...") end end + + } - end - -} - +end \ No newline at end of file diff -r 305329da1c75 -r 5ca9de94cb13 app/main/delegation/show.lua --- a/app/main/delegation/show.lua Fri May 18 21:03:10 2012 +0200 +++ b/app/main/delegation/show.lua Sun May 20 19:43:01 2012 +0200 @@ -1,14 +1,22 @@ local voting_right_unit_id +local current_trustee_id +local current_trustee_name local unit = Unit:by_id(param.get("unit_id", atom.integer)) if unit then + unit:load_delegation_info_once_for_member_id(app.session.member_id) voting_right_unit_id = unit.id + if unit.delegation_info.own_delegation_scope == 'unit' then + current_trustee_id = unit.delegation_info.first_trustee_id + current_trustee_name = unit.delegation_info.first_trustee_name + end slot.put_into("title", encode.html(config.single_unit_id and _"Set global delegation" or _"Set unit delegation")) util.help("delegation.new.unit") end local area = Area:by_id(param.get("area_id", atom.integer)) if area then + area:load_delegation_info_once_for_member_id(app.session.member_id) voting_right_unit_id = area.unit_id slot.put_into("title", encode.html(_"Set delegation for Area '#{name}'":gsub("#{name}", area.name))) util.help("delegation.new.area") @@ -16,6 +24,7 @@ local issue = Issue:by_id(param.get("issue_id", atom.integer)) if issue then + issue:load_delegation_info_once_for_member_id(app.session.member_id) voting_right_unit_id = issue.area.unit_id 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))) util.help("delegation.new.issue") @@ -23,6 +32,17 @@ local initiative = Initiative:by_id(param.get("initiative_id", atom.integer)) +local contact_members = Member:build_selector{ + is_contact_of_member_id = app.session.member_id, + voting_right_for_unit_id = voting_right_unit_id, + active = true, + order = "name" +}:exec() + +local preview_trustee_id = param.get("preview_trustee_id", atom.integer) + +ui.script{ static = "js/update_delegation_info.js" } + slot.select("actions", function() if issue then ui.link{ @@ -57,14 +77,8 @@ end) -local contact_members = Member:build_selector{ - is_contact_of_member_id = app.session.member_id, - voting_right_for_unit_id = voting_right_unit_id, - order = "name" -}:exec() - ui.form{ - attr = { class = "vertical" }, + attr = { class = "vertical", id = "delegationForm" }, module = "delegation", action = "update", params = { @@ -148,6 +162,11 @@ end -- add saved members + if current_trustee_id then + records[#records+1] = {id="_", name= "--- " .. _"Current trustee" .. " ---"} + records[#records+1] = { id = current_trustee_id, name = current_trustee_name } + end + -- add saved members records[#records+1] = {id="_", name= "--- " .. _"Saved contacts" .. " ---"} for i, record in ipairs(contact_members) do records[#records+1] = record @@ -165,15 +184,20 @@ disabled_records[app.session.member_id] = true ui.field.select{ + attr = { onchange = "updateDelegationInfo();" }, label = _"Trustee", name = "trustee_id", foreign_records = records, foreign_id = "id", foreign_name = "name", - disabled_records = disabled_records + disabled_records = disabled_records, + value = preview_trustee_id or current_trustee_id } + ui.field.hidden{ name = "preview" } + ui.submit{ text = _"Save" } + end } @@ -244,9 +268,7 @@ slot_name = "default" end -if delegation then - - if not delegation.trustee_id then + if delegation and not delegation.trustee_id then ui.image{ static = "icons/16/table_go_crossed.png" } @@ -259,7 +281,7 @@ local delegation_chain = Member:new_selector() :add_field("delegation_chain.*") - :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") + :join({ "delegation_chain(?,?,?,?,?)", app.session.member.id, unit_id, area_id, issue_id, preview_trustee_id }, "delegation_chain", "member.id = delegation_chain.member_id") :add_order_by("index") :exec() @@ -311,4 +333,3 @@ end slot.put("
") end -end \ No newline at end of file diff -r 305329da1c75 -r 5ca9de94cb13 app/main/interest/_show_box.lua --- a/app/main/interest/_show_box.lua Fri May 18 21:03:10 2012 +0200 +++ b/app/main/interest/_show_box.lua Sun May 20 19:43:01 2012 +0200 @@ -7,7 +7,11 @@ if interest then - ui.tag{ content = _"Your are interested" } + if issue.closed then + ui.tag{ content = _"You were interested" } + else + ui.tag{ content = _"You are interested" } + end slot.put(" ") if issue.state ~= "finished" and issue.state ~= "cancelled" and issue.state ~= "voting" then diff -r 305329da1c75 -r 5ca9de94cb13 app/main/issue/_show.lua --- a/app/main/issue/_show.lua Fri May 18 21:03:10 2012 +0200 +++ b/app/main/issue/_show.lua Sun May 20 19:43:01 2012 +0200 @@ -12,6 +12,8 @@ local vote_link_text = direct_voter and _"Change vote" or "Vote now" +issue:load_delegation_info_once_for_member_id(app.session.member_id) + local class = "issue" if issue.is_interested then @@ -94,6 +96,15 @@ slot.put(" · ") end + if not issue.closed then + if issue.delegation_info.own_delegation_scope ~= "issue" then + ui.link{ text = _"Delegate issue", module = "delegation", view = "show", params = { issue_id = issue.id } } + else + ui.link{ text = _"Change issue delegation", module = "delegation", view = "show", params = { issue_id = issue.id } } + end + slot.put(" · ") + end + if config.issue_discussion_url_func then local url = config.issue_discussion_url_func(issue) ui.link{ diff -r 305329da1c75 -r 5ca9de94cb13 app/main/member/_show_thumb.lua --- a/app/main/member/_show_thumb.lua Fri May 18 21:03:10 2012 +0200 +++ b/app/main/member/_show_thumb.lua Sun May 20 19:43:01 2012 +0200 @@ -41,8 +41,9 @@ attr = { class = "flags" }, content = function() - if not member.activated then - local text = _"Member is deactivated" + if not member.active then + local text = _"inactive" + ui.tag{ content = text } ui.image{ attr = { alt = text, title = text }, static = "icons/16/cross.png" @@ -180,9 +181,7 @@ } ui.container{ attr = { class = "member_name" }, - content = function() - slot.put(name) - end + content = name } end } diff -r 305329da1c75 -r 5ca9de94cb13 app/main/member/show.lua --- a/app/main/member/show.lua Fri May 18 21:03:10 2012 +0200 +++ b/app/main/member/show.lua Sun May 20 19:43:01 2012 +0200 @@ -29,7 +29,7 @@ view = "history", id = member.id } - if not member.activated then + if not member.active then ui.tag{ tag = "div", attr = { class = "interest deactivated_member_info" }, diff -r 305329da1c75 -r 5ca9de94cb13 app/main/supporter/_show_box.lua --- a/app/main/supporter/_show_box.lua Fri May 18 21:03:10 2012 +0200 +++ b/app/main/supporter/_show_box.lua Sun May 20 19:43:01 2012 +0200 @@ -34,14 +34,22 @@ ui.image{ static = "icons/16/thumb_up_green.png" } - slot.put(_"Your are supporter") + if initiative.issue.closed then + slot.put(_"You were supporter") + else + slot.put(_"You are supporter") + end end } else ui.tag{ attr = { class = "potential_supporter" }, content = function() ui.image{ static = "icons/16/thumb_up.png" } - slot.put(_"Your are potential supporter") + if initiative.issue.closed then + slot.put(_"You were potential supporter") + else + slot.put(_"You are potential supporter") + end end } end slot.put(" (") diff -r 305329da1c75 -r 5ca9de94cb13 app/main/unit/_head.lua --- a/app/main/unit/_head.lua Fri May 18 21:03:10 2012 +0200 +++ b/app/main/unit/_head.lua Sun May 20 19:43:01 2012 +0200 @@ -1,5 +1,9 @@ local unit = param.get("unit", "table") +local show_content = param.get("show_content", atom.boolean) + +unit:load_delegation_info_once_for_member_id(app.session.member_id) + ui.container{ attr = { class = "unit_head" }, content = function() execute.view{ module = "delegation", view = "_info", params = { unit = unit } } @@ -18,11 +22,21 @@ end end } - ui.container{ attr = { class = "content" }, content = function() + if show_content then + ui.container{ attr = { class = "content" }, content = function() - if app.session.member_id and app.session.member:has_voting_right_for_unit_id(unit.id) then - ui.tag{ content = _"You have voting privileges for this unit" } - end - end } - + if app.session.member_id and app.session.member:has_voting_right_for_unit_id(unit.id) then + ui.tag{ content = _"You have voting privileges for this unit" } + slot.put(" · ") + if unit.delegation_info.first_trustee_id == nil then + ui.link{ text = _"Delegate unit", module = "delegation", view = "show", params = { unit_id = unit.id } } + else + ui.link{ text = _"Change unit delegation", module = "delegation", view = "show", params = { unit_id = unit.id } } + end + end + end } + else + slot.put("
") + end + end } diff -r 305329da1c75 -r 5ca9de94cb13 app/main/unit/show.lua --- a/app/main/unit/show.lua Fri May 18 21:03:10 2012 +0200 +++ b/app/main/unit/show.lua Sun May 20 19:43:01 2012 +0200 @@ -3,7 +3,7 @@ local unit = Unit:by_id(unit_id) slot.select("head", function() - execute.view{ module = "unit", view = "_head", params = { unit = unit } } + execute.view{ module = "unit", view = "_head", params = { unit = unit, show_content = true } } end) if config.single_unit_id and not app.session.member_id and config.motd_public then diff -r 305329da1c75 -r 5ca9de94cb13 config/default.lua --- a/config/default.lua Fri May 18 21:03:10 2012 +0200 +++ b/config/default.lua Sun May 20 19:43:01 2012 +0200 @@ -121,5 +121,3 @@ selector:optional_object_mode() return selector:exec() end - - diff -r 305329da1c75 -r 5ca9de94cb13 model/area.lua --- a/model/area.lua Fri May 18 21:03:10 2012 +0200 +++ b/model/area.lua Sun May 20 19:43:01 2012 +0200 @@ -80,7 +80,7 @@ end sub_selector:from("area") sub_selector:add_field("area.id", "area_id") - sub_selector:add_field{ '(delegation_info(?, null, area.id, null)).*', options.member_id } + sub_selector:add_field{ '(delegation_info(?, null, area.id, null, ?)).*', options.member_id, options.trustee_id } sub_selector:add_where{ 'area.id IN ($)', ids } local selector = Area:get_db_conn():new_selector() @@ -94,9 +94,9 @@ end } -function Area.list:load_delegation_info_once_for_member_id(member_id) +function Area.list:load_delegation_info_once_for_member_id(member_id, trustee_id) if self._delegation_info_loaded_for_member_id ~= member_id then - self:load("delegation_info", { member_id = member_id }) + self:load("delegation_info", { member_id = member_id, trustee_id = trustee_id }) for i, area in ipairs(self) do area._delegation_info_loaded_for_member_id = member_id end @@ -104,9 +104,9 @@ end end -function Area.object:load_delegation_info_once_for_member_id(member_id) +function Area.object:load_delegation_info_once_for_member_id(member_id, trustee_id) if self._delegation_info_loaded_for_member_id ~= member_id then - self:load("delegation_info", { member_id = member_id }) + self:load("delegation_info", { member_id = member_id, trustee_id = trustee_id }) self._delegation_info_loaded_for_member_id = member_id end end diff -r 305329da1c75 -r 5ca9de94cb13 model/issue.lua --- a/model/issue.lua Fri May 18 21:03:10 2012 +0200 +++ b/model/issue.lua Sun May 20 19:43:01 2012 +0200 @@ -130,7 +130,7 @@ end sub_selector:from("issue") sub_selector:add_field("issue.id", "issue_id") - sub_selector:add_field{ '(delegation_info(?, null, null, issue.id)).*', options.member_id } + sub_selector:add_field{ '(delegation_info(?, null, null, issue.id, ?)).*', options.member_id, options.trustee_id } sub_selector:add_where{ 'issue.id IN ($)', ids } local selector = Issue:get_db_conn():new_selector() @@ -144,9 +144,9 @@ end } -function Issue.list:load_delegation_info_once_for_member_id(member_id) +function Issue.list:load_delegation_info_once_for_member_id(member_id, trustee_id) if self._delegation_info_loaded_for_member_id ~= member_id then - self:load("delegation_info", { member_id = member_id }) + self:load("delegation_info", { member_id = member_id, trustee_id = trustee_id }) for i, issue in ipairs(self) do issue._delegation_info_loaded_for_member_id = member_id end @@ -154,9 +154,9 @@ end end -function Issue.object:load_delegation_info_once_for_member_id(member_id) +function Issue.object:load_delegation_info_once_for_member_id(member_id, trustee_id) if self._delegation_info_loaded_for_member_id ~= member_id then - self:load("delegation_info", { member_id = member_id }) + self:load("delegation_info", { member_id = member_id, trustee_id = trustee_id }) self._delegation_info_loaded_for_member_id = member_id end end diff -r 305329da1c75 -r 5ca9de94cb13 model/member.lua --- a/model/member.lua Fri May 18 21:03:10 2012 +0200 +++ b/model/member.lua Sun May 20 19:43:01 2012 +0200 @@ -236,10 +236,6 @@ model.has_rendered_content(Member, RenderedMemberStatement, "statement") -Member:new_selector() - :add_order_by("member.name") - :exec() - function Member:build_selector(args) local selector = self:new_selector() if args.active ~= nil then diff -r 305329da1c75 -r 5ca9de94cb13 model/unit.lua --- a/model/unit.lua Fri May 18 21:03:10 2012 +0200 +++ b/model/unit.lua Sun May 20 19:43:01 2012 +0200 @@ -43,7 +43,7 @@ end sub_selector:from("unit") sub_selector:add_field("unit.id", "unit_id") - sub_selector:add_field{ '(delegation_info(?, unit.id, null, null)).*', options.member_id } + sub_selector:add_field{ '(delegation_info(?, unit.id, null, null, ?)).*', options.member_id, options.trustee_id } sub_selector:add_where{ 'unit.id IN ($)', ids } local selector = Unit:get_db_conn():new_selector() @@ -57,9 +57,9 @@ end } -function Unit.list:load_delegation_info_once_for_member_id(member_id) +function Unit.list:load_delegation_info_once_for_member_id(member_id, trustee_id) if self._delegation_info_loaded_for_member_id ~= member_id then - self:load("delegation_info", { member_id = member_id }) + self:load("delegation_info", { member_id = member_id, trustee_id = trustee_id }) for i, unit in ipairs(self) do unit._delegation_info_loaded_for_member_id = member_id end @@ -67,7 +67,7 @@ end end -function Unit.object:load_delegation_info_once_for_member_id(member_id) +function Unit.object:load_delegation_info_once_for_member_id(member_id, trustee_id) if self._delegation_info_loaded_for_member_id ~= member_id then self:load("delegation_info", { member_id = member_id }) self._delegation_info_loaded_for_member_id = member_id diff -r 305329da1c75 -r 5ca9de94cb13 static/js/update_delegation_info.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/static/js/update_delegation_info.js Sun May 20 19:43:01 2012 +0200 @@ -0,0 +1,5 @@ +function updateDelegationInfo() { + var form = document.getElementById("delegationForm"); + form.preview.value = "1"; + form.submit(); +} \ No newline at end of file diff -r 305329da1c75 -r 5ca9de94cb13 static/style.css --- a/static/style.css Fri May 18 21:03:10 2012 +0200 +++ b/static/style.css Sun May 20 19:43:01 2012 +0200 @@ -285,7 +285,6 @@ margin: 0px 10px 2ex 10px; border: 1px solid #aaa; border-radius: 0 0 8px 8px; - box-shadow: #777 0px 5px 5px -5px; } @@ -425,78 +424,35 @@ * ui.tab */ -.ui_tabs_links { - margin-top: 2ex; - margin-bottom: 1ex; -} - .ui_tabs_links a { - padding: 1ex; - line-height: 300%; - background-color: #f2f2f2; + padding: 0.75ex 0.6em; + line-height: 225%; + background-color: #f7f7f7; white-space: nowrap; border-radius: 5px; margin-right: 5px; font-weight: bold; } -.ui_tabs_links a:hover { - background-color: #d7d7d7; -} - +.ui_tabs_links a:hover, .ui_tabs_links a.selected { background-color: #444; color: #fff; text-decoration: none; } -.ui_tabs_links a.yellow { - background-color: #fcc; - color: #000; -} - -.ui_tabs_links a.yellow:hover { - background-color: #faa; -} - -.ui_tabs_links a.yellow.selected { - background-color: #a44; - color: #fff; - text-decoration: none; - padding: 1ex; -} - -.ui_tabs_links a.red { - background-color: #c33; - color: #000; -} - -.ui_tabs_links a.red:hover { - background-color: #ebb; -} - -.ui_tabs_links a.red.selected { - background-color: #644; - color: #fff; - text-decoration: none; - padding: 1ex; -} - /************************************************************************* * ui.filters */ .ui_filter { - overflow: hidden; - margin-bottom: 1ex; - margin-right: 1em; + overflow: auto; } .ui_filter_head { color: #777; - margin-top: 0.5ex; - margin-bottom: 0.5ex; + margin-top: 1ex; font-size: 90%; font-weight: bold; float: left; @@ -509,6 +465,7 @@ padding: 0.5ex; } +.ui_filter_head a:hover, .ui_filter_head a.active { color: #fff; background-color: #777; @@ -855,13 +812,14 @@ .issues { clear: left; + margin-top: 2ex; } .issues .issue { - margin-top: 10px; overflow: hidden; - border: 1px solid #aaa; + border: 1px solid #ddd; border-radius: 8px; + margin-bottom: 2ex; } .issue.interested, @@ -1042,7 +1000,7 @@ } .member_thumb .flags { - text-align: right; + float: right; font-size: 75%; } @@ -1405,6 +1363,7 @@ padding: 0; } +.page_head, .initiative_head, .issues .issue, .ui_tabs_links a, @@ -1418,7 +1377,7 @@ .box { box-shadow: #777 0px 5px 5px -5px; -mox-box-shadow: #777 0px 5px 5px -5px; - -webkit-box-shadow: #777 0px 5px 5px -5px; + -webkit-box-shadow: #ddd 3px 3px 3px -1px; clear: both; }