class Pettanr.ResourcePicture extends Peta.Content @singular: () -> 'ResourcePicture' @plural: () -> 'ResourcePictures' defaults: { id: null } is_visible: (operators = Pettanr.cache.operators) -> @is_user_visible(operators) filename: () -> @get('id') + '.' + @get('ext') gifname: () -> @get('id') + '.gif' mime_type: () -> 'image/' + @get('ext') r_url: (subdir = null) -> opt = if _.isEmpty(subdir) '' else '?subdir=' + Pettanr.to_s(subdir) '/resource_pictures/' + @filename() + opt tmb_opt_img_tag: () -> klass = if true # thumbnail Pettanr.Image.SymbolPicture new klass({ attr: { src: @r_url() }, picture: this }) opt_img_tag: () -> {src: @url('full'), width: @get('width'), height: @get('height')} alt_name: () -> lgn = Pettanr.to_s(@license().license_group().get('caption')) ln = Pettanr.to_s(@license().get('caption')) lgn + '[' + ln + ']' symbol_option: (context, options) -> @retrieve(this, { success: (symbol_item) => options.success.call(context, symbol_item.to_symbol()) }) credit_icon_view: () -> new Pettanr.Views.ResourcePicture.CreditIcon({item: this}) credit_view: (with_icon = true) -> new Pettanr.Views.ResourcePicture.Credit({item: this, with_icon: with_icon}) initialize: (attr = {}, options = {}) -> super(attr, options)