X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=app%2Fassets%2Fjavascripts%2Fmodels%2Fground_picture.js.coffee;h=a699cce2091c137c6b1212a1c604de50653e1ff1;hb=bfd70bbe42b6a526ac84254cda52c59b95d8a785;hp=a49d9f8d55b35aac4ba86cf9834cd9d3797f14d7;hpb=eec19634998fd448e4bb1be831260537199d8271;p=pettanr%2Fpettanr.git diff --git a/app/assets/javascripts/models/ground_picture.js.coffee b/app/assets/javascripts/models/ground_picture.js.coffee index a49d9f8d..a699cce2 100644 --- a/app/assets/javascripts/models/ground_picture.js.coffee +++ b/app/assets/javascripts/models/ground_picture.js.coffee @@ -17,38 +17,36 @@ class Pettanr.GroundPicture extends Peta.Element @repeat_texts: () -> ['repeat', 'repeat-x', 'repeat-y', 'no-repeat'] - panel: () -> - new Pettanr.Panel({id: @get('panel_id')}) + panel: (options = {}) -> + new Pettanr.Panel({id: @get('panel_id')}, options) picture: () -> new Pettanr.Picture({id: @get('picture_id')}) - has_picture: () -> + @has_picture: () -> true tmb_opt_img_tag: (picture) -> new Pettanr.Image.SymbolPicture({ attr: { src: picture.r_url(), - alt: @get('caption') + alt: @escape('caption') }, picture: picture }) - symbol_option: (cb) -> + symbol_option: () -> i = @picture() - _this = this - i.fetch().done -> - cb(_this.tmb_opt_img_tag(i)) + i.fetch({cache: true}).done => + @trigger('ready:symbol', i.tmb_opt_img_tag()) repeat_text: () -> Pettanr.GroundPicture.repeat_texts()[@get('repeat')] + element_face: () -> + new Pettanr.Views.GroundPicture.ElementFace({element: this}) + initialize: () -> if @id @url = @url + @id -class Pettanr.GroundPicture.Collection extends Backbone.Collection - model: Pettanr.GroundPicture - url: '/ground_pictures/' -