X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=app%2Fassets%2Fjavascripts%2Fmodels%2Flicense.js.coffee;h=9b064ed020b95e013fe7ea213b860a85f60b2491;hb=f25bedea8e4e22d2ac9b65f3694fcc90a9dfa91c;hp=c5f32ebaa7a7e51c5c6b69d62eafc38c79850c43;hpb=8c860bbc3faaff8c7a458b28f1cac7e30ff490df;p=pettanr%2Fpettanr.git diff --git a/app/assets/javascripts/models/license.js.coffee b/app/assets/javascripts/models/license.js.coffee index c5f32eba..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,33 +10,21 @@ class Pettanr.License extends Peta.SystemResource id: null } - license_group: () -> - r = new Pettanr.LicenseGroup({id: @get('license_group_id')}) + @trace_routes: () -> + { + symbol: ['system_picture'] + } - system_picture: () -> - new Pettanr.SystemPicture({id: @get('system_picture_id')}) + caption_with_group: () -> + @get_parent('license_group', this, { + success: (license_group) => + caption = license_group.escape('caption') + '/' + @escape('caption') + @trigger('ready:caption', caption) + }) - symbol_option: (cb) -> - i = @system_picture() - i.fetch({cache: true}).done -> - cb(i.tmb_opt_img_tag()) + is_own: () -> + true - caption_with_group: () -> - new Pettanr.License.Caption({license: this, license_group: @license_group()}) - - initialize: () -> - if @id - @url = @url + @id - -class Pettanr.License.Caption extends Backbone.View - tagName: 'span' - initialize: (options) -> - @license = options.license - @license_group = options.license_group - - render: () -> - _this = this - @license_group.fetch({cache: true}).done -> - _this.$el.html(_this.license_group.get('caption') + '/' + _this.license.get('caption')) - this + initialize: (attr = {}, options = {}) -> + super(attr, options)