| 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@1045
 | 
     9 
 | 
| 
bsw@1045
 | 
    10 local records = {
 | 
| 
bsw@1045
 | 
    11   {
 | 
| 
bsw@1045
 | 
    12     id = "-1",
 | 
| 
bsw@1045
 | 
    13     name = _"Choose member"
 | 
| 
bsw@1045
 | 
    14   }
 | 
| 
bsw@1045
 | 
    15 }
 | 
| 
bsw@1045
 | 
    16 local contact_members = app.session.member:get_reference_selector("saved_members"):add_order_by("name"):exec()
 | 
| 
bsw@1045
 | 
    17 for i, record in ipairs(contact_members) do
 | 
| 
bsw@1045
 | 
    18   records[#records+1] = record
 | 
| 
bsw@1045
 | 
    19 end
 | 
| 
bsw@10
 | 
    20 
 | 
| 
bsw@1045
 | 
    21 execute.view {
 | 
| 
bsw@1045
 | 
    22   module = "issue", view = "_head", params = {
 | 
| 
bsw@1045
 | 
    23     issue = initiative.issue,
 | 
| 
bsw@1045
 | 
    24     member = app.session.member
 | 
| 
bsw@10
 | 
    25   }
 | 
| 
bsw@1045
 | 
    26 }
 | 
| 
bsw@1045
 | 
    27 
 | 
| 
bsw@1561
 | 
    28 ui.grid{ content = function()
 | 
| 
bsw@1561
 | 
    29   ui.cell_main{ content = function()
 | 
| 
bsw@10
 | 
    30 
 | 
| 
bsw@1561
 | 
    31     ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function()
 | 
| 
bsw@1045
 | 
    32 
 | 
| 
bsw@1561
 | 
    33       ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function()
 | 
| 
bsw@1561
 | 
    34         ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = initiative.display_name }
 | 
| 
bsw@1561
 | 
    35       end }
 | 
| 
bsw@1045
 | 
    36 
 | 
| 
bsw@1561
 | 
    37       ui.container{ attr = { class = "mdl-card__content" }, content = function()
 | 
| 
bsw@1561
 | 
    38         ui.form{
 | 
| 
bsw@1561
 | 
    39           attr = { class = "wide section" },
 | 
| 
bsw@1561
 | 
    40           module = "initiative",
 | 
| 
bsw@1561
 | 
    41           action = "add_initiator",
 | 
| 
bsw@1561
 | 
    42           params = {
 | 
| 
bsw@1561
 | 
    43             initiative_id = initiative.id,
 | 
| 
bsw@1561
 | 
    44           },
 | 
| 
bsw@1561
 | 
    45           routing = {
 | 
| 
bsw@1561
 | 
    46             ok = {
 | 
| 
bsw@1561
 | 
    47               mode = "redirect",
 | 
| 
bsw@1561
 | 
    48               module = "initiative",
 | 
| 
bsw@1561
 | 
    49               view = "show",
 | 
| 
bsw@1561
 | 
    50               id = initiative.id,
 | 
| 
bsw@1561
 | 
    51               params = {
 | 
| 
bsw@1561
 | 
    52                 tab = "initiators",
 | 
| 
bsw@1561
 | 
    53               }
 | 
| 
bsw@1561
 | 
    54             }
 | 
| 
bsw@1561
 | 
    55           },
 | 
| 
bsw@1561
 | 
    56           content = function()
 | 
| 
bsw@1045
 | 
    57 
 | 
| 
bsw@1561
 | 
    58             ui.heading { level = 3, content = _"Invite an initiator to initiative" }
 | 
| 
bsw@1561
 | 
    59             ui.container{ content = _"You can choose only members which you have been saved as contact before." }
 | 
| 
bsw@1561
 | 
    60             slot.put("<br />")
 | 
| 
bsw@1561
 | 
    61             ui.field.select{
 | 
| 
bsw@1561
 | 
    62               name = "member_id",
 | 
| 
bsw@1561
 | 
    63               foreign_records = records,
 | 
| 
bsw@1561
 | 
    64               foreign_id = "id",
 | 
| 
bsw@1561
 | 
    65               foreign_name = "name"
 | 
| 
bsw@1561
 | 
    66             }
 | 
| 
bsw@1561
 | 
    67            slot.put("<br />")
 | 
| 
bsw@1561
 | 
    68            slot.put("<br />")
 | 
| 
bsw@1561
 | 
    69             ui.tag{
 | 
| 
bsw@1561
 | 
    70               tag = "input",
 | 
| 
bsw@1561
 | 
    71               attr = {
 | 
| 
bsw@1561
 | 
    72                 type = "submit",
 | 
| 
bsw@1561
 | 
    73                 class = "mdl-button mdl-js-button mdl-button--raised mdl-button--colored",
 | 
| 
bsw@1561
 | 
    74                 value = _"Invite member"
 | 
| 
bsw@1561
 | 
    75               },
 | 
| 
bsw@1561
 | 
    76               content = ""
 | 
| 
bsw@1561
 | 
    77             }
 | 
| 
bsw@1561
 | 
    78             slot.put("   ")
 | 
| 
bsw@1561
 | 
    79             ui.link{
 | 
| 
bsw@1561
 | 
    80               attr = { class = "mdl-button mdl-js-button mdl-button--raised" },
 | 
| 
bsw@1561
 | 
    81               content = _"Cancel",
 | 
| 
bsw@1561
 | 
    82               module = "initiative",
 | 
| 
bsw@1561
 | 
    83               view = "show",
 | 
| 
bsw@1561
 | 
    84               id = initiative.id,
 | 
| 
bsw@1561
 | 
    85               params = {
 | 
| 
bsw@1561
 | 
    86                 tab = "initiators"
 | 
| 
bsw@1561
 | 
    87               }
 | 
| 
bsw@1561
 | 
    88             }
 | 
| 
bsw@1561
 | 
    89           end
 | 
| 
bsw@1561
 | 
    90         }
 | 
| 
bsw@1045
 | 
    91 
 | 
| 
bsw@1561
 | 
    92       end }
 | 
| 
bsw@1561
 | 
    93     end }
 | 
| 
bsw@1561
 | 
    94   end }
 | 
| 
bsw@1561
 | 
    95 
 | 
| 
bsw@1561
 | 
    96 end }
 | 
| 
bsw@1561
 | 
    97 
 | 
| 
bsw@1561
 | 
    98 
 |