@link = m.LinkFactory.factory this, @my_manifest.link, @item\r
\r
render: () ->\r
- if @my_manifest.link.type == 'none'\r
- this.$el.html(@face.render().el)\r
- else\r
+ if @has_link()\r
this.$el.html(@link.render().el)\r
@delegateEvents({'click .face': 'show'}) \r
+ else\r
+ this.$el.html(@face.el)\r
this\r
\r
+ has_link: () ->\r
+ @my_manifest.link.type != 'none'\r
+ \r
show: () ->\r
window.router.navigate(@link.url(), true);\r
return false\r
@default_caption = options.default_caption\r
@my_manifest = options.my_manifest\r
@item = options.item\r
+ @clear()\r
+ @listenTo(@item, 'ready:caption', @render)\r
+ \r
+ clear: () ->\r
+ icon = new Pettanr.Views.Common.LoadIcon()\r
+ this.$el.html(icon.render().el)\r
+ this\r
\r
render: () ->\r
this\r
\r
initialize: (options) ->\r
super(options)\r
+ @render()\r
\r
render: () ->\r
if Pettanr.is_blank(@face())\r
\r
initialize: (options) ->\r
super(options)\r
+ if @item[@method_name()]\r
+ @item[@method_name()]()\r
\r
render: () ->\r
- if Pettanr.is_a_string(@face())\r
- if Pettanr.is_blank(@face())\r
- 'empty'\r
- else\r
- this.$el.html(@face())\r
- else\r
- # render view when method return related model\r
- this.$el.html(@face().render().el)\r
- \r
+ this.$el.html(@item.caption_text)\r
this\r
\r
- @template_file_name: () ->\r
- if @face().is_blank()\r
- 'empty'\r
- else\r
- 'column'\r
- \r
- face: () ->\r
- @item[@my_manifest.method_name]()\r
+ method_name: () ->\r
+ @my_manifest.method_name\r
\r
\r
render: () ->\r
this.$el.attr('href', @url())\r
- # embed face everytime\r
- this.$el.html(@default_caption.face.render().el)\r
+ this.$el.html(@face.el)\r
this\r
\r
url: () ->\r
@default_caption = options.default_caption\r
@my_manifest = options.my_manifest\r
@item = options.item\r
+ @face = @default_caption.face\r
\r
url: () ->\r
raise "undefined url\n"\r
\r
render: () ->\r
this.$el.attr('href', @url())\r
- # embed face everytime\r
- this.$el.html(@default_caption.face.render().el)\r
+ this.$el.html(@face.el)\r
this\r
\r
js_url: () ->\r
render: () ->\r
view = Pettanr.Views[@item.singular()]\r
summary = new view[view.summary()]({item: @item})\r
- this.$el.html(summary.render().el)\r
+ this.$el.html(summary.el)\r
this\r
\r
@link = m.LinkFactory.factory this, @my_manifest.link, @item\r
\r
render: () ->\r
- if @my_manifest.link.type == 'none'\r
- this.$el.html(@face.render().el)\r
- else\r
+ if @has_link()\r
this.$el.html(@link.render().el)\r
@delegateEvents({'click .face': 'show'}) \r
+ else\r
+ this.$el.html(@face.el)\r
this\r
\r
+ has_link: () ->\r
+ @my_manifest.link.type != 'none'\r
+ \r
show: () ->\r
window.router.navigate(@link.url(), true)\r
return false\r
@default_symbol = options.default_symbol\r
@my_manifest = options.my_manifest\r
@item = options.item\r
+ @clear()\r
+ @listenTo(@item, 'ready:symbol', @render)\r
+ \r
+ clear: () ->\r
+ icon = new Pettanr.Views.Common.LoadIcon()\r
+ this.$el.html(icon.render().el)\r
+ this\r
\r
render: () ->\r
this\r
\r
initialize: (options) ->\r
super(options)\r
- attr =\r
@picture = new Pettanr.Image.SymbolImg({\r
attr: {\r
src: @url()\r
}\r
})\r
+ @render()\r
\r
render: () ->\r
- if @picture\r
- this.$el.html(@picture.render().el)\r
+ this.$el.html(@picture.render().el)\r
this\r
\r
url: () ->\r
initialize: (options) ->\r
super(options)\r
if @item[@method_name()]\r
- @item[@method_name()]((pic) =>\r
- @picture = pic\r
- @render()\r
- )\r
+ @item[@method_name()]()\r
+ \r
+ render: () ->\r
+ if @item.symbol_picture\r
+ this.$el.html(@item.symbol_picture.render().el)\r
else\r
- @picture = new Pettanr.Image.SymbolImg({\r
+ picture = new Pettanr.Image.SymbolImg({\r
attr: {\r
src: '/images/error.png'\r
}\r
})\r
- @render()\r
- \r
- render: () ->\r
- if @picture\r
- this.$el.html(@picture.render().el)\r
+ this.$el.html(picture.render().el)\r
this\r
\r
method_name: () ->\r
\r
render: () ->\r
this.$el.attr('href', @url())\r
- # embed face everytime\r
- this.$el.html(@default_symbol.face.render().el)\r
+ this.$el.html(@face.el)\r
this\r
\r
url: () ->\r
@default_symbol = options.default_symbol\r
@my_manifest = options.my_manifest\r
@item = options.item\r
+ @face = @default_symbol.face\r
\r
url: () ->\r
raise "undefined url\n"\r
\r
render: () ->\r
this.$el.attr('href', @url())\r
- # embed face everytime\r
- this.$el.html(@default_symbol.face.render().el)\r
+ this.$el.html(@face.el)\r
this\r
\r
js_url: () ->\r
r_url: () ->\r
'/system_pictures/' + @system_picture().filename()\r
\r
- symbol_option: (cb) ->\r
+ symbol_option: () ->\r
sb = @speech_balloon()\r
sb.fetch({cache: true}).done =>\r
sbt = sb.speech_balloon_template()\r
sbt.fetch({cache: true}).done =>\r
sp = sbt.system_picture()\r
sp.fetch({cache: true}).done =>\r
- cb(sp.tmb_opt_img_tag())\r
+ @symbol_picture = sp.tmb_opt_img_tag()\r
+ @trigger('ready:symbol')\r
\r
initialize: () ->\r
if @id\r
caption: () ->\r
@get('name').replace(/\/$/, '').split('/').pop()\r
\r
+ filer_caption: () ->\r
+ @caption_text = @caption()\r
+ @trigger('ready:caption')\r
+ \r
is_remote: () ->\r
if @get('category_id') == 10\r
true\r
picture: picture\r
})\r
\r
- symbol_option: (cb) ->\r
+ symbol_option: () ->\r
i = @picture()\r
i.fetch({cache: true}).done =>\r
- cb(@tmb_opt_img_tag(i))\r
+ @symbol_picture = i.tmb_opt_img_tag()\r
+ @trigger('ready:symbol')\r
\r
repeat_text: () ->\r
Pettanr.GroundPicture.repeat_texts()[@get('repeat')]\r
system_picture: () ->\r
new Pettanr.SystemPicture({id: @get('system_picture_id')})\r
\r
- symbol_option: (cb) ->\r
+ symbol_option: () ->\r
i = @system_picture()\r
i.fetch({cache: true}).done =>\r
- cb(i.tmb_opt_img_tag())\r
+ @symbol_picture = i.tmb_opt_img_tag()\r
+ @trigger('ready:symbol')\r
\r
caption_with_group: () ->\r
- new Pettanr.License.Caption({license: this, license_group: @license_group()})\r
+ i = @license_group()\r
+ i.fetch({cache: true}).done =>\r
+ @caption_text = i.get('caption') + '/' + @get('caption')\r
+ @trigger('ready:caption')\r
\r
initialize: () ->\r
if @id\r
@url = @url + @id\r
\r
-class Pettanr.License.Caption extends Backbone.View\r
- tagName: 'span'\r
- initialize: (options) ->\r
- @license = options.license\r
- @license_group = options.license_group\r
- \r
- render: () ->\r
- @license_group.fetch({cache: true}).done =>\r
- this.$el.html(@license_group.get('caption') + '/' + @license.get('caption'))\r
- this\r
- \r
})\r
\r
symbol_option: (cb) ->\r
- this.fetch({cache: true}).done =>\r
- cb(@tmb_opt_img_tag())\r
+ @fetch({cache: true}).done =>\r
+ @symbol_picture = @tmb_opt_img_tag()\r
+ @trigger('ready:symbol')\r
\r
revision: () ->\r
new Pettanr.OriginalPicture.Head({original_picture: this})\r
picture: picture\r
})\r
\r
- symbol_option: (cb) ->\r
+ symbol_option: () ->\r
i = @picture()\r
i.fetch({cache: true}).done =>\r
- cb(@tmb_opt_img_tag(i))\r
+ @symbol_picture = i.tmb_opt_img_tag()\r
+ @trigger('ready:symbol')\r
\r
element_face: () ->\r
new Pettanr.Views.PanelPicture.ElementFace({element: this})\r
ln = Pettanr.to_s(@license().get('caption'))\r
lgn + '[' + ln + ']'\r
\r
- symbol_option: (cb) ->\r
- @fetch({cache: true}).done =>\r
- cb(@tmb_opt_img_tag())\r
+ symbol_option: () ->\r
+ @tmb_opt_img_tag()\r
\r
is_enable: () ->\r
if @head().resource_picture()\r
credit_view: (with_icon = true) ->\r
new Pettanr.Views.Picture.Credit({item: this, with_icon: with_icon})\r
\r
+ fetch: (options) ->\r
+ if @id\r
+ @credit_icon = @credit_icon_view()\r
+ @credit = null\r
+ f = (data, status) =>\r
+ @credit = data\r
+ @trigger('ready')\r
+ $.get(@url + '/credit', null, f, 'html')\r
+ super(options)\r
+ \r
initialize: () ->\r
if @id\r
@url = @url + @id\r
ln = Pettanr.to_s(@license().get('caption'))\r
lgn + '[' + ln + ']'\r
\r
- symbol_option: (cb) ->\r
+ symbol_option: () ->\r
@fetch({cache: true}).done =>\r
- cb(@tmb_opt_img_tag())\r
+ @symbol_picture = @tmb_opt_img_tag()\r
+ @trigger('ready:symbol')\r
\r
credit_icon_view: () ->\r
new Pettanr.Views.ResourcePicture.CreditIcon({item: this})\r
sbt.fetch({cache: true}).done =>\r
sp = sbt.system_picture()\r
sp.fetch({cache: true}).done =>\r
- cb(sp.tmb_opt_img_tag())\r
+ @symbol_picture = sp.tmb_opt_img_tag()\r
+ @trigger('ready:symbol')\r
\r
text_align_text: () ->\r
Pettanr.Speech.text_align_texts()[@get('text_align')]\r
@has_picture: () ->\r
false\r
\r
- symbol_option: (cb) ->\r
+ symbol_option: () ->\r
sbt = @speech_balloon_template()\r
sbt.fetch({cache: true}).done =>\r
sp = sbt.system_picture()\r
sp.fetch({cache: true}).done =>\r
- cb(sp.tmb_opt_img_tag())\r
+ @symbol_picture = sp.tmb_opt_img_tag()\r
+ @trigger('ready:symbol')\r
\r
plain_scenario: () ->\r
@get('caption')\r
system_picture: () ->\r
new Pettanr.SystemPicture({id: @get('system_picture_id')})\r
\r
- symbol_option: (cb) ->\r
+ symbol_option: () ->\r
i = @system_picture()\r
i.fetch({cache: true}).done =>\r
- cb(i.tmb_opt_img_tag())\r
+ @symbol_picture = i.tmb_opt_img_tag()\r
+ @trigger('ready:symbol')\r
\r
parsed_settings: () ->\r
JSON.parse(@get('settings'))\r
picture: this\r
})\r
\r
- symbol_option: (cb) ->\r
+ symbol_option: () ->\r
@fetch({cache: true}).done =>\r
- cb(@tmb_opt_img_tag())\r
+ @symbol_picture = @tmb_opt_img_tag()\r
+ @trigger('ready:symbol')\r
\r
initialize: () ->\r
if @id\r
system_picture: () ->\r
new Pettanr.SystemPicture({id: @get('system_picture_id')})\r
\r
- symbol_option: (cb) ->\r
+ symbol_option: () ->\r
i = @system_picture()\r
i.fetch({cache: true}).done =>\r
- cb(i.tmb_opt_img_tag())\r
+ @symbol_picture = i.tmb_opt_img_tag()\r
+ @trigger('ready:symbol')\r
\r
initialize: () ->\r
if @id\r
-class Pettanr.Views.Artist.Summary extends Backbone.View\r
+class Pettanr.Views.Artist.Summary extends Pettanr.Views.Common.Summary\r
\r
initialize: (options) ->\r
super(options)\r
+ @trigger('ready')\r
\r
render: () ->\r
this.$el.html('')\r
-class Pettanr.Views.Author.Summary extends Backbone.View\r
+class Pettanr.Views.Author.Summary extends Pettanr.Views.Common.Summary\r
\r
initialize: (options) ->\r
super(options)\r
+ @trigger('ready')\r
\r
render: () ->\r
this.$el.html('')\r
-class Pettanr.Views.Balloon.Summary extends Backbone.View\r
+class Pettanr.Views.Balloon.Summary extends Pettanr.Views.Common.Summary\r
\r
initialize: (options) ->\r
+ super(options)\r
@item = options.item\r
+ @load()\r
+ \r
+ load: () ->\r
@speech_balloon = @item.speech_balloon()\r
+ @speech_balloon.fetch({cache: true}).done =>\r
+ @panel = @speech_balloon.panel()\r
+ @panel.fetch({cache: true}).done =>\r
+ @panel_icon = new Pettanr.Views.Common.Icon({item: @panel, half: true})\r
+ @trigger('ready')\r
\r
render: () ->\r
this.$el.html('')\r
- @speech_balloon.fetch({cache: true}).done =>\r
- panel = @speech_balloon.panel()\r
- panel.fetch({cache: true}).done =>\r
- panel_icon = new Pettanr.Views.Common.Icon({item: panel, half: true})\r
- this.$el.append(panel_icon.render().el)\r
+ this.$el.append(@panel_icon.render().el)\r
this\r
\r
class Pettanr.Views.Common\r
+class Pettanr.Views.Common.LoadIcon extends Tag.Img\r
+ \r
+ initialize: () ->\r
+ @attr = {}\r
+ @width = Manifest.manifest().magic_numbers['thumbnail_width']\r
+ @height = Manifest.manifest().magic_numbers['thumbnail_height']\r
+ @width = Pettanr.to_i(@width/2)\r
+ @height = Pettanr.to_i(@height/2)\r
+ @attr['src'] = '/images/loading.gif'\r
+ @attr['width'] = @width\r
+ @attr['height'] = @height\r
+ @attr['alt'] = 'Loading'\r
+ @attr['title'] = 'Loading'\r
+ opt = {\r
+ attr: @attr,\r
+ }\r
+ super(opt)\r
+\r
class Pettanr.Views.Common.Icon extends Backbone.View\r
tagName: 'span'\r
\r
this.$el.append(@caption.render().el)\r
this\r
\r
+class Pettanr.Views.Common.Summary extends Backbone.View\r
+ \r
+ initialize: (options) ->\r
+ @clear()\r
+ @listenTo(this, 'ready', @render)\r
+ \r
+ clear: () ->\r
+ icon = new Pettanr.Views.Common.LoadIcon()\r
+ this.$el.html(icon.render().el)\r
+ this\r
+ \r
+ render: () ->\r
+ this.$el.html('')\r
+ this\r
+ \r
class Pettanr.Views.Common.Binder\r
-class Pettanr.Views.Common.Binder.Summary extends Backbone.View\r
+class Pettanr.Views.Common.Binder.Summary extends Pettanr.Views.Common.Summary\r
\r
initialize: (options) ->\r
+ super(options)\r
@item = options.item\r
@visible_t = options.visible_t\r
@visible_column_name = options.visible_column_name\r
+ @load()\r
+ \r
+ load: () ->\r
@visible = new Tag.Div({\r
content: Pettanr.AppHelper.t_selected_item(@visible_t, @item.get(@visible_column_name))\r
})\r
@author = @item.author()\r
@author.fetch({cache: true}).done =>\r
@author_icon_with_caption = @author.icon_with_caption_view(true, 'name', 12)\r
- @render()\r
+ @trigger('ready')\r
\r
render: () ->\r
this.$el.html('')\r
this.$el.append(@visible.render().el)\r
- if @author_icon_with_caption\r
- this.$el.append(@author_icon_with_caption.render().el)\r
+ this.$el.append(@author_icon_with_caption.render().el)\r
this\r
\r
class Pettanr.Views.Common.Leaf\r
-class Pettanr.Views.Common.Leaf.Summary extends Backbone.View\r
+class Pettanr.Views.Common.Leaf.Summary extends Pettanr.Views.Common.Summary\r
\r
initialize: (options) ->\r
+ super(options)\r
@item = options.item\r
@binder_item_name = options.binder_item_name\r
@destination_item_name = options.destination_item_name\r
+ @load()\r
+ \r
+ load: () ->\r
@binder = @item[@binder_item_name]()\r
@binder.fetch({cache: true}).done =>\r
@binder_icon = @binder.icon_view(true)\r
@binder_author = @binder.author()\r
@binder_author.fetch({cache: true}).done =>\r
@binder_author_icon_with_caption = @binder_author.icon_with_caption_view(true, 'name', 12)\r
- @render()\r
+ @trigger('ready')\r
@destination = @item[@destination_item_name]()\r
@destination.fetch({cache: true}).done =>\r
@destination_icon = @destination.icon_view(true)\r
@destination_author = @destination.author()\r
@destination_author.fetch({cache: true}).done =>\r
@destination_author_icon_with_caption = @destination_author.icon_with_caption_view(true, 'name', 12)\r
- @render()\r
+ @trigger('ready')\r
\r
render: () ->\r
this.$el.html('')\r
- if @binder_author_icon_with_caption and @destination_author_icon_with_caption\r
+ if @binder_author_icon_with_caption\r
this.$el.append(@binder_icon.render().el)\r
this.$el.append(@binder_author_icon_with_caption.render().el)\r
+ if @destination_author_icon_with_caption\r
this.$el.append(@destination_icon.render().el)\r
this.$el.append(@destination_author_icon_with_caption.render().el)\r
this\r
-class Pettanr.Views.Folder.Summary extends Backbone.View\r
+class Pettanr.Views.Folder.Summary extends Pettanr.Views.Common.Summary\r
\r
initialize: (options) ->\r
super(options)\r
+ @trigger('ready')\r
\r
render: () ->\r
this.$el.html('')\r
-class Pettanr.Views.GroundColor.Summary extends Backbone.View\r
+class Pettanr.Views.GroundColor.Summary extends Pettanr.Views.Common.Summary\r
\r
initialize: (options) ->\r
+ super(options)\r
@item = options.item\r
+ @load()\r
\r
- render: () ->\r
- this.$el.html('')\r
+ load: () ->\r
panel = @item.panel()\r
panel.fetch({cache: true}).done =>\r
- panel_icon = new Pettanr.Views.Common.Icon({item: panel, half: true})\r
- this.$el.append(panel_icon.render().el)\r
+ @panel_icon = new Pettanr.Views.Common.Icon({item: panel, half: true})\r
+ @trigger('ready')\r
+ \r
+ render: () ->\r
+ this.$el.html('')\r
+ this.$el.append(@panel_icon.render().el)\r
this\r
\r
-class Pettanr.Views.GroundPicture.Summary extends Backbone.View\r
+class Pettanr.Views.GroundPicture.Summary extends Pettanr.Views.Common.Summary\r
\r
initialize: (options) ->\r
+ super(options)\r
@item = options.item\r
- @picture = @item.picture()\r
+ @load()\r
\r
- render: () ->\r
- this.$el.html('')\r
+ load: () ->\r
+ @picture = @item.picture()\r
@picture.fetch({cache: true}).done =>\r
- credit = @picture.credit_view(false)\r
- this.$el.append(credit.render().el)\r
+ @credit = @picture.credit_view(false)\r
panel = @item.panel()\r
panel.fetch({cache: true}).done =>\r
- panel_icon = new Pettanr.Views.Common.Icon({item: panel, half: true})\r
- this.$el.append(panel_icon.render().el)\r
+ @panel_icon = new Pettanr.Views.Common.Icon({item: panel, half: true})\r
+ @trigger('ready')\r
+ \r
+ render: () ->\r
+ this.$el.html('')\r
+ this.$el.append(@credit.render().el)\r
+ this.$el.append(@panel_icon.render().el)\r
this\r
\r
-class Pettanr.Views.LicenseGroup.Summary extends Backbone.View\r
+class Pettanr.Views.LicenseGroup.Summary extends Pettanr.Views.Common.Summary\r
\r
initialize: (options) ->\r
super(options)\r
+ @trigger('ready')\r
\r
render: () ->\r
this.$el.html('')\r
-class Pettanr.Views.License.Summary extends Backbone.View\r
+class Pettanr.Views.License.Summary extends Pettanr.Views.Common.Summary\r
\r
initialize: (options) ->\r
@item = options.item\r
+ @load()\r
\r
- render: () ->\r
- this.$el.html('')\r
+ load: () ->\r
@system_picture = @item.system_picture()\r
@system_picture.fetch({cache: true}).done =>\r
- img = new Tag.Img({\r
+ @img = new Tag.Img({\r
attr: {\r
src: @system_picture.r_url()\r
}\r
})\r
- this.$el.html(img.render().el)\r
+ @trigger('ready')\r
+ \r
+ render: () ->\r
+ this.$el.html('')\r
+ this.$el.html(@img.render().el)\r
this\r
\r
-class Pettanr.Views.OriginalPicture.Summary extends Backbone.View\r
+class Pettanr.Views.OriginalPicture.Summary extends Pettanr.Views.Common.Summary\r
className: 'op-smy'\r
\r
initialize: (options) ->\r
+ super(options)\r
@item = options.item\r
#@item = new Pettanr.OriginalPicture({id: options.item.get('id')}) # with resource_picture\r
+ @load()\r
\r
- render: () ->\r
+ load: () ->\r
@item.fetch({cache: false}).done =>\r
- this.$el.html('')\r
- visible = new Tag.Span({\r
+ @visible = new Tag.Span({\r
class_name: 'state',\r
content: I18n.t('original_pictures.' + @item.state())\r
})\r
- this.$el.append(visible.render().el)\r
if ra = @item.get('resource_picture')\r
resource_picture = new Pettanr.ResourcePicture(ra)\r
- credit = resource_picture.credit_view(true)\r
- this.$el.append(credit.render().el)\r
- rb = new Tag.RowBreak()\r
- this.$el.append(rb.render().el)\r
+ @credit = resource_picture.credit_view(true)\r
+ @trigger('ready')\r
+ \r
+ render: () ->\r
+ this.$el.html('')\r
+ this.$el.append(@visible.render().el)\r
+ if @credit\r
+ this.$el.append(@credit.render().el)\r
+ rb = new Tag.RowBreak()\r
+ this.$el.append(rb.render().el)\r
this\r
\r
-class Pettanr.Views.PanelPicture.Summary extends Backbone.View\r
+class Pettanr.Views.PanelPicture.Summary extends Pettanr.Views.Common.Summary\r
\r
initialize: (options) ->\r
+ super(options)\r
@item = options.item\r
- @picture = @item.picture()\r
+ @load()\r
\r
- render: () ->\r
- this.$el.html('')\r
+ load: () ->\r
+ @picture = @item.picture()\r
@picture.fetch({cache: true}).done =>\r
- credit = @picture.credit_view(false)\r
- this.$el.append(credit.render().el)\r
+ @credit = @picture.credit_view(false)\r
panel = @item.panel()\r
panel.fetch({cache: true}).done =>\r
- panel_icon = new Pettanr.Views.Common.Icon({item: panel, half: true})\r
- this.$el.append(panel_icon.render().el)\r
+ @panel_icon = new Pettanr.Views.Common.Icon({item: panel, half: true})\r
+ @trigger('ready')\r
+ \r
+ render: () ->\r
+ this.$el.html('')\r
+ this.$el.append(@credit.render().el)\r
+ this.$el.append(@panel_icon.render().el)\r
this\r
\r
-class Pettanr.Views.Panel.Summary extends Backbone.View\r
+class Pettanr.Views.Panel.Summary extends Pettanr.Views.Common.Summary\r
\r
initialize: (options) ->\r
+ super(options)\r
@item = options.item\r
options['visible_t'] = 'panel_publish_items'\r
options['visible_column_name'] = 'publish'\r
@visible_t = options.visible_t\r
@visible_column_name = options.visible_column_name\r
+ @load()\r
+ \r
+ load: () ->\r
@visible = new Tag.Div({\r
content: Pettanr.AppHelper.t_selected_item(@visible_t, @item.get(@visible_column_name))\r
})\r
@author = @item.author()\r
@author.fetch({cache: true}).done =>\r
@author_icon_with_caption = @author.icon_with_caption_view(true, 'name', 12)\r
- @render()\r
+ @trigger('ready')\r
\r
render: () ->\r
this.$el.html('')\r
this.$el.append(@visible.render().el)\r
- if @author_icon_with_caption\r
- this.$el.append(@author_icon_with_caption.render().el)\r
+ this.$el.append(@author_icon_with_caption.render().el)\r
this\r
\r
@item = options.item\r
@with_icon = options.with_icon\r
@url = @item.url + '/credit'\r
+ @listenTo(@item, 'ready', @render)\r
\r
render: () ->\r
this.$el.html('')\r
if @with_icon\r
- p = @item.credit_icon_view()\r
- this.$el.append(p.render().el)\r
- if Pettanr.credits[@url]\r
- this.$el.append(Pettanr.credits[@url])\r
- this.$el.append((new Tag.RowBreak()).render().el)\r
- else\r
- f = (data, status) =>\r
- Pettanr.credits[@url] = data\r
- this.$el.append(data)\r
- rb = new Tag.RowBreak()\r
- this.$el.append(rb.render().el)\r
- $.get(@url, null, f, 'html')\r
+ this.$el.append(@item.credit_icon.render().el)\r
+ this.$el.append(@item.credit)\r
+ this.$el.append((new Tag.RowBreak()).render().el)\r
this\r
\r
-class Pettanr.Views.Picture.Summary extends Backbone.View\r
+class Pettanr.Views.Picture.Summary extends Pettanr.Views.Common.Summary\r
\r
initialize: (options) ->\r
super(options)\r
+ @trigger('ready')\r
\r
render: () ->\r
this.$el.html('')\r
-class Pettanr.Views.ResourcePicture.Summary extends Backbone.View\r
+class Pettanr.Views.ResourcePicture.Summary extends Pettanr.Views.Common.Summary\r
\r
initialize: (options) ->\r
+ super(options)\r
@item = options.item\r
+ @load()\r
+ \r
+ load: () ->\r
@picture = @item.picture()\r
+ @picture.fetch({cache: true}).done =>\r
+ @credit = @picture.credit_view(false)\r
+ @trigger('ready')\r
\r
render: () ->\r
this.$el.html('')\r
- @picture.fetch({cache: true}).done =>\r
- credit = @picture.credit_view(false)\r
- this.$el.append(credit.render().el)\r
+ this.$el.append(@credit.render().el)\r
this\r
\r
-class Pettanr.Views.SheetPanel.Summary extends Backbone.View\r
+class Pettanr.Views.SheetPanel.Summary extends Pettanr.Views.Common.Summary\r
\r
initialize: (options) ->\r
super(options)\r
+ @trigger('ready')\r
\r
render: () ->\r
this.$el.html('')\r
-class Pettanr.Views.SpeechBalloonTemplate.Summary extends Backbone.View\r
+class Pettanr.Views.SpeechBalloonTemplate.Summary extends Pettanr.Views.Common.Summary\r
\r
initialize: (options) ->\r
super(options)\r
+ @trigger('ready')\r
\r
render: () ->\r
this.$el.html('')\r
-class Pettanr.Views.SpeechBalloon.Summary extends Backbone.View\r
+class Pettanr.Views.SpeechBalloon.Summary extends Pettanr.Views.Common.Summary\r
\r
initialize: (options) ->\r
@item = options.item\r
+ @load()\r
\r
- render: () ->\r
- this.$el.html('')\r
+ load: () ->\r
panel = @item.panel()\r
panel.fetch({cache: true}).done =>\r
- panel_icon = new Pettanr.Views.Common.Icon({item: panel, half: true})\r
- this.$el.append(panel_icon.render().el)\r
+ @panel_icon = new Pettanr.Views.Common.Icon({item: panel, half: true})\r
+ @trigger('ready')\r
+ \r
+ render: () ->\r
+ this.$el.html('')\r
+ this.$el.append(@panel_icon.render().el)\r
this\r
\r
-class Pettanr.Views.Speech.Summary extends Backbone.View\r
+class Pettanr.Views.Speech.Summary extends Pettanr.Views.Common.Summary\r
\r
initialize: (options) ->\r
+ super(options)\r
@item = options.item\r
- @speech_balloon = @item.speech_balloon()\r
+ @load()\r
\r
- render: () ->\r
- this.$el.html('')\r
+ load: () ->\r
+ @speech_balloon = @item.speech_balloon()\r
@speech_balloon.fetch({cache: true}).done =>\r
panel = @speech_balloon.panel()\r
panel.fetch({cache: true}).done =>\r
- panel_icon = new Pettanr.Views.Common.Icon({item: panel, half: true})\r
- this.$el.append(panel_icon.render().el)\r
+ @panel_icon = new Pettanr.Views.Common.Icon({item: panel, half: true})\r
+ @trigger('ready')\r
+ \r
+ render: () ->\r
+ this.$el.html('')\r
+ this.$el.append(@panel_icon.render().el)\r
this\r
\r
-class Pettanr.Views.SystemPicture.Summary extends Backbone.View\r
+class Pettanr.Views.SystemPicture.Summary extends Pettanr.Views.Common.Summary\r
\r
initialize: (options) ->\r
super(options)\r
+ @trigger('ready')\r
\r
render: () ->\r
this.$el.html('')\r
-class Pettanr.Views.WritingFormat.Summary extends Backbone.View\r
+class Pettanr.Views.WritingFormat.Summary extends Pettanr.Views.Common.Summary\r
\r
initialize: (options) ->\r
super(options)\r
+ @trigger('ready')\r
\r
render: () ->\r
this.$el.html('')\r
face: {\r
type: 'method',\r
args: {\r
- method_name: 'caption',\r
+ method_name: 'filer_caption',\r
},\r
},\r
},\r
"face": {\r
"type": "method",\r
"args": {\r
- "method_name": "caption"\r
+ "method_name": "filer_caption"\r
}\r
}\r
}\r