X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=app%2Fassets%2Fjavascripts%2Fmodels%2Flicense.js.coffee;h=9b064ed020b95e013fe7ea213b860a85f60b2491;hb=f25bedea8e4e22d2ac9b65f3694fcc90a9dfa91c;hp=dd57148bc8497954c12efde25029e1c27b8a6312;hpb=3f0b76f7b7fddc70ba3badd2a97b2babe9549b79;p=pettanr%2Fpettanr.git diff --git a/app/assets/javascripts/models/license.js.coffee b/app/assets/javascripts/models/license.js.coffee index dd57148b..9b064ed0 100644 --- a/app/assets/javascripts/models/license.js.coffee +++ b/app/assets/javascripts/models/license.js.coffee @@ -1,5 +1,4 @@ class Pettanr.License extends Peta.SystemResource - url: '/licenses/' @singular: () -> 'License' @@ -11,27 +10,21 @@ class Pettanr.License extends Peta.SystemResource id: null } - license_group: () -> - r = new Pettanr.LicenseGroup({id: @get('license_group_id')}) - - system_picture: () -> - new Pettanr.SystemPicture({id: @get('system_picture_id')}) - - symbol_option: () -> - i = @system_picture() - i.fetch({cache: true}).done => - @trigger('ready:symbol', i.tmb_opt_img_tag()) + @trace_routes: () -> + { + symbol: ['system_picture'] + } caption_with_group: () -> - i = @license_group() - i.fetch({cache: true}).done => - caption = i.escape('caption') + '/' + @escape('caption') - @trigger('ready:caption', caption) + @get_parent('license_group', this, { + success: (license_group) => + caption = license_group.escape('caption') + '/' + @escape('caption') + @trigger('ready:caption', caption) + }) + is_own: () -> true initialize: (attr = {}, options = {}) -> super(attr, options) - if @id - @url = @url + @id