X-Git-Url: http://git.osdn.net/view?p=pettanr%2Fpettanr.git;a=blobdiff_plain;f=app%2Fassets%2Fjavascripts%2Fview%2Fshow.js.coffee;h=b23db105ce7c51de257867f315f13df0a4599ab0;hp=caf92482115e4da7d5e3a3d324a93c3a0e295d0c;hb=d7c8065be895b67dc453b0e11ad0f259f1ca6706;hpb=0ead3a286b925e86845cf8211982a7985e522813 diff --git a/app/assets/javascripts/view/show.js.coffee b/app/assets/javascripts/view/show.js.coffee index caf92482..b23db105 100644 --- a/app/assets/javascripts/view/show.js.coffee +++ b/app/assets/javascripts/view/show.js.coffee @@ -1 +1,85 @@ class Pettanr.View.Show extends Pettanr.View + tagName: 'div' + className: 'show' + + constructor: (@item, options) -> + super(options) + + default_header_options: () -> + { + face: { + click: () => + @trigger('http_get', @item.show_url()) + }, + label: { + click: () => + @trigger('http_get', @item.show_url()) + }, + prof: { + click: () => + @trigger('http_get', @item.prof_url()) + }, + } + + binder_header_options: () -> + { + face: { + click: () => + @trigger('http_get', @item.show_url()) + }, + label: { + url: @item.play_url(), + click: () => + @trigger('http_get', @item.play_url()) + }, + prof: { + click: () => + @trigger('http_get', @item.prof_url()) + }, + } + + default_footer_options: () -> + { + actions: { + edit: { + click: () => + @trigger('http_get', @item.edit_url()) + }, + destroy: { + click: () => + redirect = (url) => + @trigger('http_get', url) + Pettanr.Proxy.destroy(@item, {redirect: redirect}) + }, + }, + } + + edit_only_footer_options: () -> + { + actions: { + edit: { + click: () => + @trigger('http_get', @item.edit_url()) + }, + }, + } + + add_credits: (options = {icon: true}) -> + @credits = new Pettanr.View.Credits(this, options) + @listenTo(@credits, 'click:credit:icon', @click_credit_icon) + this.$el.append(@credits.render().el) + @append_rb() + @credits.push(@panel.licensed_pictures()) + + add_credit: (picture, options = {icon: true}) -> + credit = new Pettanr.View.Credit(picture, options) + this.$el.append(credit.render().el) + @listenTo(credit, 'click:icon', @click_credit_icon) + @append_rb() + + click_authored_by: (author) -> + @trigger('http_get', author.show_url()) + + click_credit_icon: (item) -> + @trigger('http_get', item.show_url()) +