1 class Pettanr.Picture extends Peta.Content
\r
13 @trace_routes: () ->
\r
15 resource_picture: ['resource_picture_picture', 'resource_picture']
\r
18 is_visible: (operators = Pettanr.cache.operators) ->
\r
22 @get('id') + '.' + @get('ext')
\r
28 'image/' + @get('ext')
\r
31 '/pictures/' + @filename()
\r
34 title = if @['get'] # is instance?
\r
35 @model_name() + ' ID:' + Pettanr.to_s(@get('id'))
\r
44 {src: @r_url(), width: @get('width'), height: @get('height')}
\r
46 tmb_opt_img_tag: () ->
\r
49 tail_opt_img_tag: (img) ->
\r
50 {src: img, width: @get('width'), height: @get('height')}
\r
52 tail_tmb_opt_img_tag: (img) ->
\r
53 wh = Pettanr.Imager.thumbnail_size(@get('width'), @get('height'))
\r
54 {src: img, width: wh[0], height: wh[1]}
\r
57 lgn = Pettanr.to_s(@license().license_group().get('caption'))
\r
58 ln = Pettanr.to_s(@license().get('caption'))
\r
59 lgn + '[' + ln + ']'
\r
61 symbol_option: (context, options) ->
\r
63 success: (symbol_item) =>
\r
64 options.success.call(context, symbol_item.to_symbol())
\r
68 if @head().resource_picture()
\r
74 #Picture.find( conditions => ['original_picture_id = ?', opid], :order => 'pictures.revision desc')
\r
77 Picture.head(@get('original_picture_id'))
\r
83 if @license_extend().reverse < 0
\r
86 ['', 'v', 'h', 'vh']
\r
88 is_showable: (operators = Pettanr.cache.operators) ->
\r
89 return false if not @original_picture()
\r
90 return true if @is_own(operators)
\r
91 #@is_enable() and @is_head()
\r
94 new Pettanr.Views.Picture.History({item: this})
\r
96 credit_icon_view: () ->
\r
97 new Pettanr.Views.Picture.CreditIcon({item: this})
\r
99 credit_view: (with_icon = true) ->
\r
100 new Pettanr.Views.Picture.Credit({item: this, with_icon: with_icon})
\r
102 picture_file: (subdir = null) ->
\r
103 new Pettanr.PictureFile(this, subdir)
\r
105 fetch: (options) ->
\r
107 @credit_icon = @credit_icon_view()
\r
109 f = (data, status) =>
\r
112 $.get(@url + '/credit', null, f, 'html')
\r
115 initialize: (attr = {}, options = {}) ->
\r
116 super(attr, options)
\r