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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
module(..., package.seeall)

local util = require"sputnik.util"

SLASH = "/"
actions = {}

actions.mixed_album = function(node, params, sputnik)

local total_height = 0
for i, row in ipairs(node.content.rows) do
total_height = total_height + 8 + (#row==6 and 150 or 100)
end

local function pixify(value)
return string.format("%dpx", value)
end

node.inner_html = cosmo.f(node.templates.MIXED_ALBUM){
before = node.markup.transform(node.content.before or ""),
after = node.markup.transform(node.content.after or ""),
do_photos = function()
local width, dwidth, height
local y = 2
for i, row in ipairs(node.content.rows) do
if #row == 6 then
width, dwidth, height = 100, 6, 150
else
width, dwidth, height = 150, 10, 100
end
local x = 2
for i = 1,#row do
photo = row[i]
if photo then
local album, image = util.split(photo.id, SLASH)
photo.size = photo.size or 1

cosmo.yield {
width = pixify(width*photo.size + dwidth*(photo.size-1)),
height = pixify(height*photo.size + 8*(photo.size-1)),
left = pixify(2 + (width + dwidth) * (i-1)),
top = pixify(y),
link_base = node.content.link_base,
thumb_base = node.content.thumb_base,
suffix = photo.size>1 and string.format("%dx", photo.size) or "",
thumb_dir = photo.size==1 and album or "oddsize",
album = album,
image = image,
id = photo.id,

}
end
end
y = y + height + 8
end
end,
height = total_height
}

return node.wrappers.default(node, params, sputnik)
end

Show details Hide details

Change log

r191 by takhteyev on Feb 10, 2008   Diff
Updated the album demo for the new version
of Sputnik
Go to: 
Project members, sign in to write a code review

Older revisions

r178 by takhteyev on Jan 19, 2008   Diff
Moving plugins to rocks
r176 by takhteyev on Jan 19, 2008   Diff
More plugins
r167 by takhteyev on Jan 01, 2008   Diff
moving modules to "modules"
All revisions of this file

File info

Size: 3099 bytes, 62 lines
Hosted by Google Code