OSDN Git Service

fix: js models
[pettanr/pettanr.git] / app / assets / javascripts / models / license.js.coffee
1 class Pettanr.License extends Peta.SystemResource\r
2   @singular: () ->\r
3     'License'\r
4   \r
5   @plural: () ->\r
6     'Licenses'\r
7   \r
8   defaults: {\r
9     id: null\r
10   } \r
11   \r
12   license_group: () ->\r
13     r = new Pettanr.LicenseGroup({id: @get('license_group_id')})\r
14     r.fetch({}).done () ->\r
15       r\r
16   \r
17   caption_with_group: () ->\r
18     @license_group().get('caption') + '/' + @get('caption')\r
19   \r
20   initialize: () ->\r
21     if @id\r
22       @url = @url + @id\r
23   \r
24 class Pettanr.License.Collection extends Backbone.Collection\r
25   model: Pettanr.License\r
26   url: '/licenses'\r