1 class Pettanr.PanelPicture extends Peta.Element
\r
2 url: '/panel_pictures/'
\r
14 @pick_item_name: () ->
\r
18 Manifest.item_name_to_model(@pick_item_name())
\r
20 @traceable_item_names: () ->
\r
21 ['ground_picture', 'picture']
\r
23 @is_traceable: (item_name) ->
\r
24 _.contains(@traceable_item_names(), item_name)
\r
26 trace_from_ground_picture: () ->
\r
28 trace_from_picture: () ->
\r
30 pick: (picked_item) ->
\r
32 picture_id: picked_item.get('picture_id'),
\r
33 width: picked_item.get('width'),
\r
34 height: picked_item.get('height')
\r
38 new Pettanr.Picture({id: @get('picture_id')})
\r
40 panel: (options = {}) ->
\r
41 new Pettanr.Panel({id: @get('panel_id')}, options)
\r
47 v = if @get('height') > 0
\r
51 h = if @get('width') > 0
\r
56 res = res # format of /1.png?subdir=v
\r
57 # res += '/' unless res.empty? # format of /v/1.png
\r
60 filename: (picture) ->
\r
61 q = if _.isEmpty(@flip())
\r
64 '?subdir=' + @flip()
\r
65 picture.filename() + q
\r
68 '/pictures/' + @filename(picture)
\r
70 tmb_opt_img_tag: (picture) ->
\r
71 new Pettanr.Image.SymbolPicture({
\r
73 src: picture.r_url(),
\r
74 alt: @escape('caption')
\r
79 symbol_option: () ->
\r
81 i.fetch({cache: true}).done =>
\r
82 @trigger('ready:symbol', i.tmb_opt_img_tag())
\r
85 new Pettanr.Views.PanelPicture.ElementFace({element: this})
\r
87 initialize: (attr, options) ->
\r
88 super(attr, options)
\r
91 @bind('change:width', () ->
\r