X-Git-Url: http://git.osdn.net/view?p=pettanr%2Fpettanr.git;a=blobdiff_plain;f=app%2Fassets%2Fjavascripts%2Fmodels%2Fscroll_panel.js.coffee;h=e8065f509399df2bbe50f3937fc24ac4e10bc3ef;hp=96debaf831f0334fd881abf30dd978b406c50577;hb=d7c8065be895b67dc453b0e11ad0f259f1ca6706;hpb=c34d9fccbf3ae4574e81fea35371ed9c5dd1bd15 diff --git a/app/assets/javascripts/models/scroll_panel.js.coffee b/app/assets/javascripts/models/scroll_panel.js.coffee index 96debaf8..e8065f50 100644 --- a/app/assets/javascripts/models/scroll_panel.js.coffee +++ b/app/assets/javascripts/models/scroll_panel.js.coffee @@ -1,7 +1,6 @@ class Pettanr.ScrollPanel extends Peta.Leaf - url: '' - @single: () -> + @singular: () -> 'ScrollPanel' @plural: () -> @@ -9,12 +8,34 @@ class Pettanr.ScrollPanel extends Peta.Leaf defaults: { id: null, + scroll_id: null, + panel_id: null, + t: null } - initialize: () -> - if @id - @url = @url + @id + @pick_item_name: () -> + 'panel' + + @traceable_item_names: () -> + [] + + pick: (picked_item) -> + { + panel_id: picked_item.get('id'), + } + + @licensed_pictures: (scroll_panels) -> + panels = _.filter(scroll_panels, (sp) -> + sp.has_panel() + ) + Pettanr.Panel.licensed_pictures(panels) + + has_panel: () -> + if @get('panel_id') + true + else + false + + initialize: (attr = {}, options = {}) -> + super(attr, options) -class Pettanr.ScrollPanel.Collection extends Backbone.Collection - model: Pettanr.ScrollPanel - url: '/scroll_panels'