| rev | 
   line source | 
| 
bsw@1045
 | 
     1 local initiative = Initiative:by_id(param.get_id())
 | 
| 
bsw@1045
 | 
     2 
 | 
| 
bsw@1045
 | 
     3 initiative:load_everything_for_member_id(app.session.member_id)
 | 
| 
bsw@1045
 | 
     4 initiative.issue:load_everything_for_member_id(app.session.member_id)
 | 
| 
bsw@1045
 | 
     5 
 | 
| 
bsw@1045
 | 
     6 
 | 
| 
bsw/jbe@1309
 | 
     7 ui.grid{ content = function()
 | 
| 
bsw@1045
 | 
     8 
 | 
| 
bsw/jbe@1309
 | 
     9   ui.cell_main{ content = function()
 | 
| 
bsw/jbe@1309
 | 
    10     ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function()
 | 
| 
bsw@1045
 | 
    11 
 | 
| 
bsw/jbe@1309
 | 
    12       ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function ()
 | 
| 
bsw/jbe@1309
 | 
    13         ui.heading { 
 | 
| 
bsw/jbe@1309
 | 
    14           attr = { class = "mdl-card__title-text" },
 | 
| 
bsw/jbe@1309
 | 
    15           content = function()
 | 
| 
bsw/jbe@1309
 | 
    16             ui.link{
 | 
| 
bsw/jbe@1309
 | 
    17               module = "initiative", view = "show", id = initiative.id,
 | 
| 
bsw/jbe@1309
 | 
    18               content = initiative.display_name
 | 
| 
bsw/jbe@1309
 | 
    19             }
 | 
| 
bsw/jbe@1309
 | 
    20           end
 | 
| 
bsw/jbe@1309
 | 
    21         }
 | 
| 
bsw/jbe@1309
 | 
    22         ui.container { content = _"Draft history" }
 | 
| 
bsw/jbe@1309
 | 
    23       end }
 | 
| 
bsw/jbe@1309
 | 
    24       
 | 
| 
bsw/jbe@1309
 | 
    25       ui.container {
 | 
| 
bsw/jbe@1309
 | 
    26         attr = { class = "mdl-card__content" },
 | 
| 
bsw/jbe@1309
 | 
    27         content = function()
 | 
| 
bsw/jbe@1309
 | 
    28           ui.form{
 | 
| 
bsw/jbe@1309
 | 
    29             method = "get",
 | 
| 
bsw/jbe@1309
 | 
    30             module = "draft",
 | 
| 
bsw/jbe@1309
 | 
    31             view = "diff",
 | 
| 
bsw/jbe@1309
 | 
    32             attr = { class = "section" },
 | 
| 
bsw/jbe@1309
 | 
    33             content = function()
 | 
| 
bsw/jbe@1309
 | 
    34               ui.field.hidden{ name = "initiative_id", value = initiative.id }
 | 
| 
bsw/jbe@1309
 | 
    35             
 | 
| 
bsw/jbe@1309
 | 
    36               ui.sectionRow( function()
 | 
| 
bsw/jbe@1309
 | 
    37               
 | 
| 
bsw/jbe@1309
 | 
    38                 local columns = {
 | 
| 
bsw/jbe@1309
 | 
    39                   {
 | 
| 
bsw/jbe@1309
 | 
    40                     label = _"draft ID",
 | 
| 
bsw/jbe@1309
 | 
    41                     content = function(record)
 | 
| 
bsw/jbe@1309
 | 
    42                       ui.tag { content = record.id }
 | 
| 
bsw/jbe@1309
 | 
    43                     end
 | 
| 
bsw/jbe@1309
 | 
    44                   },
 | 
| 
bsw/jbe@1309
 | 
    45                   {
 | 
| 
bsw/jbe@1309
 | 
    46                     label = _"published at",
 | 
| 
bsw/jbe@1309
 | 
    47                     content = function(record)
 | 
| 
bsw/jbe@1309
 | 
    48                       ui.link{
 | 
| 
bsw/jbe@1309
 | 
    49                         attr = { class = "action" },
 | 
| 
bsw/jbe@1309
 | 
    50                         module = "draft", view = "show", id = record.id,
 | 
| 
bsw/jbe@1309
 | 
    51                         text = format.timestamp(record.created)
 | 
| 
bsw/jbe@1309
 | 
    52                       }
 | 
| 
bsw/jbe@1309
 | 
    53                     end
 | 
| 
bsw/jbe@1309
 | 
    54                   },
 | 
| 
bsw/jbe@1309
 | 
    55                   {
 | 
| 
bsw/jbe@1309
 | 
    56                     label = _"compare",
 | 
| 
bsw/jbe@1309
 | 
    57                     content = function(record)
 | 
| 
bsw/jbe@1309
 | 
    58                       slot.put('<label class="mdl-radio mdl-js-radio mdl-js-ripple-effect" for="old_draft_id_' .. record.id .. '"><input type="radio" class="mdl-radio__button" id="old_draft_id_' .. record.id .. '" name="old_draft_id" value="' .. tostring(record.id) .. '"></label>')
 | 
| 
bsw/jbe@1309
 | 
    59                       slot.put('<label class="mdl-radio mdl-js-radio mdl-js-ripple-effect" for="new_draft_id_' .. record.id .. '"><input type="radio" class="mdl-radio__button" id="new_draft_id_' .. record.id .. '" name="new_draft_id" value="' .. tostring(record.id) .. '"></label>')
 | 
| 
bsw/jbe@1309
 | 
    60                       --lot.put('<input type="radio" name="new_draft_id" value="' .. tostring(record.id) .. '">')
 | 
| 
bsw/jbe@1309
 | 
    61                     end
 | 
| 
bsw/jbe@1309
 | 
    62                   }
 | 
| 
bsw/jbe@1309
 | 
    63                 }
 | 
| 
bsw/jbe@1309
 | 
    64                 
 | 
| 
bsw/jbe@1309
 | 
    65                 if app.session:has_access("authors_pseudonymous") then
 | 
| 
bsw/jbe@1309
 | 
    66                   columns[#columns+1] = {
 | 
| 
bsw/jbe@1309
 | 
    67                     label = _"author",
 | 
| 
bsw/jbe@1309
 | 
    68                     content = function(record)
 | 
| 
bsw/jbe@1309
 | 
    69                       if record.author then
 | 
| 
bsw/jbe@1309
 | 
    70                         return util.micro_avatar ( record.author )
 | 
| 
bsw/jbe@1309
 | 
    71                       end
 | 
| 
bsw/jbe@1309
 | 
    72                     end
 | 
| 
bsw/jbe@1309
 | 
    73                   }
 | 
| 
bsw/jbe@1309
 | 
    74                 end
 | 
| 
bsw/jbe@1309
 | 
    75                 
 | 
| 
bsw/jbe@1309
 | 
    76                 if config.render_external_reference and config.render_external_reference.draft then
 | 
| 
bsw/jbe@1309
 | 
    77                   columns[#columns+1] = {
 | 
| 
bsw/jbe@1309
 | 
    78                     label = _"external reference",
 | 
| 
bsw/jbe@1309
 | 
    79                     content = function(draft)
 | 
| 
bsw/jbe@1309
 | 
    80                       config.render_external_reference.draft(draft, function (callback)
 | 
| 
bsw/jbe@1309
 | 
    81                         callback()
 | 
| 
bsw/jbe@1309
 | 
    82                       end)
 | 
| 
bsw/jbe@1309
 | 
    83                     end
 | 
| 
bsw/jbe@1309
 | 
    84                   }
 | 
| 
bsw/jbe@1309
 | 
    85                 end
 | 
| 
bsw/jbe@1309
 | 
    86                 
 | 
| 
bsw/jbe@1309
 | 
    87                 ui.list{
 | 
| 
bsw/jbe@1309
 | 
    88                   records = initiative.drafts,
 | 
| 
bsw/jbe@1309
 | 
    89                   columns = columns
 | 
| 
bsw/jbe@1309
 | 
    90                 }
 | 
| 
bsw/jbe@1309
 | 
    91                 
 | 
| 
bsw/jbe@1309
 | 
    92                 slot.put("<br />")
 | 
| 
bsw/jbe@1309
 | 
    93                 ui.container { attr = { class = "actions" }, content = function()
 | 
| 
bsw/jbe@1309
 | 
    94                   ui.tag{
 | 
| 
bsw/jbe@1309
 | 
    95                     tag = "input",
 | 
| 
bsw/jbe@1309
 | 
    96                     attr = {
 | 
| 
bsw/jbe@1309
 | 
    97                       type = "submit",
 | 
| 
bsw/jbe@1309
 | 
    98                       class = "mdl-button mdl-js-button mdl-button--raised mdl-button--colored",
 | 
| 
bsw/jbe@1309
 | 
    99                       value = _"compare revisions"
 | 
| 
bsw/jbe@1309
 | 
   100                     },
 | 
| 
bsw/jbe@1309
 | 
   101                     content = ""
 | 
| 
bsw/jbe@1309
 | 
   102                   }
 | 
| 
bsw/jbe@1309
 | 
   103                 end }
 | 
| 
bsw/jbe@1309
 | 
   104               end )
 | 
| 
bsw/jbe@1309
 | 
   105             end
 | 
| 
bsw@1045
 | 
   106           }
 | 
| 
bsw@1045
 | 
   107         end
 | 
| 
bsw@1045
 | 
   108       }
 | 
| 
bsw/jbe@1309
 | 
   109     end }
 | 
| 
bsw/jbe@1309
 | 
   110   end }
 | 
| 
bsw/jbe@1309
 | 
   111   
 | 
| 
bsw/jbe@1309
 | 
   112   ui.cell_sidebar{ content = function()
 | 
| 
bsw/jbe@1309
 | 
   113     execute.view{ module = "issue", view = "_sidebar", params = {
 | 
| 
bsw/jbe@1309
 | 
   114       initiative = initiative,
 | 
| 
bsw/jbe@1309
 | 
   115       issue = initiative.issue
 | 
| 
bsw/jbe@1309
 | 
   116     } }
 | 
| 
bsw/jbe@1309
 | 
   117 
 | 
| 
bsw/jbe@1309
 | 
   118     execute.view {
 | 
| 
bsw/jbe@1309
 | 
   119       module = "issue", view = "_sidebar_whatcanido",
 | 
| 
bsw/jbe@1309
 | 
   120       params = { initiative = initiative }
 | 
| 
bsw/jbe@1309
 | 
   121     }
 | 
| 
bsw/jbe@1309
 | 
   122 
 | 
| 
bsw/jbe@1309
 | 
   123     execute.view { 
 | 
| 
bsw/jbe@1309
 | 
   124       module = "issue", view = "_sidebar_members", params = {
 | 
| 
bsw/jbe@1309
 | 
   125         issue = initiative.issue, initiative = initiative
 | 
| 
bsw@1045
 | 
   126       }
 | 
| 
bsw/jbe@1309
 | 
   127     }
 | 
| 
bsw/jbe@1309
 | 
   128   end }
 | 
| 
bsw/jbe@1309
 | 
   129   
 | 
| 
bsw/jbe@1309
 | 
   130 end }
 |