liquid_feedback_frontend
diff app/main/initiative/revoke.lua @ 1045:701a5cf6b067
Imported LiquidFeedback Frontend 3.0 branch
author | bsw |
---|---|
date | Thu Jul 10 01:19:48 2014 +0200 (2014-07-10) |
parents | 72c5e0ee7c98 |
children | 15f33adc0e31 |
line diff
1.1 --- a/app/main/initiative/revoke.lua Thu Jul 10 01:02:43 2014 +0200 1.2 +++ b/app/main/initiative/revoke.lua Thu Jul 10 01:19:48 2014 +0200 1.3 @@ -1,26 +1,60 @@ 1.4 local initiative = Initiative:by_id(param.get_id()) 1.5 +local initiatives = app.session.member 1.6 + :get_reference_selector("supported_initiatives") 1.7 + :join("issue", nil, "issue.id = initiative.issue_id") 1.8 + :add_where("issue.closed ISNULL") 1.9 + :add_order_by("issue.id") 1.10 + :exec() 1.11 1.12 -slot.put_into("title", _"Revoke initiative") 1.13 + 1.14 +local member = app.session.member 1.15 +if member then 1.16 + initiative:load_everything_for_member_id(member.id) 1.17 + initiative.issue:load_everything_for_member_id(member.id) 1.18 +end 1.19 + 1.20 + 1.21 +local tmp = { { id = -1, myname = _"Suggest no initiative" }} 1.22 +for i, initiative in ipairs(initiatives) do 1.23 + initiative.myname = _("Issue ##{issue_id}: #{initiative_name}", { 1.24 + issue_id = initiative.issue.id, 1.25 + initiative_name = initiative.name 1.26 + }) 1.27 + tmp[#tmp+1] = initiative 1.28 +end 1.29 1.30 -slot.select("actions", function() 1.31 - ui.link{ 1.32 - content = function() 1.33 - ui.image{ static = "icons/16/cancel.png" } 1.34 - slot.put(_"Cancel") 1.35 - end, 1.36 - module = "initiative", 1.37 - view = "show", 1.38 - id = initiative.id, 1.39 - params = { 1.40 - tab = "initiators" 1.41 - } 1.42 +execute.view { 1.43 + module = "issue", view = "_head", params = { 1.44 + issue = initiative.issue, 1.45 + member = member 1.46 } 1.47 -end) 1.48 +} 1.49 +execute.view{ module = "issue", view = "_sidebar_state", params = { 1.50 + initiative = initiative 1.51 +} } 1.52 1.53 -util.help("initiative.revoke") 1.54 +execute.view { 1.55 + module = "issue", view = "_sidebar_issue", 1.56 + params = { 1.57 + issue = initiative.issue, 1.58 + highlight_initiative_id = initiative.id 1.59 + } 1.60 +} 1.61 + 1.62 +execute.view { 1.63 + module = "issue", view = "_sidebar_whatcanido", 1.64 + params = { initiative = initiative } 1.65 +} 1.66 + 1.67 +execute.view { 1.68 + module = "issue", view = "_sidebar_members", params = { 1.69 + issue = initiative.issue, initiative = initiative 1.70 + } 1.71 +} 1.72 + 1.73 1.74 ui.form{ 1.75 - attr = { class = "vertical" }, 1.76 + attr = { class = "wide section" }, 1.77 module = "initiative", 1.78 action = "revoke", 1.79 id = initiative.id, 1.80 @@ -33,30 +67,67 @@ 1.81 } 1.82 }, 1.83 content = function() 1.84 - local initiatives = app.session.member 1.85 - :get_reference_selector("supported_initiatives") 1.86 - :join("issue", nil, "issue.id = initiative.issue_id") 1.87 - :add_field("'Issue #' || issue.id || ': ' || initiative.name", "myname") 1.88 - :exec() 1.89 + 1.90 + ui.sectionHead( function() 1.91 + ui.link{ 1.92 + module = "initiative", view = "show", id = initiative.id, 1.93 + content = function () 1.94 + ui.heading { 1.95 + level = 1, 1.96 + content = initiative.display_name 1.97 + } 1.98 + end 1.99 + } 1.100 + ui.heading { level = 2, content = _"Revoke initiative" } 1.101 + end ) 1.102 + 1.103 + ui.sectionRow( function() 1.104 1.105 - local tmp = { { id = -1, myname = _"Suggest no initiative" }} 1.106 - for i, initiative in ipairs(initiatives) do 1.107 - tmp[#tmp+1] = initiative 1.108 - end 1.109 - ui.field.select{ 1.110 - label = _"Suggested initiative", 1.111 - name = "suggested_initiative_id", 1.112 - foreign_records = tmp, 1.113 - foreign_id = "id", 1.114 - foreign_name = "myname", 1.115 - value = param.get("suggested_initiative_id", atom.integer) 1.116 - } 1.117 - slot.put("") 1.118 - ui.field.boolean{ 1.119 - label = _"Are you sure?", 1.120 - name = "are_you_sure", 1.121 - } 1.122 + ui.heading{ level = 2, content = _"Do you want to suggest to support another initiative?" } 1.123 + 1.124 + ui.field.select{ 1.125 + name = "suggested_initiative_id", 1.126 + foreign_records = tmp, 1.127 + foreign_id = "id", 1.128 + foreign_name = "myname", 1.129 + value = param.get("suggested_initiative_id", atom.integer) 1.130 + } 1.131 + ui.container{ content = _"You may choose one of the ongoing initiatives you are currently supporting" } 1.132 + slot.put("<br />") 1.133 + ui.heading { level = 2, content = _"Are you aware that revoking an initiative is irrevocable?" } 1.134 + ui.container{ content = function() 1.135 + ui.tag{ tag = "input", attr = { 1.136 + type = "checkbox", 1.137 + name = "are_you_sure", 1.138 + value = "1" 1.139 + } } 1.140 + ui.tag { content = _"I understand, that this is not revocable" } 1.141 + end } 1.142 + 1.143 + 1.144 + slot.put("<br />") 1.145 + ui.tag{ 1.146 + tag = "input", 1.147 + attr = { 1.148 + type = "submit", 1.149 + class = "btn btn-dangerous", 1.150 + value = _"Revoke now" 1.151 + }, 1.152 + content = "" 1.153 + } 1.154 + slot.put("<br />") 1.155 + slot.put("<br />") 1.156 1.157 - ui.submit{ text = _"Revoke initiative" } 1.158 + ui.link{ 1.159 + content = _"Cancel", 1.160 + module = "initiative", 1.161 + view = "show", 1.162 + id = initiative.id, 1.163 + params = { 1.164 + tab = "initiators" 1.165 + } 1.166 + } 1.167 + end ) 1.168 + 1.169 end 1.170 } 1.171 \ No newline at end of file