# HG changeset patch # User bsw # Date 1340569829 -7200 # Node ID 9df26b41ace04a628f824fc348ad0144b93704d7 # Parent 516962033e963965051bc9330e2c2b50a613ac8b Improved member home page and area list diff -r 516962033e96 -r 9df26b41ace0 app/main/area/_list.lua --- a/app/main/area/_list.lua Sun Jun 24 20:50:02 2012 +0200 +++ b/app/main/area/_list.lua Sun Jun 24 22:30:29 2012 +0200 @@ -29,176 +29,13 @@ areas_selector:add_field("0", "issues_to_vote_count") end - -ui.container{ attr = { class = "box area_list" }, content = function() - - ui.container{ attr = { class = "area head" }, content = function() - - ui.container{ attr = { class = "phases" }, content = function() - - ui.container{ attr = { class = "admission" }, content = function() - ui.image{ static = "icons/16/new.png", attr = { alt = _"New" } } - end } - - ui.container{ attr = { class = "discussion" }, content = function() - ui.image{ static = "icons/16/comments.png", attr = { alt = _"Discussion" } } - end } - - ui.container{ attr = { class = "verification" }, content = function() - ui.image{ static = "icons/16/lock.png", attr = { alt = _"Verification" } } - end } - - ui.container{ attr = { class = "voting" }, content = function() - ui.image{ static = "icons/16/email_open.png", attr = { alt = _"Voting" } } - end } - - ui.container{ attr = { class = "finished" }, content = function() - ui.image{ static = "icons/16/tick.png", attr = { alt = _"Finished" } } - end } - - ui.container{ attr = { class = "cancelled" }, content = function() - ui.image{ static = "icons/16/cross.png", attr = { alt = _"Cancelled" } } - end } - - end } - - end } - - for i, area in ipairs(areas_selector:exec()) do - - ui.container{ attr = { class = "area" }, content = function() - - ui.container{ attr = { class = "bar" }, content = function() - if area.member_weight and area.direct_member_count then - local max_value = MemberCount:get() - ui.bargraph{ - max_value = max_value, - width = 100, - bars = { - { color = "#444", value = area.direct_member_count }, - { color = "#777", value = area.member_weight - area.direct_member_count }, - { color = "#ddd", value = max_value - area.member_weight }, - } - } - end - end } - - ui.container{ attr = { class = "name" }, content = function() - ui.link{ - text = area.name, - module = "area", - view = "show", - id = area.id - } - slot.put(" ") - ui.tag{ content = "" } - end } +slot.put("
") - if not hide_membership then - ui.container{ attr = { class = "membership" }, content = function() - if area.is_member then - local text = _"Member of area" - ui.image{ - attr = { title = text, alt = text }, - static = "icons/16/user_gray.png", - } - else - slot.put('') - end - end } - end - - ui.container{ attr = { class = "delegatee" }, content = function() - if area.trustee_member_id then - local trustee_member = Member:by_id(area.trustee_member_id) - local text = _("Area delegated to '#{name}'", { name = area.trustee_member_name }) - 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 = trustee_member, - image_type = "avatar", - show_dummy = true, - class = "micro_avatar", - popup_text = text - } - } - else - slot.put('') - end - end } +for i, area in ipairs(areas_selector:exec()) do - ui.container{ attr = { class = "phases" }, content = function() - - ui.container{ attr = { class = "admission" }, content = function() - ui.link{ - text = tostring(area.issues_new_count), - module = "area", - view = "show", - id = area.id, - params = { filter = "new", tab = "open" } - } - end } + ui.container{ attr = { class = "area_list" }, content = function() + execute.view { module = "area", view = "_list_entry", params = { area = area } } + end } + +end - ui.container{ attr = { class = "discussion" }, content = function() - ui.link{ - text = tostring(area.issues_discussion_count), - module = "area", - view = "show", - id = area.id, - params = { filter = "accepted", tab = "open" } - } - end } - - ui.container{ attr = { class = "verification" }, content = function() - ui.link{ - text = tostring(area.issues_frozen_count), - module = "area", - view = "show", - id = area.id, - params = { filter = "half_frozen", tab = "open" } - } - end } - - ui.container{ attr = { class = "voting" }, content = function() - ui.link{ - text = tostring(area.issues_voting_count), - module = "area", - view = "show", - id = area.id, - params = { filter = "frozen", tab = "open" } - } - end } - - ui.container{ attr = { class = "finished" }, content = function() - ui.link{ - text = tostring(area.issues_finished_count), - module = "area", - view = "show", - id = area.id, - params = { filter = "finished", tab = "closed" } - } - end } - - ui.container{ attr = { class = "cancelled" }, content = function() - ui.link{ - text = tostring(area.issues_cancelled_count), - module = "area", - view = "show", - id = area.id, - params = { filter = "cancelled", issue_list = "newest", tab = "closed" } - } - end } - - end } - - slot.put("
") - end } - - end - -end } diff -r 516962033e96 -r 9df26b41ace0 app/main/area/_list_entry.lua --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/main/area/_list_entry.lua Sun Jun 24 22:30:29 2012 +0200 @@ -0,0 +1,46 @@ +local area = param.get("area", "table") + +ui.container{ attr = { class = "area" }, content = function() + execute.view{ module = "delegation", view = "_info", params = { area = area } } + + ui.container{ attr = { class = "title" }, content = function() + -- area name + ui.link{ + module = "area", view = "show", id = area.id, + attr = { class = "area_name" }, content = area.name + } + end } + + ui.container{ attr = { class = "content" }, content = function() + ui.link{ + module = "area", view = "show", id = area.id, params = { tab = "open", filter = "new" }, + text = _("#{count} new", { count = area.issues_new_count }) + } + slot.put(" · ") + ui.link{ + module = "area", view = "show", id = area.id, params = { tab = "open", filter = "discussion" }, + text = _("#{count} in discussion", { count = area.issues_discussion_count }) + } + slot.put(" · ") + ui.link{ + module = "area", view = "show", id = area.id, params = { tab = "open", filter = "verification" }, + text = _("#{count} in verification", { count = area.issues_frozen_count }) + } + slot.put(" · ") + ui.link{ + module = "area", view = "show", id = area.id, params = { tab = "open", filter = "voting" }, + text = _("#{count} in voting", { count = area.issues_voting_count }) + } + slot.put(" · ") + ui.link{ + module = "area", view = "show", id = area.id, params = { tab = "closed", filter = "finished" }, + text = _("#{count} finished", { count = area.issues_finished_count }) + } + slot.put(" · ") + ui.link{ + module = "area", view = "show", id = area.id, params = { tab = "closed", filter = "cancelled" }, + text = _("#{count} cancelled", { count = area.issues_cancelled_count }) + } + end } + +end } diff -r 516962033e96 -r 9df26b41ace0 app/main/index/_member_home.lua --- a/app/main/index/_member_home.lua Sun Jun 24 20:50:02 2012 +0200 +++ b/app/main/index/_member_home.lua Sun Jun 24 22:30:29 2012 +0200 @@ -1,27 +1,37 @@ local member = param.get("member", "table") local for_member = param.get("for_member", atom.boolean) -local filter_unit = param.get_all_cgi()["filter_unit"] or "personal" +local filter_unit = param.get_all_cgi()["filter_unit"] or "my_areas" if not for_member then execute.view{ module = "index", view = "_notifications" } - ui.container{ attr = { class = "ui_filter_head" }, content = function() + ui.container{ attr = { class = "ui_filter" }, content = function() + ui.container{ attr = { class = "ui_filter_head" }, content = function() + + ui.link{ + attr = { class = filter_unit == "my_areas" and "ui_tabs_link active" or nil }, + text = _"My areas", + module = "index", view = "index", params = { filter_unit = "my_areas" } + } + + slot.put(" ") - ui.link{ - attr = { class = filter_unit == "personal" and "ui_tabs_link active" or nil }, - text = _"My units and areas", - module = "index", view = "index", params = { filter_unit = "personal" } - } - - slot.put(" ") + ui.link{ + attr = { class = filter_unit == "my_units" and "ui_tabs_link active" or nil }, + text = _"All areas in my units", + module = "index", view = "index", params = { filter_unit = "my_units" } + } + + slot.put(" ") - ui.link{ - attr = { class = filter_unit == "global" and "active" or nil }, - text = _"All units", - module = "index", view = "index", params = { filter_unit = "global" } - } + ui.link{ + attr = { class = filter_unit == "global" and "active" or nil }, + text = _"All units", + module = "index", view = "index", params = { filter_unit = "global" } + } + end } end } end @@ -35,61 +45,67 @@ end -local units = Unit:new_selector():exec() +local units = Unit:new_selector():add_order_by("name"):exec() + +if member then + units:load_delegation_info_once_for_member_id(member.id) +end for i, unit in ipairs(units) do if member:has_voting_right_for_unit_id(unit.id) then - local trustee_member = Member:new_selector() - :join("delegation", nil, { "delegation.scope = 'unit' AND delegation.unit_id = ? AND delegation.trustee_id = member.id AND delegation.truster_id = ?", unit.id, member.id }) - :optional_object_mode() - :exec() - + local areas_selector = Area:new_selector() - :join("membership", nil, { "membership.area_id = area.id AND membership.member_id = ?", member.id }) + :reset_fields() + :add_field("area.id", nil, { "grouped" }) + :add_field("area.name", nil, { "grouped" }) + :add_field("member_weight", nil, { "grouped" }) + :add_field("direct_member_count", nil, { "grouped" }) + :add_field("(SELECT COUNT(*) FROM issue WHERE issue.area_id = area.id AND issue.accepted ISNULL AND issue.closed ISNULL)", "issues_new_count") + :add_field("(SELECT COUNT(*) FROM issue WHERE issue.area_id = area.id AND issue.accepted NOTNULL AND issue.half_frozen ISNULL AND issue.closed ISNULL)", "issues_discussion_count") + :add_field("(SELECT COUNT(*) FROM issue WHERE issue.area_id = area.id AND issue.half_frozen NOTNULL AND issue.fully_frozen ISNULL AND issue.closed ISNULL)", "issues_frozen_count") + :add_field("(SELECT COUNT(*) FROM issue WHERE issue.area_id = area.id AND issue.fully_frozen NOTNULL AND issue.closed ISNULL)", "issues_voting_count") + :add_field("(SELECT COUNT(*) FROM issue WHERE issue.area_id = area.id AND issue.fully_frozen NOTNULL AND issue.closed NOTNULL)", "issues_finished_count") + :add_field("(SELECT COUNT(*) FROM issue WHERE issue.area_id = area.id AND issue.fully_frozen ISNULL AND issue.closed NOTNULL)", "issues_cancelled_count") :add_where{ "area.unit_id = ?", unit.id } :add_where{ "area.active" } - :add_order_by("area.member_weight DESC") + :add_order_by("area.name") + + if filter_unit == "my_areas" then + areas_selector:join("membership", nil, { "membership.area_id = area.id AND membership.member_id = ?", member.id }) + end local area_count = areas_selector:count() - ui.container{ attr = { class = "member_area_list" }, content = function() + ui.container{ attr = { class = "area_list" }, content = function() ui.container{ attr = { class = "unit_head" }, content = function() ui.link{ text = unit.name, module = "unit", view = "show", id = unit.id } - if trustee_member then - local text = _("Unit delegated to '#{name}'", { name = trustee_member.name }) - ui.image{ - attr = { class = "delegation_arrow", alt = text, title = text }, - static = "delegation_arrow_24_horizontal.png" - } + execute.view{ module = "delegation", view = "_info", params = { unit = unit } } + end } + + if area_count > 0 then + local areas = areas_selector:exec() + for i, area in ipairs(areas) do execute.view{ - module = "member_image", - view = "_show", - params = { - member = trustee_member, - image_type = "avatar", - show_dummy = true, - class = "micro_avatar", - popup_text = text + module = "area", view = "_list_entry", params = { + area = area } } end - end } - - if area_count > 0 then - execute.view{ - module = "area", view = "_list", - params = { areas_selector = areas_selector, hide_membership = true } - } elseif member:has_voting_right_for_unit_id(unit.id) then - if for_member then - 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." } - else - ui.container{ attr = { class = "voting_priv_info" }, content = _"You have voting privileges for this unit, but you are not member of any of its areas." } - end + ui.container{ attr = { class = "area" }, content = function() + ui.container{ attr = { class = "content" }, content = function() + slot.put("
") + if for_member then + ui.tag{ content = _"This member has voting privileges for this unit, but you ist not member of any of its areas." } + else + ui.tag{ content = _"You have voting privileges for this unit, but you are not member of any of its areas." } + end + end } + end } end local max_area_count = Area:new_selector() :add_where{ "area.unit_id = ?", unit.id } @@ -102,13 +118,18 @@ :left_join("membership", nil, { "membership.area_id = area.id AND membership.member_id = ?", member.id } ) :add_where{ "membership.member_id ISNULL" } :join("delegation", nil, { "delegation.area_id = area.id AND delegation.truster_id = ?", member.id } ) + :add_where{ "delegation.trustee_id NOTNULL" } :count() if more_area_count > 0 then - slot.put("
") - ui.container{ attr = { class = "more_areas" }, content = function() - ui.link{ content = _("#{count} more areas in this unit, #{delegated_count} of them are delegated", { count = more_area_count, delegated_count = delegated_count }), module = "unit", view = "show", id = unit.id } + ui.container{ attr = { class = "area" }, content = function() + ui.container{ attr = { class = "content" }, content = function() + slot.put("
") + ui.link{ content = _("#{count} more areas in this unit, #{delegated_count} of them have an area delegation set", { count = more_area_count, delegated_count = delegated_count }), module = "unit", view = "show", id = unit.id } + end } end } end + slot.put("
") + slot.put("
") end } end end diff -r 516962033e96 -r 9df26b41ace0 static/style.css --- a/static/style.css Sun Jun 24 20:50:02 2012 +0200 +++ b/static/style.css Sun Jun 24 22:30:29 2012 +0200 @@ -359,14 +359,16 @@ .page_head .title, .issue .context, .issue .title, -.initiative_head .title { +.initiative_head .title, +.area_list .title { padding: 8px 10px 2px 10px; } .page_head .unit_head .content, .page_head .area_head .content, .issue .content, -.initiative_head .content { +.initiative_head .content, +.area_list .area .content { padding: 2px 10px 8px 10px; } @@ -383,7 +385,8 @@ .page_head .title, .issue .title, -.initiative_head .title { +.initiative_head .title, +.area_list .area_name { font-weight: bold; font-size: 120%; } @@ -401,7 +404,9 @@ .page_head .issue .content.actions, .page_head .issue .content.actions a, .issues .issue .content.actions, -.issues .issue .content.actions a { +.issues .issue .content.actions a, +.area_list .area .content, +.area_list .area .content a { color: #777; } @@ -775,104 +780,17 @@ * Area list */ -.member_area_list { - margin-bottom: 0ex; - border-radius: 8px; - border: 1px solid #aaa; - padding: 1ex; - margin-bottom: 2ex; -} - -.member_area_list .unit_head { +.area_list .unit_head { font-size: 120%; font-weight: bold; - float: left; - clear: both; -} - -.member_area_list .unit_delegatee { - float: left; -} - -.member_area_list .voting_priv_info { - clear: left; - margin-top: 4ex; -} - -.member_area_list .more_areas { - font-style: italic; -} - -.area_list { - margin-bottom: 4ex; -} - -.member_area_list .area_list { - margin-bottom: 0; + margin-bottom: 1ex; } .area_list .area { - line-height: 32px; - clear: both; -} - -.area_list .bargraph { - line-height: 10px; -} - -.area_list .area .delegatee { - white-space: nowrap; -} - -.area_list .area.head .phases { - xmargin-top: 2ex; -} - -.area_list .area img { - vertical-align: middle; -} - -.area_list .area .bar { - float: left; - padding-top: 6px -} - -.area_list .area .membership, -.area_list .area .delegatee { - display: inline; - width: 24px + margin-bottom: 1ex; } -.area_list .area .name { - display: inline; - font-weight: bold; -} -.area_list .area .phases { - float: right; -} - -.area_list .area .phases div { - float: left; - width: 3em; - text-align: right; -} - -@media screen and (max-width: 480px) { - .area_list .area .name { - display: block; - line-height: 100%; - } - - .area_list .area .delegatee, - .area_list .area .membership { - float: left; - white-space: nowrap; - } - .area_list .area .bar { - display: none; - } -} /************************************************************************* * Events @@ -1434,12 +1352,14 @@ /* shadows */ +.area_list .area, .initiative_head, .box, div.notifications { border-radius: 8px; } +.area_list .area, .initiative_head, .box { border: 1px solid #aaa; @@ -1449,12 +1369,8 @@ padding: 1ex; } -.member_area_list .box { - border: none; - padding: 0; -} - .slot_head, +.area_list .area, .initiative_head, .issues .issue, .ui_tabs_links a, @@ -1464,7 +1380,6 @@ .motd, .ui_filter a.active, .vote_info .content, -.member_area_list, .box, div.notifications { box-shadow: #777 0px 5px 5px -5px; @@ -1473,12 +1388,6 @@ clear: both; } -.member_area_list .box { - box-shadow: none; - -mox-box-shadow: none; - -webkit-box-shadow: none; -} - .slot_footer { margin: 0 1%; border-top: 1px solid #ccc;