X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=app%2Fassets%2Fjavascripts%2Fmodels%2Fground_picture.js.coffee;h=a699cce2091c137c6b1212a1c604de50653e1ff1;hb=dc5fe0b8ebfbde443317df9e2c18aa0deacd471d;hp=3b0d89f9532febed2cb3af16330f269951c17af1;hpb=664f8d5b324115a330cbe80338f2374fe570fdff;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 3b0d89f9..a699cce2 100644 --- a/app/assets/javascripts/models/ground_picture.js.coffee +++ b/app/assets/javascripts/models/ground_picture.js.coffee @@ -17,35 +17,36 @@ class Pettanr.GroundPicture extends Peta.Element @repeat_texts: () -> ['repeat', 'repeat-x', 'repeat-y', 'no-repeat'] + 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/' -