X-Git-Url: http://git.osdn.net/view?p=pettanr%2Fpettanr.git;a=blobdiff_plain;f=app%2Fassets%2Fjavascripts%2Fmodels%2Fground_picture.js.coffee;h=07dd815ed5c462f7fc6d8baefd0ed0440046e463;hp=1a18c151366a5f97397a54cb10af1562ce2bec6c;hb=d7c8065be895b67dc453b0e11ad0f259f1ca6706;hpb=2e1fe642e8bf2e237f6bcfb605d4d26da96fe2e9 diff --git a/app/assets/javascripts/models/ground_picture.js.coffee b/app/assets/javascripts/models/ground_picture.js.coffee index 1a18c151..07dd815e 100644 --- a/app/assets/javascripts/models/ground_picture.js.coffee +++ b/app/assets/javascripts/models/ground_picture.js.coffee @@ -1,4 +1,5 @@ class Pettanr.GroundPicture extends Peta.Element + @singular: () -> 'GroundPicture' @@ -15,39 +16,30 @@ class Pettanr.GroundPicture extends Peta.Element @repeat_texts: () -> ['repeat', 'repeat-x', 'repeat-y', 'no-repeat'] - picture: () -> - @get('picture') + @pick_item_name: () -> + 'resource_picture' - has_picture: () -> - true + @traceable_item_names: () -> + ['panel_picture', 'picture'] - style: (spot = null, opacity = 20) -> - r = { - position: 'absolute', - top: '0px', - left: '0px', - 'z-index': @get('z'), - 'background-image': 'url(' + @picture().r_url() + ')', - 'background-repeat': @repeat_text(), - 'background-position': Pettanr.to_s(@get('x')) + 'px ' + Pettanr.to_s(@get('y')) + 'px' - } - @merge_opacity(r, opacity) if spot and spot != this - r + pick: (picked_item) -> + {picture_id: picked_item.get('picture_id')} - tmb_opt_img_tag: () -> - wh = Pettanr.Imager.thumbnail_size(@picture().get('width'), @picture().get('height')) - {src: @picture().r_url(), width: wh[0], height: wh[1], alt: @get('caption')} + @trace_routes: () -> + { + resource_picture: ['picture', 'resource_picture_picture', 'resource_picture'], + symbol: 'picture' + } - symbol_option: () -> - @tmb_opt_img_tag() + @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}) + + initialize: (attr, options) -> + super(attr, options) -class Pettanr.GroundPicture.Collection extends Backbone.Collection - model: Pettanr.GroundPicture - url: '/ground_pictures'