| rev | 
   line source | 
| 
bsw@10
 | 
     1 local initiative = Initiative:by_id(param.get("initiative_id"))
 | 
| 
bsw@10
 | 
     2 
 | 
| 
bsw@1045
 | 
     3 local member = app.session.member
 | 
| 
bsw@1045
 | 
     4 if member then
 | 
| 
bsw@1045
 | 
     5   initiative:load_everything_for_member_id(member.id)
 | 
| 
bsw@1045
 | 
     6   initiative.issue:load_everything_for_member_id(member.id)
 | 
| 
bsw@1045
 | 
     7 end
 | 
| 
bsw@1045
 | 
     8 
 | 
| 
bsw@10
 | 
     9 local initiator = Initiator:by_pk(initiative.id, app.session.member.id)
 | 
| 
bsw@10
 | 
    10 if not initiator or initiator.accepted ~= true then
 | 
| 
bsw/jbe@1309
 | 
    11   return execute.view { module = "index", view = "403" }
 | 
| 
bsw@10
 | 
    12 end
 | 
| 
bsw@10
 | 
    13 
 | 
| 
bsw@1045
 | 
    14 execute.view {
 | 
| 
bsw@1045
 | 
    15   module = "issue", view = "_head", params = {
 | 
| 
bsw@1045
 | 
    16     issue = initiative.issue,
 | 
| 
bsw@1045
 | 
    17     member = app.session.member
 | 
| 
bsw@1045
 | 
    18   }
 | 
| 
bsw@1045
 | 
    19 }
 | 
| 
bsw@1045
 | 
    20 
 | 
| 
bsw@1563
 | 
    21 ui.grid{ content = function()
 | 
| 
bsw@1563
 | 
    22   ui.cell_main{ content = function()
 | 
| 
bsw@1563
 | 
    23 
 | 
| 
bsw@1563
 | 
    24     ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function()
 | 
| 
bsw@10
 | 
    25 
 | 
| 
bsw@1563
 | 
    26       ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function()
 | 
| 
bsw@1563
 | 
    27         ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = initiative.display_name }
 | 
| 
bsw@1563
 | 
    28       end }
 | 
| 
bsw@10
 | 
    29 
 | 
| 
bsw@1563
 | 
    30       ui.container{ attr = { class = "mdl-card__content" }, content = function()
 | 
| 
bsw@1045
 | 
    31 
 | 
| 
bsw@1563
 | 
    32         ui.form{
 | 
| 
bsw@1563
 | 
    33           attr = { class = "vertical section" },
 | 
| 
bsw@1563
 | 
    34           module = "initiative",
 | 
| 
bsw@1563
 | 
    35           action = "remove_initiator",
 | 
| 
bsw@1563
 | 
    36           params = {
 | 
| 
bsw@1563
 | 
    37             initiative_id = initiative.id,
 | 
| 
bsw@1563
 | 
    38           },
 | 
| 
bsw@1563
 | 
    39           routing = {
 | 
| 
bsw@1563
 | 
    40             ok = {
 | 
| 
bsw@1563
 | 
    41               mode = "redirect",
 | 
| 
bsw@1563
 | 
    42               module = "initiative",
 | 
| 
bsw@1563
 | 
    43               view = "show",
 | 
| 
bsw@1563
 | 
    44               id = initiative.id,
 | 
| 
bsw@1563
 | 
    45               params = {
 | 
| 
bsw@1563
 | 
    46                 tab = "initiators",
 | 
| 
bsw@1563
 | 
    47               }
 | 
| 
bsw@1563
 | 
    48             }
 | 
| 
bsw@1563
 | 
    49           },
 | 
| 
bsw@1563
 | 
    50           content = function()
 | 
| 
bsw@10
 | 
    51 
 | 
| 
bsw@1563
 | 
    52             ui.heading { level = 3, content = _"Remove an initiator from initiative" }
 | 
| 
bsw@1045
 | 
    53 
 | 
| 
bsw@1563
 | 
    54             local records = initiative:get_reference_selector("initiating_members"):add_where("accepted OR accepted ISNULL"):exec()
 | 
| 
bsw@1045
 | 
    55 
 | 
| 
bsw@1563
 | 
    56             ui.field.select{
 | 
| 
bsw@1563
 | 
    57               name = "member_id",
 | 
| 
bsw@1563
 | 
    58               foreign_records = records,
 | 
| 
bsw@1563
 | 
    59               foreign_id = "id",
 | 
| 
bsw@1563
 | 
    60               foreign_name = "name",
 | 
| 
bsw@1563
 | 
    61             }
 | 
| 
bsw@1563
 | 
    62             slot.put("<br />")
 | 
| 
bsw@1563
 | 
    63             ui.tag{
 | 
| 
bsw@1563
 | 
    64               tag = "input",
 | 
| 
bsw@1563
 | 
    65               attr = {
 | 
| 
bsw@1563
 | 
    66                 type = "submit",
 | 
| 
bsw@1563
 | 
    67                 class = "mdl-button mdl-js-button mdl-button--raised mdl-button--colored",
 | 
| 
bsw@1563
 | 
    68                 value = _"Remove initiator"
 | 
| 
bsw@1563
 | 
    69               },
 | 
| 
bsw@1563
 | 
    70               content = ""
 | 
| 
bsw@1563
 | 
    71             }
 | 
| 
bsw@1563
 | 
    72             slot.put("   ")
 | 
| 
bsw@1563
 | 
    73             ui.link{
 | 
| 
bsw@1563
 | 
    74               attr = { class = "mdl-button mdl-js-button mdl-button--raised" },
 | 
| 
bsw@1563
 | 
    75               content = _"Cancel",
 | 
| 
bsw@1563
 | 
    76               module = "initiative",
 | 
| 
bsw@1563
 | 
    77               view = "show",
 | 
| 
bsw@1563
 | 
    78               id = initiative.id,
 | 
| 
bsw@1563
 | 
    79               params = {
 | 
| 
bsw@1563
 | 
    80                 tab = "initiators"
 | 
| 
bsw@1563
 | 
    81               }
 | 
| 
bsw@1563
 | 
    82             }
 | 
| 
bsw@1563
 | 
    83           end
 | 
| 
bsw@1045
 | 
    84         }
 | 
| 
bsw@1563
 | 
    85       end }
 | 
| 
bsw@1563
 | 
    86     end }
 | 
| 
bsw@1563
 | 
    87   end }
 | 
| 
bsw@1563
 | 
    88 end }
 |