liquid_feedback_frontend
view app/main/initiative/add_initiator.lua @ 1227:e0235b3d19ee
Removed code not used anymore (outdated feature "discussion url")
| author | bsw | 
|---|---|
| date | Tue Dec 01 17:29:54 2015 +0100 (2015-12-01) | 
| parents | 701a5cf6b067 | 
| children | 5edf916b7cd2 | 
 line source
     1 local initiative = Initiative:by_id(param.get("initiative_id"))
     3 local member = app.session.member
     4 if member then
     5   initiative:load_everything_for_member_id(member.id)
     6   initiative.issue:load_everything_for_member_id(member.id)
     7 end
    10 local records = {
    11   {
    12     id = "-1",
    13     name = _"Choose member"
    14   }
    15 }
    16 local contact_members = app.session.member:get_reference_selector("saved_members"):add_order_by("name"):exec()
    17 for i, record in ipairs(contact_members) do
    18   records[#records+1] = record
    19 end
    21 execute.view {
    22   module = "issue", view = "_head", params = {
    23     issue = initiative.issue,
    24     member = app.session.member
    25   }
    26 }
    28 execute.view{ module = "issue", view = "_sidebar_state", params = {
    29   initiative = initiative
    30 } }
    32 execute.view { 
    33   module = "issue", view = "_sidebar_issue", 
    34   params = {
    35     issue = initiative.issue,
    36     highlight_initiative_id = initiative.id
    37   }
    38 }
    40 execute.view {
    41   module = "issue", view = "_sidebar_whatcanido",
    42   params = { initiative = initiative }
    43 }
    45 execute.view { 
    46   module = "issue", view = "_sidebar_members", params = {
    47     issue = initiative.issue, initiative = initiative
    48   }
    49 }
    51 ui.form{
    52   attr = { class = "wide section" },
    53   module = "initiative",
    54   action = "add_initiator",
    55   params = {
    56     initiative_id = initiative.id,
    57   },
    58   routing = {
    59     ok = {
    60       mode = "redirect",
    61       module = "initiative",
    62       view = "show",
    63       id = initiative.id,
    64       params = {
    65         tab = "initiators",
    66       }
    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 = _"Invite an initiator to initiative" }
    82     end )
    84     ui.sectionRow( function()
    85       ui.heading { level = 2, content = _"Choose a member to invite" }
    86       ui.field.select{
    87         name = "member_id",
    88         foreign_records = records,
    89         foreign_id = "id",
    90         foreign_name = "name"
    91       }
    92       ui.container{ content = _"You can choose only members which you have been saved as contact before." }
    93       slot.put("<br />")
    94       ui.tag{
    95         tag = "input",
    96         attr = {
    97           type = "submit",
    98           class = "btn btn-default",
    99           value = _"Invite member"
   100         },
   101         content = ""
   102       }
   103       slot.put("<br />")
   104       slot.put("<br />")
   105       ui.link{
   106         content = _"Cancel",
   107         module = "initiative",
   108         view = "show",
   109         id = initiative.id,
   110         params = {
   111           tab = "initiators"
   112         }
   113       }
   114     end )
   115   end
   116 }
