# HG changeset patch # User bsw # Date 1329045619 -3600 # Node ID aec9df5b4cd32f746d708cf86ecfbc129c839b2a # Parent 7196685f9dd71b2e8bc5152103a68e8fde6405cc More optical enhancements and repositioning of elements diff -r 7196685f9dd7 -r aec9df5b4cd3 app/main/_layout/default.html --- a/app/main/_layout/default.html Wed Feb 08 18:49:22 2012 +0100 +++ b/app/main/_layout/default.html Sun Feb 12 12:20:19 2012 +0100 @@ -57,8 +57,11 @@ +
+ +
-
+
diff -r 7196685f9dd7 -r aec9df5b4cd3 app/main/area/_list.lua --- a/app/main/area/_list.lua Wed Feb 08 18:49:22 2012 +0100 +++ b/app/main/area/_list.lua Sun Feb 12 12:20:19 2012 +0100 @@ -18,7 +18,12 @@ :add_field({ "(SELECT COUNT(*) FROM issue LEFT JOIN direct_voter ON direct_voter.issue_id = issue.id AND direct_voter.member_id = ? WHERE issue.area_id = area.id AND issue.fully_frozen NOTNULL AND issue.closed ISNULL AND direct_voter.member_id ISNULL)", app.session.member.id }, "issues_to_vote_count") :left_join("membership", "_membership", { "_membership.area_id = area.id AND _membership.member_id = ?", app.session.member.id }) :add_field("_membership.member_id NOTNULL", "is_member", { "grouped" }) - :add_field({ "(SELECT member.name FROM delegation LEFT JOIN member ON delegation.trustee_id = member.id WHERE delegation.scope = 'area' AND delegation.area_id = area.id AND truster_id = ?)", app.session.member.id }, "area_delegation_name") + :left_join("delegation", nil, { + "delegation.truster_id = ? AND delegation.area_id = area.id AND delegation.scope = 'area'", app.session.member_id + }) + :left_join("member", nil, "member.id = delegation.trustee_id") + :add_field("member.id", "trustee_member_id", { "grouped" }) + :add_field("member.name", "trustee_member_name", { "grouped" }) else areas_selector:add_field("0", "issues_to_vote_count") end @@ -43,11 +48,19 @@ }, { content = function(record) - if record.area_delegation_name then - local text = _("Area delegated to '#{name}'", { name = record.area_delegation_name }) - ui.image{ - attr = { title = text, alt = text, style = "vertical-align: middle;" }, - static = "icons/16/link.png", + if record.trustee_member_id then + local trustee_member = Member:by_id(record.trustee_member_id) + local text = _("Area delegated to '#{name}'", { name = record.trustee_member_name }) + execute.view{ + module = "member_image", + view = "_show", + params = { + member = trustee_member, + image_type = "avatar", + show_dummy = true, + class = "micro_avatar", + popup_text = text + } } end end @@ -218,7 +231,7 @@ }, } } - +--[[ ui.bargraph_legend{ width = 25, bars = { @@ -296,3 +309,4 @@ slot.put(" ") slot.put(_"Cancelled") +--]] \ No newline at end of file diff -r 7196685f9dd7 -r aec9df5b4cd3 app/main/draft/_show.lua --- a/app/main/draft/_show.lua Wed Feb 08 18:49:22 2012 +0100 +++ b/app/main/draft/_show.lua Sun Feb 12 12:20:19 2012 +0100 @@ -7,43 +7,6 @@ readonly = true, content = function() - if app.session.member_id or config.public_access == "pseudonym" then - if draft.author then - -- ugly workaround for getting html into a replaced string und to the user - ui.container{label = _"Last author", label_attr={class="ui_field_label"}, content = function() - local str = _("#{author} at #{date}", - {author = string.format('%s', - encode.url{ - module = "member", - view = "show", - id = draft.author.id, - }, - encode.html(draft.author.name)), - date = encode.html(format.timestamp(draft.created)) - } - ) - slot.put("", str, "") - end - } - else - text = _("#{author} at #{date}", { - author = encode.html(draft.author_name), - date = format.timestamp(draft.created) - }) - ui.field.text{label = _"Last author", value = text } - end - else - ui.field.text{ - label = _"Last author", - value = _( - "#{author} at #{date}", { - author = _"[not displayed public]", - date = format.timestamp(draft.created) - } - ) - } - end - ui.container{ attr = { class = "draft_content wiki" }, content = function() diff -r 7196685f9dd7 -r aec9df5b4cd3 app/main/initiative/_details.lua --- a/app/main/initiative/_details.lua Wed Feb 08 18:49:22 2012 +0100 +++ b/app/main/initiative/_details.lua Sun Feb 12 12:20:19 2012 +0100 @@ -1,12 +1,12 @@ local initiative = param.get("initiative", "table") +ui.container{ content = _"Initiative details" } + ui.form{ attr = { class = "vertical" }, record = initiative, readonly = true, content = function() - local policy = initiative.issue.policy - ui.field.text{ label = _"Issue policy", value = initiative.issue.policy.name } ui.field.text{ label = _"Created at", value = tostring(initiative.created) @@ -17,17 +17,10 @@ value = format.timestamp(initiative.revoked) } end - ui.field.text{ - label = _"Initiative quorum", - value = format.percentage(policy.initiative_quorum_num / policy.initiative_quorum_den) - } - if initiative.issue.population then - ui.field.text{ - label = _"Currently required", - value = math.ceil(initiative.issue.population * (policy.initiative_quorum_num / policy.initiative_quorum_den)), - } - end - -- ui.field.date{ label = _"Revoked at", name = "revoked" } ui.field.boolean{ label = _"Admitted", name = "admitted" } end } + +ui.container{ content = _"Issue details" } + +execute.view{ module = "issue", view = "_details", params = { issue = initiative.issue } } \ No newline at end of file diff -r 7196685f9dd7 -r aec9df5b4cd3 app/main/initiative/_list.lua --- a/app/main/initiative/_list.lua Wed Feb 08 18:49:22 2012 +0100 +++ b/app/main/initiative/_list.lua Sun Feb 12 12:20:19 2012 +0100 @@ -4,6 +4,8 @@ local initiatives_selector = param.get("initiatives_selector", "table") +local highlight_initiative = param.get("highlight_initiative", "table") + initiatives_selector :join("issue", nil, "issue.id = initiative.issue_id") @@ -150,7 +152,7 @@ if issue.ranks_available then initiatives_selector:add_order_by("initiative.rank, initiative.admitted DESC, vote_ratio(initiative.positive_votes, initiative.negative_votes) DESC, initiative.id") else - initiatives_selector:add_order_by("CASE WHEN issue.population = 0 THEN 0 ELSE initiative.supporter_count::float / issue.population::float END DESC, initiative.id") + initiatives_selector:add_order_by("CASE WHEN issue.population = 0 OR initiative.supporter_count = 0 OR initiative.supporter_count ISNULL THEN 0 ELSE initiative.supporter_count::float / issue.population::float END DESC, initiative.id") end end @@ -162,9 +164,23 @@ ui.paginate{ name = issue and "issue_" .. tostring(issue.id) .. "_page" or nil, selector = initiatives_selector, - per_page = param.get("per_page", atom.number), + per_page = param.get("per_page", atom.number) or limit, content = function() local initiatives = initiatives_selector:exec() + if highlight_initiative then + local highlight_initiative_found + for i, initiative in ipairs(initiatives) do + if initiative.id == highlight_initiative.id then + highhighlight_initiative_found = true + end + end + if not highhighlight_initiative_found then + initiatives[#initiatives+1] = highlight_initiative + if more_initiatives_count then + more_initiatives_count = more_initiatives_count - 1 + end + end + end for i, initiative in ipairs(initiatives) do local expanded = config.user_tab_mode == "accordeon_all_expanded" and expandable or show_for_initiative and initiative.id == show_for_initiative.id @@ -176,6 +192,7 @@ view = "_list_element", params = { initiative = initiative, + selected = highlight_initiative and highlight_initiative.id == initiative.id or nil, expanded = expanded, expandable = expandable } @@ -187,9 +204,15 @@ } if more_initiatives_count then + local text + if more_initiatives_count == 1 then + text = _("and one more initiative") + else + text = _("and #{count} more initiatives", { count = more_initiatives_count }) + end ui.link{ - attr = { style = "font-size: 75%; font-style: italic;" }, - content = _("and #{count} more initiatives", { count = more_initiatives_count }), + attr = { class = "more_initiatives_link" }, + content = text, module = "issue", view = "show", id = issue.id, diff -r 7196685f9dd7 -r aec9df5b4cd3 app/main/initiative/_list_element.lua --- a/app/main/initiative/_list_element.lua Wed Feb 08 18:49:22 2012 +0100 +++ b/app/main/initiative/_list_element.lua Sun Feb 12 12:20:19 2012 +0100 @@ -1,4 +1,5 @@ local initiative = param.get("initiative", "table") +local selected = param.get("selected", atom.boolean) local expanded = param.get("expanded", atom.boolean) local expandable = param.get("expandable", atom.boolean) @@ -127,10 +128,19 @@ { field_attr = { style = "padding: 0;"}, content = function() - local link_class + local link_class = "initiative_link" if initiative.revoked then link_class = "revoked" end + if selected then + link_class = link_class .. " selected" + end + if initiative.is_supporter then + link_class = link_class .. " supported" + end + if initiative.is_potential_supporter then + link_class = link_class .. " potentially_supported" + end ui.link{ attr = { id = link_name, class = link_class }, content = function() @@ -140,6 +150,7 @@ else name = encode.html(initiative.shortened_name) end + ui.tag{ content = "i" .. initiative.id .. ": " } slot.put(name) end, module = module, @@ -148,27 +159,6 @@ params = params, } - if initiative.issue.state == "new" then - ui.image{ - static = "icons/16/new.png" - } - end - if initiative.is_supporter then - slot.put(" ") - local label = _"You are supporting this initiative" - ui.image{ - attr = { alt = label, title = label }, - static = "icons/16/thumb_up_green.png" - } - end - if initiative.is_potential_supporter then - slot.put(" ") - local label = _"You are potential supporter of this initiative" - ui.image{ - attr = { alt = label, title = label }, - static = "icons/16/thumb_up.png" - } - end if initiative.is_initiator then slot.put(" ") local label = _"You are initiator of this initiative" diff -r 7196685f9dd7 -r aec9df5b4cd3 app/main/initiative/_show.lua --- a/app/main/initiative/_show.lua Wed Feb 08 18:49:22 2012 +0100 +++ b/app/main/initiative/_show.lua Sun Feb 12 12:20:19 2012 +0100 @@ -10,6 +10,20 @@ local initiators = initiators_members_selector:exec() + +local initiatives_selector = initiative.issue:get_reference_selector("initiatives") +slot.select("initiatives_list", function() + execute.view{ + module = "initiative", + view = "_list", + params = { + issue = initiative.issue, + initiatives_selector = initiatives_selector, + no_sort = true, highlight_initiative = initiative, limit = 3 + } + } +end) + slot.select("initiative_head", function() ui.container{ @@ -32,8 +46,8 @@ module = "member", view = "show", id = initiator.id } end - end - } + end + } if initiator and initiator.accepted and not initiative.issue.fully_frozen and not initiative.issue.closed and not initiative.revoked then slot.put(" · ") diff -r 7196685f9dd7 -r aec9df5b4cd3 app/main/issue/_show_head.lua --- a/app/main/issue/_show_head.lua Wed Feb 08 18:49:22 2012 +0100 +++ b/app/main/issue/_show_head.lua Sun Feb 12 12:20:19 2012 +0100 @@ -46,19 +46,6 @@ tag = "div", content = function() - local initiative_count = issue:get_reference_selector("initiatives"):count() - local text - if initiative_count == 1 then - text = _("1 initiative", { count = initiative_count }) - else - text = _("#{count} initiatives", { count = initiative_count }) - end - ui.link{ - text = text, - module = "issue", view = "show", id = issue.id - } - - slot.put(" · ") ui.link{ text = issue.policy.name, module = "policy", @@ -74,10 +61,6 @@ ui.tag{ content = _("#{time_left} left", { time_left = issue.state_time_left }) } end - if issue.next_states_names then - slot.put(" · ") - ui.tag{ content = _("Next state: #{state}", { state = issue.next_states_names }) } - end end } diff -r 7196685f9dd7 -r aec9df5b4cd3 app/main/member/_area_list.lua --- a/app/main/member/_area_list.lua Wed Feb 08 18:49:22 2012 +0100 +++ b/app/main/member/_area_list.lua Sun Feb 12 12:20:19 2012 +0100 @@ -6,13 +6,25 @@ :add_where{ "area.unit_id = ?", unit.id } :add_order_by("area.member_weight DESC") ui.link{ + attr = { class = "heading" }, text = unit.name, module = "area", view = "list", params = { unit_id = unit.id } } - execute.view{ - module = "area", view = "_list", - params = { areas_selector = areas_selector }, - } + if areas_selector:count() > 0 then + execute.view{ + module = "area", view = "_list", + params = { areas_selector = areas_selector }, + } + else + ui.tag{ content = _"You have voting privileges for this unit, but you are not member of any of its areas." } + slot.put(" ") + ui.link{ + text = _"Show all areas of this unit", + module = "area", view = "list", params = { unit_id = unit.id } + } + end + slot.put("
") + end diff -r 7196685f9dd7 -r aec9df5b4cd3 app/main/member_image/_show.lua --- a/app/main/member_image/_show.lua Wed Feb 08 18:49:22 2012 +0100 +++ b/app/main/member_image/_show.lua Sun Feb 12 12:20:19 2012 +0100 @@ -1,6 +1,14 @@ local member = param.get("member", "table") local image_type = param.get("image_type") local show_dummy = param.get("show_dummy", atom.boolean) +local class = param.get("class") +local popup_text = param.get("popup_text") + +if class then + class = " " .. class +else + class = "" +end local image = member:get_reference_selector("images") :add_where{ "image_type = ?", image_type } @@ -10,18 +18,18 @@ if image or show_dummy then if config.fastpath_url_func then ui.image{ - attr = { class = "member_image member_image_" .. image_type }, + attr = { title = popup_text, class = "member_image member_image_" .. image_type .. class }, external = config.fastpath_url_func(member.id, image_type) } else if not image then ui.image{ - attr = { class = "member_image member_image_" .. image_type }, + attr = { title = popup_text, class = "member_image member_image_" .. image_type .. class }, external = encode.url{ static = (config.member_image_default_file[image_type] or 'icons/16/lightning.png')}, } else ui.image{ - attr = { class = "member_image member_image_" .. image_type }, + attr = { title = popup_text, class = "member_image member_image_" .. image_type .. class }, module = "member_image", view = "show", extension = "jpg", diff -r 7196685f9dd7 -r aec9df5b4cd3 model/area.lua --- a/model/area.lua Wed Feb 08 18:49:22 2012 +0100 +++ b/model/area.lua Sun Feb 12 12:20:19 2012 +0100 @@ -69,10 +69,10 @@ function Area:build_selector(args) local selector = Area:new_selector() if args.active ~= nil then - selector:add_where{ "active = ?", args.active } + selector:add_where{ "area.active = ?", args.active } end if args.unit_id ~= nil then - selector:add_where{ "unit_id = ?", args.unit_id } + selector:add_where{ "area.unit_id = ?", args.unit_id } end return selector end diff -r 7196685f9dd7 -r aec9df5b4cd3 static/style.css --- a/static/style.css Wed Feb 08 18:49:22 2012 +0100 +++ b/static/style.css Sun Feb 12 12:20:19 2012 +0100 @@ -15,7 +15,7 @@ } .area_list { - line-height: 170%; + line-height: 140%; } body, a { @@ -116,7 +116,7 @@ background-color: #444; color: #fff; font-size: 90%; - line-height: 140%; + line-height: 100%; padding-left: 10px; } @@ -135,7 +135,7 @@ .navigation, .logout_button { - line-height: 250%; + line-height: 200%; } .navigation img, @@ -195,17 +195,18 @@ */ .title_bar { - padding-top: 2ex; padding-bottom: 1ex; xbackground-color: #def; + text-shadow: #fff 0px 0px 3px; +} + +.title_bar_content { + padding-left: 1em; + padding-top: 1.5ex; background: -webkit-gradient(linear, left top, left bottom, /*color-stop(0%,#abd3ee), color-stop(100%,#ffffff)*/ color-stop(0%,#ddd), color-stop(100%,#fff) - ); -} - -.title_bar_content { - margin-left: 1em; + ); } .path { @@ -258,6 +259,12 @@ margin-right: 0.5em; } +.micro_avatar { + width: 24px; + height: 24px; + border-radius: 4px; +} + .actions { font-size: 75%; line-height: 220%; @@ -267,9 +274,6 @@ display: inline; } -.actions { -} - .actions a { padding: 1px 0.5em 1px 0.0em; margin-right: 1em; @@ -278,12 +282,13 @@ .slot_initiative_head { - xbackground: -webkit-gradient(linear, left top, left bottom, + background: -webkit-gradient(linear, left top, left bottom, /*color-stop(0%,#AFEFB9), color-stop(100%,#ffffff) */ color-stop(0%,#ddd), color-stop(100%,#fff) ); padding-left: 1em; padding-top: 2ex; + text-shadow: #fff 0px 0px 3px; } .initiative_name { @@ -366,25 +371,25 @@ .interest .head_active, .slot_support .head_potential_supporter{ background-color: #fec; - border: 1px solid #b96; + box-shadow: #fff 0px 0px 10px 1px; border-radius: 5px; } .slot_support .head_supporter { background-color: #dfc; - border: 1px solid #8b8; + box-shadow: #fff 0px 0px 10px 1px; border-radius: 5px; } .slot_support .head_initiator { background-color: #eee; - border: 1px solid #999; + box-shadow: #fff 0px 0px 10px 1px; border-radius: 5px; } .delegation .head_active { background-color: #ddf; - border: 1px solid #88b; + box-shadow: #fff 0px 0px 10px 1px; border-radius: 5px; } @@ -801,7 +806,6 @@ th { text-align: left; - border-bottom: 1px solid #000; } tr:hover td { @@ -907,24 +911,24 @@ .issues .issue { xborder: 1px solid #ccc; - background: -webkit-gradient(linear, left top, left bottom, - color-stop(0%,#e7e7e7), color-stop(33%, #f7f7f7), color-stop(100%,#fff)); overflow: hidden; margin-bottom: 2ex; border-radius: 8px; } -.issues .issue.interested { - background: -webkit-gradient(linear, left top, left bottom, - color-stop(0%,#eec), color-stop(25%, #ffe), color-stop(100%,#fff)); -} - .issues .issue .issue_info { xfloat: left; xwidth: 25%; padding: 1ex; line-height: 140%; xoverflow: hidden; + background: -webkit-gradient(linear, left top, left bottom, + color-stop(0%,#e7e7e7), color-stop(33%, #f7f7f7), color-stop(66%,#fff)); +} + +.issues .issue.interested .issue_info{ + background: -webkit-gradient(linear, left top, left bottom, + color-stop(0%,#FFEECC), color-stop(33%, #FFF7E6), color-stop(66%,#fff)); } .issues .issue .issue_info .issue_id { @@ -939,11 +943,36 @@ font-weight: bold; } +.more_initiatives_link { + margin-left: 158px; + font-style: italic; +} + .issues tr tr { border: none; background: none; } +.initiative_link { + padding: 0.5ex 0.5em; +} + +.initiative_link.selected { + font-weight: bold; +} + +.initiative_link.supported { + background-color: #C9FFD1; + border-radius: 5px; + background: -webkit-radial-gradient(center, ellipse cover, #c9ffd1 0%,#fff 100%); /* Chrome10+,Safari5.1+ */ +} + +.initiative_link.potentially_supported { + background-color: #FFEECC; + border-radius: 5px; + background: -webkit-radial-gradient(center, ellipse cover, #ffeecc 0%,#fff 100%); /* Chrome10+,Safari5.1+ */ +} + .lang_chooser { float: right; margin-right: 0.5em; @@ -1211,6 +1240,7 @@ } .heading { + display: block; font-size: 120%; font-weight: bold; margin-top: 2ex;