X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;ds=sidebyside;f=app%2Fassets%2Fjavascripts%2Fmodels%2Fsystem_picture.js.coffee;h=36bda580ad0a2e8b8f5563ebda026814e2e401ab;hb=083cd052b6a10be6ddb3534307176f8c415952a8;hp=82e60c8e0f2f6b13998386b6e95a503fc68349b7;hpb=458e6cecccbd13b65838495bffaa9614652b851f;p=pettanr%2Fpettanr.git diff --git a/app/assets/javascripts/models/system_picture.js.coffee b/app/assets/javascripts/models/system_picture.js.coffee index 82e60c8e..36bda580 100644 --- a/app/assets/javascripts/models/system_picture.js.coffee +++ b/app/assets/javascripts/models/system_picture.js.coffee @@ -11,6 +11,9 @@ class Pettanr.SystemPicture extends Peta.SystemResource id: null } + picture: () -> + new Pettanr.Cache.Retriever(Pettanr.Picture, @get('picture_id')) + filename: () -> @get('id') + '.' + @get('ext') @@ -24,16 +27,23 @@ class Pettanr.SystemPicture extends Peta.SystemResource {src: @r_url(), width: @get('width'), height: @get('height')} tmb_opt_img_tag: () -> - wh = Pettanr.Imager.thumbnail_size(@get('width'), @get('height')) - {src: @r_url(), width: wh[0], height: wh[1]} + new Pettanr.Image.SymbolPicture({ + attr: { + src: @r_url() + }, + picture: this + }) symbol_option: () -> - @tmb_opt_img_tag() + retriever = @retriever() + @listenTo(retriever, 'retrieve', @retrieve_symbol) + retriever.retrieve() + + retrieve_symbol: (item) -> + @trigger('ready:symbol', item.tmb_opt_img_tag()) - initialize: () -> + initialize: (attr = {}, options = {}) -> + super(attr, options) if @id @url = @url + @id -class Pettanr.SystemPicture.Collection extends Backbone.Collection - model: Pettanr.SystemPicture - url: '/system_pictures'