X-Git-Url: http://git.osdn.net/view?p=pettanr%2Fpettanr.git;a=blobdiff_plain;f=app%2Fassets%2Fjavascripts%2Fmodels%2Fsystem_picture.js.coffee;h=58e76a47a825e4b8732b62148fed961afbc6babb;hp=36db60aac466c3bf0347f0806d612c5bea5c509f;hb=d7c8065be895b67dc453b0e11ad0f259f1ca6706;hpb=c4fc0258365dccdd39e18629bb5d8e5873c658fc diff --git a/app/assets/javascripts/models/system_picture.js.coffee b/app/assets/javascripts/models/system_picture.js.coffee index 36db60aa..58e76a47 100644 --- a/app/assets/javascripts/models/system_picture.js.coffee +++ b/app/assets/javascripts/models/system_picture.js.coffee @@ -1,5 +1,4 @@ class Pettanr.SystemPicture extends Peta.SystemResource - url: '/system_pictures/' @singular: () -> 'SystemPicture' @@ -11,9 +10,6 @@ class Pettanr.SystemPicture extends Peta.SystemResource id: null } - picture: () -> - new Pettanr.Picture({id: @get('picture_id')}) - filename: () -> @get('id') + '.' + @get('ext') @@ -23,23 +19,14 @@ class Pettanr.SystemPicture extends Peta.SystemResource r_url: () -> '/system_pictures/' + @filename() - opt_img_tag: () -> - {src: @r_url(), width: @get('width'), height: @get('height')} - - tmb_opt_img_tag: () -> - new Pettanr.Image.SymbolPicture({ - attr: { - src: @r_url() - }, - picture: this + symbol_option: (context, options) -> + @retrieve(this, { + success: (symbol_item) => + options.success.call(context, symbol_item.symbol_file()) + fail: (response, opt) => + options.fail.call(context, response, opt) }) - symbol_option: () -> - @fetch({cache: true}).done => - @symbol_picture = @tmb_opt_img_tag() - @trigger('ready:symbol') - - initialize: () -> - if @id - @url = @url + @id + initialize: (attr = {}, options = {}) -> + super(attr, options)