# HG changeset patch # User bsw # Date 1299183995 -3600 # Node ID acf92c2d33f406570e1d78910985197927467828 # Parent 3e4ad069847a661faccb8917119ffe3de04754fe Seperated css and fixed issue delegations for second generation frontend diff -r 3e4ad069847a -r acf92c2d33f4 app/main/_layout/lf2.html --- a/app/main/_layout/lf2.html Thu Mar 03 18:39:00 2011 +0100 +++ b/app/main/_layout/lf2.html Thu Mar 03 21:26:35 2011 +0100 @@ -1,574 +1,32 @@ - - - - - - -
- -
-
- - - - - -
-
TRACE
- - - + diff -r 3e4ad069847a -r acf92c2d33f4 app/main/lf2/_issues.lua --- a/app/main/lf2/_issues.lua Thu Mar 03 18:39:00 2011 +0100 +++ b/app/main/lf2/_issues.lua Thu Mar 03 21:26:35 2011 +0100 @@ -85,7 +85,7 @@ ui.box_col{ class = "interest left", content = function() if interest then ui.image{ static = "lf2/icon_star.png" } - if issue.closed then + if issue.close then slot.put(" ", _"You were interested in this issue") else slot.put(" ", _"You are interested in this issue") diff -r 3e4ad069847a -r acf92c2d33f4 app/main/lf2/_sidebar_issue.lua --- a/app/main/lf2/_sidebar_issue.lua Thu Mar 03 18:39:00 2011 +0100 +++ b/app/main/lf2/_sidebar_issue.lua Thu Mar 03 21:26:35 2011 +0100 @@ -1,4 +1,5 @@ local issue = param.get("issue", "table") +local initiative_id = param.get("initiative_id", atom.integer) local initiatives = issue.initiatives @@ -10,27 +11,12 @@ 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) .. ", 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 ui.box{ class = "issue", content = function() @@ -42,21 +28,21 @@ } end } end } - ui.box_row{ class = "unit_name", content = function() ui.box_col{ content = function() + ui.box_row{ class = "unit_name head2", content = function() ui.box_col{ content = function() ui.link{ module = "lf2", view = "unit", id = 1, content = "DE / Berlin / Friedrichshain-Kreuzberg" } end } end } - ui.box_row{ class = "area_name", content = function() ui.box_col{ content = function() + ui.box_row{ class = "area_name head2", content = function() ui.box_col{ content = function() ui.link{ module = "lf2", view = "area", id = issue.area_id, content = issue.area.name } end } end } - ui.box_row{ class = "policy_name", content = function() ui.box_col{ content = function() + ui.box_row{ class = "policy_name head2", content = function() ui.box_col{ content = function() ui.link{ module = "lf2", view = "policy", id = issue.policy_id, content = issue.policy.name @@ -76,7 +62,9 @@ slot.put(" ", _"You are interested in this issue") end else - ui.image{ static = "lf2/icon_star_grey.png" } + 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") end @@ -97,7 +85,7 @@ ui.link{ module = "interest", action = "update", params = { issue_id = issue.id, delete = true }, routing = { default = { - mode = "redirect", module = "lf2", view = "issue", id = issue.id + mode = "redirect", module = "lf2", view = initiative_id and "initiative" or "issue", id = initiative_id or issue.id, } }, attr = { class = "hoverbutton red"}, content = function() @@ -112,7 +100,7 @@ ui.link{ module = "interest", action = "update", params = { issue_id = issue.id }, routing = { default = { - mode = "redirect", module = "lf2", view = "issue", id = issue.id + mode = "redirect", module = "lf2", view = initiative_id and "initiative" or "issue", id = initiative_id or issue.id, } }, attr = { class = "hoverbutton green"}, content = function() @@ -128,13 +116,23 @@ end } end } ui.box_row{ class = "delegation hoverbutton_container", content = function() ui.box_col{ content = function() - if delegation then - if delegation.issue_id then - slot.put(encode.html(_"You have delegated this issue")) - elseif delegation.area_id then - slot.put(encode.html(_"You have delegated this area")) - elseif delegation then - slot.put(encode.html(_"You have delegated globally")) + if trustees[1].scope_out then + if trustees[1].disabled_out == false then + if trustees[1].scope_out == "issue" then + slot.put(encode.html(_"You have delegated this issue")) + elseif trustees[1].scope_out == "area" then + slot.put(encode.html(_"You have delegated this area")) + elseif trustees[1].scope_out == "global" then + slot.put(encode.html(_"You have delegated globally")) + end + else + if trustees[1].scope_out == "issue" then + slot.put(encode.html(_"Issue delegation abandoned")) + elseif trustees[1].scope_out == "area" then + slot.put(encode.html(_"Area delegation abandoned")) + elseif trustees[1].scope_out == "global" then + slot.put(encode.html(_"Global delegation abandoned")) + end end else slot.put(encode.html(_"No delegation active")) @@ -147,19 +145,25 @@ end } end } else - if delegation then - ui.link{ attr = { class = "hoverbutton red"}, content = function() + if #trustees > 1 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 delegation...")) + slot.put(" ", encode.html(_"Change issue delegation...")) end } end } else - ui.link{ attr = { class = "hoverbutton green"}, content = function() + ui.link{ + 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(" ", encode.html(_"Delegate issue")) + slot.put(" ") + slot.put(" ", encode.html(_"Set issue delegation...")) + end } end } @@ -167,8 +171,8 @@ end end } end } - - if delegation then + + if #trustees > 1 then ui.box_row{ class = "delegation", content = function() ui.box_col{ content = function() execute.view{ module = "lf2", view = "_avatars", params = { members = trustees, arrows = true, size = "small" } } end } end } diff -r 3e4ad069847a -r acf92c2d33f4 app/main/lf2/delegation.lua --- a/app/main/lf2/delegation.lua Thu Mar 03 18:39:00 2011 +0100 +++ b/app/main/lf2/delegation.lua Thu Mar 03 21:26:35 2011 +0100 @@ -37,8 +37,8 @@ default = { mode = "redirect", module = "lf2", - view = area and "area" or issue and "issue" or "index", - id = area and area.id or issue and issue.id or nil, + view = area and "area" or initiative and "initiative" or issue and "issue" or "index", + id = area and area.id or initiative and initiative.id or issue and issue.id or nil, } }, content = function() diff -r 3e4ad069847a -r acf92c2d33f4 app/main/lf2/initiative.lua --- a/app/main/lf2/initiative.lua Thu Mar 03 18:39:00 2011 +0100 +++ b/app/main/lf2/initiative.lua Thu Mar 03 21:26:35 2011 +0100 @@ -1,8 +1,12 @@ slot.set_layout("lf2") +slot.put_into("leftright_pre", '') + local initiative = Initiative:by_id(param.get_id()) local issue = initiative.issue +issue:load("interest_for_member", { member_id = app.session.member_id }, "interest") local supporting_members_selector = Member:new_selector() :join("direct_supporter_snapshot", "dss", { "dss.issue_id = ? AND dss.initiative_id = ? AND dss.member_id = member.id and dss.event = (select latest_snapshot_event from issue where id = ?)", issue.id, initiative.id, issue.id }) @@ -23,7 +27,7 @@ slot.select("sidebar", function() - execute.view{ module = "lf2", view = "_sidebar_issue", params = { issue = issue } } + 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, diff -r 3e4ad069847a -r acf92c2d33f4 static/lf2.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/static/lf2.css Thu Mar 03 21:26:35 2011 +0100 @@ -0,0 +1,548 @@ +/* CSS reset */ + +html, body, div, span, applet, object, iframe, +h1, h2, h3, h4, h5, h6, p, blockquote, pre, +a, abbr, acronym, address, big, cite, code, +del, dfn, em, font, img, ins, kbd, q, s, samp, +small, strike, strong, sub, sup, tt, var, +dl, dt, dd, ol, ul, li, +fieldset, form, label, legend, +table, caption, tbody, tfoot, thead, tr, th, td { + margin: 0; + padding: 0; + border: 0; + outline: 0; + font-weight: inherit; + font-style: inherit; + font-size: 100%; + font-family: inherit; + vertical-align: baseline; +} +/* remember to define focus styles! */ +:focus { + outline: 0; +} +body { + line-height: 1; + color: black; + background: white; +} +ol, ul { + list-style: none; +} +/* tables still need 'cellspacing="0"' in the markup */ +table { + border-collapse: separate; + border-spacing: 0; +} +caption, th, td { + text-align: left; + font-weight: normal; +} +blockquote:before, blockquote:after, +q:before, q:after { + content: ""; +} +blockquote, q { + quotes: "" ""; +} + +/* end CSS reset */ + + +/* + Global settings +*/ +body { + font-family: sans-serif; + background-color: #7df; + color: #000; +} + +a { + background-color: #ffffff; + color: #000; +} + +/* + Main top navigation +*/ + +.tab1 { + background-color: #444; + color: #000; +} + +.tab1 .right { + float: right; +} + +.tab1 a { + float: left; + padding: 0.5ex 0.5em 0.5ex 0.5em; + margin-left: 0.5em; + background-color: #444; + color: #fff; + font-weight: bold; + text-decoration: none; +} + +.tab1 .right a { + margin-left: 0; + margin-right: 0.5em; +} + +.tab1 a.active { + background-color: #7df; + color: #000; +} + +/* + Default slot +*/ + +.slot_default { + margin: 2ex 1% 2ex 32%; + position: relative; + width: 67%; +} + +.sidebar_right .slot_default { + margin: 2ex 32% 2ex 1%; +} + +/* +Sidebar +*/ + +.slot_sidebar { + margin: 2ex 1% 2ex 1%; + float: left; + width: 30%; +} + +.sidebar_right .slot_sidebar { + margin: 0 1% 2ex 1%; + float: right; + width: 30%; +} + +.slot_sidebar .box { + width: 100%; +} + + +/* + Boxes +*/ + +.box a { + text-decoration: none; + 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; + width: 100%; + margin-bottom: 2ex; + + /* border and shadow*/ + border-radius: 1ex; + -moz-border-radius: 1ex; + -webkit-box-shadow: 2px 2px 3px 0px #444; + -moz-box-shadow: 2px 2px 3px 0px #444; + + /* color */ + background-color: #fff; + color: #000; + +} + +.box .row { + overflow: auto; + /* position */ + + /* border */ + border-top: 1px solid #ccc; +} + +.box .row .col { + /* position */ + padding: 0.5ex 0.2em 0.5ex 0.2em; + + /* text format */ + line-height: 125%; +} + +.box .row .col.left { + float: left; +} + +.box .row .col.right { + 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.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 { + /* position */ + padding-left: 0.5em; +} + +.box .row.toggled .col.first { + /* position */ + padding-left: 0.2em; +} + +.box .row.head { + background-color: #e4e7f0; + color: #000; + border-radius: 1ex 1ex 0 0; +} + +.box .row.last { + border-radius: 0 0 1ex 1ex; +} + +.box .row.head .col.head { + font-weight: bold; + color: #444; +} + +.box .row.head .col a { + background-color: #e4e7f0; + color: #3B6E7F; +} + +.box .row.head2 { + background-color: #f2f3f7; + color: #000; +} + +.box .row.head2 .col a { + background-color: #f2f3f7; + color: #3B6E7F; +} + + +.box .row .col a { + color: #3B6E7F; +} + +.box .row.active, +.box .row.active a { + background-color: #DDF7FF; +} + +/* Sidebar hover button */ + +.hoverbutton_container { + position: relative; +} + + +.hoverbutton { + /* position */ + display: none; + position: absolute; + top: 0px; + left: 0px; + height: 100%; + width: 100%; + + /* color */ + background-color: #fff; + + /* text format */ + font-weight: bold; + + /* cursor */ + cursor: pointer; +} + +.hoverbutton_container:hover .hoverbutton { + /* position */ + display: block; +} + +.hoverbutton_container:hover .hoverbutton img { + /* text format */ + vertical-align: middle; +} + +.hoverbutton_container:hover .hoverbutton.noaction { + /* color */ + background-color: #ccc; + + /* cursor */ + cursor: default; +} + +.hoverbutton_container:hover .hoverbutton.green { + background-color: #cfc; +} + +.hoverbutton_container:hover .hoverbutton.red { + background-color: #fcc; +} + +.hoverbutton .content { + /* position */ + padding: 0.5ex 0.2em 0.5ex 0.5em; +} + +/* Scrolled col */ + +.box .row .col.scrolled { + padding: 0; + max-height: 300px; + overflow: auto; +} + +.box .row .col.scrolled .head { + font-weight: bold; + padding: 0.5ex 0.2em 0.5ex 0.5em; +} + +/* + Bars +*/ + +.bar { + float: right; + margin-left: 0.3em; +} + +.bar div { + margin-top: 2px; + float: left; + height: 11px; +} +.bar .green { + background-color: #0a0; +} + +.bar .grey { + background-color: #eee; +} + +/* + Avatars +*/ + +.avatars { + overflow: auto; +} + +.avatars .avatar { + float: left; + margin-left: 2px; + margin-right: 2px; +} + +.avatars.normal .avatar { + width: 100px; + -webkit-box-shadow: 1px 1px 1px #000; + background-color: #eee; + border-radius: 1ex; + -moz-border-radius: 1ex; +} + +.avatars.small .avatar { + border: 2px solid #fff; + border-radius: 0.5ex; + -moz-border-radius: 0.5ex; +} + +.avatars .arrow { + float: left; + margin-top: 0.3ex; +} + +.avatars .avatar.myweight { + border-color: #f70; + background-color: #f70; +} + +.avatars .avatar.autoreject { + border-color: #f00; + background-color: #f00; +} + +.avatars.small .avatar img { + border-radius: 0.25ex; + -moz-border-radius: 0.25ex; +} + +.avatars.normal .avatar img { + margin-left: 0.3em; + margin-top: 0.3ex; + border-radius: 1ex; + -moz-border-radius: 1ex; +} + +.avatars.small .avatar img { + height: 24px; + width: 24px; +} + +.avatars.normal .avatar img { + height: 48px; + width: 48px; +} + +.avatars.normal .avatar .name { + margin-left: 0.3em; + margin-top: 0.3ex; + line-height: 100%; + font-size: 70%; + overflow: hidden; + height: 4ex; +} + +.avatars .avatar .weight { + text-align: center; + font-size: 70%; +} + +.avatars.small .avatar.participation { + border-color: #f70; +} + +.avatars.small .avatar.overridden, +.avatars.small .arrow.overridden { + opacity: 0.3; +} + +/* + Area +*/ + +.area .name { + color: #444; +} + +.area .name a { + font-weight: normal; +} + +.area .name .avatars { + float: right; + margin-top: -3px; +} + +/* Initiatives */ + +.initiative .name, +.initiative a.name { + font-weight: bold; +} + +.initiative .authors { + /* color */ + color: #777; + + /* text format */ + font-size: 80%; + font-style: italic; +} + +.initiative .authors a { + /* color */ +} + +.drafts .draft .created { + font-weight: bold; +} + +.drafts .draft .author_name { + font-style: italic; +} + +/* Draft */ + +.draft { + line-height: 135%; +} + +.draft h2 { + font-size: 135%; + font-weight: bold; + margin-bottom: 0.5ex; +} + +.draft h3 { + font-size: 135%; + margin-bottom: 0.5ex; +} + +.draft p { + margin-bottom: 1ex; +} + +.draft ul { + padding-left: 2em; + list-style: disc; +} + +.draft ul li { + margin-bottom: 1ex; +}