Skip to content

Commit

Permalink
Merge pull request #359 from gogolander/test
Browse files Browse the repository at this point in the history
Committees
  • Loading branch information
gogolander committed Aug 4, 2014
2 parents 6d9a146 + 08196fd commit 6606863
Show file tree
Hide file tree
Showing 6 changed files with 422 additions and 4 deletions.
5 changes: 5 additions & 0 deletions app/main/committee/_action/request_committee.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
slot.set_layout("custom")

slot.put_into("notice", "action not implemented yet!")

return "ok"
181 changes: 181 additions & 0 deletions app/main/committee/status.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
slot.set_layout("custom")

local committee_id = param.get("committee_id", atom.integer)
local report_id = param.get("report_id", atom.integer)

ui.form {
method = "post",
module = "committee",
action = "request_committee",
attr={id = "page_status"},
routing = {
ok = {
mode = "redirect",
module = "committee",
view = "status",
params = {initiative_id = initiative_id, field_keywords = field_keywords}
},
error = {
mode = "redirect",
module = "committee",
view = "status",
params = {initiative_id = initiative_id, field_keywords = field_keywords}
}
},
content = function()

ui.container{attr={class = "row-fluid paper"}, content = function()
ui.container{attr={class = "span12"}, content = function()
ui.container{content=function()
ui.container{attr={class="row-fluid"},content = function()
ui.image{attr={class="offset3 span1"}, static="png/committee.png" } --LOGO COMMISSIONI TECNICHE
ui.container{attr={class="span6 text-center"},content = function()
ui.heading{level=1, content = function() slot.put(_"<strong>TECHNICAL COMMITTEE REPORT</strong>") end }
if not committee_id then
ui.heading{level=2, content = slot.put(_"- No technical committee summoned yet for this initiative -")}
else
ui.heading{level=2, content = function() slot.put(_("Committee: <strong>C#{committee_code}</strong>", {committee_code = committee_id})) end }
end
end
}
if not committee_id then
ui.container{attr={class="row-fluid"},content=function()
ui.image{ attr = { class = "span12", }, static = "svg/commission_box_step3.svg"}
end
}
else
if not report_id then
ui.container{attr={class="row-fluid"},content=function()
ui.image{ attr = { class = "span12", }, static = "svg/commission_box_step4.svg"}
end
}
else
ui.container{attr={class="row-fluid"},content=function()
ui.image{ attr = { class = "span12", }, static = "svg/commission_box_step5.svg"}
end
}
end
end
end
}
end
}
end
}

if not committee_id then
ui.container{attr={class="row-fluid"}, content = function()
ui.image{attr={class="offset4 span1"}, static="png/committee.png"}
ui.heading{level=1, attr={class="span5"}, content = function() slot.put(_"Committee summoned") end }
end
}
ui.container{attr={class="row-fluid"}, content = function()
ui.heading{level=4, attr={class="span12 text-center"}, content = function() slot.put(_("<strong>#{accepted}</strong> members over <strong>12</strong> accepted the request to be part of the committee.", {accepted = 0})) end }
ui.heading{level=6, attr={class="span12 text-center"}, content = function() slot.put(_"(if not enough specialists will accept the call within seven days, the committee will be formed by the permanent technical committee.)") end }
ui.heading{level=3, attr={class="span12 text-center"}, content = function() slot.put(_("REPORT DEADLINE: #{deadline}", {deadline="99/99/2999"})) end }
ui.heading{level=3, attr={class="span12 text-left"}, content = function() slot.put(_("Technical fields:")) end }
ui.tag {
tag = "textarea",
id = "areas",
attr={class="span12"},
content = "This will summarize the composition of the committee"
}
ui.heading{level=3, attr={class="span12 text-left"}, content = function() slot.put(_("Experts that accepted the call:")) end }
ui.tag {
tag = "textarea",
id = "member_list",
attr={class="span12"},
content = "This will contain the list of members of the committee"
}
end
}
else
if not report_id then
--local committee = Committee:by_id(committee_id)
ui.container{attr={class="row-fluid"},content=function()
ui.heading{attr={class="span12"},level=2,content=function() slot.put(_("Committee id: <strong>C#{committee_code}</strong>", {committee_code = committee_id})) end }
ui.heading{attr={class="span12"},level=2,content=function() slot.put(_("Summoned on: <strong>#{committee_summoned}</strong>", {committee_summoned = "00/00/0000"--[[committee.summoned]]})) end }
ui.heading{attr={class="span12"},level=2,content=function() slot.put(_("Report deadline: <strong>#{deadline}</strong>", {deadline = "99/99/2999" --[[committee.deadline]]})) end }
end
}
ui.container{attr={class="row-fluid spaceline"}, content=function()
ui.container{attr={class="span6 offset3 commission-in-progress text-center"}, content=function()
ui.heading{level=1, content="Committee is examining the initiative"}
end
}
slot.put("<br>")
ui.tag {
tag = "a",
attr={class="offset3 btn btn-primary spaceline"},
content=_"Enter the committee area (read-only)"
}
end
}

ui.container{attr={class="row-fluid"}, content=function()
ui.heading{attr={class="span6 offset3 text-center"}, level=3, content=_"(The 12-members made committee will examin the initiative and it will publish a report within seven days. Initiative will be frozen in the meantime.)"}
ui.heading{level=3, attr={class="span12 text-left"}, content = function() slot.put(_("Technical fields:")) end }
ui.tag {
tag = "textarea",
id = "areas",
attr={class="span12"},
content = "This will summarize the composition of the committee"
}
ui.heading{level=3, attr={class="span12 text-left"}, content = function() slot.put(_("Members of the panel:")) end }
ui.tag {
tag = "textarea",
id = "member_list",
attr={class="span12"},
content = "This will contain the list of members of the committee"
}
end
}
else
--local committee = Committee:by_id(committee_id)
ui.container{attr={class="row-fluid"},content=function()
ui.heading{attr={class="span12"},level=2,content=function() slot.put(_("Committee id: <strong>C#{committee_code}</strong>", {committee_code = committee_id})) end }
ui.heading{attr={class="span12"},level=2,content=function() slot.put(_("Summoned on: <strong>#{committee_summoned}</strong>", {committee_summoned = "00/00/0000"--[[committee.summoned]]})) end }
ui.heading{attr={class="span12"},level=2,content=function() slot.put(_("Report published on: <strong>#{deadline}</strong>", {deadline = "99/99/2999" --[[committee.deadline]]})) end }
end
}
ui.container{attr={class="row-fluid spaceline"}, content=function()
ui.container{attr={class="span6 offset3 commission-in-progress text-center"}, content=function()
-- if committee.approve then
ui.heading{attr={class="committee-box-approved"},level=1, content="Committee APPROVED"}
-- else
-- ui.heading{attr={class="committee-box-disapproved"},level=1, content="Committee DISAPPROVED"}
-- end
end
}
end
}
ui.container{attr={class="row-fluid spaceline"}, content=function()
ui.heading{level=3, attr={class="span12 text-left"}, content = function() slot.put(_("Technical fields:")) end }
ui.tag {
tag = "textarea",
id = "areas",
attr={class="span12"},
content = "This will summarize the composition of the committee"
}
ui.heading{level=3, attr={class="span12 text-left"}, content = function() slot.put(_("Members of the panel <strong>C#{committee_code}</strong>:", {committee_code=committee_id})) end }
ui.tag {
tag = "textarea",
id = "member_list",
attr={class="span12"},
content = "This will contain the list of members of the committee"
}
ui.heading{level=3, attr={class="span12 text-left"}, content = function() slot.put(_("Report code: <strong>R#{report_code}</strong>", {report_code=report_id})) end }
ui.tag {
tag = "textarea",
id = "report",
attr={class="span12"},
content = "This will contain the report text"
}
end
}
end
end
end
}
end
}
134 changes: 134 additions & 0 deletions app/main/committee/summon.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
slot.set_layout("custom")

local initiative_id = param.get("initiative_id", atom.integer)
local field_keyword = param.get("field_keyword", atom.string)
local requested = param.get("requested", atom.boolean) or false

ui.form {
method = "post",
module = "committee",
action = "request_committee",
attr={id = "page_summon"},
routing = {
ok = {
mode = "redirect",
module = "committee",
view = "summon",
params = {initiative_id = initiative_id, field_keywords = field_keywords, requested = true}
},
error = {
mode = "redirect",
module = "committee",
view = "summon",
params = {initiative_id = initiative_id, field_keywords = field_keywords, requested = false}
}
},
content = function()
ui.container{attr={class="paper"}, content = function()
ui.container{attr={class = "row-fluid"}, content = function()
ui.container{attr={class = "span12"}, content = function()
ui.container{content=function()
ui.container{attr={class="row-fluid"},content = function()
ui.image{attr={class="offset1 span2"}, static="png/committee.png" } --LOGO COMMISSIONI TECNICHE
ui.container{attr={class="span8 text-center"},content = function()
ui.heading{level=1, content = function() slot.put(_"<strong>TECHNICAL COMMITTEE REPORT</strong>") end }
ui.heading{level=5, content = slot.put(_"- No technical committee summoned yet for this initiative -")}
end
}
ui.container{attr={class="row-fluid"},content=function()
if not requested then
ui.image{ attr = { class = "span12", }, static = "svg/commission_box_step1.svg"}
else
ui.image{ attr = { class = "span12", }, static = "svg/commission_box_step2.svg"}
end
end
}
end
}
end
}
end
}
end
}
if not requested then
ui.container{attr={class = "row-fluid text-center"}, content = function()
ui.container{attr={class = "span12 text-left"}, content = function()
ui.heading{level=6, content = _"You decided to summon a technical committee to examin this initiative. In the following you have to specify which competences are needed. You can either leave the ones selected from the author of the initiative or substitute some of them with others you prefer." }
end
}
ui.container{attr={class = "row-fluid"},content=function()
ui.tag {
tag = "textarea",
attr={class = "span12"},
id = "competences",
content = technical_keywords or ""
}
end
}
end
}
ui.container{attr={class = "row-fluid"}, content = function()
ui.container{attr={class = "offset2 span4"}, content = function()
ui.link {
attr={class="btn btn-primary"},
module = "committee",
view = "view",
params = {initiative_id = initiative_id},
content = _"Ignore request"
}
end
}

ui.container{attr={class = "offset2 span4"}, content = function()
ui.tag {
tag = "a",
attr={class="btn btn-primary", onclick="getElementById('page_summon').submit()"},
content = _"Send request"
}
end
}
end
}

else
ui.container{attr={class = "row-fluid"}, content = function()
ui.heading{attr={class="span12 text-center"},level=3, content = _"Waiting for the quorum to be reached"}
ui.container{attr={class = "span4"}, content = function()
ui.container{attr = {class="row-fluid"}, content =function()
local quorum_percent = 20--issue.policy.issue_quorum_num * 100 / issue.policy.issue_quorum_den
local quorum_supporters
--[[if issue.population and issue.population > 0 then
quorum_supporters = math.ceil(issue.population * quorum_percent / 100)
else]]
quorum_supporters = 0
--end

ui.container{attr = {class="span2 offset2"}, content =function()
ui.container{attr = {class="initiative_quorum_out_box"}, content =function()
ui.container{attr = {id="quorum_box", class="initiative_quorum_box", style="left:"..2+quorum_percent.."%"}, content =function()
ui.container{attr = {id="quorum_txt"}, content=function()
slot.put(" ".."Quorum".." "..quorum_percent.."%".."<br>".." ("..quorum_supporters.." ".._"supporters"..")")
end }
end }
end }
end }
end
}
end
}
ui.container{attr={class = "span7"}, content = function()
ui.heading{level = 6, content = function()
slot.put(_("<strong>#{count_supporters}</strong> people support the request to summon a technical committee. <strong>#{count_remaining}</strong> people still needed.<br>The committee will be summoned only if the initiative will gather enough supporters.", {count_supporters = 140, count_remaining = 1000}))
end
}
end
}
end
}
end

end
}
end
}
Loading

0 comments on commit 6606863

Please sign in to comment.