X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=app%2Fassets%2Fjavascripts%2Fmodels%2Fpicture.js.coffee;h=b1d85c344a2dfa37c9f274c7937d8af0d2c86e60;hb=2ad2de8db58dac6a0e81f1db91a1a8415b2b9de7;hp=2795754c835c68bcaf1a2d2445875f64556ea112;hpb=bc9dd75754da9a89194b6495a5992521050f2e7d;p=pettanr%2Fpettanr.git diff --git a/app/assets/javascripts/models/picture.js.coffee b/app/assets/javascripts/models/picture.js.coffee index 2795754c..b1d85c34 100644 --- a/app/assets/javascripts/models/picture.js.coffee +++ b/app/assets/javascripts/models/picture.js.coffee @@ -10,6 +10,11 @@ class Pettanr.Picture extends Peta.Content id: null } + @trace_routes: () -> + { + resource_picture: ['resource_picture_picture', 'resource_picture'] + } + is_visible: (operators = Pettanr.cache.operators) -> return true @@ -25,16 +30,21 @@ class Pettanr.Picture extends Peta.Content r_url: () -> '/pictures/' + @filename() + img_option: () -> + title = if @['get'] # is instance? + @model_name() + ' ID:' + Pettanr.to_s(@get('id')) + else + @model_name() + { + title: title + alt: @model_name() + } + opt_img_tag: () -> - {src: @r_url(), width: @get('width'), height: @get('height')} + @picture_file() tmb_opt_img_tag: () -> - new Pettanr.Image.SymbolPicture({ - attr: { - src: @r_url() - }, - picture: this - }) + @symbol_file() tail_opt_img_tag: (img) -> {src: img, width: @get('width'), height: @get('height')} @@ -48,8 +58,11 @@ class Pettanr.Picture extends Peta.Content ln = Pettanr.to_s(@license().get('caption')) lgn + '[' + ln + ']' - symbol_option: () -> - @tmb_opt_img_tag() + symbol_option: (context, options) -> + @retrieve(this, { + success: (symbol_item) => + options.success.call(context, symbol_item.to_symbol()) + }) is_enable: () -> if @head().resource_picture() @@ -80,22 +93,6 @@ class Pettanr.Picture extends Peta.Content history_view: () -> new Pettanr.Views.Picture.History({item: this}) - credit_icon_view: () -> - new Pettanr.Views.Picture.CreditIcon({item: this}) - - credit_view: (with_icon = true) -> - new Pettanr.Views.Picture.Credit({item: this, with_icon: with_icon}) - - fetch: (options) -> - if @id - @credit_icon = @credit_icon_view() - @credit = null - f = (data, status) => - @credit = data - @trigger('ready') - $.get(@url + '/credit', null, f, 'html') - super(options) - initialize: (attr = {}, options = {}) -> super(attr, options)