3 class Pettanr.Image.Icon extends Pettanr.Tag.Img
\r
5 # attr: {any_attr: 'hoge', ...}
\r
6 # class_name: 'El-Class'
\r
8 # half: true // half size if you want
\r
9 initialize: (options) ->
\r
10 @item = options.item
\r
11 @half = options.half
\r
12 @class_name = options.class_name
\r
13 @attr = options.attr || {}
\r
14 @width = Manifest.manifest().magic_numbers['thumbnail_width']
\r
15 @height = Manifest.manifest().magic_numbers['thumbnail_height']
\r
16 @name = @item.model_name()
\r
17 @title = if @item['get'] # is instance?
\r
18 @name + ' ID:' + Pettanr.to_s(@item.get('id'))
\r
22 @width = Pettanr.to_i(@width/2)
\r
23 @height = Pettanr.to_i(@height/2)
\r
24 @attr['src'] = '/images/' + Pettanr.underscore(@name) + '.gif'
\r
25 @attr['width'] = @width
\r
26 @attr['height'] = @height
\r
27 @attr['alt'] = @name
\r
28 @attr['title'] = @title
\r
31 class_name: @class_name
\r
35 class Pettanr.Image.SymbolPicture extends Pettanr.Tag.Img
\r
36 # show picture as symbol size
\r
38 # attr: {src: '/2.png', alt: 'title', ...}
\r
39 # class_name: 'El-Class'
\r
40 # picture: instance of AnyPicture
\r
41 # half: true // half size if you want
\r
42 initialize: (options) ->
\r
43 @picture = options.picture
\r
44 @class_name = options.class_name
\r
45 @attr = options.attr
\r
46 @half = options.half
\r
47 wh = Pettanr.Imager.thumbnail_size(@picture.get('width'), @picture.get('height'))
\r
48 @width = Math.abs(wh[0])
\r
49 @height = Math.abs(wh[1])
\r
51 @width = Pettanr.to_i(@width/2)
\r
52 @height = Pettanr.to_i(@height/2)
\r
53 @attr['width'] = @width
\r
54 @attr['height'] = @height
\r
57 class_name: @class_name
\r
61 class Pettanr.Image.SymbolImg extends Pettanr.Tag.Img
\r
62 # show image file as symbol size
\r
64 # attr: {src: '/2.png', alt: 'title', ...}
\r
65 # class_name: 'El-Class'
\r
66 # half: true // half size if you want
\r
67 initialize: (options) ->
\r
68 @class_name = options.class_name
\r
69 @attr = options.attr
\r
70 @half = options.half
\r
71 @width = Manifest.manifest().magic_numbers['thumbnail_width']
\r
72 @height = Manifest.manifest().magic_numbers['thumbnail_height']
\r
74 @width = Pettanr.to_i(@width/2)
\r
75 @height = Pettanr.to_i(@height/2)
\r
76 @attr['width'] = @width
\r
77 @attr['height'] = @height
\r
80 class_name: @class_name
\r