class Pettanr.License extends Peta.SystemResource url: '/licenses/' @singular: () -> 'License' @plural: () -> 'Licenses' defaults: { 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: (cb) -> i = @system_picture() i.fetch({cache: true}).done -> cb(i.tmb_opt_img_tag()) 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