1 class Pettanr.PanelPicture extends Peta.Element
\r
2 url: '/panel_pictures/'
\r
14 @pick_item_name: () ->
\r
17 @traceable_item_names: () ->
\r
18 ['ground_picture', 'picture']
\r
20 trace_from_ground_picture: () ->
\r
22 trace_from_picture: () ->
\r
24 pick: (picked_item) ->
\r
26 picture_id: picked_item.get('picture_id'),
\r
27 width: picked_item.get('width'),
\r
28 height: picked_item.get('height')
\r
32 new Pettanr.Cache.Retriever(Pettanr.Picture, @get('picture_id'))
\r
35 new Pettanr.Cache.Retriever(Pettanr.Panel, @get('panel_id'))
\r
41 v = if @get('height') > 0
\r
45 h = if @get('width') > 0
\r
50 res = res # format of /1.png?subdir=v
\r
51 # res += '/' unless res.empty? # format of /v/1.png
\r
54 filename: (picture) ->
\r
55 q = if _.isEmpty(@flip())
\r
58 '?subdir=' + @flip()
\r
59 picture.filename() + q
\r
62 '/pictures/' + @filename(picture)
\r
64 tmb_opt_img_tag: (picture) ->
\r
65 new Pettanr.Image.SymbolPicture({
\r
67 src: picture.r_url(),
\r
68 alt: @escape('caption')
\r
73 symbol_option: () ->
\r
74 retriever = @picture()
\r
75 @listenTo(retriever, 'retrieve', @retrieve_symbol)
\r
76 retriever.retrieve()
\r
78 retrieve_symbol: (item) ->
\r
79 @trigger('ready:symbol', item.tmb_opt_img_tag())
\r
82 new Pettanr.Views.PanelPicture.ElementFace({element: this})
\r
84 initialize: (attr, options) ->
\r
85 super(attr, options)
\r
88 @bind('change:width', () ->
\r