My favorites | Sign in
Project Logo
                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44

module(..., package.seeall)


local TEMPLATE = [===[

<a $new_ticket_link>Create New Ticket</a>

<ul>
$do_tickets[[<li>$status: <a $ticket_link>$ticket_id</a> ($title)</li>]]
</ul>
]===]


actions = {}

actions.show = function(node, request, sputnik)
local tickets = {}
local ticket_counter = 0
for i, node_id in ipairs(sputnik:get_node_names()) do
if node_id:sub(0,7) == "Ticket:" then
local ticket = sputnik:get_node(node_id)
ticket.ticket_id = node_id:sub(8)
table.insert(tickets, ticket)
local ticket_number = tonumber(ticket.ticket_id) or 0
if ticket_number > ticket_counter then ticket_counter = ticket_number; end
end
end
node.inner_html = cosmo.f(TEMPLATE){
do_tickets = function()
for i, ticket in ipairs(tickets) do
cosmo.yield{
ticket_link = sputnik:make_link(ticket.name),
ticket_id = ticket.ticket_id,
status = ticket.status,
title = ticket.title,
}
end
end,
new_ticket_link = sputnik:make_link(string.format("Ticket:%06d", ticket_counter + 1), "edit",
{prototype = "@Ticket", reported_by = request.user})
}
return node.wrappers.default(node, request, sputnik)
end
Show details Hide details

Change log

r178 by takhteyev on Jan 19, 2008   Diff
Moving plugins to rocks
Go to: 
Project members, sign in to write a code review

Older revisions

r158 by takhteyev on Dec 25, 2007   Diff
refactored stylesheets, etc.
All revisions of this file

File info

Size: 1692 bytes, 44 lines
Hosted by Google Code