liquid_feedback_frontend
view app/main/initiative/revoke.lua @ 1294:ea026690a86c
German translations added
| author | bsw | 
|---|---|
| date | Mon Apr 18 11:13:20 2016 +0200 (2016-04-18) | 
| parents | 701a5cf6b067 | 
| children | 15f33adc0e31 | 
 line source
     1 local initiative = Initiative:by_id(param.get_id())
     2 local initiatives = app.session.member
     3   :get_reference_selector("supported_initiatives")
     4   :join("issue", nil, "issue.id = initiative.issue_id")
     5   :add_where("issue.closed ISNULL")
     6   :add_order_by("issue.id")
     7   :exec()
    10 local member = app.session.member
    11 if member then
    12   initiative:load_everything_for_member_id(member.id)
    13   initiative.issue:load_everything_for_member_id(member.id)
    14 end
    17 local tmp = { { id = -1, myname = _"Suggest no initiative" }}
    18 for i, initiative in ipairs(initiatives) do
    19   initiative.myname = _("Issue ##{issue_id}: #{initiative_name}", {
    20     issue_id = initiative.issue.id,
    21     initiative_name = initiative.name
    22   })
    23   tmp[#tmp+1] = initiative
    24 end
    26 execute.view {
    27   module = "issue", view = "_head", params = {
    28     issue = initiative.issue,
    29     member = member
    30   }
    31 }
    32 execute.view{ module = "issue", view = "_sidebar_state", params = {
    33   initiative = initiative
    34 } }
    36 execute.view { 
    37   module = "issue", view = "_sidebar_issue", 
    38   params = {
    39     issue = initiative.issue,
    40     highlight_initiative_id = initiative.id
    41   }
    42 }
    44 execute.view {
    45   module = "issue", view = "_sidebar_whatcanido",
    46   params = { initiative = initiative }
    47 }
    49 execute.view { 
    50   module = "issue", view = "_sidebar_members", params = {
    51     issue = initiative.issue, initiative = initiative
    52   }
    53 }
    56 ui.form{
    57   attr = { class = "wide section" },
    58   module = "initiative",
    59   action = "revoke",
    60   id = initiative.id,
    61   routing = {
    62     ok = {
    63       mode = "redirect",
    64       module = "initiative",
    65       view = "show",
    66       id = initiative.id
    67     }
    68   },
    69   content = function()
    71     ui.sectionHead( function()
    72       ui.link{
    73         module = "initiative", view = "show", id = initiative.id,
    74         content = function ()
    75           ui.heading { 
    76             level = 1,
    77             content = initiative.display_name
    78           }
    79         end
    80       }
    81       ui.heading { level = 2, content = _"Revoke initiative" }
    82     end )
    84     ui.sectionRow( function()
    86       ui.heading{ level = 2, content = _"Do you want to suggest to support another initiative?" }
    88       ui.field.select{
    89         name = "suggested_initiative_id",
    90         foreign_records = tmp,
    91         foreign_id = "id",
    92         foreign_name = "myname",
    93         value = param.get("suggested_initiative_id", atom.integer)
    94       }
    95       ui.container{ content = _"You may choose one of the ongoing initiatives you are currently supporting" }
    96       slot.put("<br />")
    97       ui.heading { level = 2, content = _"Are you aware that revoking an initiative is irrevocable?" }
    98       ui.container{ content = function()
    99         ui.tag{ tag = "input", attr = {
   100           type = "checkbox",
   101           name = "are_you_sure",
   102           value = "1"
   103         } }
   104         ui.tag { content = _"I understand, that this is not revocable" }
   105       end }
   108       slot.put("<br />")
   109       ui.tag{
   110         tag = "input",
   111         attr = {
   112           type = "submit",
   113           class = "btn btn-dangerous",
   114           value = _"Revoke now"
   115         },
   116         content = ""
   117       }
   118       slot.put("<br />")
   119       slot.put("<br />")
   121       ui.link{
   122         content = _"Cancel",
   123         module = "initiative",
   124         view = "show",
   125         id = initiative.id,
   126         params = {
   127           tab = "initiators"
   128         }
   129       }
   130     end )
   132   end
   133 }
