bsw@1045: local initiative = Initiative:by_id(param.get_id())
bsw@1045:
bsw@1045: initiative:load_everything_for_member_id(app.session.member_id)
bsw@1045: initiative.issue:load_everything_for_member_id(app.session.member_id)
bsw@1045:
bsw@1045:
bsw@1045: execute.view{ module = "issue", view = "_sidebar_state", params = {
bsw@1045: initiative = initiative
bsw@1045: } }
bsw@1045:
bsw@1045: execute.view {
bsw@1045: module = "issue", view = "_sidebar_issue",
bsw@1045: params = {
bsw@1045: issue = initiative.issue,
bsw@1045: highlight_initiative_id = initiative.id
bsw@1045: }
bsw@1045: }
bsw@1045:
bsw@1045: execute.view {
bsw@1045: module = "issue", view = "_sidebar_whatcanido",
bsw@1045: params = { initiative = initiative }
bsw@1045: }
bsw@1045:
bsw@1045: execute.view {
bsw@1045: module = "issue", view = "_sidebar_members", params = {
bsw@1045: issue = initiative.issue, initiative = initiative
bsw@1045: }
bsw@1045: }
bsw@1045:
bsw@1045:
bsw@1045:
bsw@1045: execute.view {
bsw@1045: module = "issue", view = "_head", params = {
bsw@1045: issue = initiative.issue
bsw@1045: }
bsw@1045: }
bsw@1045:
bsw@1045: ui.form{
bsw@1045: method = "get",
bsw@1045: module = "draft",
bsw@1045: view = "diff",
bsw@1045: attr = { class = "section" },
bsw@1045: content = function()
bsw@1045: ui.field.hidden{ name = "initiative_id", value = initiative.id }
bsw@1045:
bsw@1045: ui.sectionHead( function()
bsw@1045: ui.link{
bsw@1045: module = "initiative", view = "show", id = initiative.id,
bsw@1045: content = function ()
bsw@1045: ui.heading {
bsw@1045: level = 1,
bsw@1045: content = initiative.display_name
bsw@1045: }
bsw@1045: end
bsw@1045: }
bsw@1045: ui.heading { level = 2, content = _"Draft history" }
bsw@1045: end)
bsw@1045:
bsw@1045: ui.sectionRow( function()
bsw@1045:
bsw@1045: local columns = {
bsw@1045: {
bsw@1045: label = _"draft ID",
bsw@1045: content = function(record)
bsw@1045: ui.tag { content = record.id }
bsw@1045: end
bsw@1045: },
bsw@1045: {
bsw@1045: label = _"published at",
bsw@1045: content = function(record)
bsw@1045: ui.link{
bsw@1045: attr = { class = "action" },
bsw@1045: module = "draft", view = "show", id = record.id,
bsw@1045: text = format.timestamp(record.created)
bsw@1045: }
bsw@1045: end
bsw@1045: },
bsw@1045: {
bsw@1045: label = _"compare",
bsw@1045: content = function(record)
bsw@1045: slot.put('')
bsw@1045: slot.put('')
bsw@1045: end
bsw@1045: }
bsw@1045: }
bsw@1045:
bsw@1045: if app.session:has_access("authors_pseudonymous") then
bsw@1045: columns[#columns+1] = {
bsw@1045: label = _"author",
bsw@1045: content = function(record)
bsw@1045: if record.author then
bsw@1045: return util.micro_avatar ( record.author )
bsw@1045: end
bsw@1045: end
bsw@1045: }
bsw@1045: end
bsw@1045:
bsw@1209: if config.render_external_reference and config.render_external_reference.draft then
bsw@1209: columns[#columns+1] = {
bsw@1209: label = _"external reference",
bsw@1209: content = function(draft)
bsw@1209: config.render_external_reference.draft(draft, function (callback)
bsw@1209: callback()
bsw@1209: end)
bsw@1209: end
bsw@1209: }
bsw@1209: end
bsw@1209:
bsw@1045: ui.list{
bsw@1045: records = initiative.drafts,
bsw@1045: columns = columns
bsw@1045: }
bsw@1045:
bsw@1045: slot.put("
")
bsw@1045: ui.container { attr = { class = "actions" }, content = function()
bsw@1045: ui.tag{
bsw@1045: tag = "input",
bsw@1045: attr = {
bsw@1045: type = "submit",
bsw@1045: class = "btn btn-default",
bsw@1045: value = _"compare revisions"
bsw@1045: },
bsw@1045: content = ""
bsw@1045: }
bsw@1045: end }
bsw@1045: end )
bsw@1045: end
bsw@1045: }