# HG changeset patch # User bsw # Date 1340800666 -7200 # Node ID cc64a4fc6ab6ae72ac5408df350dcd7b849a7393 # Parent 46b94112781d2fb8f8ce53616568dd4b0a9dfd65 Cleaned up initiative page diff -r 46b94112781d -r cc64a4fc6ab6 app/main/draft/_show.lua --- a/app/main/draft/_show.lua Wed Jun 27 12:35:34 2012 +0200 +++ b/app/main/draft/_show.lua Wed Jun 27 14:37:46 2012 +0200 @@ -1,24 +1,16 @@ local draft = param.get("draft", "table") local source = param.get("source", atom.boolean) -ui.form{ - attr = { class = "vertical" }, - record = draft, - readonly = true, +ui.container{ + attr = { class = "draft_content wiki" }, content = function() - - ui.container{ - attr = { class = "draft_content wiki" }, - content = function() - if source then - ui.tag{ - tag = "pre", - content = draft.content - } - else - slot.put(draft:get_content("html")) - end - end - } + if source then + ui.tag{ + tag = "pre", + content = draft.content + } + else + slot.put(draft:get_content("html")) + end end } diff -r 46b94112781d -r cc64a4fc6ab6 app/main/initiative/_battles.lua --- a/app/main/initiative/_battles.lua Wed Jun 27 12:35:34 2012 +0200 +++ b/app/main/initiative/_battles.lua Wed Jun 27 14:37:46 2012 +0200 @@ -19,11 +19,6 @@ :count() if number_of_initiatives > 1 then - ui.container{ - attr = { class = "heading first" }, - content = _"This initiative compared to alternative initiatives" - } - ui.list{ records = battled_initiatives, columns = { diff -r 46b94112781d -r cc64a4fc6ab6 app/main/initiative/_details.lua --- a/app/main/initiative/_details.lua Wed Jun 27 12:35:34 2012 +0200 +++ b/app/main/initiative/_details.lua Wed Jun 27 14:37:46 2012 +0200 @@ -1,12 +1,30 @@ local initiative = param.get("initiative", "table") -ui.container{ content = _"Initiative details" } - ui.form{ attr = { class = "vertical" }, record = initiative, readonly = true, content = function() + if initiative.issue.closed then + ui.field.boolean{ label = _"Direct majority", value = initiative.direct_majority } + ui.field.boolean{ label = _"Indirect majority", value = initiative.indirect_majority } + ui.field.text{ label = _"Schulze rank", value = tostring(initiative.schulze_rank) .. " (" .. _("Status quo: #{rank}", { rank = initiative.issue.status_quo_schulze_rank }) .. ")" } + local texts = {} + if initiative.reverse_beat_path then + texts[#texts+1] = _"reverse beat path to status quo (including ties)" + end + if initiative.multistage_majority then + texts[#texts+1] = _"possibly instable result caused by multistage majority" + end + if #texts == 0 then + texts[#texts+1] = _"none" + end + ui.field.text{ + label = _"Other failures", + value = table.concat(texts, ", ") + } + ui.field.boolean{ label = _"Eligible as winner", value = initiative.eligible } + end ui.field.text{ label = _"Created at", value = tostring(initiative.created) @@ -17,10 +35,10 @@ value = format.timestamp(initiative.revoked) } end - ui.field.boolean{ label = _"Admitted", name = "admitted" } + if initiative.admitted ~= nil then + ui.field.boolean{ label = _"Admitted", name = "admitted" } + end end } -ui.container{ content = _"Issue details" } - execute.view{ module = "issue", view = "_details", params = { issue = initiative.issue } } \ No newline at end of file diff -r 46b94112781d -r cc64a4fc6ab6 app/main/initiative/_show.lua --- a/app/main/initiative/_show.lua Wed Jun 27 12:35:34 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,309 +0,0 @@ -local initiative = param.get("initiative", "table") - -local initiators_members_selector = initiative:get_reference_selector("initiating_members") - :add_field("initiator.accepted", "accepted") - :add_order_by("member.name") -if initiator and initiator.accepted then - initiators_members_selector:add_where("initiator.accepted ISNULL OR initiator.accepted") -else - initiators_members_selector:add_where("initiator.accepted") -end - -local initiators = initiators_members_selector:exec() - - -local initiatives_selector = initiative.issue:get_reference_selector("initiatives") -slot.select("head", function() - execute.view{ - module = "issue", - view = "_show", - params = { - issue = initiative.issue, - initiative_limit = 3, - for_initiative = initiative - } - } -end) - -ui.container{ attr = { class = "initiative_head" }, content = function() - - ui.container{ - attr = { class = "title" }, - content = _("Initiative i#{id}: #{name}", { id = initiative.id, name = initiative.name }) - } - - ui.container{ attr = { class = "content" }, content = function() - if app.session.member_id or config.public_access == "pseudonym" or config.public_access == "full" then - ui.tag{ - attr = { class = "initiator_names" }, - content = function() - for i, initiator in ipairs(initiators) do - slot.put(" ") - if app.session.member_id or config.public_access == "full" then - ui.link{ - content = function () - execute.view{ - module = "member_image", - view = "_show", - params = { - member = initiator, - image_type = "avatar", - show_dummy = true, - class = "micro_avatar", - popup_text = text - } - } - end, - module = "member", view = "show", id = initiator.id - } - slot.put(" ") - end - ui.link{ - text = initiator.name, - module = "member", view = "show", id = initiator.id - } - if not initiator.accepted then - ui.tag{ attr = { title = _"Not accepted yet" }, content = "?" } - end - 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(" · ") - ui.link{ - attr = { class = "action" }, - content = function() - slot.put(_"Invite initiator") - end, - module = "initiative", - view = "add_initiator", - params = { initiative_id = initiative.id } - } - if #initiators > 1 then - slot.put(" · ") - ui.link{ - content = function() - slot.put(_"Remove initiator") - end, - module = "initiative", - view = "remove_initiator", - params = { initiative_id = initiative.id } - } - end - end - if initiator and initiator.accepted == false then - slot.put(" · ") - ui.link{ - text = _"Cancel refuse of invitation", - module = "initiative", - action = "remove_initiator", - params = { - initiative_id = initiative.id, - member_id = app.session.member.id - }, - routing = { - ok = { - mode = "redirect", - module = "initiative", - view = "show", - id = initiative.id - } - } - } - end - end } - ui.container{ attr = { class = "content" }, content = function() - if app.session.member_id then - execute.view{ - module = "supporter", - view = "_show_box", - params = { - initiative = initiative - } - } - end - - end } - - if initiative.issue.ranks_available and initiative.admitted then - local class = initiative.winner and "admitted_info" or "not_admitted_info" - ui.container{ - attr = { class = class }, - content = function() - local max_value = initiative.issue.voter_count - slot.put(" ") - local positive_votes = initiative.positive_votes - local negative_votes = initiative.negative_votes - local sum_votes = initiative.positive_votes + initiative.negative_votes - local function perc(votes, sum) - if sum > 0 and votes > 0 then return " (" .. string.format( "%.f", votes * 100 / sum ) .. "%)" end - return "" - end - slot.put(_"Yes" .. ": " .. tostring(positive_votes) .. perc(positive_votes, sum_votes) .. "") - slot.put(" · ") - slot.put(_"Abstention" .. ": " .. tostring(max_value - initiative.negative_votes - initiative.positive_votes) .. "") - slot.put(" · ") - slot.put(_"No" .. ": " .. tostring(initiative.negative_votes) .. perc(negative_votes, sum_votes) .. "") - slot.put(" · ") - slot.put("") - if initiative.winner then - slot.put(_"Approved") - elseif initiative.rank then - slot.put(_("Not approved (rank #{rank})", { rank = initiative.rank })) - else - slot.put(_"Not approved") - end - slot.put("") - end - } - end - - if initiative.admitted == false then - local policy = initiative.issue.policy - ui.container{ - attr = { class = "not_admitted_info" }, - content = _("This initiative has not been admitted! It failed the quorum of #{quorum}.", { quorum = format.percentage(policy.initiative_quorum_num / policy.initiative_quorum_den) }) - } - end - - if initiative.revoked then - ui.container{ - attr = { class = "revoked_info" }, - content = function() - slot.put(_("This initiative has been revoked at #{revoked}", { revoked = format.timestamp(initiative.revoked) })) - local suggested_initiative = initiative.suggested_initiative - if suggested_initiative then - slot.put("

") - slot.put(_("The initiators suggest to support the following initiative:")) - slot.put(" ") - ui.link{ - content = _("Issue ##{id}", { id = suggested_initiative.issue.id } ) .. ": " .. encode.html(suggested_initiative.name), - module = "initiative", - view = "show", - id = suggested_initiative.id - } - end - end - } - end - -end } - -util.help("initiative.show") - - -if initiator and initiator.accepted == nil and not initiative.issue.half_frozen and not initiative.issue.closed then - ui.container{ - attr = { class = "initiator_invite_info" }, - content = function() - slot.put(_"You are invited to become initiator of this initiative.") - slot.put(" ") - ui.link{ - image = { static = "icons/16/tick.png" }, - text = _"Accept invitation", - module = "initiative", - action = "accept_invitation", - id = initiative.id, - routing = { - default = { - mode = "redirect", - module = request.get_module(), - view = request.get_view(), - id = param.get_id_cgi(), - params = param.get_all_cgi() - } - } - } - slot.put(" ") - ui.link{ - image = { static = "icons/16/cross.png" }, - text = _"Refuse invitation", - module = "initiative", - action = "reject_initiator_invitation", - params = { - initiative_id = initiative.id, - member_id = app.session.member.id - }, - routing = { - default = { - mode = "redirect", - module = request.get_module(), - view = request.get_view(), - id = param.get_id_cgi(), - params = param.get_all_cgi() - } - } - } - end - } - slot.put("
") -end - - -local supporter - -if app.session.member_id then - supporter = app.session.member:get_reference_selector("supporters") - :add_where{ "initiative_id = ?", initiative.id } - :optional_object_mode() - :exec() -end - -if supporter and not initiative.issue.closed then - local old_draft_id = supporter.draft_id - local new_draft_id = initiative.current_draft.id - if old_draft_id ~= new_draft_id then - ui.container{ - attr = { class = "draft_updated_info" }, - content = function() - slot.put(_"The draft of this initiative has been updated!") - slot.put(" ") - ui.link{ - content = _"Show diff", - module = "draft", - view = "diff", - params = { - old_draft_id = old_draft_id, - new_draft_id = new_draft_id - } - } - if not initiative.revoked then - slot.put(" ") - ui.link{ - text = _"Refresh support to current draft", - module = "initiative", - action = "add_support", - id = initiative.id, - routing = { - default = { - mode = "redirect", - module = "initiative", - view = "show", - id = initiative.id - } - } - } - end - end - } - end -end - -execute.view{ - module = "initiative", - view = "show_tab", - params = { - initiative = initiative, - initiator = initiator - } -} - -if initiative.issue.snapshot then - slot.put("
") - ui.field.timestamp{ label = _"Last snapshot:", value = initiative.issue.snapshot } -end - - - diff -r 46b94112781d -r cc64a4fc6ab6 app/main/initiative/_show_voting.lua --- a/app/main/initiative/_show_voting.lua Wed Jun 27 12:35:34 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,70 +0,0 @@ -local initiative = param.get("initiative", "table") - -if initiative.revoked then - slot.put(_"Not voted (revoked from initiator)") -elseif initiative.admitted == false then - slot.put(_"Not voted (not admitted)") -else - - execute.view{ - module = "initiative", - view = "_battles", - params = { initiative = initiative } - } - - slot.put("
") - - ui.container{ - attr = { class = "heading" }, - content = _"Member voting" - } - - execute.view{ - module = "member", - view = "_list", - params = { - initiative = initiative, - for_votes = true, - members_selector = initiative.issue:get_reference_selector("direct_voters") - :left_join("vote", nil, { "vote.initiative_id = ? AND vote.member_id = member.id", initiative.id }) - :add_field("direct_voter.weight as voter_weight") - :add_field("coalesce(vote.grade, 0) as grade") - :left_join("initiative", nil, "initiative.id = vote.initiative_id") - :left_join("issue", nil, "issue.id = initiative.issue_id") - } - } - - slot.put("
") - - ui.container{ - attr = { class = "heading" }, - content = _"Voting details" - } - - ui.form{ - attr = { class = "vertical" }, - content = function() - - ui.field.boolean{ label = _"Direct majority", value = initiative.direct_majority } - ui.field.boolean{ label = _"Indirect majority", value = initiative.indirect_majority } - ui.field.text{ label = _"Schulze rank", value = tostring(initiative.schulze_rank) .. " (" .. _("Status quo: #{rank}", { rank = initiative.issue.status_quo_schulze_rank }) .. ")" } - local texts = {} - if initiative.reverse_beat_path then - texts[#texts+1] = _"reverse beat path to status quo (including ties)" - end - if initiative.multistage_majority then - texts[#texts+1] = _"possibly instable result caused by multistage majority" - end - if #texts == 0 then - texts[#texts+1] = _"none" - end - ui.field.text{ - label = _"Other failures", - value = table.concat(texts, ", ") - } - ui.field.boolean{ label = _"Eligible as winner", value = initiative.eligible } - end -} - - -end diff -r 46b94112781d -r cc64a4fc6ab6 app/main/initiative/_suggestions.lua --- a/app/main/initiative/_suggestions.lua Wed Jun 27 12:35:34 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -local initiative = param.get("initiative", "table") - - - - diff -r 46b94112781d -r cc64a4fc6ab6 app/main/initiative/show.lua --- a/app/main/initiative/show.lua Wed Jun 27 12:35:34 2012 +0200 +++ b/app/main/initiative/show.lua Wed Jun 27 14:37:46 2012 +0200 @@ -17,11 +17,447 @@ } end) +local initiators_members_selector = initiative:get_reference_selector("initiating_members") + :add_field("initiator.accepted", "accepted") + :add_order_by("member.name") +if initiator and initiator.accepted then + initiators_members_selector:add_where("initiator.accepted ISNULL OR initiator.accepted") +else + initiators_members_selector:add_where("initiator.accepted") +end + +local initiators = initiators_members_selector:exec() + + +local initiatives_selector = initiative.issue:get_reference_selector("initiatives") +slot.select("head", function() + execute.view{ + module = "issue", + view = "_show", + params = { + issue = initiative.issue, + initiative_limit = 3, + for_initiative = initiative + } + } +end) + +util.help("initiative.show") + +ui.container{ attr = { class = "initiative_head" }, content = function() + + ui.container{ + attr = { class = "title" }, + content = _("Initiative i#{id}: #{name}", { id = initiative.id, name = initiative.name }) + } + + ui.container{ attr = { class = "content" }, content = function() + if app.session.member_id or config.public_access == "pseudonym" or config.public_access == "full" then + ui.tag{ + attr = { class = "initiator_names" }, + content = function() + for i, initiator in ipairs(initiators) do + slot.put(" ") + if app.session.member_id or config.public_access == "full" then + ui.link{ + content = function () + execute.view{ + module = "member_image", + view = "_show", + params = { + member = initiator, + image_type = "avatar", + show_dummy = true, + class = "micro_avatar", + popup_text = text + } + } + end, + module = "member", view = "show", id = initiator.id + } + slot.put(" ") + end + ui.link{ + text = initiator.name, + module = "member", view = "show", id = initiator.id + } + if not initiator.accepted then + ui.tag{ attr = { title = _"Not accepted yet" }, content = "?" } + end + 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(" · ") + ui.link{ + attr = { class = "action" }, + content = function() + slot.put(_"Invite initiator") + end, + module = "initiative", + view = "add_initiator", + params = { initiative_id = initiative.id } + } + if #initiators > 1 then + slot.put(" · ") + ui.link{ + content = function() + slot.put(_"Remove initiator") + end, + module = "initiative", + view = "remove_initiator", + params = { initiative_id = initiative.id } + } + end + end + if initiator and initiator.accepted == false then + slot.put(" · ") + ui.link{ + text = _"Cancel refuse of invitation", + module = "initiative", + action = "remove_initiator", + params = { + initiative_id = initiative.id, + member_id = app.session.member.id + }, + routing = { + ok = { + mode = "redirect", + module = "initiative", + view = "show", + id = initiative.id + } + } + } + end + end } + ui.container{ attr = { class = "content" }, content = function() + if app.session.member_id then + execute.view{ + module = "supporter", + view = "_show_box", + params = { + initiative = initiative + } + } + end + + end } + + + -- voting results + if initiative.issue.ranks_available and initiative.admitted then + local class = initiative.winner and "admitted_info" or "not_admitted_info" + ui.container{ + attr = { class = class }, + content = function() + local max_value = initiative.issue.voter_count + slot.put(" ") + local positive_votes = initiative.positive_votes + local negative_votes = initiative.negative_votes + local sum_votes = initiative.positive_votes + initiative.negative_votes + local function perc(votes, sum) + if sum > 0 and votes > 0 then return " (" .. string.format( "%.f", votes * 100 / sum ) .. "%)" end + return "" + end + slot.put(_"Yes" .. ": " .. tostring(positive_votes) .. perc(positive_votes, sum_votes) .. "") + slot.put(" · ") + slot.put(_"Abstention" .. ": " .. tostring(max_value - initiative.negative_votes - initiative.positive_votes) .. "") + slot.put(" · ") + slot.put(_"No" .. ": " .. tostring(initiative.negative_votes) .. perc(negative_votes, sum_votes) .. "") + slot.put(" · ") + slot.put("") + if initiative.winner then + slot.put(_"Approved") + elseif initiative.rank then + slot.put(_("Not approved (rank #{rank})", { rank = initiative.rank })) + else + slot.put(_"Not approved") + end + slot.put("") + end + } + end + + ui.container{ attr = { class = "content" }, content = function() + execute.view{ + module = "initiative", + view = "_battles", + params = { initiative = initiative } + } + end } + + -- initiative not admitted info + if initiative.admitted == false then + local policy = initiative.issue.policy + ui.container{ + attr = { class = "not_admitted_info" }, + content = _("This initiative has not been admitted! It failed the quorum of #{quorum}.", { quorum = format.percentage(policy.initiative_quorum_num / policy.initiative_quorum_den) }) + } + end + + -- initiative revoked info + if initiative.revoked then + ui.container{ + attr = { class = "revoked_info" }, + content = function() + slot.put(_("This initiative has been revoked at #{revoked}", { revoked = format.timestamp(initiative.revoked) })) + local suggested_initiative = initiative.suggested_initiative + if suggested_initiative then + slot.put("

") + slot.put(_("The initiators suggest to support the following initiative:")) + slot.put(" ") + ui.link{ + content = _("Issue ##{id}", { id = suggested_initiative.issue.id } ) .. ": " .. encode.html(suggested_initiative.name), + module = "initiative", + view = "show", + id = suggested_initiative.id + } + end + end + } + end + + + -- invited as initiator + if initiator and initiator.accepted == nil and not initiative.issue.half_frozen and not initiative.issue.closed then + ui.container{ + attr = { class = "initiator_invite_info" }, + content = function() + slot.put(_"You are invited to become initiator of this initiative.") + slot.put(" ") + ui.link{ + image = { static = "icons/16/tick.png" }, + text = _"Accept invitation", + module = "initiative", + action = "accept_invitation", + id = initiative.id, + routing = { + default = { + mode = "redirect", + module = request.get_module(), + view = request.get_view(), + id = param.get_id_cgi(), + params = param.get_all_cgi() + } + } + } + slot.put(" ") + ui.link{ + image = { static = "icons/16/cross.png" }, + text = _"Refuse invitation", + module = "initiative", + action = "reject_initiator_invitation", + params = { + initiative_id = initiative.id, + member_id = app.session.member.id + }, + routing = { + default = { + mode = "redirect", + module = request.get_module(), + view = request.get_view(), + id = param.get_id_cgi(), + params = param.get_all_cgi() + } + } + } + end + } + end + + -- draft updated + local supporter + + if app.session.member_id then + supporter = app.session.member:get_reference_selector("supporters") + :add_where{ "initiative_id = ?", initiative.id } + :optional_object_mode() + :exec() + end + + if supporter and not initiative.issue.closed then + local old_draft_id = supporter.draft_id + local new_draft_id = initiative.current_draft.id + if old_draft_id ~= new_draft_id then + ui.container{ + attr = { class = "draft_updated_info" }, + content = function() + slot.put(_"The draft of this initiative has been updated!") + slot.put(" ") + ui.link{ + content = _"Show diff", + module = "draft", + view = "diff", + params = { + old_draft_id = old_draft_id, + new_draft_id = new_draft_id + } + } + if not initiative.revoked then + slot.put(" ") + ui.link{ + text = _"Refresh support to current draft", + module = "initiative", + action = "add_support", + id = initiative.id, + routing = { + default = { + mode = "redirect", + module = "initiative", + view = "show", + id = initiative.id + } + } + } + end + end + } + end + end + + + execute.view{ + module = "draft", + view = "_show", + params = { + draft = initiative.current_draft + } + } + +end } + +execute.view{ + module = "suggestion", + view = "_list", + params = { + initiative = initiative, + suggestions_selector = initiative:get_reference_selector("suggestions"), + tab_id = param.get("tab_id") + } +} + + +if config.public_access == "full" or app.session.member_id then + if initiative.issue.ranks_available then + local members_selector = initiative.issue:get_reference_selector("direct_voters") + :left_join("vote", nil, { "vote.initiative_id = ? AND vote.member_id = member.id", initiative.id }) + :add_field("direct_voter.weight as voter_weight") + :add_field("coalesce(vote.grade, 0) as grade") + :left_join("initiative", nil, "initiative.id = vote.initiative_id") + :left_join("issue", nil, "issue.id = initiative.issue_id") + + ui.container{ attr = { class = "heading"}, content = _"Member voting" } + + execute.view{ + module = "member", + view = "_list", + params = { + initiative = initiative, + for_votes = true, + members_selector = members_selector + } + } + end + + local members_selector = initiative:get_reference_selector("supporting_members_snapshot") + :join("issue", nil, "issue.id = direct_supporter_snapshot.issue_id") + :join("direct_interest_snapshot", nil, "direct_interest_snapshot.event = issue.latest_snapshot_event AND direct_interest_snapshot.issue_id = issue.id AND direct_interest_snapshot.member_id = member.id") + :add_field("direct_interest_snapshot.weight") + :add_where("direct_supporter_snapshot.event = issue.latest_snapshot_event") + :add_where("direct_supporter_snapshot.satisfied") + :add_field("direct_supporter_snapshot.informed", "is_informed") + + + + if members_selector:count() > 0 then + if issue.fully_frozen then + ui.container{ attr = { class = "heading"}, content = _"Supporters (before begin of voting)" } + else + ui.container{ attr = { class = "heading"}, content = _"Supporters" } + end + + execute.view{ + module = "member", + view = "_list", + params = { + + initiative = initiative, + members_selector = members_selector + } + } + else + if issue.fully_frozen then + ui.container{ attr = { class = "heading"}, content = _"No supporters (before begin of voting)" } + else + ui.container{ attr = { class = "heading"}, content = _"No supporters" } + end + slot.put("
") + end + + local members_selector = initiative:get_reference_selector("supporting_members_snapshot") + :join("issue", nil, "issue.id = direct_supporter_snapshot.issue_id") + :join("direct_interest_snapshot", nil, "direct_interest_snapshot.event = issue.latest_snapshot_event AND direct_interest_snapshot.issue_id = issue.id AND direct_interest_snapshot.member_id = member.id") + :add_field("direct_interest_snapshot.weight") + :add_where("direct_supporter_snapshot.event = issue.latest_snapshot_event") + :add_where("NOT direct_supporter_snapshot.satisfied") + :add_field("direct_supporter_snapshot.informed", "is_informed") + + + if members_selector:count() > 0 then + if issue.fully_frozen then + ui.container{ attr = { class = "heading"}, content = _"Potential supporters (before begin of voting" } + else + ui.container{ attr = { class = "heading"}, content = _"Potential supporters" } + end + + execute.view{ + module = "member", + view = "_list", + params = { + + initiative = initiative, + members_selector = members_selector + } + } + else + if issue.fully_frozen then + ui.container{ attr = { class = "heading"}, content = _"No potential supporters (before begin of voting)" } + else + ui.container{ attr = { class = "heading"}, content = _"No potential supporters" } + end + slot.put("
") + end + + ui.container{ attr = { class = "heading"}, content = _"Details" } + execute.view { + module = "initiative", + view = "_details", + params = { + initiative = initiative, + members_selector = members_selector + } + } + +end + + +--[[ execute.view{ module = "initiative", - view = "_show", + view = "show_tab", params = { initiative = initiative, initiator = initiator } } + +if initiative.issue.snapshot then + slot.put("
") + ui.field.timestamp{ label = _"Last snapshot:", value = initiative.issue.snapshot } +end + + +--]] diff -r 46b94112781d -r cc64a4fc6ab6 app/main/issue/_details.lua --- a/app/main/issue/_details.lua Wed Jun 27 12:35:34 2012 +0200 +++ b/app/main/issue/_details.lua Wed Jun 27 14:37:46 2012 +0200 @@ -7,7 +7,7 @@ attr = { class = "vertical" }, content = function() ui.field.text{ label = _"Population", name = "population" } - ui.field.text{ label = _"State", name = "state" } + ui.field.text{ label = _"State", name = "state_name" } ui.field.timestamp{ label = _"Created at", name = "created" } ui.field.text{ label = _"Admission time", value = issue.admission_time } ui.field.text{ @@ -20,9 +20,13 @@ value = math.ceil(issue.population * policy.issue_quorum_num / policy.issue_quorum_den) } end - ui.field.timestamp{ label = _"Accepted at", name = "accepted" } + if issue.accepted then + ui.field.timestamp{ label = _"Accepted at", name = "accepted" } + end ui.field.text{ label = _"Discussion time", value = issue.discussion_time } - ui.field.timestamp{ label = _"Half frozen at", name = "half_frozen" } + if issue.half_frozen then + ui.field.timestamp{ label = _"Half frozen at", name = "half_frozen" } + end ui.field.text{ label = _"Verification time", value = issue.verification_time } ui.field.text{ label = _"Initiative quorum", @@ -34,9 +38,13 @@ value = math.ceil(issue.population * (issue.policy.initiative_quorum_num / issue.policy.initiative_quorum_den)), } end - ui.field.timestamp{ label = _"Fully frozen at", name = "fully_frozen" } + if issue.fully_frozen then + ui.field.timestamp{ label = _"Fully frozen at", name = "fully_frozen" } + end ui.field.text{ label = _"Voting time", value = issue.voting_time } - ui.field.timestamp{ label = _"Closed", name = "closed" } + if issue.closed then + ui.field.timestamp{ label = _"Closed", name = "closed" } + end end } ui.form{ diff -r 46b94112781d -r cc64a4fc6ab6 app/main/member/_list.lua --- a/app/main/member/_list.lua Wed Jun 27 12:35:34 2012 +0200 +++ b/app/main/member/_list.lua Wed Jun 27 14:37:46 2012 +0200 @@ -22,19 +22,6 @@ local filter = { name = "member_list" } if issue or initiative then - if for_votes then - filter[#filter+1] = { - name = "delegations", - label = _"Delegations", - selector_modifier = function(selector) selector:add_order_by("voter_weight DESC") end - } - else - filter[#filter+1] = { - name = "delegations", - label = _"Delegations", - selector_modifier = function(selector) selector:add_order_by("weight DESC") end - } - end end filter[#filter+1] = { @@ -59,7 +46,17 @@ selector_modifier = function(selector) selector:add_order_by("name DESC") end } -ui.filters{ +local ui_filters = ui.filters +if issue or initiative then + ui_filters = function(args) args.content() end + if for_votes then + members_selector:add_order_by("voter_weight DESC, name, id") + else + members_selector:add_order_by("weight DESC, name, id") + end +end + +ui_filters{ label = _"Change order", selector = members_selector, filter, diff -r 46b94112781d -r cc64a4fc6ab6 app/main/suggestion/_list.lua --- a/app/main/suggestion/_list.lua Wed Jun 27 12:35:34 2012 +0200 +++ b/app/main/suggestion/_list.lua Wed Jun 27 14:37:46 2012 +0200 @@ -4,319 +4,95 @@ suggestions_selector:add_order_by("plus2_unfulfilled_count + plus1_unfulfilled_count DESC, id") -local tab_id = param.get("tab_id") -local show_name = param.get("show_name", atom.boolean) -if show_name == nil then - show_name = true -end -local show_filter = param.get("show_filter", atom.boolean) -if show_filter == nil then - show_filter = true -end - -local partial = { - routing = { - default = { - mode = "redirect", - module = "initiative", - view = "show_tab", - params = { - initiative_id = initiative.id, - tab = "suggestions", - tab_id = tab_id - }, - } - } -} - local ui_filters = ui.filters if true or not show_filter then ui_filters = function(args) args.content() end end -ui.container{ attr = { class = "box" }, + +ui.container{ attr = { class = "initiative_head" }, content = function() - ui.paginate{ - selector = suggestions_selector, - content = function() - ui.list{ - attr = { style = "table-layout: fixed;" }, - records = suggestions_selector:exec(), - columns = { - { - label = show_name and _"Suggestion" or nil, - content = function(record) - if show_name then - ui.link{ - text = record.name, - module = "suggestion", - view = "show", - id = record.id - } - end - end - }, - { - label = _"Collective opinion of supporters", - label_attr = { style = "width: 101px;" }, - content = function(record) - if record.minus2_unfulfilled_count then - local max_value = record.initiative.supporter_count - ui.bargraph{ - max_value = max_value, - width = 100, - bars = { - { color = "#0a0", value = record.plus2_unfulfilled_count + record.plus2_fulfilled_count }, - { color = "#8f8", value = record.plus1_unfulfilled_count + record.plus1_fulfilled_count }, - { color = "#eee", value = max_value - record.minus2_unfulfilled_count - record.minus1_unfulfilled_count - record.minus2_fulfilled_count - record.minus1_fulfilled_count - record.plus1_unfulfilled_count - record.plus2_unfulfilled_count - record.plus1_fulfilled_count - record.plus2_fulfilled_count}, - { color = "#f88", value = record.minus1_unfulfilled_count + record.minus1_fulfilled_count }, - { color = "#a00", value = record.minus2_unfulfilled_count + record.minus2_fulfilled_count }, - } - } - end - end - }, - { - label = _"My opinion", - label_attr = { style = "width: 130px; font-style: italic;" }, - content = function(record) - local degree - local opinion - if app.session.member_id then - opinion = Opinion:by_pk(app.session.member.id, record.id) - end - if opinion then - degree = opinion.degree - end - ui.container{ - attr = { class = "suggestion_my_opinion" }, - content = function() - local has_voting_right = app.session.member and app.session.member:has_voting_right_for_unit_id(initiative.issue.area.unit_id) - if app.session.member_id and has_voting_right then - if initiative.issue.state == "voting" or initiative.issue.state == "closed" then - if degree == -2 then - ui.tag{ - tag = "span", - attr = { - class = "action" .. (degree == -2 and " active_red2" or "") - }, - content = _"must not" - } - end - if degree == -1 then - ui.tag{ - tag = "span", - attr = { class = "action" .. (degree == -1 and " active_red1" or "") }, - content = _"should not" - } - end - if degree == nil then - ui.tag{ - tag = "span", - attr = { class = "action" .. (degree == nil and " active" or "") }, - content = _"neutral" - } - end - if degree == 1 then - ui.tag{ - tag = "span", - attr = { class = "action" .. (degree == 1 and " active_green1" or "") }, - content = _"should" - } - end - if degree == 2 then - ui.tag{ - tag = "span", - attr = { class = "action" .. (degree == 2 and " active_green2" or "") }, - content = _"must" - } - end - else - -- we need to put initiative_id into the parameters to have a redirect target in case the suggestion is gone after the action - params = param.get_all_cgi() - params['initiative_id'] = initiative.id - - ui.link{ - attr = { class = "action" .. (degree == 2 and " active_green2" or "") }, - text = _"must", - module = "opinion", - action = "update", - routing = { default = { mode = "redirect", module = request.get_module(), view = request.get_view(), id = param.get_id_cgi(), params = params } }, - params = { - suggestion_id = record.id, - degree = 2 - }, - partial = partial + ui.container{ attr = { class = "title" }, content = _"Suggestions" } + ui.container{ attr = { class = "content" }, content = function() + ui.paginate{ + selector = suggestions_selector, + content = function() + local suggestions = suggestions_selector:exec() + if #suggestions < 1 then + if not initiative.issue.fully_frozen and not initiative.issue.closed then + ui.tag{ content = _"No suggestions yet" } + else + ui.tag{ content = _"No suggestions" } + end + else + ui.list{ + attr = { style = "table-layout: fixed;" }, + records = suggestions, + columns = { + { + label_attr = { style = "width: 101px;" }, + content = function(record) + if record.minus2_unfulfilled_count then + local max_value = record.initiative.supporter_count + ui.bargraph{ + max_value = max_value, + width = 100, + bars = { + { color = "#0a0", value = record.plus2_unfulfilled_count + record.plus2_fulfilled_count }, + { color = "#8f8", value = record.plus1_unfulfilled_count + record.plus1_fulfilled_count }, + { color = "#eee", value = max_value - record.minus2_unfulfilled_count - record.minus1_unfulfilled_count - record.minus2_fulfilled_count - record.minus1_fulfilled_count - record.plus1_unfulfilled_count - record.plus2_unfulfilled_count - record.plus1_fulfilled_count - record.plus2_fulfilled_count}, + { color = "#f88", value = record.minus1_unfulfilled_count + record.minus1_fulfilled_count }, + { color = "#a00", value = record.minus2_unfulfilled_count + record.minus2_fulfilled_count }, } - slot.put(" ") - ui.link{ - attr = { class = "action" .. (degree == 1 and " active_green1" or "") }, - text = _"should", - module = "opinion", - action = "update", - routing = { default = { mode = "redirect", module = request.get_module(), view = request.get_view(), id = param.get_id_cgi(), params = params} }, - params = { - suggestion_id = record.id, - degree = 1 - }, - partial = partial - } - slot.put(" ") - ui.link{ - attr = { class = "action" .. (degree == nil and " active" or "") }, - text = _"neutral", - module = "opinion", - action = "update", - routing = { default = { mode = "redirect", module = request.get_module(), view = request.get_view(), id = param.get_id_cgi(), params = params } }, - params = { - suggestion_id = record.id, - delete = true - }, - partial = partial - } - slot.put(" ") - ui.link{ - attr = { class = "action" .. (degree == -1 and " active_red1" or "") }, - text = _"should not", - module = "opinion", - action = "update", - routing = { default = { mode = "redirect", module = request.get_module(), view = request.get_view(), id = param.get_id_cgi(), params = params } }, - params = { - suggestion_id = record.id, - degree = -1 - }, - partial = partial - } - slot.put(" ") - ui.link{ - attr = { class = "action" .. (degree == -2 and " active_red2" or "") }, - text = _"must not", - module = "opinion", - action = "update", - routing = { default = { mode = "redirect", module = request.get_module(), view = request.get_view(), id = param.get_id_cgi(), params = params } }, - params = { - suggestion_id = record.id, - degree = -2 - }, - partial = partial - } - end - elseif app.session.member_id then - ui.field.text{ value = _"[No voting privilege]" } - else - ui.field.text{ value = _"[Registered members only]" } + } end end - } - end - }, - { - label = _"Suggestion currently not implemented", - label_attr = { style = "width: 101px;" }, - content = function(record) - if record.minus2_unfulfilled_count then - local max_value = record.initiative.supporter_count - ui.bargraph{ - max_value = max_value, - width = 100, - bars = { - { color = "#0a0", value = record.plus2_unfulfilled_count }, - { color = "#8f8", value = record.plus1_unfulfilled_count }, - { color = "#eee", value = max_value - record.minus2_unfulfilled_count - record.minus1_unfulfilled_count - record.plus1_unfulfilled_count - record.plus2_unfulfilled_count }, - { color = "#f88", value = record.minus1_unfulfilled_count }, - { color = "#a00", value = record.minus2_unfulfilled_count }, - } - } - end - end - }, - { - label = _"Suggestion currently implemented", - label_attr = { style = "width: 101px;" }, - content = function(record) - if record.minus2_fulfilled_count then - local max_value = record.initiative.supporter_count - ui.bargraph{ - max_value = max_value, - width = 100, - bars = { - { color = "#0a0", value = record.plus2_fulfilled_count }, - { color = "#8f8", value = record.plus1_fulfilled_count }, - { color = "#eee", value = max_value - record.minus2_fulfilled_count - record.minus1_fulfilled_count - record.plus1_fulfilled_count - record.plus2_fulfilled_count}, - { color = "#f88", value = record.minus1_fulfilled_count }, - { color = "#a00", value = record.minus2_fulfilled_count }, + }, + { + content = function(record) + ui.link{ + text = record.name, + module = "suggestion", + view = "show", + id = record.id } - } - end - end - }, - { - label = app.session.member_id and _"I consider suggestion as" or nil, - label_attr = { style = "width: 100px; font-style: italic;" }, - content = function(record) - local degree - local opinion - if app.session.member_id then - opinion = Opinion:by_pk(app.session.member.id, record.id) - end - if opinion then - degree = opinion.degree - end - if opinion then - - ui.link{ - attr = { class = opinion.fulfilled and "action active" or "action" }, - text = _"implemented", - module = "opinion", - action = "update", - routing = { default = { mode = "redirect", module = request.get_module(), view = request.get_view(), id = param.get_id_cgi(), params = param.get_all_cgi() } }, - params = { - suggestion_id = record.id, - fulfilled = true - }, - partial = partial - } - slot.put("
") - ui.link{ - attr = { class = not opinion.fulfilled and "action active" or "action" }, - text = _"not implemented", - module = "opinion", - action = "update", - routing = { default = { mode = "redirect", module = request.get_module(), view = request.get_view(), id = param.get_id_cgi(), params = param.get_all_cgi() } }, - params = { - suggestion_id = record.id, - fulfilled = false - }, - partial = partial - } - - end - end - }, - { - label = app.session.member_id and _"So I'm" or nil, - content = function(record) - local opinion - if app.session.member_id then - opinion = Opinion:by_pk(app.session.member.id, record.id) - end - if opinion then - if (opinion.fulfilled and opinion.degree > 0) or (not opinion.fulfilled and opinion.degree < 0) then - local title = _"satisfied" - ui.image{ attr = { alt = title, title = title }, static = "icons/emoticon_happy.png" } - elseif opinion.degree == 1 or opinion.degree == -1 then - local title = _"a bit unsatisfied" - ui.image{ attr = { alt = title, title = title }, static = "icons/emoticon_unhappy.png" } - else - local title = _"more unsatisfied" - ui.image{ attr = { alt = title, title = title }, static = "icons/emoticon_unhappy_red.png" } + local degree + local opinion + if app.session.member_id then + opinion = Opinion:by_pk(app.session.member.id, record.id) + end + if opinion then + local degrees = { + ["-2"] = _"must not", + ["-1"] = _"should not", + ["0"] = _"neutral", + ["1"] = _"should", + ["2"] = _"must" + } + slot.put(" · ") + ui.tag{ content = degrees[tostring(opinion.degree)] } + slot.put(" · ") + if opinion.fulfilled then + ui.tag{ content = _"implemented" } + else + ui.tag{ content = _"not implemented" } + end + end end - end - end - }, - } + }, + } + } + end + end + } + end } + if not initiative.issue.fully_frozen and not initiative.issue.closed then + ui.container{ attr = { class = "content" }, content = function() + ui.link{ + module = "suggestion", view = "new", params = { initiative_id = initiative.id }, + text = _"New suggestion" } - end - } + end } + end end } diff -r 46b94112781d -r cc64a4fc6ab6 app/main/suggestion/_list_element.lua --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/main/suggestion/_list_element.lua Wed Jun 27 14:37:46 2012 +0200 @@ -0,0 +1,322 @@ + +local initiative = param.get("initiative", "table") +local suggestions_selector = param.get("suggestions_selector", "table") + +suggestions_selector:add_order_by("plus2_unfulfilled_count + plus1_unfulfilled_count DESC, id") + +local tab_id = param.get("tab_id") +local show_name = param.get("show_name", atom.boolean) +if show_name == nil then + show_name = true +end +local show_filter = param.get("show_filter", atom.boolean) +if show_filter == nil then + show_filter = true +end + +local partial = { + routing = { + default = { + mode = "redirect", + module = "initiative", + view = "show_tab", + params = { + initiative_id = initiative.id, + tab = "suggestions", + tab_id = tab_id + }, + } + } +} + +local ui_filters = ui.filters +if true or not show_filter then + ui_filters = function(args) args.content() end +end + +ui.container{ attr = { class = "box" }, + content = function() + ui.paginate{ + selector = suggestions_selector, + content = function() + ui.list{ + attr = { style = "table-layout: fixed;" }, + records = suggestions_selector:exec(), + columns = { + { + label = show_name and _"Suggestion" or nil, + content = function(record) + if show_name then + ui.link{ + text = record.name, + module = "suggestion", + view = "show", + id = record.id + } + end + end + }, + { + label = _"Collective opinion of supporters", + label_attr = { style = "width: 101px;" }, + content = function(record) + if record.minus2_unfulfilled_count then + local max_value = record.initiative.supporter_count + ui.bargraph{ + max_value = max_value, + width = 100, + bars = { + { color = "#0a0", value = record.plus2_unfulfilled_count + record.plus2_fulfilled_count }, + { color = "#8f8", value = record.plus1_unfulfilled_count + record.plus1_fulfilled_count }, + { color = "#eee", value = max_value - record.minus2_unfulfilled_count - record.minus1_unfulfilled_count - record.minus2_fulfilled_count - record.minus1_fulfilled_count - record.plus1_unfulfilled_count - record.plus2_unfulfilled_count - record.plus1_fulfilled_count - record.plus2_fulfilled_count}, + { color = "#f88", value = record.minus1_unfulfilled_count + record.minus1_fulfilled_count }, + { color = "#a00", value = record.minus2_unfulfilled_count + record.minus2_fulfilled_count }, + } + } + end + end + }, + { + label = _"My opinion", + label_attr = { style = "width: 130px; font-style: italic;" }, + content = function(record) + local degree + local opinion + if app.session.member_id then + opinion = Opinion:by_pk(app.session.member.id, record.id) + end + if opinion then + degree = opinion.degree + end + ui.container{ + attr = { class = "suggestion_my_opinion" }, + content = function() + local has_voting_right = app.session.member and app.session.member:has_voting_right_for_unit_id(initiative.issue.area.unit_id) + if app.session.member_id and has_voting_right then + if initiative.issue.state == "voting" or initiative.issue.state == "closed" then + if degree == -2 then + ui.tag{ + tag = "span", + attr = { + class = "action" .. (degree == -2 and " active_red2" or "") + }, + content = _"must not" + } + end + if degree == -1 then + ui.tag{ + tag = "span", + attr = { class = "action" .. (degree == -1 and " active_red1" or "") }, + content = _"should not" + } + end + if degree == nil then + ui.tag{ + tag = "span", + attr = { class = "action" .. (degree == nil and " active" or "") }, + content = _"neutral" + } + end + if degree == 1 then + ui.tag{ + tag = "span", + attr = { class = "action" .. (degree == 1 and " active_green1" or "") }, + content = _"should" + } + end + if degree == 2 then + ui.tag{ + tag = "span", + attr = { class = "action" .. (degree == 2 and " active_green2" or "") }, + content = _"must" + } + end + else + -- we need to put initiative_id into the parameters to have a redirect target in case the suggestion is gone after the action + params = param.get_all_cgi() + params['initiative_id'] = initiative.id + + ui.link{ + attr = { class = "action" .. (degree == 2 and " active_green2" or "") }, + text = _"must", + module = "opinion", + action = "update", + routing = { default = { mode = "redirect", module = request.get_module(), view = request.get_view(), id = param.get_id_cgi(), params = params } }, + params = { + suggestion_id = record.id, + degree = 2 + }, + partial = partial + } + slot.put(" ") + ui.link{ + attr = { class = "action" .. (degree == 1 and " active_green1" or "") }, + text = _"should", + module = "opinion", + action = "update", + routing = { default = { mode = "redirect", module = request.get_module(), view = request.get_view(), id = param.get_id_cgi(), params = params} }, + params = { + suggestion_id = record.id, + degree = 1 + }, + partial = partial + } + slot.put(" ") + ui.link{ + attr = { class = "action" .. (degree == nil and " active" or "") }, + text = _"neutral", + module = "opinion", + action = "update", + routing = { default = { mode = "redirect", module = request.get_module(), view = request.get_view(), id = param.get_id_cgi(), params = params } }, + params = { + suggestion_id = record.id, + delete = true + }, + partial = partial + } + slot.put(" ") + ui.link{ + attr = { class = "action" .. (degree == -1 and " active_red1" or "") }, + text = _"should not", + module = "opinion", + action = "update", + routing = { default = { mode = "redirect", module = request.get_module(), view = request.get_view(), id = param.get_id_cgi(), params = params } }, + params = { + suggestion_id = record.id, + degree = -1 + }, + partial = partial + } + slot.put(" ") + ui.link{ + attr = { class = "action" .. (degree == -2 and " active_red2" or "") }, + text = _"must not", + module = "opinion", + action = "update", + routing = { default = { mode = "redirect", module = request.get_module(), view = request.get_view(), id = param.get_id_cgi(), params = params } }, + params = { + suggestion_id = record.id, + degree = -2 + }, + partial = partial + } + end + elseif app.session.member_id then + ui.field.text{ value = _"[No voting privilege]" } + else + ui.field.text{ value = _"[Registered members only]" } + end + end + } + end + }, + { + label = _"Suggestion currently not implemented", + label_attr = { style = "width: 101px;" }, + content = function(record) + if record.minus2_unfulfilled_count then + local max_value = record.initiative.supporter_count + ui.bargraph{ + max_value = max_value, + width = 100, + bars = { + { color = "#0a0", value = record.plus2_unfulfilled_count }, + { color = "#8f8", value = record.plus1_unfulfilled_count }, + { color = "#eee", value = max_value - record.minus2_unfulfilled_count - record.minus1_unfulfilled_count - record.plus1_unfulfilled_count - record.plus2_unfulfilled_count }, + { color = "#f88", value = record.minus1_unfulfilled_count }, + { color = "#a00", value = record.minus2_unfulfilled_count }, + } + } + end + end + }, + { + label = _"Suggestion currently implemented", + label_attr = { style = "width: 101px;" }, + content = function(record) + if record.minus2_fulfilled_count then + local max_value = record.initiative.supporter_count + ui.bargraph{ + max_value = max_value, + width = 100, + bars = { + { color = "#0a0", value = record.plus2_fulfilled_count }, + { color = "#8f8", value = record.plus1_fulfilled_count }, + { color = "#eee", value = max_value - record.minus2_fulfilled_count - record.minus1_fulfilled_count - record.plus1_fulfilled_count - record.plus2_fulfilled_count}, + { color = "#f88", value = record.minus1_fulfilled_count }, + { color = "#a00", value = record.minus2_fulfilled_count }, + } + } + end + end + }, + { + label = app.session.member_id and _"I consider suggestion as" or nil, + label_attr = { style = "width: 100px; font-style: italic;" }, + content = function(record) + local degree + local opinion + if app.session.member_id then + opinion = Opinion:by_pk(app.session.member.id, record.id) + end + if opinion then + degree = opinion.degree + end + if opinion then + + ui.link{ + attr = { class = opinion.fulfilled and "action active" or "action" }, + text = _"implemented", + module = "opinion", + action = "update", + routing = { default = { mode = "redirect", module = request.get_module(), view = request.get_view(), id = param.get_id_cgi(), params = param.get_all_cgi() } }, + params = { + suggestion_id = record.id, + fulfilled = true + }, + partial = partial + } + slot.put("
") + ui.link{ + attr = { class = not opinion.fulfilled and "action active" or "action" }, + text = _"not implemented", + module = "opinion", + action = "update", + routing = { default = { mode = "redirect", module = request.get_module(), view = request.get_view(), id = param.get_id_cgi(), params = param.get_all_cgi() } }, + params = { + suggestion_id = record.id, + fulfilled = false + }, + partial = partial + } + + end + end + }, + { + label = app.session.member_id and _"So I'm" or nil, + content = function(record) + local opinion + if app.session.member_id then + opinion = Opinion:by_pk(app.session.member.id, record.id) + end + if opinion then + if (opinion.fulfilled and opinion.degree > 0) or (not opinion.fulfilled and opinion.degree < 0) then + local title = _"satisfied" + ui.image{ attr = { alt = title, title = title }, static = "icons/emoticon_happy.png" } + elseif opinion.degree == 1 or opinion.degree == -1 then + local title = _"a bit unsatisfied" + ui.image{ attr = { alt = title, title = title }, static = "icons/emoticon_unhappy.png" } + else + local title = _"more unsatisfied" + ui.image{ attr = { alt = title, title = title }, static = "icons/emoticon_unhappy_red.png" } + end + end + end + }, + } + } + end + } + end +} diff -r 46b94112781d -r cc64a4fc6ab6 app/main/suggestion/_suggestion.lua --- a/app/main/suggestion/_suggestion.lua Wed Jun 27 12:35:34 2012 +0200 +++ b/app/main/suggestion/_suggestion.lua Wed Jun 27 14:37:46 2012 +0200 @@ -19,7 +19,7 @@ } execute.view{ module = "suggestion", - view = "_list", + view = "_list_element", params = { suggestions_selector = Suggestion:new_selector():add_where{ "id = ?", suggestion.id }, initiative = suggestion.initiative, diff -r 46b94112781d -r cc64a4fc6ab6 app/main/suggestion/show.lua --- a/app/main/suggestion/show.lua Wed Jun 27 12:35:34 2012 +0200 +++ b/app/main/suggestion/show.lua Wed Jun 27 14:37:46 2012 +0200 @@ -21,9 +21,9 @@ app.html_title.title = suggestion.name app.html_title.subtitle = _("Suggestion ##{id}", { id = suggestion.id }) -slot.put_into("title", encode.html(_"Suggestion for initiative: '#{name}'":gsub("#{name}", suggestion.initiative.name) )) +ui.title(_"Suggestion for initiative: '#{name}'":gsub("#{name}", suggestion.initiative.name)) -slot.select("actions", function() +ui.actions(function() ui.link{ content = function() ui.image{ static = "icons/16/resultset_previous.png" } diff -r 46b94112781d -r cc64a4fc6ab6 static/style.css --- a/static/style.css Wed Jun 27 12:35:34 2012 +0200 +++ b/static/style.css Wed Jun 27 14:37:46 2012 +0200 @@ -68,10 +68,6 @@ margin: 0 auto; } -table { - margin-top: 1ex; -} - body, a { color: #000; } @@ -321,7 +317,6 @@ .member_thumb, .member_statement, -.draft_content, .suggestion_content, .slot_head, .area_list, @@ -329,7 +324,6 @@ .issues .issue, .ui_tabs_links a, .ui_filter a, -.draft_content, .help, .use_terms, .motd, @@ -375,6 +369,10 @@ line-height: 120%; } +.initiative_head { + margin-bottom: 10px; +} + .page_head .actions:last-child, .page_head .unit_head .content:last-child, .page_head .area_head .content:last-child, @@ -1211,30 +1209,34 @@ text-decoration: line-through; } +.admitted_info, +.not_admitted_info, +.revoked_info, +.draft_updated_info, +.initiator_invite_info { + padding: 1ex; +} + .admitted_info { background-color: #afc; - padding: 1ex; - border-radius: 0 0 8px 8px; } .not_admitted_info, .revoked_info { background-color: #fbb; - padding: 1ex; - border-radius: 8px; - border-radius: 0 0 8px 8px; } .draft_updated_info, -.initiator_invite_info, +.initiator_invite_info { + background-color: #fda; +} + .motd, .public_access_issue_head { background-color: #fda; padding: 1ex; margin-top: 1ex; margin-bottom: 2ex; - border: 1px solid #fa0; - border-radius: 10px; } .suggestion_fulfilled { @@ -1336,6 +1338,7 @@ display: block; font-size: 115%; font-weight: bold; + margin-bottom: 10px; } .heading.first { @@ -1418,7 +1421,6 @@ /* shadows */ .member_statement, -.draft_content, .suggestion_content, .initiative_head, .box, @@ -1427,7 +1429,6 @@ } .member_statement, -.draft_content, .suggestion_content, .initiative_head, .box {