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@1045
|
7 execute.view{ module = "issue", view = "_sidebar_state", params = {
|
bsw@1045
|
8 initiative = initiative
|
bsw@1045
|
9 } }
|
bsw@1045
|
10
|
bsw@1045
|
11 execute.view {
|
bsw@1045
|
12 module = "issue", view = "_sidebar_issue",
|
bsw@1045
|
13 params = {
|
bsw@1045
|
14 issue = initiative.issue,
|
bsw@1045
|
15 highlight_initiative_id = initiative.id
|
bsw@1045
|
16 }
|
bsw@1045
|
17 }
|
bsw@1045
|
18
|
bsw@1045
|
19 execute.view {
|
bsw@1045
|
20 module = "issue", view = "_sidebar_whatcanido",
|
bsw@1045
|
21 params = { initiative = initiative }
|
bsw@1045
|
22 }
|
bsw@1045
|
23
|
bsw@1045
|
24 execute.view {
|
bsw@1045
|
25 module = "issue", view = "_sidebar_members", params = {
|
bsw@1045
|
26 issue = initiative.issue, initiative = initiative
|
bsw@1045
|
27 }
|
bsw@1045
|
28 }
|
bsw@1045
|
29
|
bsw@1045
|
30
|
bsw@1045
|
31
|
bsw@1045
|
32 execute.view {
|
bsw@1045
|
33 module = "issue", view = "_head", params = {
|
bsw@1045
|
34 issue = initiative.issue
|
bsw@1045
|
35 }
|
bsw@1045
|
36 }
|
bsw@1045
|
37
|
bsw@1045
|
38 ui.form{
|
bsw@1045
|
39 method = "get",
|
bsw@1045
|
40 module = "draft",
|
bsw@1045
|
41 view = "diff",
|
bsw@1045
|
42 attr = { class = "section" },
|
bsw@1045
|
43 content = function()
|
bsw@1045
|
44 ui.field.hidden{ name = "initiative_id", value = initiative.id }
|
bsw@1045
|
45
|
bsw@1045
|
46 ui.sectionHead( function()
|
bsw@1045
|
47 ui.link{
|
bsw@1045
|
48 module = "initiative", view = "show", id = initiative.id,
|
bsw@1045
|
49 content = function ()
|
bsw@1045
|
50 ui.heading {
|
bsw@1045
|
51 level = 1,
|
bsw@1045
|
52 content = initiative.display_name
|
bsw@1045
|
53 }
|
bsw@1045
|
54 end
|
bsw@1045
|
55 }
|
bsw@1045
|
56 ui.heading { level = 2, content = _"Draft history" }
|
bsw@1045
|
57 end)
|
bsw@1045
|
58
|
bsw@1045
|
59 ui.sectionRow( function()
|
bsw@1045
|
60
|
bsw@1045
|
61 local columns = {
|
bsw@1045
|
62 {
|
bsw@1045
|
63 label = _"draft ID",
|
bsw@1045
|
64 content = function(record)
|
bsw@1045
|
65 ui.tag { content = record.id }
|
bsw@1045
|
66 end
|
bsw@1045
|
67 },
|
bsw@1045
|
68 {
|
bsw@1045
|
69 label = _"published at",
|
bsw@1045
|
70 content = function(record)
|
bsw@1045
|
71 ui.link{
|
bsw@1045
|
72 attr = { class = "action" },
|
bsw@1045
|
73 module = "draft", view = "show", id = record.id,
|
bsw@1045
|
74 text = format.timestamp(record.created)
|
bsw@1045
|
75 }
|
bsw@1045
|
76 end
|
bsw@1045
|
77 },
|
bsw@1045
|
78 {
|
bsw@1045
|
79 label = _"compare",
|
bsw@1045
|
80 content = function(record)
|
bsw@1045
|
81 slot.put('<input type="radio" name="old_draft_id" value="' .. tostring(record.id) .. '">')
|
bsw@1045
|
82 slot.put('<input type="radio" name="new_draft_id" value="' .. tostring(record.id) .. '">')
|
bsw@1045
|
83 end
|
bsw@1045
|
84 }
|
bsw@1045
|
85 }
|
bsw@1045
|
86
|
bsw@1045
|
87 if app.session:has_access("authors_pseudonymous") then
|
bsw@1045
|
88 columns[#columns+1] = {
|
bsw@1045
|
89 label = _"author",
|
bsw@1045
|
90 content = function(record)
|
bsw@1045
|
91 if record.author then
|
bsw@1045
|
92 return util.micro_avatar ( record.author )
|
bsw@1045
|
93 end
|
bsw@1045
|
94 end
|
bsw@1045
|
95 }
|
bsw@1045
|
96 end
|
bsw@1045
|
97
|
bsw@1045
|
98 ui.list{
|
bsw@1045
|
99 records = initiative.drafts,
|
bsw@1045
|
100 columns = columns
|
bsw@1045
|
101 }
|
bsw@1045
|
102
|
bsw@1045
|
103 slot.put("<br />")
|
bsw@1045
|
104 ui.container { attr = { class = "actions" }, content = function()
|
bsw@1045
|
105 ui.tag{
|
bsw@1045
|
106 tag = "input",
|
bsw@1045
|
107 attr = {
|
bsw@1045
|
108 type = "submit",
|
bsw@1045
|
109 class = "btn btn-default",
|
bsw@1045
|
110 value = _"compare revisions"
|
bsw@1045
|
111 },
|
bsw@1045
|
112 content = ""
|
bsw@1045
|
113 }
|
bsw@1045
|
114 end }
|
bsw@1045
|
115 end )
|
bsw@1045
|
116 end
|
bsw@1045
|
117 }
|