picture: () ->\r
new Pettanr.Picture({id: @get('picture_id')})\r
\r
- panel: () ->\r
- new Pettanr.Panel({id: @get('panel_id')})\r
+ panel: (options = {}) ->\r
+ new Pettanr.Panel({id: @get('panel_id')}, options)\r
\r
@has_picture: () ->\r
true\r
class Peta.Element extends Peta.ElementNestableContent\r
merge_opacity: (style_hash, opacity) ->\r
_.extend(style_hash, {\r
- opacity: opacity.to_f/100, \r
+ opacity: opacity/100, \r
filter: 'alpha(opacity=' + Pettanr.to_s(opacity) + ')'\r
})\r
datetime\r
\r
@cache = {}\r
+ @credits = {}\r
\r
class Pettanr.FilerCollection extends Backbone.Collection\r
\r
render: () ->\r
this.$el.html('')\r
_this = this\r
- @speech_balloon.fetch().done ->\r
+ @speech_balloon.fetch({cache: true}).done ->\r
panel = _this.speech_balloon.panel()\r
- panel.fetch().done ->\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\r
height: Pettanr.to_s(@div_height()) + '%', \r
'background-color': '#' + ('000000' + @element.get('code').toString(16)).slice(-6)\r
}\r
- @merge_opacity(r, opacity) if spot and spot != @element\r
r\r
\r
this.$el.html('')\r
_this = this\r
panel = @item.panel()\r
- panel.fetch().done ->\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\r
'background-repeat': @repeat_text(), \r
'background-position': Pettanr.to_s(@element.get('x')) + 'px ' + Pettanr.to_s(@element.get('y')) + 'px'\r
}\r
- @merge_opacity(r, opacity) if spot and spot != @element\r
r\r
\r
style_wh: () ->\r
render: () ->\r
this.$el.html('')\r
_this = this\r
- @picture.fetch().done ->\r
+ @picture.fetch({cache: true}).done ->\r
credit = _this.picture.credit_view(false)\r
_this.$el.append(credit.render().el)\r
panel = _this.item.panel()\r
- panel.fetch().done ->\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\r
\r
opt_img_tag: (spot = null, opacity = 20) ->\r
style = {}\r
- if spot and spot != @element\r
- @merge_opacity(style, opacity)\r
+ if spot and spot.constructor == @element.constructor and spot.get('id') != @element.get('id')\r
+ @element.merge_opacity(style, opacity)\r
{\r
vPicture: @element.get('id'), \r
src: @element.r_url(@picture), \r
prof_url: prof_url\r
})\r
_this = this\r
- @panel = @item.panel()\r
- @panel.fetch({cache: true}).done ->\r
+ @panel = @item.panel({with_elements: true})\r
+ @panel.fetch({cache: false}).done -> # with elements\r
_this.author = new Pettanr.Views.Show.HeaderAuthor({item: _this.panel})\r
+ _this.body = new Pettanr.Views.Panel.Body({\r
+ panel: _this.panel,\r
+ operators: _this.operators,\r
+ spot: _this.item\r
+ })\r
+ _this.credits = new Pettanr.Views.Panel.Show.Credits({panel: _this.panel})\r
+ rb = new Tag.RowBreak()\r
+ _this.$el.append(rb.render().el)\r
_this.render()\r
\r
render: () ->\r
this.$el.html('')\r
this.$el.append(@header.render().el)\r
this.$el.append(@author.render().el)\r
+ this.$el.append(@body.render().el)\r
+ this.$el.append(@credits.render().el)\r
this\r
\r
render: () ->\r
this.$el.html('')\r
_this = this\r
- @picture.fetch().done ->\r
+ @picture.fetch({cache: true}).done ->\r
credit = _this.picture.credit_view(false)\r
_this.$el.append(credit.render().el)\r
panel = _this.item.panel()\r
- panel.fetch().done ->\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\r
_this = this\r
this.$el.html('')\r
_.each @pictures, (picture) ->\r
- picture.fetch().done ->\r
+ picture.fetch({cache: true}).done ->\r
credit = picture.credit_view()\r
_this.$el.append(credit.render().el)\r
this\r
p = @item.credit_icon_view()\r
this.$el.append(p.render().el)\r
_this = this\r
- f = (data, status) ->\r
- _this.$el.append(data)\r
- rb = new Tag.RowBreak()\r
- _this.$el.append(rb.render().el)\r
- $.get(@url, null, f, 'html')\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[_this.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\r
\r
render: () ->\r
this.$el.html('')\r
_this = this\r
- @picture.fetch().done ->\r
+ @picture.fetch({cache: true}).done ->\r
credit = _this.picture.credit_view(false)\r
_this.$el.append(credit.render().el)\r
this\r
this.$el.html('')\r
_this = this\r
panel = @item.panel()\r
- panel.fetch().done ->\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\r
render: () ->\r
this.$el.html('')\r
_this = this\r
- @speech_balloon.fetch().done ->\r
+ @speech_balloon.fetch({cache: true}).done ->\r
panel = _this.speech_balloon.panel()\r
- panel.fetch().done ->\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\r