# HG changeset patch # User bsw # Date 1299335657 -3600 # Node ID 1dab81353eb1b15227bdc34653b8ec3b0936b9f8 # Parent 7e3acb2f6284988959369b5278357dfec05d120f More enhancements for second generation frontend diff -r 7e3acb2f6284 -r 1dab81353eb1 app/main/lf2/_area.lua --- a/app/main/lf2/_area.lua Thu Mar 03 23:47:35 2011 +0100 +++ b/app/main/lf2/_area.lua Sat Mar 05 15:34:17 2011 +0100 @@ -28,9 +28,9 @@ execute.view{ module = "lf2", view = "_avatars", params = { members = trustees, arrows = true, size = "small" } } end } if trustees[1].scope_out == "area" then - text = _"Change or revoke area delegation..." + text = _"Change or revoke area delegation" else - text = _"Set area delegation..." + text = _"Set area delegation" end ui.box_col{ class = "right", content = function() ui.link{ @@ -71,7 +71,7 @@ slot.put(" · ") end ui.link{ - text = _"Set area delegation...", + text = _"Set area delegation", module = "lf2", view = "delegation", params = { area_id = area.id } } end diff -r 7e3acb2f6284 -r 1dab81353eb1 app/main/lf2/_areas.lua --- a/app/main/lf2/_areas.lua Thu Mar 03 23:47:35 2011 +0100 +++ b/app/main/lf2/_areas.lua Sat Mar 05 15:34:17 2011 +0100 @@ -1,6 +1,7 @@ local areas = param.get("areas_selector", "table"):exec() local current_area_id = param.get("current_area_id", atom.integer) local head_content = param.get("head_content", "function") +local current_phase = param.get("current_phase") if #areas == 0 then return @@ -8,34 +9,32 @@ areas:load("membership_for_member", { member_id = app.session.member_id}, "membership") -ui.box{ class = "areas", row_count = #areas + 1, content = function() - if head_content then - ui.box_row{ class = "head", content = function() ui.box_col{ class = "head", content = function() - ui.link{ content = head_content, module = "lf2", view = "index" } - end } end } +for i, area in ipairs(areas) do + local delegation = Delegation:by_pk(app.session.member_id, area.id) + + local class = "area" + if (current_area_id and area.id == current_area_id) + or (not current_area_id and area.membership) + then + class = class .. " active" end - - for i, area in ipairs(areas) do - local delegation = Delegation:by_pk(app.session.member_id, area.id) - - local class = "area" - if (current_area_id and area.id == current_area_id) - or (not current_area_id and area.membership) - then - class = class .. " active" + ui.box_row{ + class = class, + content = function() + ui.box_col{ class = "name", content = function() + if delegation then + execute.view{ module = "lf2", view = "_avatars", params = { + members = { delegation.trustee }, size = "small" + } } + end + ui.link{ + module = "lf2", view = "area", id = area.id, params = { + phase = current_phase, order = current_order + }, + text = area.name + } + end } end - ui.box_row{ - class = class, - content = function() - ui.box_col{ class = "name", content = function() - if delegation then - execute.view{ module = "lf2", view = "_avatars", params = { members = { delegation.trustee }, size = "small" } } - end - ui.link{ module = "lf2", view = "area", id = area.id, text = area.name } - end } - end - } - - end - -end } + } + +end diff -r 7e3acb2f6284 -r 1dab81353eb1 app/main/lf2/_filter_view/10_topnav.lua --- a/app/main/lf2/_filter_view/10_topnav.lua Thu Mar 03 23:47:35 2011 +0100 +++ b/app/main/lf2/_filter_view/10_topnav.lua Sat Mar 05 15:34:17 2011 +0100 @@ -1,44 +1,67 @@ -local state = param.get("state") +execute.inner() + +local phase +if app.topnav_phase then + phase = app.topnav_phase +else + phase = param.get("phase") +end + +local area_id +if app.topnav_area_id then + area_id = app.topnav_area_id +else + area_id = param.get_all_cgi()["area_id"] +end + local order = param.get("order") +local view +local id +if area_id then + view = "area" + id = area_id +else + view = "index" +end + slot.select("topnav", function() ui.link{ - attr = { class = state == "closed" and "active" or nil }, - text = _"Closed", module = "lf2", view = "index", params = { state = "closed", order = order } + attr = { class = phase == "closed" and "active" or nil }, + text = _"Closed", module = "lf2", view = view, id = id, params = { phase = "closed", order = order } } ui.link{ - attr = { class = state == "voting" and "active" or nil }, - text = _"Voting", module = "lf2", view = "index", params = { state = "voting", order = order } + attr = { class = phase == "voting" and "active" or nil }, + text = _"Voting", module = "lf2", view = view, id = id, params = { phase = "voting", order = order } } ui.link{ - attr = { class = state == "frozen" and "active" or nil }, - text = _"Frozen", module = "lf2", view = "index", params = { state = "frozen", order = order } + attr = { class = phase == "frozen" and "active" or nil }, + text = _"Frozen", module = "lf2", view = view, id = id, params = { phase = "frozen", order = order } } ui.link{ - attr = { class = state == "discussion" and "active" or nil }, - text = _"Discussion", module = "lf2", view = "index", params = { state = "discussion", order = order } + attr = { class = phase == "discussion" and "active" or nil }, + text = _"Discussion", module = "lf2", view = view, id = id, params = { phase = "discussion", order = order } } ui.link{ - attr = { class = state == "new" and "active" or nil }, - text = _"New", module = "lf2", view = "index", params = { state = "new", order = order } + attr = { class = phase == "new" and "active" or nil }, + text = _"New", module = "lf2", view = view, id = id, params = { phase = "new", order = order } } ui.container{ attr = { class = "right" }, content = function() ui.link{ attr = { class = order == "last_change" and "active" or nil }, - text = _"Last change", module = "lf2", view = "index", params = { order = "last_change", state = state } + text = _"Last change", module = "lf2", view = view, id = id, params = { order = "last_change", state = state } } ui.link{ attr = { class = order == "time_left" and "active" or nil }, - text = _"Time left", module = "lf2", view = "index", params = { order = "time_left", state = state } + text = _"Time left", module = "lf2", view = view, id = id, params = { order = "time_left", state = state } } ui.link{ attr = { class = order == "interest" and "active" or nil }, - text = _"Interest", module = "lf2", view = "index", params = { order = "interest", state = state } + text = _"Interest", module = "lf2", view = view, id = id, params = { order = "interest", state = state } } end } end) -execute.inner() \ No newline at end of file diff -r 7e3acb2f6284 -r 1dab81353eb1 app/main/lf2/_initiative.lua --- a/app/main/lf2/_initiative.lua Thu Mar 03 23:47:35 2011 +0100 +++ b/app/main/lf2/_initiative.lua Sat Mar 05 15:34:17 2011 +0100 @@ -45,32 +45,9 @@ end end -if initiative.issue.closed then - if initiative.issue.accepted then - if initiative.admitted then - if initiative.agreed then - if initiative.rank == 1 then - ui.image{ static = "lf2/icon_award_gold.png" } - else - ui.image{ static = "lf2/icon_award_silver.png" } - end - slot.put(" ") - ui.tag{ content = initiative.rank } - else - ui.image{ attr = { title = _"Initiative not agreed" }, static = "lf2/icon_cross.png" } - end - else - ui.image{ attr = { title = _"Initiative not admitted" }, static = "lf2/icon_cross.png" } - end - else - ui.image{ attr = { title = _"Issue not accepted" }, static = "lf2/icon_cross.png" } - end - slot.put(" ") -end - ui.link{ module = "lf2", view = "initiative", id = initiative.id, - params = { tab = "draft" }, attr = { class = "name" }, + attr = { class = "name" }, text = initiative.name } diff -r 7e3acb2f6284 -r 1dab81353eb1 app/main/lf2/_initiative_support.lua --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/main/lf2/_initiative_support.lua Sat Mar 05 15:34:17 2011 +0100 @@ -0,0 +1,51 @@ +local initiative = param.get("initiative", "table") +local supporter = Supporter:by_pk(initiative.id, app.session.member.id) + +local routing = { + default = { + mode = "redirect", + module = "lf2", + view = "initiative", + id = initiative.id + } +} + +if not initiative.issue.fully_frozen and not initiative.issue.closed then + ui.box_row{ content = function() + if supporter then + ui.box_col{ class = "left", content = function() + if not supporter:has_critical_opinion() then + ui.image{ static = "lf2/icon_star.png" } + slot.put(" ") + ui.tag{ content = _"Your are supporter" } + else + ui.image{ static = "lf2/icon_star.png" } + slot.put(" ") + ui.tag{ content = _"Your are potential supporter" } + end + end } + ui.box_col{ class = "right", content = function() + ui.link{ + text = _"Remove support", + module = "initiative", + action = "remove_support", + id = initiative.id, + routing = routing, + } + end } + elseif not initiative.revoked then + ui.box_col{ content = function() + ui.image{ static = "lf2/icon_star_grey.png" } + slot.put(" ") + ui.link{ + text = _"Support this initiative", + module = "initiative", + action = "add_support", + id = initiative.id, + routing = routing + } + end } + end + end } +end + diff -r 7e3acb2f6284 -r 1dab81353eb1 app/main/lf2/_interested.lua --- a/app/main/lf2/_interested.lua Thu Mar 03 23:47:35 2011 +0100 +++ b/app/main/lf2/_interested.lua Sat Mar 05 15:34:17 2011 +0100 @@ -1,5 +1,5 @@ local interested_members = param.get("interested_members", "table") -ui.box{ content = function() +ui.box{ row_count = 2, content = function() ui.box_row{ class = "head interested", content = function() ui.box_col{ class = "head left", content = _"Members, interested in this issue" } ui.box_col{ class = "right", content = _("#{count} members", { count = #interested_members }) } diff -r 7e3acb2f6284 -r 1dab81353eb1 app/main/lf2/_issue_initiatives.lua --- a/app/main/lf2/_issue_initiatives.lua Thu Mar 03 23:47:35 2011 +0100 +++ b/app/main/lf2/_issue_initiatives.lua Sat Mar 05 15:34:17 2011 +0100 @@ -1,15 +1,17 @@ local initiatives = param.get("initiatives", "table") +local current_initiative_id = param.get("current_initiative_id", atom.integer) for i, initiative in ipairs(initiatives) do - local first = "" - if i == 1 then first = " first" end + local class = "initiative" + if i == 1 then class = class .. " first" end + if initiative.id == current_initiative_id then class = class .. " active" end - ui.box_row{ class = "initiative" .. first, content = function() ui.box_col { content = function() + ui.box_row{ class = class, content = function() ui.box_col { content = function() ui.link{ module = "lf2", view = "initiative", id = initiative.id, - params = { tab = "draft" }, attr = { class = "name" }, + attr = { class = "name" }, text = initiative.name } diff -r 7e3acb2f6284 -r 1dab81353eb1 app/main/lf2/_issues.lua --- a/app/main/lf2/_issues.lua Thu Mar 03 23:47:35 2011 +0100 +++ b/app/main/lf2/_issues.lua Sat Mar 05 15:34:17 2011 +0100 @@ -29,10 +29,23 @@ local delegation = issue_delegation or area_delegation or global_delegation local delegating_interest = issue.delegating_interest + --[[ + local current_delegating_interest = false - ui.box{ class = "issue", content = function() + for i, trustee in ipairs(trustees) do + if i > 1 and trustee.participation then + delegating_interest = true + end + end + --]] + local row_count = #initiatives + 3 + if #trustees > 1 then + row_count = row_count + 1 + end + + ui.box{ class = "issue", row_count = row_count, content = function() - ui.box_row{ class = "head", content = function() + ui.box_row{ class = "head2", content = function() ui.box_col{ class = "issue_id left head", content = function() ui.link{ @@ -50,7 +63,7 @@ end } - ui.box_row{ class = "head2", content = function() + ui.box_row{ class = "head", content = function() ui.box_col{ class = "state_name left", content = function() ui.tag{ content = issue.state_name } @@ -61,15 +74,19 @@ end } if #trustees > 1 then - ui.box_row{ class = "head2", content = function() + local class = "head2" + if issue.closed or issue.fully_frozen then + class = class .. " head2_last" + end + ui.box_row{ class = class, content = function() ui.box_col{ class = "left", content = function() execute.view{ module = "lf2", view = "_avatars", params = { members = trustees, arrows = true, size = "small" } } end } if not issue.closed and not issue.fully_frozen then if trustees[1].scope_out == "issue" then - text = _"Change or revoke issue delegation..." + text = _"Change or revoke issue delegation" else - text = _"Set issue delegation..." + text = _"Set issue delegation" end ui.box_col{ class = "right", content = function() ui.link{ @@ -81,28 +98,32 @@ end } end - ui.box_row{ class = "head2", content = function() - ui.box_col{ class = "interest left", content = function() - if interest then - ui.image{ static = "lf2/icon_star.png" } - if issue.close then - slot.put(" ", _"You were interested in this issue") - else - slot.put(" ", _"You are interested in this issue") + if not issue.closed and not issue.fully_frozen then + ui.box_row{ class = "head2 head2_last", content = function() + ui.box_col{ class = "interest left", content = function() + if interest then + ui.image{ static = "lf2/icon_star.png" } + if issue.close then + slot.put(" ", _"You were interested in this issue") + else + slot.put(" ", _"You are interested in this issue") + end + elseif delegating_interest then + ui.image{ static = "lf2/icon_delegated_star.png" } + if issue.closed then + slot.put(" ", _"Someone in your delegation chain was interested") + else + slot.put(" ", _"Someone in your delegation chain is interested") + end + elseif not issue.closed and not issue.fully_frozen then + ui.link{ + text = _"Add my interest", + module = "interest", action = "update", params = { issue_id = issue.id }, + routing = { default = { mode = "redirect", module = "lf2", view = "issue", id = issue.id } } + } end - elseif delegating_interest then - ui.image{ static = "lf2/icon_delegated_star.png" } - if issue.closed then - slot.put(" ", _"You were interested in this issue by delegation") - else - slot.put(" ", _"You are interested in this issue by delegation") - end - else - slot.put(_"You are not interested in this issue") - end - end } + end } - if not issue.closed and not issue.fully_frozen then ui.box_col{ class = "right", content = function() if interest then ui.link{ @@ -110,24 +131,25 @@ module = "interest", action = "update", params = { issue_id = issue.id, delete = true }, routing = { default = { mode = "redirect", module = "lf2", view = "issue", id = issue.id } } } - else + slot.put(" · ") + elseif delegating_interest then ui.link{ text = _"Add my interest", module = "interest", action = "update", params = { issue_id = issue.id }, routing = { default = { mode = "redirect", module = "lf2", view = "issue", id = issue.id } } } + slot.put(" · ") end if #trustees == 1 then - slot.put(" · ") ui.link{ - text = _"Set issue delegation...", + text = _"Set issue delegation", module = "lf2", view = "delegation", params = { issue_id = issue.id } } end end } - end + end } - end } + end for i, initiative in ipairs(issue.initiatives) do ui.box_row{ class = "initiative", content = function() ui.box_col { content = function() diff -r 7e3acb2f6284 -r 1dab81353eb1 app/main/lf2/_search.lua --- a/app/main/lf2/_search.lua Thu Mar 03 23:47:35 2011 +0100 +++ b/app/main/lf2/_search.lua Sat Mar 05 15:34:17 2011 +0100 @@ -1,4 +1,4 @@ -ui.box{ class = "search", content = function() +ui.box{ row_count = 2, class = "search", content = function() ui.box_row{ class = "head", content = function() ui.box_col{ class = "head", content = _"Search in initiatives" } end } ui.box_row{ content = function() ui.box_col{ content = function() diff -r 7e3acb2f6284 -r 1dab81353eb1 app/main/lf2/_sidebar.lua --- a/app/main/lf2/_sidebar.lua Thu Mar 03 23:47:35 2011 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -local current_area_id = param.get("current_area_id", atom.integer) - -local member_areas_selector = Area:build_selector{ - member_id = app.session.member_id, - order = "name" -} -local other_areas_selector = Area:build_selector{ - not_member_id = app.session.member_id, - order = "name" -} - -execute.view{ module = "lf2", view = "_sidebar_unit", params = { unit = {} } } --TODO - -ui.form{ - method = "get", - content = function() - - ui.container{ attr = { class = "boxhead" }, content = _"" } - --execute.view{ module = "lf2", view = "_areas", params = { areas_selector = member_areas_selector } } - - execute.view{ - module = "lf2", view = "_areas", params = { - areas_selector = member_areas_selector, - current_area_id = current_area_id, - head_content = function() ui.tag{ content = _"Areas, you are member of" } end - } - } - - execute.view{ - module = "lf2", view = "_areas", params = { - areas_selector = other_areas_selector, - current_area_id = current_area_id, - head_content = function() ui.tag{ content = _"Areas, you are not member of" } end - } - } - - end -} - -execute.view{ module = "lf2", view = "_search", params = { area = area } } - diff -r 7e3acb2f6284 -r 1dab81353eb1 app/main/lf2/_sidebar_drafts.lua --- a/app/main/lf2/_sidebar_drafts.lua Thu Mar 03 23:47:35 2011 +0100 +++ b/app/main/lf2/_sidebar_drafts.lua Sat Mar 05 15:34:17 2011 +0100 @@ -5,53 +5,52 @@ :add_order_by("id DESC") :exec() +ui.form{ + method = "get", + module = "draft", + view = "diff", + content = function() + ui.box{ class = "drafts", content = function() + if drafts then -ui.box{ class = "drafts", content = function() - if drafts then - ui.form{ - method = "get", - module = "draft", - view = "diff", - content = function() ui.box_row{ class = "head", content = function() ui.box_col{ class = "head", content = _"Draft revisions" } end } - ui.box_row{ class = "", content = function() - ui.box_col{ class = "scrolled", content = function() - for i, draft in ipairs(drafts) do - local class = "draft" - if i == 1 then class = class .. " first" end - ui.box_row{ class = class, content = function() - ui.box_col{ class = "left", content = function() - ui.link{ - attr = { class = "created" }, - text = format.timestamp(draft.created), - module = "draft", - view = "show", - id = draft.id - } - slot.put("
") + ui.box_row{ content = function() ui.box_col{ class = "scrolled", content = function() + for i, draft in ipairs(drafts) do + local class = "draft" + if i == 1 then class = class .. " first" end + ui.box_row{ class = class, content = function() + ui.box_col{ class = "left", content = function() + ui.link{ + attr = { class = "created" }, + text = format.timestamp(draft.created), + module = "draft", + view = "show", + id = draft.id + } + ui.container{ attr = { class = "authors" }, content = function() ui.tag{ content = _"by" } slot.put(" ") ui.link{ - attr = { class = "author_name" }, module = "lf2", view = "issue", id = initiative.issue_id, params = { member_id = author_id }, text = draft.author.name } - end } - ui.box_col{ class = "right", content = function() - slot.put('') - slot.put('') end } + end } + ui.box_col{ class = "right", content = function() + slot.put('') + slot.put('') end } - end - end } end } + end } + end + end } end } - ui.box_row{ content = function() ui.box_col{ class = "right", content = function() + ui.box_row{ class = "last", content = function() ui.box_col{ class = "right", content = function() ui.submit{ text = _"Compare selected" } end } end } + end - } - else + end } end -end } +} diff -r 7e3acb2f6284 -r 1dab81353eb1 app/main/lf2/_sidebar_initiatives.lua --- a/app/main/lf2/_sidebar_initiatives.lua Thu Mar 03 23:47:35 2011 +0100 +++ b/app/main/lf2/_sidebar_initiatives.lua Sat Mar 05 15:34:17 2011 +0100 @@ -1,14 +0,0 @@ -local head_content = param.get("head_content", "function") - -local initiatives = param.get("initiatives", "table") -ui.box{ content = function() - if head_content then - ui.box_row{ class = "head", content = function() ui.box_col{ class = "head", content = head_content } end } - end - ui.box_row{ class = "initiatives", content = function() - ui.box_col{ class = "scrolled", content = function() - execute.view{ module = "lf2", view = "_issue_initiatives", params = { initiatives = initiatives } } - end } - end } -end } - diff -r 7e3acb2f6284 -r 1dab81353eb1 app/main/lf2/_sidebar_issue.lua --- a/app/main/lf2/_sidebar_issue.lua Thu Mar 03 23:47:35 2011 +0100 +++ b/app/main/lf2/_sidebar_issue.lua Sat Mar 05 15:34:17 2011 +0100 @@ -1,6 +1,8 @@ local issue = param.get("issue", "table") local initiative_id = param.get("initiative_id", atom.integer) +local alternative_initiatives = param.get("alternative_initiatives", "table") + local initiatives = issue.initiatives local interested_members_selector = Member:new_selector() @@ -21,16 +23,9 @@ ui.box{ class = "issue", content = function() - ui.box_row{ class = "issue_id head", content = function() ui.box_col{ class = "head", content = function() - ui.link{ - module = "lf2", view = "issue", id = issue.id, - content = _("Issue ##{id}", { id = issue.id }) - } - end } end } - ui.box_row{ class = "unit_name head2", content = function() ui.box_col{ content = function() ui.link{ - module = "lf2", view = "unit", id = 1, + module = "lf2", view = "index", id = 1, content = "DE / Berlin / Friedrichshain-Kreuzberg" } end } end } @@ -42,6 +37,13 @@ } end } end } + ui.box_row{ class = "issue_id head2", content = function() ui.box_col{ class = "head", content = function() + ui.link{ + module = "lf2", view = "issue", id = issue.id, + content = _("Issue ##{id}", { id = issue.id }) + } + end } end } + ui.box_row{ class = "policy_name head2", content = function() ui.box_col{ content = function() ui.link{ module = "lf2", view = "policy", id = issue.policy_id, @@ -49,7 +51,7 @@ } end } end } - ui.box_row{ class = "time_left", content = function() + ui.box_row{ class = "time_left head", content = function() ui.box_col{ content = issue.closed and _("Closed since #{date}", { date = format.date(issue.closed.date) }) or _("#{time_left} left", { time_left = issue.state_time_left }) } end } @@ -65,7 +67,7 @@ if not issue.closed and not issue.fully_frozen then ui.image{ static = "lf2/icon_star_grey.png" } end - slot.put(_"You are not interested in this issue") + slot.put(" ", _"You are not interested in this issue") end if issue.closed then @@ -117,13 +119,15 @@ ui.box_row{ class = "delegation hoverbutton_container", content = function() ui.box_col{ content = function() if trustees[1].scope_out then + ui.image{ static = "lf2/icon_delegation.png" } + slot.put(" ") if trustees[1].disabled_out == false then if trustees[1].scope_out == "issue" then - slot.put(encode.html(_"You have delegated this issue")) + slot.put(encode.html(_"Issue is delegated")) elseif trustees[1].scope_out == "area" then - slot.put(encode.html(_"You have delegated this area")) + slot.put(encode.html(_"Area is delegated")) elseif trustees[1].scope_out == "global" then - slot.put(encode.html(_"You have delegated globally")) + slot.put(encode.html(_"Unit wide delegated")) end else if trustees[1].scope_out == "issue" then @@ -144,14 +148,19 @@ slot.put(" ", encode.html(_"This issue is closed")) end } end } + elseif issue.fully_frozen then + ui.container{ attr = { class = "hoverbutton noaction"}, content = function() + ui.container{ attr = { class = "content"}, content = function() + slot.put(" ", encode.html(_"This issue is in voting")) + end } + end } else - if #trustees > 1 then + if #trustees > 1 and trustees[1].scope_out == "issue" then ui.link{ module = "lf2", view = "delegation", params = { issue_id = issue.id, initiative_id = initiative_id }, attr = { class = "hoverbutton red"}, content = function() ui.container{ attr = { class = "content"}, content = function() - ui.image{ static = "lf2/icon_delegation.png" } - slot.put(" ", encode.html(_"Change issue delegation...")) + slot.put(" ", encode.html(_"Change issue delegation")) end } end } @@ -160,9 +169,7 @@ module = "lf2", view = "delegation", params = { issue_id = issue.id, initiative_id = initiative_id }, attr = { class = "hoverbutton green"}, content = function() ui.container{ attr = { class = "content"}, content = function() - ui.image{ static = "lf2/icon_delegation.png" } - slot.put(" ") - slot.put(" ", encode.html(_"Set issue delegation...")) + slot.put(" ", encode.html(_"Set issue delegation")) end } end } @@ -178,4 +185,12 @@ end } end } end + ui.box_row{ class = "subhead", content = function() ui.box_col{ class = "head", content = _"Initiatives in this issue" } end } + ui.box_row{ class = "initiatives last", content = function() + ui.box_col{ class = "scrolled", content = function() + execute.view{ module = "lf2", view = "_issue_initiatives", params = { initiatives = alternative_initiatives, current_initiative_id = initiative_id } } + end } + end } + + end } diff -r 7e3acb2f6284 -r 1dab81353eb1 app/main/lf2/_sidebar_unit.lua --- a/app/main/lf2/_sidebar_unit.lua Thu Mar 03 23:47:35 2011 +0100 +++ b/app/main/lf2/_sidebar_unit.lua Sat Mar 05 15:34:17 2011 +0100 @@ -1,4 +1,16 @@ -local unit = param.get("unit", "table") +local current_area_id = param.get("current_area_id", atom.integer) +local current_phase = param.get_all_cgi()["phase"] + +local member_areas_selector = Area:build_selector{ + member_id = app.session.member_id, + order = "name" +} +local other_areas_selector = Area:build_selector{ + not_member_id = app.session.member_id, + order = "name" +} + +local unit = {} local trustees = Member:new_selector() :add_field("delegation_chain.*") @@ -6,7 +18,12 @@ :add_order_by("index") :exec() -ui.box{ content = function() +local row_count = member_areas_selector:count() + other_areas_selector:count() + 4 +if #trustees > 1 then + row_count = row_count + 1 +end + +ui.box{ row_count = row_count, content = function() ui.box_row{ class = "head", content = function() ui.box_col{ class = "head", content = _"DE / Berlin / Friedrichshain-Kreuzberg" } end } @@ -19,9 +36,9 @@ ui.box_row{ content = function() ui.box_col{ content = function() if trustees[1].scope_out == "global" then - text = _"Change or revoke unit delegation..." + text = _"Change or revoke unit delegation" else - text = _"Set unit delegation..." + text = _"Set unit delegation" end ui.link{ text = text, @@ -29,5 +46,38 @@ } end } end } + + ui.form{ + method = "get", + content = function() + + ui.box_row{ class = "subhead", content = function() ui.box_col{ class = "head", content = function() + ui.link{ text = _"Areas, you are member of", module = "lf2", view = "index" } + end } end } + + execute.view{ + module = "lf2", view = "_areas", params = { + areas_selector = member_areas_selector, + current_area_id = current_area_id, + current_phase = current_phase + } + } + + ui.box_row{ class = "subhead", content = function() ui.box_col{ class = "head", content = function() + ui.link{ content = _"Other areas", module = "lf2", view = "index" } + end } end } + + execute.view{ + module = "lf2", view = "_areas", params = { + areas_selector = other_areas_selector, + current_area_id = current_area_id, + current_phase = current_phase + } + } + + end + } + end } - \ No newline at end of file + +execute.view{ module = "lf2", view = "_search", params = { area = area } } diff -r 7e3acb2f6284 -r 1dab81353eb1 app/main/lf2/area.lua --- a/app/main/lf2/area.lua Thu Mar 03 23:47:35 2011 +0100 +++ b/app/main/lf2/area.lua Sat Mar 05 15:34:17 2011 +0100 @@ -3,7 +3,7 @@ slot.set_layout("lf2") slot.select("sidebar", function() - execute.view{ module = "lf2", view = "_sidebar", params = { current_area_id = area.id } } + execute.view{ module = "lf2", view = "_sidebar_unit", params = { current_area_id = area.id } } end) execute.view{ module = "lf2", view = "_area", params = { area = area } } @@ -11,7 +11,7 @@ local issues_selector = Issue:build_selector{ area_id = area.id, - state = param.get("state"), + phase = param.get("phase"), order = param.get("order") }:limit(25) @@ -21,4 +21,7 @@ issues:load("interest_for_member", { member_id = app.session.member_id }, "interest") issues:load("outgoing_delegations_for_member", { member_id = app.session.member_id }, "outgoing_delegations") + +app.topnav_area_id = area.id + execute.view{ module = "lf2", view = "_issues", params = { issues = issues } } diff -r 7e3acb2f6284 -r 1dab81353eb1 app/main/lf2/delegation.lua --- a/app/main/lf2/delegation.lua Thu Mar 03 23:47:35 2011 +0100 +++ b/app/main/lf2/delegation.lua Sat Mar 05 15:34:17 2011 +0100 @@ -130,6 +130,9 @@ } end } end } + ui.box_row{ content = function() + ui.box_col{ content = _"Please note: Member, interest and supporter counts are calculated periodically, therefore it can take some time until your changes become effective everywhere." } + end } ui.box_row{ content = function() ui.box_col{ content = function() ui.submit{ text = _"Save" } end } end } diff -r 7e3acb2f6284 -r 1dab81353eb1 app/main/lf2/index.lua --- a/app/main/lf2/index.lua Thu Mar 03 23:47:35 2011 +0100 +++ b/app/main/lf2/index.lua Sat Mar 05 15:34:17 2011 +0100 @@ -1,12 +1,11 @@ slot.set_layout("lf2") -slot.select("sidebar", function() - execute.view{ module = "lf2", view = "_sidebar" } -end) +local current_phase = param.get("phase") +local current_order = param.get("order") local issues_selector = Issue:build_selector{ - state = param.get("state"), - order = param.get("order") + phase = current_phase, + order = current_order }:limit(25) local issues = issues_selector:exec() @@ -15,4 +14,9 @@ issues:load("interest_for_member", { member_id = app.session.member_id }, "interest") issues:load("outgoing_delegations_for_member", { member_id = app.session.member_id }, "outgoing_delegations") + +slot.select("sidebar", function() + execute.view{ module = "lf2", view = "_sidebar_unit" } +end) + execute.view{ module = "lf2", view = "_issues", params = { issues = issues } } diff -r 7e3acb2f6284 -r 1dab81353eb1 app/main/lf2/initiative.lua --- a/app/main/lf2/initiative.lua Thu Mar 03 23:47:35 2011 +0100 +++ b/app/main/lf2/initiative.lua Sat Mar 05 15:34:17 2011 +0100 @@ -24,16 +24,15 @@ local alternative_initiatives = initiative.issue.initiatives alternative_initiatives:load("initiating_members", nil, "initiating_members") +local support = Supporter:by_pk(initiative.id, app.session.member.id) + +app.topnav_phase = issue.phase + slot.select("sidebar", function() - execute.view{ module = "lf2", view = "_sidebar_issue", params = { issue = issue, initiative_id = initiative.id } } - - execute.view{ module = "lf2", view = "_sidebar_initiatives", params = { - initiatives = alternative_initiatives, - head_content = function() ui.tag{ content = _"Alternative initiatives" } end - } } - + execute.view{ module = "lf2", view = "_sidebar_issue", params = { issue = issue, initiative_id = initiative.id, alternative_initiatives = alternative_initiatives } } + execute.view{ module = "lf2", view = "_sidebar_drafts", params = { initiative = initiative } } @@ -45,52 +44,80 @@ ui.box{ content = function() - ui.box_row{ class = "initiative head", content = function() ui.box_col { content = function() + ui.box_row{ class = "initiative head2", content = function() ui.box_col { content = function() execute.view{ module = "lf2", view = "_initiative", params = { initiative = initiative } } end } end } - ui.box_row{ class = "head2", content = function() ui.box_col{ content = function() + ui.box_row{ class = "head", content = function() ui.box_col{ content = function() + if initiative.issue.closed then + if initiative.issue.accepted then + if initiative.admitted then + if initiative.agreed then + if initiative.rank == 1 then + ui.image{ static = "lf2/icon_award_gold.png" } + slot.put(" ") + ui.tag{ content = _"Approved" } + else + ui.image{ static = "lf2/icon_award_silver.png" } + slot.put(" ") + ui.tag{ content = _("Not approved (rank #{rank})", { rank = initiative.rank }) } + end + else + ui.image{ static = "lf2/icon_cross.png" } + slot.put(" ") + ui.tag{ content = _"Initiative not approved" } + end + else + ui.image{ static = "lf2/icon_cross.png" } + slot.put(" ") + ui.tag{ content = _"Initiative not admitted" } + end + else + ui.image{ static = "lf2/icon_cross.png" } + slot.put(" ") + ui.tag{ content = _"Issue not accepted" } + end + slot.put(" ") + end + if initiative.issue.fully_frozen and initiative.issue.closed then - ui.link{ external = "#votes", text = _("#{vote_count} votes", { vote_count = #voting_members }) } + if initiative.admitted and initiative.issue.ranks_available then + slot.put(" · ") + ui.link{ external = "#votes", text = _("#{vote_count}+#{delegated_weight} votes", { vote_count = #voting_members, delegated_weight = initiative.issue.voter_count - #voting_members }) } + end + end + if initiative.issue.closed then slot.put(" · ") end ui.link{ external = "#suggestions", text = _("#{suggestion_count} suggestions", { suggestion_count = 23 }) } slot.put(" · ") - ui.link{ external = "#supporters", text = _("#{supporter_count} supporters", { supporter_count = #supporting_members }) } + ui.link{ external = "#supporters", text = _("#{supporter_count}+#{delegated_weight} supporters", { supporter_count = #supporting_members, delegated_weight = initiative.supporter_count - #supporting_members }) } end } end } + execute.view{ module = "lf2", view = "_initiative_support", params = { + initiative = initiative + } } + + ui.box_row{ class = "subhead", content = function() ui.box_col{ class = "head", content = _"Current draft" } end } ui.box_row{ content = function() ui.box_col{ content = function() execute.view{ module = "lf2", view = "_draft", params = { draft = draft } } end } end } - end -} -if initiative.issue.fully_frozen and initiative.issue.closed then - ui.boxhead{ name = "votes", content = _"Votes" } - ui.box{ - content = function() + if initiative.issue.fully_frozen and initiative.issue.closed then + ui.box_row{ class = "subhead", content = function() ui.box_col{ class = "head", content = _"Voters" } end } ui.box_row{ content = function() ui.box_col{ content = function() execute.view{ module = "lf2", view = "_avatars", params = { members = voting_members } } end } end } end - } -end -ui.boxhead{ name = "suggestions", content = _"Suggestions" } -ui.box{ - content = function() + ui.box_row{ class = "subhead", content = function() ui.box_col{ class = "head", content = _"Suggestions" } end } ui.box_row{ content = function() ui.box_col{ content = function() slot.put("suggestions") end } end } - end -} - -ui.boxhead{ name = "supporters", content = _"Supporters" } -ui.box{ - content = function() + + ui.box_row{ class = "subhead", content = function() ui.box_col{ class = "head", content = _"Supporters" } end } ui.box_row{ content = function() ui.box_col{ content = function() execute.view{ module = "lf2", view = "_avatars", params = { members = supporting_members } } end } end } - end -} - + +end } diff -r 7e3acb2f6284 -r 1dab81353eb1 app/main/lf2/interest.lua --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/main/lf2/interest.lua Sat Mar 05 15:34:17 2011 +0100 @@ -0,0 +1,61 @@ +slot.set_layout("lf2") + + +local issue = Issue:by_id(param.get_id()) +local member = Member:by_id(param.get("member", atom.integer)) + +local area = issue.area + +-- TODO broken +--issue:load("interested_members_snapshot", {}, "interested_members") +issue:load("delegating_interest_snapshot_for_member", { member_id = app.session.member_id }, "delegating_interest") +issue:load("interest_for_member", { member_id = app.session.member_id }, "interest") +issue:load("outgoing_delegations_for_member", { member_id = app.session.member_id }, "outgoing_delegations") + +local initiatives = issue.initiatives + +local interested_members = issue.interested_members + +local interest = issue.interest + +local delegations = issue.delegations + +local trustees = Member:new_selector() + :add_field("delegation_chain.*") + :join("delegation_chain(" .. tostring(app.session.member.id) .. ", " .. tostring(area_id or "NULL") .. ", " .. tostring(issue_id or "NULL") .. ")", "delegation_chain", "member.id = delegation_chain.member_id") + :add_order_by("index") + :exec() + +local global_delegation +local area_delegation +local issue_delegation + +for i, delegation in ipairs(issue.delegations) do + if delegation.scope == "global" then global_delegation = delegation + elseif delegation.scope == "area" then area_delegation = delegation + elseif delegation.scope == "issue" then issue_delegation = delegation + end +end + +local delegation = issue_delegation or area_delegation or global_delegation + +local delegating_interest = issue.delegating_interest + +app.topnav_phase = issue.phase +app.topnav_area_id = issue.area_id + +slot.select("sidebar", function() + execute.view{ module = "lf2", view = "_sidebar_unit", params = { current_area_id = issue.area_id } } +end) + +execute.view{ module = "lf2", view = "_area", params = { area = area } } + +execute.view{ module = "lf2", view = "_issues", params = { issues = { issue } } } + +-- TODO bugfix for not working reference loader +interested_members = issue:get_reference_selector("interested_members_snapshot"):exec() + +execute.view{ module = "lf2", view = "_interested", params = { + interested_members = interested_members +} } + diff -r 7e3acb2f6284 -r 1dab81353eb1 app/main/lf2/issue.lua --- a/app/main/lf2/issue.lua Thu Mar 03 23:47:35 2011 +0100 +++ b/app/main/lf2/issue.lua Sat Mar 05 15:34:17 2011 +0100 @@ -39,8 +39,11 @@ local delegating_interest = issue.delegating_interest +app.topnav_phase = issue.phase +app.topnav_area_id = issue.area_id + slot.select("sidebar", function() - execute.view{ module = "lf2", view = "_sidebar", params = { current_area_id = issue.area_id } } + execute.view{ module = "lf2", view = "_sidebar_unit", params = { current_area_id = issue.area_id } } end) execute.view{ module = "lf2", view = "_area", params = { area = area } } diff -r 7e3acb2f6284 -r 1dab81353eb1 env/ui/box.lua --- a/env/ui/box.lua Thu Mar 03 23:47:35 2011 +0100 +++ b/env/ui/box.lua Sat Mar 05 15:34:17 2011 +0100 @@ -1,6 +1,4 @@ function ui.box(args) - app.ui_box_row = 1 - app.ui_box_row_count = args.row_count local class = "box" if args.class then class = class .. " " .. args.class end ui.container{ attr = { class = class }, content = args.content } diff -r 7e3acb2f6284 -r 1dab81353eb1 env/ui/box_col.lua --- a/env/ui/box_col.lua Thu Mar 03 23:47:35 2011 +0100 +++ b/env/ui/box_col.lua Sat Mar 05 15:34:17 2011 +0100 @@ -1,7 +1,5 @@ function ui.box_col(args) local class = "col" if args.class then class = class .. " " .. args.class end - if app.ui_box_col == 1 then class = class .. " first" end ui.container{ attr = { class = class }, content = args.content } - app.ui_box_col = app.ui_box_col + 1 end diff -r 7e3acb2f6284 -r 1dab81353eb1 env/ui/box_row.lua --- a/env/ui/box_row.lua Thu Mar 03 23:47:35 2011 +0100 +++ b/env/ui/box_row.lua Sat Mar 05 15:34:17 2011 +0100 @@ -2,24 +2,11 @@ app.ui_box_col = 1 local class = "row" if args.class then class = class .. " " .. args.class end - if app.ui_box_row == 1 then class = class .. " first" end - if app.ui_box_row == app.ui_box_row_count then class = class .. " last" end - if args.toggle_content then class = class .. " toggled" end ui.container{ attr = { class = class }, content = function() - if args.toggle_content then - ui.container{ attr = { class = "col toggle"}, content = function() - if type(args.toggle_content) == "function" then - args.toggle_content() - else - slot.put(encode.html(args.toggle_content)) - end - end } - end if type(args.content) == "function" then args.content() else slot.put(encode.html(args.content)) end end } - app.ui_box_row = app.ui_box_row + 1 end diff -r 7e3acb2f6284 -r 1dab81353eb1 model/issue.lua --- a/model/issue.lua Thu Mar 03 23:47:35 2011 +0100 +++ b/model/issue.lua Sat Mar 05 15:34:17 2011 +0100 @@ -302,15 +302,15 @@ if args.area_id then selector:add_where{ "issue.area_id = ?", args.area_id } end - if args.state == "closed" then + if args.phase == "closed" then selector:add_where("issue.closed NOTNULL") - elseif args.state == "voting" then + elseif args.phase == "voting" then selector:add_where("issue.fully_frozen NOTNULL AND issue.closed ISNULL") - elseif args.state == "frozen" then + elseif args.phase == "frozen" then selector:add_where("issue.half_frozen NOTNULL AND issue.fully_frozen ISNULL AND issue.closed ISNULL") - elseif args.state == "discussion" then + elseif args.phase == "discussion" then selector:add_where("issue.accepted NOTNULL AND issue.half_frozen ISNULL AND issue.closed ISNULL") - elseif args.state == "new" then + elseif args.phase == "new" then selector:add_where("issue.accepted ISNULL AND issue.closed ISNULL") end if args.order == "time_left" then @@ -343,6 +343,15 @@ end +function Issue.object_get:phase() + local state = self.state + if state == "finished" or state == "cancelled" then + return "closed" + else + return state + end +end + function Issue.object_get:state_name() return Issue:get_state_name_for_state(self.state) end diff -r 7e3acb2f6284 -r 1dab81353eb1 static/lf2.css --- a/static/lf2.css Thu Mar 03 23:47:35 2011 +0100 +++ b/static/lf2.css Sat Mar 05 15:34:17 2011 +0100 @@ -56,11 +56,11 @@ body { font-family: sans-serif; background-color: #7df; + xbackground-image: url('lf2/back.jpg'); color: #000; } a { - background-color: #ffffff; color: #000; } @@ -141,23 +141,6 @@ color: #46a; } -.boxhead, -a.boxhead { - /* position */ - display: block; - margin-bottom: 0.5ex; - margin-top: 1ex; - margin-left: 0.5em; - - /* color */ - background-color: #7df; - color: #000; - - /* text format */ - font-weight: bold; - text-shadow: 2px 2px 2px #fff; -} - .box { /* position */ position: relative; @@ -181,7 +164,7 @@ /* position */ /* border */ - border-top: 1px solid #ccc; + border-bottom: 1px solid #ccc; } .box .row .col { @@ -189,7 +172,7 @@ padding: 0.5ex 0.2em 0.5ex 0.2em; /* text format */ - line-height: 125%; + line-height: 115%; } .box .row .col.left { @@ -200,65 +183,28 @@ float: right; } -.box .row .col.clearleft { - clear: left; -} - -.box .row .col.clearright { - clear: right; -} - -.box .row .col.toggle { - float: left; - /* position */ - padding-left: 0.4em; -} - -.box .row .col.toggle:hover { - /* color */ - background-color: #7cf; - - /* cursor */ - cursor: pointer; +.box .row:last-child { + /* border */ + border-bottom: none; } -.box .row.first .col.toggle { - /* border */ - border-radius: 1ex 0 0 0; -} - -.box .row.last .col.toggle { - /* border */ - border-radius: 0 0 0 1ex; -} - -.box .row.toggled .col.first { - /* position */ - margin-left: 1.5em; -} - -.box .row.first { - /* border */ - border-top: none; -} - -.box .row .col.first { +.box .row .col:first-child { /* position */ padding-left: 0.5em; } -.box .row.toggled .col.first { - /* position */ - padding-left: 0.2em; +.box .row:first-child.head, +.box .row:first-child.head2 { + border-radius: 1ex 1ex 0 0; } .box .row.head { - background-color: #e4e7f0; + background-color: #fafcff; color: #000; - border-radius: 1ex 1ex 0 0; + border-bottom-color: #777; } -.box .row.last { +.box .row:last-child { border-radius: 0 0 1ex 1ex; } @@ -268,20 +214,32 @@ } .box .row.head .col a { - background-color: #e4e7f0; + background-color: #fafcff; color: #3B6E7F; } .box .row.head2 { - background-color: #f2f3f7; + background-color: #fafcff; color: #000; } +.box .row.head2 .col.head { + font-weight: bold; +} + .box .row.head2 .col a { - background-color: #f2f3f7; + background-color: #fafcff; color: #3B6E7F; } +.box .row.subhead .col { + margin-top: 2ex; + font-weight: bold; +} + +.box .row.subhead { + border-bottom-color: #777; +} .box .row .col a { color: #3B6E7F; @@ -349,6 +307,11 @@ padding: 0.5ex 0.2em 0.5ex 0.5em; } +.box .row.last-child .hoverbutton { + border-radius: 0 0 1ex 1ex; +} + + /* Scrolled col */ .box .row .col.scrolled { @@ -496,6 +459,7 @@ font-weight: bold; } +.draft .authors, .initiative .authors { /* color */ color: #777; @@ -505,6 +469,7 @@ font-style: italic; } +.draft .authors a, .initiative .authors a { /* color */ } @@ -513,10 +478,9 @@ font-weight: bold; } -.drafts .draft .author_name { - font-style: italic; +.box.issue .row.unit_name { + border-bottom-color: #ccc; } - /* Draft */ .draft { diff -r 7e3acb2f6284 -r 1dab81353eb1 static/lf2/back.jpg Binary file static/lf2/back.jpg has changed diff -r 7e3acb2f6284 -r 1dab81353eb1 static/lf2/icon_delegation.png Binary file static/lf2/icon_delegation.png has changed diff -r 7e3acb2f6284 -r 1dab81353eb1 static/lf2/icon_delegation_issue.png Binary file static/lf2/icon_delegation_issue.png has changed