X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=app%2Fassets%2Fjavascripts%2Fmodels%2Fground_picture.js.coffee;h=07dd815ed5c462f7fc6d8baefd0ed0440046e463;hb=e05f18d1db38e531e7bca45d4ba8db71b082402f;hp=d5deea6cc9fc870b775d2484b7ae2d606d25e2cb;hpb=99f2d489050575e3ff46f6e67b9c1b792ef0eb31;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 d5deea6c..07dd815e 100644 --- a/app/assets/javascripts/models/ground_picture.js.coffee +++ b/app/assets/javascripts/models/ground_picture.js.coffee @@ -1,5 +1,4 @@ class Pettanr.GroundPicture extends Peta.Element - url: '/ground_pictures/' @singular: () -> 'GroundPicture' @@ -17,38 +16,30 @@ class Pettanr.GroundPicture extends Peta.Element @repeat_texts: () -> ['repeat', 'repeat-x', 'repeat-y', 'no-repeat'] - panel: () -> - new Pettanr.Panel({id: @get('panel_id')}) + @pick_item_name: () -> + 'resource_picture' - picture: () -> - new Pettanr.Picture({id: @get('picture_id')}) + @traceable_item_names: () -> + ['panel_picture', 'picture'] - has_picture: () -> - true + pick: (picked_item) -> + {picture_id: picked_item.get('picture_id')} + + @trace_routes: () -> + { + resource_picture: ['picture', 'resource_picture_picture', 'resource_picture'], + symbol: 'picture' + } - tmb_opt_img_tag: (picture) -> - new Pettanr.Image.SymbolPicture({ - attr: { - src: picture.r_url(), - alt: @get('caption') - }, - picture: picture - }) - - symbol_option: (cb) -> - i = @picture() - _this = this - i.fetch({cache: true}).done -> - cb(_this.tmb_opt_img_tag(i)) + @has_picture: () -> + true repeat_text: () -> Pettanr.GroundPicture.repeat_texts()[@get('repeat')] - initialize: () -> - if @id - @url = @url + @id + element_face: () -> + new Pettanr.Views.GroundPicture.ElementFace({element: this}) -class Pettanr.GroundPicture.Collection extends Backbone.Collection - model: Pettanr.GroundPicture - url: '/ground_pictures/' + initialize: (attr, options) -> + super(attr, options)