OSDN Git Service

Merge branch 'v06' of git.sourceforge.jp:/gitroot/pettanr/pettanr into v06
authoryasushiito <yas@pen-chan.jp>
Mon, 20 Jul 2015 06:04:07 +0000 (15:04 +0900)
committeryasushiito <yas@pen-chan.jp>
Mon, 20 Jul 2015 06:04:07 +0000 (15:04 +0900)
113 files changed:
app/assets/javascripts/controllers/artists.js.coffee
app/assets/javascripts/controllers/authors.js.coffee
app/assets/javascripts/controllers/balloons.js.coffee
app/assets/javascripts/controllers/comic_stories.js.coffee
app/assets/javascripts/controllers/comics.js.coffee
app/assets/javascripts/controllers/ground_colors.js.coffee
app/assets/javascripts/controllers/ground_pictures.js.coffee
app/assets/javascripts/controllers/license_groups.js.coffee
app/assets/javascripts/controllers/licenses.js.coffee
app/assets/javascripts/controllers/original_pictures.js.coffee
app/assets/javascripts/controllers/panel_pictures.js.coffee
app/assets/javascripts/controllers/panels.js.coffee
app/assets/javascripts/controllers/pictures.js.coffee
app/assets/javascripts/controllers/resource_picture_pictures.js.coffee
app/assets/javascripts/controllers/resource_pictures.js.coffee
app/assets/javascripts/controllers/scroll_panels.js.coffee
app/assets/javascripts/controllers/scrolls.js.coffee
app/assets/javascripts/controllers/sheet_panels.js.coffee
app/assets/javascripts/controllers/sheets.js.coffee
app/assets/javascripts/controllers/speech_balloon_templates.js.coffee
app/assets/javascripts/controllers/speech_balloons.js.coffee
app/assets/javascripts/controllers/speeches.js.coffee
app/assets/javascripts/controllers/stories.js.coffee
app/assets/javascripts/controllers/story_sheets.js.coffee
app/assets/javascripts/controllers/system_pictures.js.coffee
app/assets/javascripts/controllers/writing_formats.js.coffee
app/assets/javascripts/editor/panel_editor.js.coffee
app/assets/javascripts/locmare/filer/body/file_body/file_item/icon/base.js.coffee
app/assets/javascripts/locmare/filer/body/file_body/file_item/icon/default.js.coffee
app/assets/javascripts/locmare/filer/body/file_body/file_item/symbol/default.js.coffee
app/assets/javascripts/locmare/filer/body/file_body/file_item/symbol/default/face/image.js.coffee
app/assets/javascripts/models/ground_picture.js.coffee
app/assets/javascripts/models/original_picture.js.coffee
app/assets/javascripts/models/panel_picture.js.coffee
app/assets/javascripts/models/picture.js.coffee
app/assets/javascripts/models/resource_picture.js.coffee
app/assets/javascripts/models/sheet.js.coffee
app/assets/javascripts/models/system_picture.js.coffee
app/assets/javascripts/peta/content.js.coffee
app/assets/javascripts/peta/item.js.coffee
app/assets/javascripts/pettanr/file.js.coffee
app/assets/javascripts/view.js.coffee
app/assets/javascripts/view/button.js.coffee
app/assets/javascripts/view/button/item_action.js.coffee
app/assets/javascripts/view/button/shortable_caption.js.coffee
app/assets/javascripts/view/credit.js.coffee [new file with mode: 0644]
app/assets/javascripts/view/credits.js.coffee [new file with mode: 0644]
app/assets/javascripts/view/faced_label.js.coffee
app/assets/javascripts/view/icon.js.coffee
app/assets/javascripts/view/show.js.coffee
app/assets/javascripts/view/show/footer.js.coffee
app/assets/javascripts/view/show/footer/footer.js.coffee
app/assets/javascripts/view/show/header.js.coffee
app/assets/javascripts/view/show/header/authored_by.js.coffee
app/assets/javascripts/view/summary.js.coffee [new file with mode: 0644]
app/assets/javascripts/view/summary/binder.js.coffee [new file with mode: 0644]
app/assets/javascripts/view/summary/leaf.js.coffee [new file with mode: 0644]
app/assets/javascripts/views/artists/show.js.coffee
app/assets/javascripts/views/artists/summary.js.coffee
app/assets/javascripts/views/authors/show.js.coffee
app/assets/javascripts/views/authors/summary.js.coffee
app/assets/javascripts/views/balloons/show.js.coffee
app/assets/javascripts/views/balloons/summary.js.coffee
app/assets/javascripts/views/comic_stories/summary.js.coffee
app/assets/javascripts/views/comics/show.js.coffee
app/assets/javascripts/views/comics/summary.js.coffee
app/assets/javascripts/views/folders/summary.js.coffee
app/assets/javascripts/views/ground_colors/show.js.coffee
app/assets/javascripts/views/ground_colors/summary.js.coffee
app/assets/javascripts/views/ground_pictures/element.js.coffee
app/assets/javascripts/views/ground_pictures/show.js.coffee
app/assets/javascripts/views/ground_pictures/summary.js.coffee
app/assets/javascripts/views/license_groups/show.js.coffee
app/assets/javascripts/views/license_groups/summary.js.coffee
app/assets/javascripts/views/licenses/show.js.coffee
app/assets/javascripts/views/licenses/summary.js.coffee
app/assets/javascripts/views/original_pictures/show.js.coffee
app/assets/javascripts/views/original_pictures/summary.js.coffee
app/assets/javascripts/views/panel_pictures/element.js.coffee
app/assets/javascripts/views/panel_pictures/show.js.coffee
app/assets/javascripts/views/panel_pictures/summary.js.coffee
app/assets/javascripts/views/panels/show.js.coffee
app/assets/javascripts/views/panels/summary.js.coffee
app/assets/javascripts/views/pictures/credit.js.coffee [deleted file]
app/assets/javascripts/views/pictures/credit_icon.js.coffee [deleted file]
app/assets/javascripts/views/pictures/summary.js.coffee
app/assets/javascripts/views/resource_picture_pictures/summary.js.coffee
app/assets/javascripts/views/resource_pictures/credit.js.coffee [deleted file]
app/assets/javascripts/views/resource_pictures/credit_icon.js.coffee [deleted file]
app/assets/javascripts/views/resource_pictures/show.js.coffee
app/assets/javascripts/views/resource_pictures/summary.js.coffee
app/assets/javascripts/views/scroll_panels/summary.js.coffee
app/assets/javascripts/views/scrolls/play.js.coffee
app/assets/javascripts/views/scrolls/show.js.coffee
app/assets/javascripts/views/scrolls/summary.js.coffee
app/assets/javascripts/views/sheet_panels/summary.js.coffee
app/assets/javascripts/views/sheets/play.js.coffee
app/assets/javascripts/views/sheets/show.js.coffee
app/assets/javascripts/views/sheets/summary.js.coffee
app/assets/javascripts/views/speech_balloon_templates/show.js.coffee
app/assets/javascripts/views/speech_balloon_templates/summary.js.coffee
app/assets/javascripts/views/speech_balloons/show.js.coffee
app/assets/javascripts/views/speech_balloons/summary.js.coffee
app/assets/javascripts/views/speeches/show.js.coffee
app/assets/javascripts/views/speeches/summary.js.coffee
app/assets/javascripts/views/stories/show.js.coffee
app/assets/javascripts/views/stories/summary.js.coffee
app/assets/javascripts/views/story_sheets/summary.js.coffee
app/assets/javascripts/views/system_pictures/show.js.coffee
app/assets/javascripts/views/system_pictures/summary.js.coffee
app/assets/javascripts/views/writing_formats/show.js.coffee
app/assets/javascripts/views/writing_formats/summary.js.coffee
app/assets/javascripts/yasapp.js

index 96c8caf..ad7b836 100644 (file)
@@ -17,8 +17,7 @@ class Pettanr.ArtistsController extends Pettanr.AppController
   \r
   show_html: () -> \r
     @trigger('title', @params, @item.get('name'))\r
-    show = new Pettanr.Views.Artist.Show({\r
-      item: @item,\r
+    show = new Pettanr.Views.Artist.Show(@item, {\r
     })\r
     show.render()\r
     @trigger('ready', show)\r
index 1a961ed..d0a46cd 100644 (file)
@@ -17,8 +17,7 @@ class Pettanr.AuthorsController extends Pettanr.AppController
   \r
   show_html: () -> \r
     @trigger('title', @params, @item.get('name'))\r
-    show = new Pettanr.Views.Author.Show({\r
-      item: @item,\r
+    show = new Pettanr.Views.Author.Show(@item, {\r
     })\r
     show.render()\r
     @trigger('ready', show)\r
index 7992a5f..38da1bb 100644 (file)
@@ -27,8 +27,7 @@ class Pettanr.BalloonsController extends Pettanr.AppController
   \r
   show_html: () -> \r
     @trigger('title', @params)\r
-    show = new Pettanr.Views.Balloon.Show({\r
-      item: @item,\r
+    show = new Pettanr.Views.Balloon.Show(@item, {\r
     })\r
     show.render()\r
     @trigger('ready', show)\r
index 5cc0c33..7052a6f 100644 (file)
@@ -32,8 +32,7 @@ class Pettanr.ComicStoriesController extends Pettanr.AppController
   \r
   show_html: () -> \r
     @trigger('title', @params)\r
-    show = new Pettanr.Views.ComicStory.Show({\r
-      item: @item,\r
+    show = new Pettanr.Views.ComicStory.Show(@item, {\r
     })\r
     show.render()\r
     @trigger('ready', show)\r
index 7b19554..658bce5 100644 (file)
@@ -27,8 +27,7 @@ class Pettanr.ComicsController extends Pettanr.AppController
   \r
   show_html: () -> \r
     @trigger('title', @params, @item.get('title'))\r
-    show = new Pettanr.Views.Comic.Show({\r
-      item: @item,\r
+    show = new Pettanr.Views.Comic.Show(@item, {\r
     })\r
     show.render()\r
     @trigger('ready', show)\r
index 883ee9f..a0cb68f 100644 (file)
@@ -27,8 +27,7 @@ class Pettanr.GroundColorsController extends Pettanr.AppController
   \r
   show_html: () -> \r
     @trigger('title', @params, @item.get('caption'))\r
-    show = new Pettanr.Views.GroundColor.Show({\r
-      item: @item,\r
+    show = new Pettanr.Views.GroundColor.Show(@item, {\r
     })\r
     show.render()\r
     @trigger('ready', show)\r
index d3d823f..21bb7ac 100644 (file)
@@ -27,8 +27,7 @@ class Pettanr.GroundPicturesController extends Pettanr.AppController
   \r
   show_html: () -> \r
     @trigger('title', @params, @item.get('caption'))\r
-    show = new Pettanr.Views.GroundPicture.Show({\r
-      item: @item,\r
+    show = new Pettanr.Views.GroundPicture.Show(@item, {\r
     })\r
     show.render()\r
     @trigger('ready', show)\r
index 9591900..a34b2a6 100644 (file)
@@ -17,8 +17,7 @@ class Pettanr.LicenseGroupsController extends Pettanr.AppController
   \r
   show_html: () -> \r
     @trigger('title', @params, @item.get('caption'))\r
-    show = new Pettanr.Views.LicenseGroup.Show({\r
-      item: @item,\r
+    show = new Pettanr.Views.LicenseGroup.Show(@item, {\r
     })\r
     show.render()\r
     @trigger('ready', show)\r
index a76eff8..2716c94 100644 (file)
@@ -27,8 +27,7 @@ class Pettanr.LicensesController extends Pettanr.AppController
   \r
   show_html: () -> \r
     @trigger('title', @params, @item.get('caption'))\r
-    show = new Pettanr.Views.License.Show({\r
-      item: @item,\r
+    show = new Pettanr.Views.License.Show(@item, {\r
     })\r
     show.render()\r
     @trigger('ready', show)\r
index a7e6ace..70a4dc2 100644 (file)
@@ -22,8 +22,7 @@ class Pettanr.OriginalPicturesController extends Pettanr.AppController
   \r
   show_html: () -> \r
     @trigger('title', @params)\r
-    show = new Pettanr.Views.OriginalPicture.Show({\r
-      item: @item,\r
+    show = new Pettanr.Views.OriginalPicture.Show(@item, {\r
     })\r
     @listenTo(show, 'click:license', @click_license)\r
     @listenTo(show, 'success', @publish)\r
index 71e8267..8ac9740 100644 (file)
@@ -27,8 +27,7 @@ class Pettanr.PanelPicturesController extends Pettanr.AppController
   \r
   show_html: () -> \r
     @trigger('title', @params, @item.get('caption'))\r
-    show = new Pettanr.Views.PanelPicture.Show({\r
-      item: @item,\r
+    show = new Pettanr.Views.PanelPicture.Show(@item, {\r
     })\r
     show.render()\r
     @trigger('ready', show)\r
index 9158499..702ba50 100644 (file)
@@ -40,8 +40,7 @@ class Pettanr.PanelsController extends Pettanr.AppController
     @item.fetch({cache: false}).done =>\r
       @item.attributes = @item.replaced_attributes()\r
       @trigger('title', @params, @item.get('caption'))\r
-      show = new Pettanr.Views.Panel.Show({\r
-        panel: @item,\r
+      show = new Pettanr.Views.Panel.Show(@item, {\r
         spot: null\r
       })\r
       show.render()\r
index 68f969e..ea4920d 100644 (file)
@@ -22,8 +22,7 @@ class Pettanr.PicturesController extends Pettanr.AppController
   \r
   show_html: () -> \r
     @trigger('title', @params)\r
-    show = new Pettanr.Views.Picture.Show({\r
-      item: @item,\r
+    show = new Pettanr.Views.Picture.Show(@item, {\r
     })\r
     show.render()\r
     @trigger('ready', show)\r
index 8f1de07..2f4834d 100644 (file)
@@ -32,8 +32,7 @@ class Pettanr.ResourcePicturePicturesController extends Pettanr.AppController
   \r
   show_html: () -> \r
     @trigger('title', @params)\r
-    show = new Pettanr.Views.ResourcePicturePicture.Show({\r
-      item: @item,\r
+    show = new Pettanr.Views.ResourcePicturePicture.Show(@item, {\r
     })\r
     show.render()\r
     @trigger('ready', show)\r
index 58d6173..2a99643 100644 (file)
@@ -32,8 +32,7 @@ class Pettanr.ResourcePicturesController extends Pettanr.AppController
   \r
   show_html: () -> \r
     @trigger('title', @params)\r
-    show = new Pettanr.Views.ResourcePicture.Show({\r
-      item: @item,\r
+    show = new Pettanr.Views.ResourcePicture.Show(@item, {\r
     })\r
     show.render()\r
     @trigger('ready', show)\r
index 4d1ca1e..05ad66e 100644 (file)
@@ -32,8 +32,7 @@ class Pettanr.ScrollPanelsController extends Pettanr.AppController
   \r
   show_html: () -> \r
     @trigger('title', @params)\r
-    show = new Pettanr.Views.ScrollPanel.Show({\r
-      item: @item,\r
+    show = new Pettanr.Views.ScrollPanel.Show(@item, {\r
     })\r
     show.render()\r
     @trigger('ready', show)\r
index 609d057..e29fba0 100644 (file)
@@ -28,8 +28,7 @@ class Pettanr.ScrollsController extends Pettanr.AppController
   \r
   show_html: () -> \r
     @trigger('title', @params, @item.get('title'))\r
-    show = new Pettanr.Views.Scroll.Show({\r
-      item: @item,\r
+    show = new Pettanr.Views.Scroll.Show(@item, {\r
     })\r
     show.render()\r
     @trigger('ready', show)\r
index 2015fb0..1f02c3d 100644 (file)
@@ -32,8 +32,7 @@ class Pettanr.SheetPanelsController extends Pettanr.AppController
   \r
   show_html: () -> \r
     @trigger('title', @params)\r
-    show = new Pettanr.Views.SheetPanel.Show({\r
-      item: @item,\r
+    show = new Pettanr.Views.SheetPanel.Show(@item, {\r
     })\r
     show.render()\r
     @trigger('ready', show)\r
index 19b3249..56c030a 100644 (file)
@@ -32,8 +32,7 @@ class Pettanr.SheetsController extends Pettanr.AppController
   \r
   show_html: () -> \r
     @trigger('title', @params, @item.get('caption'))\r
-    show = new Pettanr.Views.Sheet.Show({\r
-      item: @item,\r
+    show = new Pettanr.Views.Sheet.Show(@item, {\r
     })\r
     show.render()\r
     @trigger('ready', show)\r
index bc3170e..e759022 100644 (file)
@@ -27,8 +27,7 @@ class Pettanr.SpeechBalloonTemplatesController extends Pettanr.AppController
   \r
   show_html: () -> \r
     @trigger('title', @params, @item.get('caption'))\r
-    show = new Pettanr.Views.SpeechBalloonTemplate.Show({\r
-      item: @item,\r
+    show = new Pettanr.Views.SpeechBalloonTemplate.Show(@item, {\r
     })\r
     show.render()\r
     @trigger('ready', show)\r
index 69aab0f..48d4744 100644 (file)
@@ -32,8 +32,7 @@ class Pettanr.SpeechBalloonsController extends Pettanr.AppController
   \r
   show_html: () -> \r
     @trigger('title', @params, @item.get('caption'))\r
-    show = new Pettanr.Views.SpeechBalloon.Show({\r
-      item: @item,\r
+    show = new Pettanr.Views.SpeechBalloon.Show(@item, {\r
     })\r
     show.render()\r
     @trigger('ready', show)\r
index 8668bd4..0c81de8 100644 (file)
@@ -27,8 +27,7 @@ class Pettanr.SpeechesController extends Pettanr.AppController
   \r
   show_html: () -> \r
     @trigger('title', @params)\r
-    show = new Pettanr.Views.Speech.Show({\r
-      item: @item,\r
+    show = new Pettanr.Views.Speech.Show(@item, {\r
     })\r
     show.render()\r
     @trigger('ready', show)\r
index c573900..f292605 100644 (file)
@@ -32,8 +32,7 @@ class Pettanr.StoriesController extends Pettanr.AppController
   \r
   show_html: () -> \r
     @trigger('title', @params, @item.get('title'))\r
-    show = new Pettanr.Views.Story.Show({\r
-      item: @item,\r
+    show = new Pettanr.Views.Story.Show(@item, {\r
     })\r
     show.render()\r
     @trigger('ready', show)\r
index 489de17..cf76d2e 100644 (file)
@@ -32,8 +32,7 @@ class Pettanr.StorySheetsController extends Pettanr.AppController
   \r
   show_html: () -> \r
     @trigger('title', @params)\r
-    show = new Pettanr.Views.StorySheet.Show({\r
-      item: @item,\r
+    show = new Pettanr.Views.StorySheet.Show(@item, {\r
     })\r
     show.render()\r
     @trigger('ready', show)\r
index 181f6e1..ff7bb38 100644 (file)
@@ -17,8 +17,7 @@ class Pettanr.SystemPicturesController extends Pettanr.AppController
   \r
   show_html: () -> \r
     @trigger('title', @params)\r
-    show = new Pettanr.Views.SystemPicture.Show({\r
-      item: @item,\r
+    show = new Pettanr.Views.SystemPicture.Show(@item, {\r
     })\r
     show.render()\r
     @trigger('ready', show)\r
index f45a395..50c97f2 100644 (file)
@@ -22,8 +22,7 @@ class Pettanr.WritingFormatsController extends Pettanr.AppController
   \r
   show_html: () -> \r
     @trigger('title', @params, @item.get('caption'))\r
-    show = new Pettanr.Views.WritingFormat.Show({\r
-      item: @item,\r
+    show = new Pettanr.Views.WritingFormat.Show(@item, {\r
     })\r
     show.render()\r
     @trigger('ready', show)\r
index 4585512..ff26b0f 100644 (file)
@@ -11,7 +11,7 @@ class Editor.PanelEditor extends Pettanr.View
       spot: null\r
     })\r
     @dock = new Editor.PanelEditor.Dock({parent: this})\r
-    @credits = new Pettanr.Views.Common.Credits(parent: this)\r
+    @credits = new Pettanr.View.Credits(parent: this)\r
     \r
     @body.on('panel:resize', @panel_resize)\r
     @listenTo(@dock, 'http_post', @http_post)\r
index e9b567b..9503c8a 100644 (file)
@@ -20,20 +20,6 @@ class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.IconItemColum
     this.$el.html(template(args))\r
     this\r
   \r
-  url: () ->\r
-    controller = Manifest.manifest().controllers[@item.table_name()]\r
-    action = controller.actions['show']\r
-    params = {\r
-      controller: controller,\r
-      action: action,\r
-      id: @item.get('id'),\r
-      format: 'prof'\r
-    }\r
-    action.url(params)\r
-  \r
-  click: () ->\r
-    @trigger('click:prof', @url())\r
-  \r
   filer: () ->\r
     @file_item.filer()\r
   \r
@@ -43,21 +29,3 @@ class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.IconItemColum
   item_name: () ->\r
     @filer().item_name\r
   \r
-  column_template_dir: () ->\r
-    @filer().template_dir + 'item_column-'\r
-  \r
-  column_template_file_name: () ->\r
-    raise "undefined column_template_file_name\n"\r
-  \r
-  column_template_name: () ->\r
-    @column_template_dir() + @column_template_file_name()\r
-  \r
-  item_template_dir: () ->\r
-    @filer().template_dir + 'icon-'\r
-  \r
-  item_template_file_name: () ->\r
-    raise "undefined item_template_file_name\n"\r
-  \r
-  item_template_name: () ->\r
-    @item_template_dir() + @item_template_file_name()\r
-  \r
index 62986c5..65be0ce 100644 (file)
@@ -4,23 +4,15 @@ class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.IconItemColum
     super(options)\r
   \r
   render: () ->\r
-    icon = new Pettanr.Image.SymbolImg({\r
+    prof_button = @item.prof_button({\r
       class_name: 'face', \r
-      attr: {\r
-        src: @icon_file_name()\r
-      }\r
+      context: this, \r
+      click: () ->\r
+        @trigger('click:prof', @item.prof_url())\r
     })\r
-    a = new Tag.A({\r
-      attr: {href: '/' + @url()}, \r
-      content: icon.render().el\r
-    })\r
-    this.$el.html(a.render().el)\r
-    @listenTo(a, 'click', @click)\r
+    this.$el.html(prof_button.render().el)\r
     this\r
   \r
-  icon_file_name: () ->\r
-    '/images/prof.gif'\r
-   \r
   is_visible: () ->\r
     true\r
   \r
index 8162a6c..6dffc03 100644 (file)
@@ -11,23 +11,18 @@ class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.SymbolItemCol
     @face.render()\r
     this\r
   \r
-  ready_symbol: (symbol) ->\r
+  ready_symbol: (symbol_file) ->\r
     view = if @has_link()\r
-      linked_symbol = new Tag.A({\r
-        attr: {href: '/' + @link.url()}, \r
-        content: symbol.render().el\r
+      Pettanr.View.face_button(@item, symbol_file, {\r
+        context: this,\r
+        click: () =>\r
+          @trigger('click:symbol')\r
+          @trigger('http_get', @link.url())\r
       })\r
-      @listenTo(linked_symbol, 'click', @click)\r
-      linked_symbol\r
     else\r
-      symbol\r
+      new Pettanr.View.Icon(symbol_file)\r
     this.$el.html(view.render().el)\r
   \r
-  click: () ->\r
-    @trigger('click:symbol')\r
-    @trigger('http_get', @link.url())\r
-    false\r
-  \r
   mdl: () ->\r
     Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.SymbolItemColumnModule.DefaultModule\r
   \r
index d92afcd..b8db290 100644 (file)
@@ -6,11 +6,7 @@ class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.SymbolItemCol
   # not render\r
   # get symbol data and send message\r
   render: () ->\r
-    picture = new Pettanr.Image.SymbolImg({\r
-      attr: {\r
-        src: @url()\r
-      }\r
-    })\r
+    picture = @item.face_file()\r
     @trigger('ready:symbol', picture)\r
   \r
   url: () ->\r
index 2218093..07dd815 100644 (file)
@@ -34,24 +34,12 @@ class Pettanr.GroundPicture extends Peta.Element
   @has_picture: () ->\r
     true\r
   \r
-  tmb_opt_img_tag: (picture) ->\r
-    new Pettanr.Image.SymbolPicture({\r
-      attr: {\r
-        src: picture.r_url(), \r
-        alt: @escape('caption')\r
-      },\r
-      picture: picture\r
-    })\r
-  \r
   repeat_text: () ->\r
     Pettanr.GroundPicture.repeat_texts()[@get('repeat')]\r
   \r
   element_face: () ->\r
     new Pettanr.Views.GroundPicture.ElementFace({element: this})\r
   \r
-  picture_file: () ->\r
-    new Pettanr.PictureFile(this)\r
-  \r
   initialize: (attr, options) ->\r
     super(attr, options)\r
   \r
index 7c169b5..06441e3 100644 (file)
@@ -26,21 +26,10 @@ class Pettanr.OriginalPicture extends Peta.Content
   license_url: () ->\r
     '/original_picture_license_groups/new/' + @get('id')\r
   \r
-  opt_img_tag: () ->\r
-    {src: @r_url(), width: @get('width'), height: @get('height')}\r
-  \r
-  tmb_opt_img_tag: () ->\r
-    new Pettanr.Image.SymbolPicture({\r
-      attr: {\r
-        src: @r_url()\r
-      },\r
-      picture: this\r
-    })\r
-  \r
   symbol_option: (context, options) ->\r
     @retrieve(this, {\r
       success: (symbol_item) => \r
-        options.success.call(context, symbol_item.to_symbol())\r
+        options.success.call(context, symbol_item.symbol_file())\r
     })\r
   \r
   filer_caption: (context, options) ->\r
index 206c834..962f2f5 100644 (file)
@@ -56,21 +56,9 @@ class Pettanr.PanelPicture extends Peta.Element
   r_url: (picture) ->\r
     '/pictures/' + @filename(picture)\r
   \r
-  tmb_opt_img_tag: (picture) ->\r
-    new Pettanr.Image.SymbolPicture({\r
-      attr: {\r
-        src: picture.r_url(), \r
-        alt: @escape('caption')\r
-      },\r
-      picture: picture\r
-    })\r
-  \r
   element_face: () ->\r
     new Pettanr.Views.PanelPicture.ElementFace({element: this})\r
   \r
-  picture_file: () ->\r
-    new Pettanr.PictureFile(this, @flip())\r
-  \r
   initialize: (attr, options) ->\r
     super(attr, options)\r
   \r
index 0cc5a67..b1d85c3 100644 (file)
@@ -41,7 +41,7 @@ class Pettanr.Picture extends Peta.Content
     }\r
   \r
   opt_img_tag: () ->\r
-    {src: @r_url(), width: @get('width'), height: @get('height')}\r
+    @picture_file()\r
   \r
   tmb_opt_img_tag: () ->\r
     @symbol_file()\r
@@ -93,25 +93,6 @@ class Pettanr.Picture extends Peta.Content
   history_view: () ->\r
     new Pettanr.Views.Picture.History({item: this})\r
   \r
-  credit_icon_view: () ->\r
-    new Pettanr.Views.Picture.CreditIcon({item: this})\r
-  \r
-  credit_view: (with_icon = true) ->\r
-    new Pettanr.Views.Picture.Credit({item: this, with_icon: with_icon})\r
-  \r
-  picture_file: (subdir = null) ->\r
-    new Pettanr.PictureFile(this, subdir)\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: (attr = {}, options = {}) ->\r
     super(attr, options)\r
   \r
index fd7081e..6a82a51 100644 (file)
@@ -22,28 +22,22 @@ class Pettanr.ResourcePicture extends Peta.Content
   mime_type: () ->\r
     'image/' + @get('ext')\r
   \r
-  full_src: () ->\r
-    @src('full')\r
-  \r
-  src: (subdir = null) ->\r
+  r_url: (subdir = null) ->\r
     opt = if _.isEmpty(subdir)\r
       ''\r
     else\r
       '?subdir=' + Pettanr.to_s(subdir)\r
     '/resource_pictures/' + @filename() + opt\r
   \r
-  tmb_opt_img_tag: () ->\r
-    klass = if true # thumbnail\r
-      Pettanr.Image.SymbolPicture\r
-    new klass({\r
-      attr: {\r
-        src: @src()\r
-      },\r
-      picture: this\r
-    })\r
+  symbol_file: () ->\r
+    subdir = if @no_resize()\r
+      'full'\r
+    else\r
+      null\r
+    super(subdir)\r
   \r
-  opt_img_tag: () ->\r
-    {src: @url('full'), width: @get('width'), height: @get('height')}\r
+  no_resize: () ->\r
+    false\r
   \r
   alt_name: () ->\r
     lgn = Pettanr.to_s(@license().license_group().get('caption'))\r
@@ -53,15 +47,9 @@ class Pettanr.ResourcePicture extends Peta.Content
   symbol_option: (context, options) ->\r
     @retrieve(this, {\r
       success: (symbol_item) => \r
-        options.success.call(context, symbol_item.to_symbol())\r
+        options.success.call(context, symbol_item.symbol_file())\r
     })\r
   \r
-  credit_icon_view: () ->\r
-    new Pettanr.Views.ResourcePicture.CreditIcon({item: this})\r
-  \r
-  credit_view: (with_icon = true) ->\r
-    new Pettanr.Views.ResourcePicture.Credit({item: this, with_icon: with_icon})\r
-  \r
   initialize: (attr = {}, options = {}) ->\r
     super(attr, options)\r
   \r
index 47e5a28..ecfba80 100644 (file)
@@ -29,6 +29,10 @@ class Pettanr.Sheet extends Peta.Root
   label: (shorten_length) ->\r
     @_label('title', shorten_length)\r
   \r
+  # item is root, but binder like\r
+  play_url: () ->\r
+    Pettanr.url(@table_name(), 'play', {id: @get('id')})\r
+  \r
   initialize: (attr = {}, options = {}) ->\r
     super(attr, options)\r
   \r
index 9007526..148a6d0 100644 (file)
@@ -19,26 +19,12 @@ class Pettanr.SystemPicture extends Peta.SystemResource
   r_url: () ->\r
     '/system_pictures/' + @filename()\r
   \r
-  opt_img_tag: () ->\r
-    {src: @r_url(), width: @get('width'), height: @get('height')}\r
-  \r
-  tmb_opt_img_tag: () ->\r
-    new Pettanr.Image.SymbolPicture({\r
-      attr: {\r
-        src: @r_url()\r
-      },\r
-      picture: this\r
-    })\r
-  \r
   symbol_option: (context, options) ->\r
     @retrieve(this, {\r
       success: (symbol_item) => \r
-        options.success.call(context, symbol_item.to_symbol())\r
+        options.success.call(context, symbol_item.symbol_file())\r
     })\r
   \r
-  picture_file: () ->\r
-    new Pettanr.PictureFile(this)\r
-  \r
   initialize: (attr = {}, options = {}) ->\r
     super(attr, options)\r
   \r
index e3f95dd..7d8134f 100644 (file)
@@ -40,7 +40,10 @@ class Peta.Content extends Peta.Item
     operator = @my_class().operator(operators)\r
     return false if not operator\r
     @owner_model().get(@my_class().owner_column()) == operator.id\r
-\r
+  \r
+  authored_by: (options) ->\r
+    new Pettanr.View.Show.AuthoredBy(this, options)\r
+  \r
   @test: () ->\r
     super()\r
     console.log(@is_content())\r
index 77d01cc..fa8ae55 100644 (file)
@@ -287,21 +287,28 @@ class Peta.Item extends Backbone.Model
   symbol_option: (context, options) ->\r
     @trace_to('symbol', this, {\r
       success: (symbol_item) => \r
-        options.success.call(context, symbol_item.to_symbol())\r
+        options.success.call(context, symbol_item.symbol_file())\r
     })\r
   \r
-  to_symbol: () ->\r
-    @tmb_opt_img_tag()\r
-  \r
-  icon_view: (half) ->\r
-    new Pettanr.Views[@my_class().singular()].Icon({item: this, half: half})\r
-  \r
   face_file: () ->\r
     new Pettanr.ImageFile('/images/' + @item_name() + '.gif')\r
   \r
-  symbol_file: () ->\r
-    new Pettanr.PictureFile(this)\r
+  # thumbnail size picture\r
+  symbol_file: (subdir) ->\r
+    new Pettanr.PictureFile(this, subdir)\r
+  \r
+  # real size picture\r
+  picture_file: (subdir = null) ->\r
+    new Pettanr.PictureFile(this, subdir)\r
   \r
+  real_picture: (subdir = null) ->\r
+    new Pettanr.View.RealIcon(@picture_file(subdir))\r
+  \r
+  # item.face_button({\r
+  #   context: this, \r
+  #   click: () ->\r
+  #     # ...\r
+  # })\r
   face_button: (options) ->\r
     Pettanr.View.face_button(this, @face_file(), options)\r
   \r
@@ -328,7 +335,7 @@ class Peta.Item extends Backbone.Model
     new Pettanr.View.FacedLabel(this, options)\r
   \r
   mini_faced_label: (options) ->\r
-    new Pettanr.View.FacedLabel(this, options)\r
+    new Pettanr.View.MiniFacedLabel(this, options)\r
   \r
   @index_url: () ->\r
     Pettanr.url(@table_name(), 'index', {id: null})\r
index 012daf0..b6c16f1 100644 (file)
@@ -13,12 +13,15 @@ class Pettanr.ImageFile extends Pettanr.File
   height: () ->
     null
   
-  size: () ->
+  real_size: () ->
     [@width(), @height()]
   
   has_size: () ->
     @width() and @height()
   
+  tag_options: () ->
+    {}
+  
   thumbnail_size: () ->
     if @has_size()
       Pettanr.View.Image.to_thumbnail_size(@width(), @height())
@@ -34,8 +37,7 @@ class Pettanr.ImageFile extends Pettanr.File
 class Pettanr.PictureFile extends Pettanr.ImageFile
   
   constructor: (@item, subdir = null) ->
-    @filename = @item.r_url()
-    @filename += ('?subdir=' + subdir) if !_.isEmpty(subdir)
+    @filename = @item.r_url(subdir)
   
   width: () ->
     Math.abs(@item.get('width'))
@@ -43,3 +45,6 @@ class Pettanr.PictureFile extends Pettanr.ImageFile
   height: () ->
     Math.abs(@item.get('height'))
   
+  tag_options: () ->
+    {}
+  
index 8eafedc..26ec937 100644 (file)
@@ -15,20 +15,20 @@ class Pettanr.View extends Backbone.View
     new Tag.Div(options)\r
   \r
   @face_button: (item, image, options = {}) ->\r
-    icon = new Pettanr.View.Icon(image, image.tag_option)\r
+    icon = new Pettanr.View.Icon(image)\r
     new Pettanr.View.Button(item.show_url(), icon.render().el, options)\r
   \r
   @mini_face_button: (item, image, options = {}) ->\r
-    icon = new Pettanr.View.Minicon(image, image.tag_option)\r
+    icon = new Pettanr.View.Minicon(image)\r
     new Pettanr.View.Button(item.show_url(), icon.render().el, options)\r
   \r
   @prof_button: (url, options = {}) ->\r
     file = Pettanr.View.Image.icon_prof_file()\r
-    icon = new Pettanr.View.Icon(file, {})\r
+    icon = new Pettanr.View.Icon(file)\r
     new Pettanr.View.Button(url, icon.render().el, options)\r
   \r
   @mini_prof_button: (url, options = {}) ->\r
     file = Pettanr.View.Image.icon_prof_file()\r
-    icon = new Pettanr.View.Minicon(file, {})\r
+    icon = new Pettanr.View.Minicon(file)\r
     new Pettanr.View.Button(url, icon.render().el, options)\r
   \r
index 8ec6053..b8f8b86 100644 (file)
@@ -1,13 +1,16 @@
 class Pettanr.View.Button extends Tag.A\r
   \r
-  initialize: (@url, @content, options) ->\r
+  constructor: (@url, @content, options) ->\r
+    super(options)\r
+  \r
+  initialize: (options) ->\r
     @context = options.context || this\r
     @class_name = options.class_name\r
     @click_func = options.click\r
-    el = if _.isFunction(content)\r
+    el = if _.isFunction(@content)\r
       content.call(@context)\r
     else\r
-      content\r
+      @content\r
     @url = '/' + @url if @url[0] != '/'\r
     super({\r
       attr: {href: @url}, \r
index 5232a06..cd3b0f1 100644 (file)
@@ -1,9 +1,12 @@
 class Pettanr.View.Button.ItemAction extends Pettanr.View.Button\r
   \r
-  initialize: (item, action_name, dic_name, options) ->\r
+  constructor: (@item, action_name, dic_name, options) ->\r
     if !options\r
       options = dic_name\r
-      dic_name = I18n.t('link.' + action_name)\r
-    url = item[action_name + '_url']()\r
-    super(url, dic_name, options)\r
+      dic_name = options.dic_name || 'link.' + action_name\r
+    url = options.url || @item[action_name + '_url']()\r
+    super(url, I18n.t(dic_name), options)\r
+  \r
+  initialize: (options) ->\r
+    super(options)\r
   \r
index b957796..3881b4d 100644 (file)
@@ -1,6 +1,9 @@
 class Pettanr.View.ShortableCaption extends Pettanr.View.Button\r
   \r
-  initialize: (item, column_name, options) ->\r
-    content = item.short(column_name, options.length)\r
-    super(item.show_url(), content, options)\r
+  constructor: (@item, @column_name, options) ->\r
+    super(options)\r
+  \r
+  initialize: (options) ->\r
+    content = @item.short(@column_name, options.length)\r
+    super(@item.show_url(), content, options)\r
   \r
diff --git a/app/assets/javascripts/view/credit.js.coffee b/app/assets/javascripts/view/credit.js.coffee
new file mode 100644 (file)
index 0000000..8558a79
--- /dev/null
@@ -0,0 +1,66 @@
+class Pettanr.View.Credit extends Pettanr.View\r
+  tagName: 'div'\r
+  className: 'credit'\r
+  \r
+  constructor: (@item, options) ->\r
+    super(options)\r
+  \r
+  initialize: (options = {icon: true}) ->\r
+    @icon_options = options.icon\r
+    @data_options = options.data\r
+  \r
+  render: () ->\r
+    this.$el.html('')\r
+    if @icon_options\r
+      icon = new Pettanr.View.Credit.Icon(@item)\r
+      @listenTo(icon, 'click:icon', @click_icon)\r
+      this.$el.append(icon.render().el)\r
+    data = new Pettanr.View.Credit.Data(@item, @data_options)\r
+    this.$el.append(data.render().el)\r
+    this\r
+  \r
+  click_icon: () ->\r
+    @trigger('click:icon', @item)\r
+  \r
+class Pettanr.View.Credit.Data extends Pettanr.View\r
+  tagName: 'div'\r
+  className: 'credit-data'\r
+  \r
+  constructor: (@item, options) ->\r
+    super(options)\r
+  \r
+  initialize: (options) ->\r
+    @credit_api_url = @item.url + '/credit'\r
+  \r
+  render: () ->\r
+    this.$el.html('')\r
+    if @item.credit_data\r
+      @append_credit_data()\r
+    else\r
+      f = (data, status) =>\r
+        @item.credit_data = data\r
+        @append_credit_data()\r
+      $.get(@credit_api_url, null, f, 'html')\r
+    this\r
+  \r
+  append_credit_data: () ->\r
+    this.$el.append(@item.credit_data)\r
+    @rb()\r
+  \r
+class Pettanr.View.Credit.Icon extends Pettanr.View\r
+  tagName: 'span'\r
+  className: 'credit-icon'\r
+  \r
+  constructor: (@item, options) ->\r
+    super(options)\r
+  \r
+  render: () ->\r
+    this.$el.html('')\r
+    symbol_button = @item.symbol_button({\r
+      context: this,\r
+      click: () =>\r
+        @trigger('click')\r
+    })\r
+    this.$el.append(symbol_button.render().el)\r
+    this\r
+  \r
diff --git a/app/assets/javascripts/view/credits.js.coffee b/app/assets/javascripts/view/credits.js.coffee
new file mode 100644 (file)
index 0000000..e233a01
--- /dev/null
@@ -0,0 +1,29 @@
+class Pettanr.View.Credits extends Pettanr.View\r
+  tagName: 'div'\r
+  className: 'credits'\r
+  \r
+  constructor: (@parent, options) ->\r
+    super(options)\r
+  \r
+  initialize: (@options) ->\r
+    @licensed_pictures = {}\r
+  \r
+  render: () ->\r
+    this.$el.html('')\r
+    this\r
+  \r
+  push: (retrievers) ->\r
+    _.each retrievers, (retriever, pid) =>\r
+      Pettanr.Picture.retrieve(pid, this, {\r
+        success: (picture) =>\r
+          pid = picture.get('id')\r
+          return if @licensed_pictures[pid]\r
+          @licensed_pictures[pid] = picture\r
+          credit = new Pettanr.View.Credit(picture, @options)\r
+          @listenTo(credit, 'click:icon', @click_credit_icon)\r
+          this.$el.append(credit.render().el)\r
+      })\r
+  \r
+  click_credit_icon: (item) ->\r
+    @trigger('click:credit:icon', item)\r
+  \r
index 71fcba2..4315f72 100644 (file)
@@ -1,9 +1,11 @@
 class Pettanr.View.FacedLabel extends Pettanr.View\r
   tagName: 'span'\r
   \r
-  initialize: (@item, options) ->\r
-    @face_button_method_name ||= 'face_button'\r
-    @face_button = @item[@face_button_method_name](options)\r
+  constructor: (@item, options) ->\r
+    super(options)\r
+  \r
+  initialize: (options) ->\r
+    @face_button = @item[@face_button_method_name()](options)\r
     @label_button = @item.label_button(options)\r
   \r
   render: () ->\r
@@ -12,9 +14,11 @@ class Pettanr.View.FacedLabel extends Pettanr.View
     this.$el.append(@label_button.render().el)\r
     this\r
   \r
-class Pettanr.View.FacedLabel extends Pettanr.View.FacedLabel\r
+  face_button_method_name: () ->\r
+    'face_button'\r
+  \r
+class Pettanr.View.MiniFacedLabel extends Pettanr.View.FacedLabel\r
   \r
-  initialize: (@item, options) ->\r
-    @face_button_method_name = 'mini_face_button'\r
-    super(@item, options)\r
+  face_button_method_name: () ->\r
+    'mini_face_button'\r
   \r
index ff5334c..9c863df 100644 (file)
@@ -1,7 +1,11 @@
 # image: picture item or image file\r
 class Pettanr.View.Icon extends Tag.Img\r
   \r
-  initialize: (@image, options = {}) ->\r
+  constructor: (@image, options) ->\r
+    super(options)\r
+  \r
+  initialize: (options) ->\r
+    options ||= @image.tag_options()\r
     attr = {}\r
     attr['src'] = @image.src()\r
     size = @get_size()\r
@@ -28,9 +32,11 @@ class Pettanr.View.Icon extends Tag.Img
   \r
 class Pettanr.View.Minicon extends Pettanr.View.Icon\r
   \r
-  initialize: (@image, options = {}) ->\r
-    super(@image, options)\r
-  \r
   get_size: () ->\r
     @image.minicon_size()\r
   \r
+class Pettanr.View.RealIcon extends Pettanr.View.Icon\r
+  \r
+  get_size: () ->\r
+    @image.real_size()\r
+  \r
index caf9248..af08756 100644 (file)
@@ -1 +1,68 @@
 class Pettanr.View.Show extends Pettanr.View\r
+  tagName: 'div'\r
+  className: 'show'\r
+  \r
+  constructor: (@item, options) ->\r
+    super(options)\r
+  \r
+  default_header_options: () ->\r
+    {\r
+      face: {\r
+        click: () =>\r
+          @trigger('http_get', @item.show_url())\r
+      },\r
+      label: {\r
+        click: () =>\r
+          @trigger('http_get', @item.show_url())\r
+      },\r
+      prof: {\r
+        click: () =>\r
+          @trigger('http_get', @item.prof_url())\r
+      },\r
+    }\r
+  \r
+  binder_header_options: () ->\r
+    {\r
+      face: {\r
+        click: () =>\r
+          @trigger('http_get', @item.show_url())\r
+      },\r
+      label: {\r
+        url: @item.play_url(),\r
+        click: () =>\r
+          @trigger('http_get', @item.play_url())\r
+      },\r
+      prof: {\r
+        click: () =>\r
+          @trigger('http_get', @item.prof_url())\r
+      },\r
+    }\r
+  \r
+  default_footer_options: () ->\r
+    {\r
+      actions: {\r
+        edit: {\r
+          click: () =>\r
+            @trigger('http_get', @item.edit_url())\r
+        }, \r
+        destroy: {\r
+          click: () =>\r
+            redirect = (url) =>\r
+              @trigger('http_get', url)\r
+            Pettanr.Proxy.destroy(@item, {redirect: redirect})\r
+        }, \r
+      }, \r
+    }\r
+  \r
+  add_credits: (options = {icon: true}) ->\r
+    @credits = new Pettanr.View.Credits(this, options)\r
+    @listenTo(@credits, 'click:credit:icon', @click_credit_icon)\r
+    this.$el.append(@credits.render().el)\r
+    @credits.push(@panel.licensed_pictures())\r
+  \r
+  click_authored_by: (author) ->\r
+    @trigger('http_get', author.show_url())\r
+  \r
+  click_credit_icon: (item) ->\r
+    @trigger('http_get', item.show_url())\r
+  \r
index d55258e..08b6b86 100644 (file)
@@ -1,16 +1,17 @@
 class Pettanr.View.Show.Footer extends Pettanr.View\r
   tagName: 'div'\r
   \r
-  initialize: (options) ->\r
+  constructor: (@item, @context, options) ->\r
     super(options)\r
-    @item = options.item\r
+  \r
+  initialize: (options = {}) ->\r
     @header = options.header || new Tag.H3({\r
       class_name: 'owner-header',\r
       content: I18n.t('editor')\r
     })\r
-    @footer = options.footer || new Pettanr.View.Show.Footer.Footer(@item)\r
-    @listenTo(@footer, 'click:edit', @click_edit)\r
-    @listenTo(@footer, 'click:destroy', @click_destroy)\r
+    @footer = options.footer || new Pettanr.View.Show.Footer.Footer(\r
+      @item, @context, options.actions\r
+    )\r
   \r
   render: () ->\r
     this.$el.html('')\r
@@ -18,11 +19,3 @@ class Pettanr.View.Show.Footer extends Pettanr.View
     this.$el.append(@footer.render().el)\r
     this\r
   \r
-  click_edit: () ->\r
-    @trigger('click:footer:edit')\r
-    @trigger('click:edit')\r
-  \r
-  click_destroy: () ->\r
-    @trigger('click:footer:destroy')\r
-    @trigger('click:destroy')\r
-  \r
index da66c31..d97f773 100644 (file)
@@ -1,27 +1,37 @@
+#\r
+#   new Footer.Footer(item, this, {\r
+#     edit: {\r
+#       click: () =>\r
+#         ...\r
+#     }\r
+#   })\r
+#\r
+#\r
+#   new Footer.Footer(null, this, {\r
+#     edit: {\r
+#       item: item1,\r
+#       dic_name: 'translation.key',\r
+#       click: () =>\r
+#         ...\r
+#     }\r
+#   })\r
 class Pettanr.View.Show.Footer.Footer extends Pettanr.View\r
   tagName: 'div'\r
   className: 'show-owner-footer'\r
   \r
-  initialize: (item, options) ->\r
+  constructor: (@item, @context, options) ->\r
     super(options)\r
-    @edit = new Pettanr.View.Button.ItemAction(\r
-      item, 'edit', {\r
-        context: this,\r
-        click: () =>\r
-          @trigger('click:edit')\r
-      }\r
-    )\r
-    @destroy = new Pettanr.View.Button.ItemAction(\r
-      item, 'destroy', {\r
-        context: this,\r
-        click: () =>\r
-          @trigger('click:destroy')\r
-      }\r
-    )\r
+  \r
+  initialize: (options) ->\r
+    @buttons = []\r
+    _.each options, (setting, action) =>\r
+      setting.context ||= @context\r
+      i = @item || setting.item\r
+      @buttons.push(new Pettanr.View.Button.ItemAction(i, action, setting))\r
   \r
   render: () ->\r
     this.$el.html('')\r
-    this.$el.append(@edit.render().el)\r
-    this.$el.append(@destroy.render().el)\r
+    _.each @buttons, (button) =>\r
+      this.$el.append(button.render().el)\r
     this\r
   \r
index 014bd65..794e429 100644 (file)
@@ -2,31 +2,33 @@ class Pettanr.View.Show.Header extends Pettanr.View
   tagName: 'h1'\r
   className: 'show-header'\r
   \r
-  initialize: (@item, options) ->\r
+  constructor: (@item, @context, options) ->\r
+    super(options)\r
+  \r
+  initialize: (options) ->\r
     @face_options = options.face\r
     @label_options = options.label\r
     @prof_options = options.prof\r
     \r
+    @face_options.context ||= @context\r
+    @face_options.class_name ||= 'face'\r
+    @face_options.click ||= () =>\r
+      @trigger('click:face')\r
+    \r
+    @label_options.context ||= @context\r
+    @label_options.class_name ||= 'label'\r
+    @label_options.click ||= () =>\r
+      @trigger('click:label')\r
+    \r
+    @prof_options.context ||= @context\r
+    @prof_options.class_name ||= 'prof'\r
+    @prof_options.click ||= () =>\r
+      @trigger('click:prof')\r
+    \r
     @pick = null\r
-    @face_button = @item.mini_face_button({\r
-      context: this,\r
-      class_name: 'icon',\r
-      click: () =>\r
-        @trigger('click:icon')\r
-    })\r
-    @label_button = @item.label_button({\r
-      url: @label_options.url,\r
-      context: this,\r
-      class_name: 'caption',\r
-      click: () =>\r
-        @trigger('click:caption')\r
-    })\r
-    @prof_button = @item.mini_prof_button({\r
-      context: this,\r
-      class_name: 'prof',\r
-      click: () =>\r
-        @trigger('click:prof')\r
-    })\r
+    @face_button = @item.mini_face_button(@face_options)\r
+    @label_button = @item.label_button(@label_options)\r
+    @prof_button = @item.mini_prof_button(@prof_options)\r
   \r
   render: () ->\r
     this.$el.html('')\r
index 61fbb0a..376c5f2 100644 (file)
@@ -1,22 +1,23 @@
 class Pettanr.View.Show.AuthoredBy extends Pettanr.View\r
   tagName: 'div'\r
   \r
-  initialize: (options) ->\r
-    @item = options.item\r
-    @item.get_parent(@item.my_class().owner_type(), this, {\r
-      success: (author) =>  # author or artist\r
-        @linked_author =  new Pettanr.View.ShortableCaption(author, 'name', {\r
-          click: () ->\r
-            @trigger('click:author')\r
-        })\r
-        @listenTo(@linked_author, 'click', @click)\r
-        @render()\r
-    })\r
+  constructor: (@content, options) ->\r
+    super(options)\r
+  \r
+  initialize: (@options = {}) ->\r
   \r
   render: () ->\r
     this.$el.html('')\r
-    this.$el.append(Pettanr.AppHelper.t_a(@item.item_name(), 'author_id'))\r
-    this.$el.append(@linked_author.render().el)\r
+    author_item_name = @content.my_class().owner_type()\r
+    @content.get_parent(author_item_name, this, {\r
+      success: (author) =>  # author or artist\r
+        label_button = author.label_button({\r
+          context: this,\r
+          click: () =>\r
+            @trigger('click', author)\r
+        })\r
+        this.$el.append(Pettanr.AppHelper.t_a(@content.item_name(), @content.my_class().owner_column()))\r
+        this.$el.append(label_button.render().el)\r
+    })\r
     this\r
   \r
-  \r
diff --git a/app/assets/javascripts/view/summary.js.coffee b/app/assets/javascripts/view/summary.js.coffee
new file mode 100644 (file)
index 0000000..a4e3aeb
--- /dev/null
@@ -0,0 +1,18 @@
+class Pettanr.View.Summary extends Pettanr.View\r
+  \r
+  constructor: (options) ->\r
+    super(options)\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
diff --git a/app/assets/javascripts/view/summary/binder.js.coffee b/app/assets/javascripts/view/summary/binder.js.coffee
new file mode 100644 (file)
index 0000000..5bf5e8d
--- /dev/null
@@ -0,0 +1,29 @@
+class Pettanr.View.Summary.Binder extends Pettanr.View\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
+    @item.get_parent('author', this, {\r
+      success: (@author) =>\r
+        @author_icon_with_caption = @author.icon_with_caption_view(true, 'name', 12)\r
+        @listenTo(@author_icon_with_caption, 'click', @author_click)\r
+        @trigger('ready')\r
+    })\r
+  \r
+  render: () ->\r
+    this.$el.html('')\r
+    this.$el.append(@visible.render().el)\r
+    this.$el.append(@author_icon_with_caption.render().el)\r
+    this\r
+  \r
+  author_click: () ->\r
+    @trigger('http_get', @author_icon_with_caption.url())\r
+  \r
diff --git a/app/assets/javascripts/view/summary/leaf.js.coffee b/app/assets/javascripts/view/summary/leaf.js.coffee
new file mode 100644 (file)
index 0000000..35dfb0a
--- /dev/null
@@ -0,0 +1,67 @@
+class Pettanr.View.Summary.Leaf extends Pettanr.View\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
+    @binder_view = new Tag.Span({})\r
+    @destination_view = new Tag.Span({})\r
+    @load()\r
+  \r
+  load: () ->\r
+    @listenTo(this, 'load_binder', @load_destination)\r
+    @listenTo(this, 'load_destination', @ready)\r
+    @load_binder()\r
+  \r
+  ready: () ->\r
+    @trigger('ready')\r
+  \r
+  load_binder: () ->\r
+    @item.get_parent(@binder_item_name, this, {\r
+      success: (@binder) =>\r
+        @binder_icon = @binder.icon_view(true)\r
+        @listenTo(@binder_icon, 'click', @binder_click)\r
+        @binder.get_parent('author', this, {\r
+          success: (@binder_author) =>\r
+            @binder_author_icon_with_caption = @binder_author.icon_with_caption_view(true, 'name', 12)\r
+            @listenTo(@binder_author_icon_with_caption, 'click', @binder_author_click)\r
+            @binder_view.$el.append(@binder_icon.render().el)\r
+            @binder_view.$el.append(@binder_author_icon_with_caption.render().el)\r
+            @trigger('load_binder')\r
+        })\r
+    })\r
+  \r
+  load_destination: () ->\r
+    @item.get_parent(@destination_item_name, this, {\r
+      success: (@destination) =>\r
+        @destination_icon = @destination.icon_view(true)\r
+        @listenTo(@destination_icon, 'click', @destination_click)\r
+        @destination.get_parent('author', this, {\r
+          success: (@destination_author) =>\r
+            @destination_author_icon_with_caption = @destination_author.icon_with_caption_view(true, 'name', 12)\r
+            @listenTo(@destination_author_icon_with_caption, 'click', @destination_author_click)\r
+            @destination_view.$el.append(@destination_icon.render().el)\r
+            @destination_view.$el.append(@destination_author_icon_with_caption.render().el)\r
+            @trigger('load_destination')\r
+        })\r
+    })\r
+  \r
+  render: () ->\r
+    this.$el.html('')\r
+    this.$el.append(@binder_view.render().el)\r
+    this.$el.append(@destination_view.render().el)\r
+    this\r
+  \r
+  binder_click: () ->\r
+    @trigger('http_get', @binder_icon.url())\r
+  \r
+  destination_click: () ->\r
+    @trigger('http_get', @destination_icon.url())\r
+  \r
+  binder_author_click: () ->\r
+    @trigger('http_get', @binder_author_icon_with_caption.url())\r
+  \r
+  destination_author_click: () ->\r
+    @trigger('http_get', @destination_author_icon_with_caption.url())\r
+  \r
index 00561e1..0761d9f 100644 (file)
@@ -45,18 +45,10 @@ class Pettanr.Views.Artist.ShowModule.Body extends Pettanr.View
   http_get: (url) ->\r
     @trigger('http_get', url)\r
   \r
-class Pettanr.Views.Artist.Show extends Pettanr.View\r
-  tagName: 'div'\r
+class Pettanr.Views.Artist.Show extends Pettanr.View.Show\r
   \r
   initialize: (options) ->\r
-    @item = options.item\r
-    @header = new Pettanr.Views.Artist.ShowModule.Header({\r
-      item: @item, \r
-      caption: @item.get('name'), \r
-      icon_url: @item.show_url(),\r
-      caption_url: @item.show_url(),\r
-      prof_url: @item.prof_url()\r
-    })\r
+    @header = new Pettanr.View.Show.Header(@item, this, @default_header_options())\r
     @body = new Pettanr.Views.Artist.ShowModule.Body({\r
       item: @item, \r
     })\r
index 371fb42..bd13f4e 100644 (file)
@@ -1,4 +1,4 @@
-class Pettanr.Views.Artist.Summary extends Pettanr.Views.Common.Summary\r
+class Pettanr.Views.Artist.Summary extends Pettanr.View.Summary\r
   \r
   initialize: (options) ->\r
     super(options)\r
index 8dbe721..8887224 100644 (file)
@@ -1,9 +1,4 @@
-class Pettanr.Views.Author.ShowModule\r
-class Pettanr.Views.Author.ShowModule.Header extends Pettanr.Views.Show.Header\r
-  \r
-  initialize: (options) ->\r
-    super(options)\r
-  \r
+class Pettanr.Views.Author.ShowModule extends Pettanr.View.Show\r
 class Pettanr.Views.Author.ShowModule.Scrolls extends Pettanr.View\r
   \r
   initialize: (options) ->\r
@@ -65,7 +60,7 @@ class Pettanr.Views.Author.ShowModule.Panels extends Pettanr.View
     super(options)\r
     @item = options.item\r
     @panels_body = new Pettanr.Views.Author.ShowModule.PanelsBody({item: @item})\r
-    @credits = new Pettanr.Views.Common.Credits({parent: this})\r
+    @credits = new Pettanr.View.Credits({parent: this})\r
   \r
   render: () ->\r
     @listenTo(@panels_body, 'ready', @ready)\r
@@ -103,18 +98,10 @@ class Pettanr.Views.Author.ShowModule.Body extends Pettanr.View
   http_get: (url) ->\r
     @trigger('http_get', url)\r
   \r
-class Pettanr.Views.Author.Show extends Pettanr.View\r
-  tagName: 'div'\r
+class Pettanr.Views.Author.Show extends Pettanr.View.Show\r
   \r
   initialize: (options) ->\r
-    @item = options.item\r
-    @header = new Pettanr.Views.Author.ShowModule.Header({\r
-      item: @item, \r
-      caption: @item.get('name'), \r
-      icon_url: @item.show_url(),\r
-      caption_url: @item.show_url(),\r
-      prof_url: @item.prof_url()\r
-    })\r
+    @header = new Pettanr.View.Show.Header(@item, this, @default_header_options())\r
     @body = new Pettanr.Views.Author.ShowModule.Body({\r
       item: @item, \r
     })\r
index ed9a3ef..c8a97ec 100644 (file)
@@ -1,4 +1,4 @@
-class Pettanr.Views.Author.Summary extends Pettanr.Views.Common.Summary\r
+class Pettanr.Views.Author.Summary extends Pettanr.View.Summary\r
   \r
   initialize: (options) ->\r
     super(options)\r
index ddaed7e..65e39a7 100644 (file)
@@ -1,26 +1,10 @@
-class Pettanr.Views.Balloon.ShowModule\r
-class Pettanr.Views.Balloon.ShowModule.Header extends Pettanr.Views.Show.Header\r
+class Pettanr.Views.Balloon.Show extends Pettanr.View.Show\r
   \r
   initialize: (options) ->\r
-    super(options)\r
+    @header = new Pettanr.View.Show.Header(@item, this, @default_header_options())\r
   \r
-class Pettanr.Views.Balloon.Show extends Pettanr.View\r
-  tagName: 'div'\r
-  className: 'show'\r
-  \r
-  initialize: (options) ->\r
-    @item = options.item\r
-    icon_url = Pettanr.url(@item.table_name(), 'show', {id: @item.get('id')})\r
-    caption_url = icon_url\r
-    prof_url = Pettanr.url(@item.table_name(), 'show', {id: @item.get('id'), format: 'prof'})\r
-    @header = new Pettanr.Views.Balloon.ShowModule.Header({\r
-      item: @item, \r
-      caption: '', \r
-      icon_url: icon_url,\r
-      caption_url: caption_url,\r
-      prof_url: prof_url\r
-    })\r
-    @listenTo(this, 'ready', @ready)\r
+  render: () ->\r
+    this.$el.html('')\r
     @item.get_parent('speech_balloon', this, {\r
       success: (@speech_balloon) =>\r
         @speech_balloon.get_parent('panel', this, {\r
@@ -28,50 +12,21 @@ class Pettanr.Views.Balloon.Show extends Pettanr.View
             @panel = item.with_elements()\r
             @panel.fetch().done =>\r
               @panel.attributes = @panel.replaced_attributes()\r
-              @author = new Pettanr.Views.Show.HeaderAuthor({item: @panel})\r
+              @authored_by = @panel.authored_by()\r
               @body = new Pettanr.Views.Panel.Body({\r
                 panel: @panel,\r
                 spot: @item\r
               })\r
-              @credits = new Pettanr.Views.Common.Credits({\r
-                parent: this\r
-              })\r
               @listenTo(@header, 'click:pick', @click_pick)\r
-              @listenTo(@header, 'click:icon', @click_show)\r
-              @listenTo(@header, 'click:caption', @click_show)\r
-              @listenTo(@header, 'click:prof', @click_prof)\r
-              @listenTo(@author, 'click:author', @click_author)\r
-              @listenTo(@credits, 'click:credit:icon', @click_credit_icon)\r
-              @trigger('ready')\r
+              @listenTo(@authored_by, 'click', @click_authored_by)\r
+              this.$el.append(@header.render().el)\r
+              this.$el.append(@authored_by.render().el)\r
+              this.$el.append(@body.render().el)\r
+              @add_credits()\r
         })\r
     })\r
-  \r
-  render: () ->\r
-    this.$el.html('')\r
     this\r
   \r
-  ready: () ->\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
-    @credits.clear()\r
-    @credits.push(@panel.licensed_pictures())\r
-    @rb()\r
-  \r
-  click_show: () ->\r
-    @trigger('http_get', @item.show_url())\r
-  \r
-  click_author: () ->\r
-    @trigger('http_get', @panel.author().show_url())\r
-  \r
-  click_prof: () ->\r
-    @trigger('http_get', @item.prof_url())\r
-  \r
-  click_credit_icon: (item) ->\r
-    @trigger('http_get', item.show_url())\r
-  \r
   click_pick: () ->\r
     @trigger('pick', @item)\r
   \r
index 099b047..bc5aa9b 100644 (file)
@@ -1,4 +1,4 @@
-class Pettanr.Views.Balloon.Summary extends Pettanr.Views.Common.Summary\r
+class Pettanr.Views.Balloon.Summary extends Pettanr.View.Summary\r
   \r
   initialize: (options) ->\r
     super(options)\r
index 9596603..e4331f0 100644 (file)
@@ -1,4 +1,4 @@
-class Pettanr.Views.ComicStory.Summary extends Pettanr.Views.Common.Leaf.Summary\r
+class Pettanr.Views.ComicStory.Summary extends Pettanr.View.Summary.Leaf\r
   \r
   initialize: (options) ->\r
     options['binder_item_name'] = 'comic'\r
index 701a045..43e90e0 100644 (file)
@@ -1,64 +1,19 @@
-class Pettanr.Views.Comic.ShowModule\r
-class Pettanr.Views.Comic.ShowModule.Header extends Pettanr.Views.Show.Header\r
+class Pettanr.Views.Comic.Show extends Pettanr.View.Show\r
   \r
   initialize: (options) ->\r
-    super(options)\r
-  \r
-class Pettanr.Views.Comic.ShowModule.Owner extends Pettanr.Views.Show.Owner\r
-  \r
-  initialize: (options) ->\r
-    super(options)\r
-  \r
-class Pettanr.Views.Comic.Show extends Pettanr.View\r
-  tagName: 'div'\r
-  className: 'show'\r
-  \r
-  initialize: (options) ->\r
-    @item = options.item\r
-    icon_url = Pettanr.url(@item.table_name(), 'show', {id: @item.get('id')})\r
-    caption_url = Pettanr.url(@item.table_name(), 'play', {id: @item.get('id')})\r
-    prof_url = Pettanr.url(@item.table_name(), 'show', {id: @item.get('id'), format: 'prof'})\r
-    @header = new Pettanr.Views.Scroll.ShowModule.Header({\r
-      item: @item, \r
-      caption: @item.get('title'), \r
-      icon_url: icon_url,\r
-      caption_url: caption_url,\r
-      prof_url: prof_url\r
-    })\r
-    @author = new Pettanr.Views.Show.HeaderAuthor({item: @item})\r
-    @owner = new Pettanr.Views.Comic.ShowModule.Owner({item: @item})\r
+    @header = new Pettanr.View.Show.Header(@item, this, @binder_header_options())\r
+    @authored_by = @item.authored_by()\r
+    @owner = new Pettanr.View.Show.Footer(@item, this, @default_footer_options())\r
     @listenTo(@header, 'click:pick', @click_pick)\r
-    @listenTo(@header, 'click:icon', @click_show)\r
-    @listenTo(@header, 'click:caption', @click_show)\r
-    @listenTo(@header, 'click:prof', @click_prof)\r
-    @listenTo(@author, 'click:author', @click_author)\r
-    @listenTo(@owner, 'click:edit', @click_edit)\r
-    @listenTo(@owner, 'click:destroy', @click_destroy)\r
+    @listenTo(@authored_by, 'click', @click_authored_by)\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(@authored_by.render().el)\r
     this.$el.append(@owner.render().el) if @item.is_own()\r
     this\r
   \r
-  click_show: () ->\r
-    @trigger('http_get', @item.show_url())\r
-  \r
-  click_author: () ->\r
-    @trigger('http_get', @panel.author().show_url())\r
-  \r
-  click_prof: () ->\r
-    @trigger('http_get', @item.prof_url())\r
-  \r
-  click_edit: () ->\r
-    @trigger('http_get', @item.edit_url())\r
-  \r
-  click_destroy: () ->\r
-    redirect = (url) =>\r
-      @trigger('http_get', url)\r
-    Pettanr.Proxy.destroy(@item, {redirect: redirect})\r
-  \r
   click_pick: () ->\r
     @trigger('pick', @item)\r
   \r
index a3c89fa..3ed1893 100644 (file)
@@ -1,4 +1,4 @@
-class Pettanr.Views.Comic.Summary extends Pettanr.Views.Common.Binder.Summary\r
+class Pettanr.Views.Comic.Summary extends Pettanr.View.Summary.Binder\r
   \r
   initialize: (options) ->\r
     options['visible_t'] = 'comic_visible_items'\r
index f12739f..0c0c705 100644 (file)
@@ -1,4 +1,4 @@
-class Pettanr.Views.Folder.Summary extends Pettanr.Views.Common.Summary\r
+class Pettanr.Views.Folder.Summary extends Pettanr.View.Summary\r
   \r
   initialize: (options) ->\r
     super(options)\r
index 85f83d7..79b28b6 100644 (file)
@@ -1,74 +1,29 @@
-class Pettanr.Views.GroundColor.ShowModule\r
-class Pettanr.Views.GroundColor.ShowModule.Header extends Pettanr.Views.Show.Header\r
+class Pettanr.Views.GroundColor.Show extends Pettanr.View.Show\r
   \r
   initialize: (options) ->\r
-    super(options)\r
+    @header = new Pettanr.View.Show.Header(@item, this, @default_header_options())\r
   \r
-class Pettanr.Views.GroundColor.Show extends Pettanr.View\r
-  tagName: 'div'\r
-  className: 'show'\r
-  \r
-  initialize: (options) ->\r
-    @item = options.item\r
-    icon_url = Pettanr.url(@item.table_name(), 'show', {id: @item.get('id')})\r
-    caption_url = icon_url\r
-    prof_url = Pettanr.url(@item.table_name(), 'show', {id: @item.get('id'), format: 'prof'})\r
-    @header = new Pettanr.Views.GroundColor.ShowModule.Header({\r
-      item: @item, \r
-      caption: @item.get('caption'), \r
-      icon_url: icon_url,\r
-      caption_url: caption_url,\r
-      prof_url: prof_url\r
-    })\r
-    @listenTo(this, 'ready', @ready)\r
+  render: () ->\r
+    this.$el.html('')\r
     @item.get_parent('panel', this, {\r
       success: (item) =>\r
         @panel = item.with_elements()\r
         @panel.fetch().done =>\r
           @panel.attributes = @panel.replaced_attributes()\r
-          @author = new Pettanr.Views.Show.HeaderAuthor({item: @panel})\r
+          @authored_by = @panel.authored_by()\r
           @body = new Pettanr.Views.Panel.Body({\r
             panel: @panel,\r
             spot: @item\r
           })\r
-          @credits = new Pettanr.Views.Common.Credits({\r
-            parent: this\r
-          })\r
           @listenTo(@header, 'click:pick', @click_pick)\r
-          @listenTo(@header, 'click:icon', @click_show)\r
-          @listenTo(@header, 'click:caption', @click_show)\r
-          @listenTo(@header, 'click:prof', @click_prof)\r
-          @listenTo(@author, 'click:author', @click_author)\r
-          @listenTo(@credits, 'click:credit:icon', @click_credit_icon)\r
-          @trigger('ready')\r
+          @listenTo(@authored_by, 'click', @click_authored_by)\r
+          this.$el.append(@header.render().el)\r
+          this.$el.append(@authored_by.render().el)\r
+          this.$el.append(@body.render().el)\r
+          @add_credits()\r
     })\r
-  \r
-  render: () ->\r
-    this.$el.html('')\r
     this\r
   \r
-  ready: () ->\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
-    @credits.clear()\r
-    @credits.push(@panel.licensed_pictures())\r
-    @rb()\r
-  \r
-  click_show: () ->\r
-    @trigger('http_get', @item.show_url())\r
-  \r
-  click_author: () ->\r
-    @trigger('http_get', @panel.author().show_url())\r
-  \r
-  click_prof: () ->\r
-    @trigger('http_get', @item.prof_url())\r
-  \r
-  click_credit_icon: (item) ->\r
-    @trigger('http_get', item.show_url())\r
-  \r
   click_pick: () ->\r
     @trigger('pick', @item)\r
   \r
index 2199cd8..14a1e98 100644 (file)
@@ -1,4 +1,4 @@
-class Pettanr.Views.GroundColor.Summary extends Pettanr.Views.Common.Summary\r
+class Pettanr.Views.GroundColor.Summary extends Pettanr.View.Summary\r
   \r
   initialize: (options) ->\r
     super(options)\r
index 5b9ceb0..326efb1 100644 (file)
@@ -38,7 +38,7 @@ class Pettanr.Views.GroundPicture.Element extends Pettanr.View
       top: '0px', \r
       left: '0px',\r
       'z-index': @element.get('z'), \r
-      'background-image': 'url(' + @picture.picture_file.src() + ')', \r
+      'background-image': 'url(' + @picture.picture_file().src() + ')', \r
       'background-repeat': @element.repeat_text(), \r
       'background-position': Pettanr.to_s(@element.get('x')) + 'px ' + Pettanr.to_s(@element.get('y')) + 'px'\r
     }\r
index feea000..7c91449 100644 (file)
@@ -1,74 +1,29 @@
-class Pettanr.Views.GroundPicture.ShowModule\r
-class Pettanr.Views.GroundPicture.ShowModule.Header extends Pettanr.Views.Show.Header\r
+class Pettanr.Views.GroundPicture.Show extends Pettanr.View.Show\r
   \r
   initialize: (options) ->\r
-    super(options)\r
+    @header = new Pettanr.View.Show.Header(@item, this, @default_header_options())\r
   \r
-class Pettanr.Views.GroundPicture.Show extends Pettanr.View\r
-  tagName: 'div'\r
-  className: 'show'\r
-  \r
-  initialize: (options) ->\r
-    @item = options.item\r
-    icon_url = Pettanr.url(@item.table_name(), 'show', {id: @item.get('id')})\r
-    caption_url = icon_url\r
-    prof_url = Pettanr.url(@item.table_name(), 'show', {id: @item.get('id'), format: 'prof'})\r
-    @header = new Pettanr.Views.GroundPicture.ShowModule.Header({\r
-      item: @item, \r
-      caption: @item.get('caption'), \r
-      icon_url: icon_url,\r
-      caption_url: caption_url,\r
-      prof_url: prof_url\r
-    })\r
-    @listenTo(this, 'ready', @ready)\r
+  render: () ->\r
+    this.$el.html('')\r
     @item.get_parent('panel', this, {\r
       success: (item) =>\r
         @panel = item.with_elements()\r
         @panel.fetch().done =>\r
           @panel.attributes = @panel.replaced_attributes()\r
-          @author = new Pettanr.Views.Show.HeaderAuthor({item: @panel})\r
+          @authored_by = @panel.authored_by()\r
           @body = new Pettanr.Views.Panel.Body({\r
             panel: @panel,\r
             spot: @item\r
           })\r
-          @credits = new Pettanr.Views.Common.Credits({\r
-            parent: this\r
-          })\r
           @listenTo(@header, 'click:pick', @click_pick)\r
-          @listenTo(@header, 'click:icon', @click_show)\r
-          @listenTo(@header, 'click:caption', @click_show)\r
-          @listenTo(@header, 'click:prof', @click_prof)\r
-          @listenTo(@author, 'click:author', @click_author)\r
-          @listenTo(@credits, 'click:credit:icon', @click_credit_icon)\r
-          @trigger('ready')\r
+          @listenTo(@authored_by, 'click', @click_authored_by)\r
+          this.$el.append(@header.render().el)\r
+          this.$el.append(@authored_by.render().el)\r
+          this.$el.append(@body.render().el)\r
+          @add_credits()\r
     })\r
-  \r
-  render: () ->\r
-    this.$el.html('')\r
     this\r
   \r
-  ready: () ->\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
-    @credits.clear()\r
-    @credits.push(@panel.licensed_pictures())\r
-    @rb()\r
-  \r
-  click_show: () ->\r
-    @trigger('http_get', @item.show_url())\r
-  \r
-  click_author: () ->\r
-    @trigger('http_get', @panel.author().show_url())\r
-  \r
-  click_prof: () ->\r
-    @trigger('http_get', @item.prof_url())\r
-  \r
-  click_credit_icon: (item) ->\r
-    @trigger('http_get', item.show_url())\r
-  \r
   click_pick: () ->\r
     @trigger('pick', @item)\r
   \r
index 1159ac5..0ce9dbb 100644 (file)
@@ -1,11 +1,11 @@
-class Pettanr.Views.GroundPicture.Summary extends Pettanr.Views.Common.Summary\r
+class Pettanr.Views.GroundPicture.Summary extends Pettanr.View.Summary\r
   \r
   initialize: (options) ->\r
     super(options)\r
     @item = options.item\r
     @item.get_parent('picture', this, {\r
       success: (@picture) =>\r
-        @credit = @picture.credit_view(false)\r
+        @credit = new Pettanr.View.Credit(@picture, {})\r
         @item.get_parent('panel', this, {\r
           success: (@panel) =>\r
             @panel_icon = new Pettanr.Views.Common.Icon({item: @panel, half: true})\r
index dd0283d..5b15ef3 100644 (file)
@@ -1,9 +1,10 @@
-class Pettanr.Views.LicenseGroup.Show extends Pettanr.View\r
-  tagName: 'div'\r
+class Pettanr.Views.LicenseGroup.Show extends Pettanr.View.Show\r
   \r
   initialize: (options) ->\r
+    @header = new Pettanr.View.Show.Header(@item, this, @binder_header_options())\r
   \r
   render: () ->\r
     this.$el.html('')\r
+    this.$el.append(@header.render().el)\r
     this\r
   \r
index 0ccbfda..0532b9a 100644 (file)
@@ -1,4 +1,4 @@
-class Pettanr.Views.LicenseGroup.Summary extends Pettanr.Views.Common.Summary\r
+class Pettanr.Views.LicenseGroup.Summary extends Pettanr.View.Summary\r
   \r
   initialize: (options) ->\r
     super(options)\r
index 292aeb4..47cfaff 100644 (file)
@@ -1,9 +1,10 @@
-class Pettanr.Views.License.Show extends Pettanr.View\r
-  tagName: 'div'\r
+class Pettanr.Views.License.Show extends Pettanr.View.Show\r
   \r
   initialize: (options) ->\r
+    @header = new Pettanr.View.Show.Header(@item, this, @binder_header_options())\r
   \r
   render: () ->\r
     this.$el.html('')\r
+    this.$el.append(@header.render().el)\r
     this\r
   \r
index 3c867ab..53140ca 100644 (file)
@@ -1,15 +1,11 @@
-class Pettanr.Views.License.Summary extends Pettanr.Views.Common.Summary\r
+class Pettanr.Views.License.Summary extends Pettanr.View.Summary\r
   \r
   initialize: (options) ->\r
     super(options)\r
     @item = options.item\r
     @item.get_parent('system_picture', this, {\r
       success: (@system_picture) =>\r
-        @img = new Tag.Img({\r
-          attr: {\r
-            src: @system_picture.src()\r
-          }\r
-        })\r
+        @img = new Pettanr.View.Icon(@system_picture.symbol_file())\r
         @trigger('ready')\r
     })\r
   \r
index 7b138fc..3d68e79 100644 (file)
@@ -1,9 +1,4 @@
 class Pettanr.Views.OriginalPicture.ShowModule\r
-class Pettanr.Views.OriginalPicture.ShowModule.Header extends Pettanr.Views.Show.Header\r
-  \r
-  initialize: (options) ->\r
-    super(options)\r
-  \r
 class Pettanr.Views.OriginalPicture.ShowModule.LinkedLicenseButton extends Tag.A\r
   \r
   initialize: (options) ->\r
@@ -35,9 +30,7 @@ class Pettanr.Views.OriginalPicture.ShowModule.OwnerFooter extends Pettanr.View
   tagName: 'div'\r
   className: 'show-owner-footer'\r
   \r
-  initialize: (options) ->\r
-    super(options)\r
-    @item = options.item\r
+  initialize: (@item, options) ->\r
     @license = new Pettanr.Views.OriginalPicture.ShowModule.LinkedLicenseButton({item: @item})\r
     @edit = new Pettanr.Views.OriginalPicture.ShowModule.LinkedReplaceButton({item: @item})\r
     @destroy = new Pettanr.Views.OriginalPicture.ShowModule.LinkedDropButton({item: @item})\r
@@ -101,46 +94,46 @@ class Pettanr.Views.OriginalPicture.ShowModule.History extends Pettanr.View
   http_get: (url) ->\r
     @trigger('http_get', url)\r
   \r
-class Pettanr.Views.OriginalPicture.Show extends Pettanr.View\r
-  tagName: 'div'\r
+class Pettanr.Views.OriginalPicture.Show extends Pettanr.View.Show\r
   \r
   initialize: (options) ->\r
-    @item = options.item\r
-    @header = new Pettanr.Views.OriginalPicture.ShowModule.Header({\r
-      item: @item, \r
-      icon_url: @item.show_url(),\r
-      prof_url: @item.prof_url()\r
-    })\r
-    @artist = new Pettanr.Views.Show.HeaderArtist({item: @item})\r
+    @header = new Pettanr.View.Show.Header(@item, this, @binder_header_options())\r
+    @authored_by = @item.authored_by()\r
     @img = new Pettanr.Views.OriginalPicture.Img({item: @item})\r
-    @owner = new Pettanr.Views.OriginalPicture.ShowModule.Owner({item: @item})\r
+    @owner = new Pettanr.View.Show.Footer(@item, this, {\r
+      actions: {\r
+        license: {\r
+          dic_name: 'original_pictures.show.select', \r
+          click: () =>\r
+            @create_dialog()\r
+            @trigger('click:license', @dialog)\r
+        }, \r
+        edit: {\r
+          dic_name: 'original_pictures.show.replace', \r
+          click: () =>\r
+            @trigger('http_get', @item.edit_url())\r
+        }, \r
+        destroy: {\r
+          click: () =>\r
+            redirect = (url) =>\r
+              @trigger('http_get', url)\r
+            Pettanr.Proxy.destroy(@item, {redirect: redirect})\r
+        }, \r
+      }, \r
+    })\r
     @history = new Pettanr.Views.OriginalPicture.ShowModule.History({item: @item})\r
-    @listenTo(@header, 'click:icon', @click_show)\r
-    @listenTo(@header, 'click:prof', @click_prof)\r
-    @listenTo(@artist, 'click:artist', @click_artist)\r
-    @listenTo(@owner, 'click:license', @click_license)\r
-    @listenTo(@owner, 'click:edit', @click_edit)\r
-    @listenTo(@owner, 'click:destroy', @click_destroy)\r
+    @listenTo(@authored_by, 'click', @click_authored_by)\r
     @listenTo(@history, 'http_get', @http_get)\r
   \r
   render: () ->\r
     this.$el.html('')\r
     this.$el.append(@header.render().el)\r
-    this.$el.append(@artist.render().el)\r
+    this.$el.append(@authored_by.render().el)\r
     this.$el.append(@img.render().el)\r
     this.$el.append(@owner.render().el)\r
     this.$el.append(@history.render().el)\r
     this\r
   \r
-  click_show: () ->\r
-    @trigger('http_get', @item.show_url())\r
-  \r
-  click_prof: () ->\r
-    @trigger('http_get', @item.prof_url())\r
-  \r
-  click_artist: () ->\r
-    @trigger('http_get', @item.artist().show_url())\r
-  \r
   click_license: () ->\r
     @create_dialog()\r
     @trigger('click:license', @dialog)\r
index de82aae..2979ef0 100644 (file)
@@ -1,4 +1,4 @@
-class Pettanr.Views.OriginalPicture.Summary extends Pettanr.Views.Common.Summary\r
+class Pettanr.Views.OriginalPicture.Summary extends Pettanr.View.Summary\r
   className: 'op-smy'\r
   \r
   initialize: (options) ->\r
@@ -19,14 +19,17 @@ class Pettanr.Views.OriginalPicture.Summary extends Pettanr.Views.Common.Summary
     @item.get_child('resource_picture', this, {\r
       success: (@resource_picture) =>\r
         if @resource_picture\r
-          @credit = @resource_picture.credit_view(true)\r
-          @listenTo(@credit, 'click:icon', @resource_picture_click)\r
-          this.$el.append(@credit.render().el)\r
+          @item.get_parent('picture', this, {\r
+            success: (@picture) =>\r
+              @credit = new Pettanr.View.Credit(@picture, {icon: true})\r
+              @listenTo(@credit, 'click:icon', @picture_click)\r
+              this.$el.append(@credit.render().el)\r
+          })\r
     })\r
     @rb()\r
     this\r
   \r
   # in credit\r
-  resource_picture_click: (resource_picture) ->\r
-    @trigger('http_get', resource_picture.show_url())\r
+  picture_click: (picture) ->\r
+    @trigger('http_get', picture.show_url())\r
   \r
index bdcad4e..62c903c 100644 (file)
@@ -76,7 +76,7 @@ class Pettanr.Views.PanelPicture.Element.Img extends Pettanr.View
       @element.merge_opacity(style, opacity)\r
     {\r
       vPicture: @element.get('id'), \r
-      src: @picture.picture_file(@element.flip()).src(@picture), \r
+      src: @picture.picture_file(@element.flip()).src(), \r
       width: Pettanr.to_s(Math.abs(@element.get('width'))) + 'px', \r
       height: Pettanr.to_s(Math.abs(@element.get('height'))) + 'px', \r
       alt: @element.get('caption'), \r
index e72d708..5c71fc3 100644 (file)
@@ -1,74 +1,29 @@
-class Pettanr.Views.PanelPicture.ShowModule\r
-class Pettanr.Views.PanelPicture.ShowModule.Header extends Pettanr.Views.Show.Header\r
+class Pettanr.Views.PanelPicture.Show extends Pettanr.View.Show\r
   \r
   initialize: (options) ->\r
-    super(options)\r
+    @header = new Pettanr.View.Show.Header(@item, this, @default_header_options())\r
   \r
-class Pettanr.Views.PanelPicture.Show extends Pettanr.View\r
-  tagName: 'div'\r
-  className: 'show'\r
-  \r
-  initialize: (options) ->\r
-    @item = options.item\r
-    icon_url = Pettanr.url(@item.table_name(), 'show', {id: @item.get('id')})\r
-    caption_url = icon_url\r
-    prof_url = Pettanr.url(@item.table_name(), 'show', {id: @item.get('id'), format: 'prof'})\r
-    @header = new Pettanr.Views.PanelPicture.ShowModule.Header({\r
-      item: @item, \r
-      caption: @item.get('caption'), \r
-      icon_url: icon_url,\r
-      caption_url: caption_url,\r
-      prof_url: prof_url\r
-    })\r
-    @listenTo(this, 'ready', @ready)\r
+  render: () ->\r
+    this.$el.html('')\r
     @item.get_parent('panel', this, {\r
       success: (item) =>\r
         @panel = item.with_elements()\r
         @panel.fetch().done =>\r
           @panel.attributes = @panel.replaced_attributes()\r
-          @author = new Pettanr.Views.Show.HeaderAuthor({item: @panel})\r
+          @authored_by = @panel.authored_by()\r
           @body = new Pettanr.Views.Panel.Body({\r
             panel: @panel,\r
             spot: @item\r
           })\r
-          @credits = new Pettanr.Views.Common.Credits({\r
-            parent: this\r
-          })\r
           @listenTo(@header, 'click:pick', @click_pick)\r
-          @listenTo(@header, 'click:icon', @click_show)\r
-          @listenTo(@header, 'click:caption', @click_show)\r
-          @listenTo(@header, 'click:prof', @click_prof)\r
-          @listenTo(@author, 'click:author', @click_author)\r
-          @listenTo(@credits, 'click:credit:icon', @click_credit_icon)\r
-          @trigger('ready')\r
+          @listenTo(@authored_by, 'click', @click_authored_by)\r
+          this.$el.append(@header.render().el)\r
+          this.$el.append(@authored_by.render().el)\r
+          this.$el.append(@body.render().el)\r
+          @add_credits()\r
     })\r
-  \r
-  render: () ->\r
-    this.$el.html('')\r
     this\r
   \r
-  ready: () ->\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
-    @credits.clear()\r
-    @credits.push(@panel.licensed_pictures())\r
-    @rb()\r
-  \r
-  click_show: () ->\r
-    @trigger('http_get', @item.show_url())\r
-  \r
-  click_author: () ->\r
-    @trigger('http_get', @panel.author().show_url())\r
-  \r
-  click_prof: () ->\r
-    @trigger('http_get', @item.prof_url())\r
-  \r
-  click_credit_icon: (item) ->\r
-    @trigger('http_get', item.show_url())\r
-  \r
   click_pick: () ->\r
     @trigger('pick', @item)\r
   \r
index 82a5e00..f25ee8f 100644 (file)
@@ -1,15 +1,18 @@
-class Pettanr.Views.PanelPicture.Summary extends Pettanr.Views.Common.Summary\r
+class Pettanr.Views.PanelPicture.Summary extends Pettanr.View.Summary\r
   \r
   initialize: (options) ->\r
     super(options)\r
     @item = options.item\r
     @item.get_parent('picture', this, {\r
       success: (@picture) =>\r
-        @credit = @picture.credit_view(false)\r
+        @credit = new Pettanr.View.Credit(@picture, {})\r
         @item.get_parent('panel', this, {\r
           success: (@panel) =>\r
-            @panel_icon = new Pettanr.Views.Common.Icon({item: @panel, half: true})\r
-            @listenTo(@panel_icon, 'click', @panel_click)\r
+            @mini_face_button =@panel.mini_face_button({\r
+              context: this, \r
+              click: () ->\r
+                @trigger('http_get', @panel.show_url())\r
+            })\r
             @trigger('ready')\r
         })\r
     })\r
@@ -17,9 +20,6 @@ class Pettanr.Views.PanelPicture.Summary extends Pettanr.Views.Common.Summary
   render: () ->\r
     this.$el.html('')\r
     this.$el.append(@credit.render().el)\r
-    this.$el.append(@panel_icon.render().el)\r
+    this.$el.append(@mini_face_button.render().el)\r
     this\r
   \r
-  panel_click: () ->\r
-    @trigger('http_get', @panel_icon.url())\r
-  \r
index 7db481c..3c06ee9 100644 (file)
@@ -1,30 +1,11 @@
-class Pettanr.Views.Panel.ShowModule\r
-class Pettanr.Views.Panel.ShowModule.Header extends Pettanr.Views.Show.Header\r
-  \r
-  initialize: (options) ->\r
-    super(options)\r
-  \r
-class Pettanr.Views.Panel.ShowModule.Owner extends Pettanr.Views.Show.Owner\r
-  \r
-  initialize: (options) ->\r
-    super(options)\r
-  \r
 # panel: panel item\r
 # spot: no opacity element\r
 class Pettanr.Views.Panel.Show extends Pettanr.View\r
-  tagName: 'div'\r
   \r
-  initialize: (options) ->\r
-    @panel = options.panel\r
+  initialize: (@panel, options) ->\r
     @spot = options.spot\r
     \r
-    @header = new Pettanr.Views.Panel.ShowModule.Header({\r
-      item: @panel, \r
-      caption: @panel.get('caption'), \r
-      icon_url: @panel.show_url(),\r
-      caption_url: @panel.show_url(),\r
-      prof_url: @panel.prof_url()\r
-    })\r
+    @header = new Pettanr.View.Show.Header(@item, this, @default_header_options())\r
     @body = new Pettanr.Views.Panel.Body({\r
       panel: @panel,\r
       spot: @spot\r
@@ -32,19 +13,12 @@ class Pettanr.Views.Panel.Show extends Pettanr.View
     @footer = new Pettanr.Views.Panel.Footer({\r
       panel: @panel,\r
     })\r
-    @credits = new Pettanr.Views.Common.Credits({\r
-      parent: this\r
-    })\r
     @owner = new Pettanr.Views.Panel.ShowModule.Owner({item: @panel})\r
     @listenTo(@header, 'click:pick', @click_pick)\r
-    @listenTo(@header, 'click:icon', @click_show)\r
-    @listenTo(@header, 'click:caption', @click_show)\r
-    @listenTo(@header, 'click:prof', @click_prof)\r
     @listenTo(@footer, 'click:panel', @click_show)\r
     @listenTo(@footer, 'click:author', @click_author)\r
     @listenTo(@footer, 'click:edit', @click_edit)\r
     @listenTo(@footer, 'click:inspire', @click_inspire)\r
-    @listenTo(@credits, 'click:credit:icon', @click_credit_icon)\r
     @listenTo(@owner, 'click:edit', @click_edit)\r
     @listenTo(@owner, 'click:destroy', @click_destroy)\r
   \r
@@ -53,16 +27,10 @@ class Pettanr.Views.Panel.Show extends Pettanr.View
     this.$el.append(@header.render().el)\r
     this.$el.append(@body.render().el)\r
     this.$el.append(@footer.render().el)\r
-    this.$el.append(@credits.render().el)\r
-    @credits.clear()\r
-    @credits.push(@panel.licensed_pictures())\r
-    @rb()\r
+    @add_credits()\r
     this.$el.append(@owner.render().el)\r
     this\r
   \r
-  click_show: () ->\r
-    @trigger('http_get', @panel.show_url())\r
-  \r
   click_author: () ->\r
     @trigger('http_get', @panel.author().show_url())\r
   \r
@@ -79,12 +47,6 @@ class Pettanr.Views.Panel.Show extends Pettanr.View
     @listenTo(inspire, 'inspire', @inspire)\r
     inspire.inspire()\r
   \r
-  click_prof: () ->\r
-    @trigger('http_get', @panel.prof_url())\r
-  \r
-  click_credit_icon: (item) ->\r
-    @trigger('http_get', item.show_url())\r
-  \r
   click_pick: () ->\r
     @trigger('pick', @item)\r
   \r
index 1d26732..8153d4a 100644 (file)
@@ -1,4 +1,4 @@
-class Pettanr.Views.Panel.Summary extends Pettanr.Views.Common.Summary\r
+class Pettanr.Views.Panel.Summary extends Pettanr.View.Summary\r
   \r
   initialize: (options) ->\r
     super(options)\r
diff --git a/app/assets/javascripts/views/pictures/credit.js.coffee b/app/assets/javascripts/views/pictures/credit.js.coffee
deleted file mode 100644 (file)
index 1de33a2..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-class Pettanr.Views.Picture.Credit extends Pettanr.View\r
-  tagName: 'div'\r
-  className: 'credit'\r
-  \r
-  initialize: (options) ->\r
-    @item = options.item\r
-    @with_icon = options.with_icon\r
-    @url = @item.url + '/credit'\r
-  \r
-  render: () ->\r
-    this.$el.html('')\r
-    if @with_icon\r
-      p = @item.credit_icon_view()\r
-      @listenTo(p, 'click', @click)\r
-      this.$el.append(p.render().el)\r
-    f = (data, status) =>\r
-      this.$el.append(data)\r
-      @rb()\r
-    $.get(@url, null, f, 'html')\r
-    this\r
-  \r
-  click: () ->\r
-    @trigger('click:icon', @item)\r
-  \r
diff --git a/app/assets/javascripts/views/pictures/credit_icon.js.coffee b/app/assets/javascripts/views/pictures/credit_icon.js.coffee
deleted file mode 100644 (file)
index 6789c7b..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-class Pettanr.Views.Picture.CreditIcon extends Pettanr.View\r
-  tagName: 'span'\r
-  className: 'credit-icon'\r
-  \r
-  initialize: (options) ->\r
-    @item = options.item\r
-  \r
-  render: () ->\r
-    this.$el.html('')\r
-    symbol_button = @item.symbol_button({\r
-      context: this,\r
-      click: () =>\r
-        @trigger('click')\r
-    })\r
-    this.$el.append(symbol_button.render().el)\r
-    this\r
-  \r
index 4780539..287ab41 100644 (file)
@@ -1,4 +1,4 @@
-class Pettanr.Views.Picture.Summary extends Pettanr.Views.Common.Summary\r
+class Pettanr.Views.Picture.Summary extends Pettanr.View.Summary\r
   \r
   initialize: (options) ->\r
     super(options)\r
index ca38b7f..b560dbe 100644 (file)
@@ -1,4 +1,4 @@
-class Pettanr.Views.ResourcePicturePicture.Summary extends Pettanr.Views.Common.Summary\r
+class Pettanr.Views.ResourcePicturePicture.Summary extends Pettanr.View.Summary\r
   \r
   initialize: (options) ->\r
     super(options)\r
@@ -8,7 +8,7 @@ class Pettanr.Views.ResourcePicturePicture.Summary extends Pettanr.Views.Common.
   load: () ->\r
     @item.get_parent('picture', this, {\r
       success: (@picture) =>\r
-        @credit = @picture.credit_view(false)\r
+        @credit = new Pettanr.View.Credit(@picture, {})\r
         @trigger('ready')\r
     })\r
   \r
diff --git a/app/assets/javascripts/views/resource_pictures/credit.js.coffee b/app/assets/javascripts/views/resource_pictures/credit.js.coffee
deleted file mode 100644 (file)
index 7974c88..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-class Pettanr.Views.ResourcePicture.Credit extends Pettanr.View\r
-  tagName: 'div'\r
-  className: 'credit'\r
-  \r
-  initialize: (options) ->\r
-    @item = options.item\r
-    @with_icon = options.with_icon\r
-    @url = @item.url + '/credit'\r
-  \r
-  render: () ->\r
-    this.$el.html('')\r
-    if @with_icon\r
-      p = @item.credit_icon_view()\r
-      @listenTo(p, 'click', @click)\r
-      this.$el.append(p.render().el)\r
-    f = (data, status) =>\r
-      this.$el.append(data)\r
-      @rb()\r
-    $.get(@url, null, f, 'html')\r
-    this\r
-  \r
-  click: () ->\r
-    @trigger('click:icon', @item)\r
-  \r
diff --git a/app/assets/javascripts/views/resource_pictures/credit_icon.js.coffee b/app/assets/javascripts/views/resource_pictures/credit_icon.js.coffee
deleted file mode 100644 (file)
index 7a0ea27..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-class Pettanr.Views.ResourcePicture.CreditIcon extends Pettanr.View\r
-  tagName: 'span'\r
-  className: 'credit-icon'\r
-  \r
-  initialize: (options) ->\r
-    @item = options.item\r
-    @url = @item.url + '/credit'\r
-  \r
-  render: () ->\r
-    this.$el.html('')\r
-    resource_picture = @item.tmb_opt_img_tag()\r
-    linked_resource_picture = new Tag.A({\r
-      attr: {href: @item.url},\r
-      content: resource_picture.render().el\r
-    })\r
-    @listenTo(linked_resource_picture, 'click', @click)\r
-    this.$el.append(linked_resource_picture.render().el)\r
-    this\r
-  \r
-  click: () ->\r
-    @trigger('click')\r
-  \r
index 06885e8..905d8de 100644 (file)
-class Pettanr.Views.ResourcePicture.ShowModule\r
-class Pettanr.Views.ResourcePicture.ShowModule.Header extends Pettanr.Views.Show.Header\r
+class Pettanr.Views.ResourcePicture.Show extends Pettanr.View.Show\r
   \r
   initialize: (options) ->\r
-    super(options)\r
-  \r
-class Pettanr.Views.ResourcePicture.ShowModule.LinkedReplaceButton extends Tag.A\r
-  \r
-  initialize: (options) ->\r
-    item = options.item\r
-    op = new Pettanr.OriginalPicture({id: item.get('original_picture_id')})\r
-    super({\r
-      attr: {href: '/' + op.edit_url()}, \r
-      content: I18n.t('original_pictures.show.replace')\r
-    })\r
-  \r
-class Pettanr.Views.ResourcePicture.ShowModule.LinkedSourceButton extends Tag.A\r
-  \r
-  initialize: (options) ->\r
-    item = options.item\r
-    op = new Pettanr.OriginalPicture({id: item.get('original_picture_id')})\r
-    super({\r
-      attr: {href: '/' + op.show_url()}, \r
-      content: I18n.t('original_pictures.show.title')\r
-    })\r
-  \r
-class Pettanr.Views.ResourcePicture.ShowModule.LinkedStopButton extends Tag.A\r
-  \r
-  initialize: (options) ->\r
-    item = options.item\r
-    super({\r
-      attr: {href: '/' + item.destroy_url()}, \r
-      content: I18n.t('original_pictures.index.stop')\r
-    })\r
-  \r
-class Pettanr.Views.ResourcePicture.ShowModule.OwnerFooter extends Pettanr.View\r
-  tagName: 'div'\r
-  className: 'show-owner-footer'\r
-  \r
-  initialize: (options) ->\r
-    super(options)\r
-    @item = options.item\r
-    @replace = new Pettanr.Views.ResourcePicture.ShowModule.LinkedReplaceButton({item: @item})\r
-    @source = new Pettanr.Views.ResourcePicture.ShowModule.LinkedSourceButton({item: @item})\r
-    @stop = new Pettanr.Views.ResourcePicture.ShowModule.LinkedStopButton({item: @item})\r
-    @listenTo(@replace, 'click', @click_replace)\r
-    @listenTo(@source, 'click', @click_source)\r
-    @listenTo(@stop, 'click', @click_stop)\r
-  \r
-  render: () ->\r
-    super()\r
-    this.$el.append(@replace.render().el)\r
-    this.$el.append(@source.render().el)\r
-    this.$el.append(@stop.render().el)\r
-    this\r
-  \r
-  click_replace: () ->\r
-    @trigger('click:replace')\r
-  \r
-  click_source: () ->\r
-    @trigger('click:source')\r
-  \r
-  click_stop: () ->\r
-    @trigger('click:stop')\r
-  \r
-class Pettanr.Views.ResourcePicture.ShowModule.Owner extends Pettanr.Views.Show.Owner\r
-  \r
-  initialize: (options) ->\r
-    super(options)\r
-    @listenTo(@footer, 'click:replace', @click_replace)\r
-    @listenTo(@footer, 'click:source', @click_source)\r
-    @listenTo(@footer, 'click:stop', @click_stop)\r
-  \r
-  click_replace: () ->\r
-    @trigger('click:replace')\r
-  \r
-  click_source: () ->\r
-    @trigger('click:source')\r
-  \r
-  click_stop: () ->\r
-    @trigger('click:stop')\r
-  \r
-  footer_class: () ->\r
-    Pettanr.Views.ResourcePicture.ShowModule.OwnerFooter\r
-  \r
-class Pettanr.Views.ResourcePicture.Show extends Pettanr.View\r
-  tagName: 'div'\r
-  className: 'show'\r
-  \r
-  initialize: (options) ->\r
-    @item = options.item\r
-    @header = new Pettanr.Views.ResourcePicture.ShowModule.Header({\r
-      item: @item, \r
-      icon_url: @item.show_url(),\r
-      caption_url: @item.show_url(),\r
-      prof_url: @item.prof_url()\r
-    })\r
-    @artist = new Pettanr.Views.Show.HeaderArtist({item: @item})\r
-    @img = new Pettanr.Views.ResourcePicture.Img({item: @item})\r
-    @credit = @item.credit_view(false)\r
-    @owner = new Pettanr.Views.ResourcePicture.ShowModule.Owner({item: @item, original_picture: @original_picture})\r
+    @header = new Pettanr.View.Show.Header(@item, this, @default_header_options())\r
+    @authored_by = @item.authored_by()\r
+    @img = @item.real_picture('full')\r
     @listenTo(@header, 'click:pick', @click_pick)\r
-    @listenTo(@header, 'click:icon', @click_show)\r
-    @listenTo(@header, 'click:prof', @click_prof)\r
-    @listenTo(@artist, 'click:artist', @click_artist)\r
-    @listenTo(@owner, 'click:replace', @click_replace)\r
-    @listenTo(@owner, 'click:source', @click_source)\r
-    @listenTo(@owner, 'click:stop', @click_stop)\r
+    @listenTo(@authored_by, 'click', @click_authored_by)\r
   \r
   render: () ->\r
     this.$el.html('')\r
     this.$el.append(@header.render().el)\r
-    this.$el.append(@artist.render().el)\r
+    this.$el.append(@authored_by.render().el)\r
     this.$el.append(@img.render().el)\r
-    this.$el.append(@credit.render().el)\r
-    this.$el.append(@owner.render().el)\r
+    @item.get_parent('original_picture', this, {\r
+      success: (@original_picture) =>\r
+        @owner = new Pettanr.View.Show.Footer(null, this, {\r
+          actions: {\r
+            replace: {\r
+              item: @original_picture,\r
+              url: @original_picture.edit_url(),\r
+              dic_name: 'original_pictures.show.replace',\r
+              click: () =>\r
+                @trigger('http_get', @original_picture.edit_url())\r
+            }, \r
+            source: {\r
+              item: @original_picture,\r
+              url: @original_picture.show_url(),\r
+              dic_name: 'original_pictures.show.title',\r
+              click: () =>\r
+                @trigger('http_get', @original_picture.show_url())\r
+            }, \r
+            stop: {\r
+              item: @item,\r
+              url: @item.destroy_url(),\r
+              dic_name: 'original_pictures.index.stop',\r
+              click: () =>\r
+                redirect = (url) =>\r
+                  @trigger('http_get', url)\r
+                Pettanr.Proxy.destroy(@item, {redirect: redirect})\r
+            }, \r
+          }, \r
+        })\r
+        @item.get_parent('picture', this, {\r
+          success: (@picture) =>\r
+            @credit = new Pettanr.View.Credit(@picture, {\r
+              icon: {\r
+                click: () =>\r
+                  @trigger('http_get', @picture.show_url())\r
+              }\r
+            })\r
+            this.$el.append(@credit.render().el)\r
+            this.$el.append(@owner.render().el)\r
+        })\r
+    })\r
     this\r
   \r
-  click_show: () ->\r
-    @trigger('http_get', @item.show_url())\r
-  \r
-  click_prof: () ->\r
-    @trigger('http_get', @item.prof_url())\r
-  \r
-  click_artist: () ->\r
-    @trigger('http_get', @item.artist().show_url())\r
-  \r
-  click_replace: () ->\r
-    op = new Pettanr.OriginalPicture({id: @item.get('original_picture_id')})\r
-    @trigger('http_get', op.edit_url())\r
-  \r
-  click_source: () ->\r
-    op = new Pettanr.OriginalPicture({id: @item.get('original_picture_id')})\r
-    @trigger('http_get', op.show_url())\r
-  \r
-  click_stop: () ->\r
-    redirect = (url) =>\r
-      @trigger('http_get', url)\r
-    Pettanr.Proxy.destroy(@item, {redirect: redirect})\r
-  \r
   click_pick: () ->\r
     @trigger('pick', @item)\r
   \r
index 0b647e0..5ae01e9 100644 (file)
@@ -1,11 +1,11 @@
-class Pettanr.Views.ResourcePicture.Summary extends Pettanr.Views.Common.Summary\r
+class Pettanr.Views.ResourcePicture.Summary extends Pettanr.View.Summary\r
   \r
   initialize: (options) ->\r
     super(options)\r
     @item = options.item\r
     @item.get_parent('picture', this, {\r
       success: (@picture) =>\r
-        @credit = @picture.credit_view(false)\r
+        @credit = new Pettanr.View.Credit(@picture, {})\r
         @trigger('ready')\r
     })\r
   \r
index e2450e0..105a940 100644 (file)
@@ -1,4 +1,4 @@
-class Pettanr.Views.ScrollPanel.Summary extends Pettanr.Views.Common.Leaf.Summary\r
+class Pettanr.Views.ScrollPanel.Summary extends Pettanr.View.Summary.Leaf\r
   \r
   initialize: (options) ->\r
     options['binder_item_name'] = 'scroll'\r
index 38053d5..ce430e7 100644 (file)
@@ -470,7 +470,7 @@ class Pettanr.Views.Scroll.PlayModule.Body extends Pettanr.View
     else\r
       this.$el.html('')\r
       # paginate(@pager)\r
-      credits = new Pettanr.Views.Common.Credits({parent: this})\r
+      credits = new Pettanr.View.Credits({parent: this})\r
       @panels = new Pettanr.Views.Scroll.PlayModule.Panels({\r
         parent: this,\r
         binder: @binder,\r
@@ -533,25 +533,13 @@ class Pettanr.Views.Scroll.PlayModule.Body extends Pettanr.View
           @appender.enable()\r
     })\r
   \r
-class Pettanr.Views.Scroll.Play extends Pettanr.View\r
-  tagName: 'div'\r
-  className: 'show'\r
+class Pettanr.Views.Scroll.Play extends Pettanr.View.Show\r
   \r
-  initialize: (options) ->\r
-    @item = options.item\r
+  initialize: (@item, options) ->\r
     @list = options.list\r
     @pager = options.pager\r
-    icon_url = Pettanr.url(@item.table_name(), 'show', {id: @item.get('id')})\r
-    caption_url = Pettanr.url(@item.table_name(), 'play', {id: @item.get('id')})\r
-    prof_url = Pettanr.url(@item.table_name(), 'show', {id: @item.get('id'), format: 'prof'})\r
-    @header = new Pettanr.Views.Scroll.PlayModule.Header({\r
-      item: @item, \r
-      caption: @item.get('title'), \r
-      icon_url: icon_url,\r
-      caption_url: caption_url,\r
-      prof_url: prof_url\r
-    })\r
-    @author = new Pettanr.Views.Show.HeaderAuthor({item: @item})\r
+    @header = new Pettanr.View.Show.Header(@item, this, @binder_header_options())\r
+    @authored_by = @item.authored_by()\r
     @body = new Pettanr.Views.Scroll.PlayModule.Body({\r
       parent: this,\r
       binder: @item,\r
@@ -560,10 +548,7 @@ class Pettanr.Views.Scroll.Play extends Pettanr.View
     })\r
     # @owner = new Pettanr.Views.Scroll.PlayModule.Owner({item: @item})\r
     @listenTo(@header, 'click:pick', @click_pick)\r
-    @listenTo(@header, 'click:icon', @click_show)\r
-    @listenTo(@header, 'click:caption', @click_play)\r
-    @listenTo(@header, 'click:prof', @click_prof)\r
-    @listenTo(@author, 'click:author', @click_author)\r
+    @listenTo(@authored_by, 'click', @click_authored_by)\r
     @listenTo(@body, 'http_get', @http_get)\r
     @listenTo(@body, 'click:insert', @click_insert)\r
     @listenTo(@body, 'click:move', @click_move)\r
@@ -572,23 +557,11 @@ class Pettanr.Views.Scroll.Play extends Pettanr.View
   render: () ->\r
     this.$el.html('')\r
     this.$el.append(@header.render().el)\r
-    this.$el.append(@author.render().el)\r
+    this.$el.append(@authored_by.render().el)\r
     this.$el.append(@body.render().el)\r
     # this.$el.append(@owner.render().el) if @item.is_own()\r
     this\r
   \r
-  click_show: () ->\r
-    @trigger('http_get', @item.show_url())\r
-  \r
-  click_play: () ->\r
-    @trigger('http_get', @item.play_url())\r
-  \r
-  click_prof: () ->\r
-    @trigger('http_get', @item.prof_url())\r
-  \r
-  click_author: () ->\r
-    @trigger('http_get', @author.author.show_url())\r
-  \r
   click_pick: () ->\r
     @trigger('pick', @item)\r
   \r
index d661c9d..5f0e297 100644 (file)
@@ -1,62 +1,19 @@
-class Pettanr.Views.Scroll.ShowModule\r
-class Pettanr.Views.Scroll.ShowModule.Header extends Pettanr.Views.Show.Header\r
+class Pettanr.Views.Scroll.Show extends Pettanr.View.Show\r
   \r
   initialize: (options) ->\r
-    super(options)\r
-  \r
-class Pettanr.Views.Scroll.ShowModule.Owner extends Pettanr.Views.Show.Owner\r
-  \r
-  initialize: (options) ->\r
-    super(options)\r
-  \r
-class Pettanr.Views.Scroll.Show extends Pettanr.View\r
-  tagName: 'div'\r
-  className: 'show'\r
-  \r
-  initialize: (options) ->\r
-    @item = options.item\r
-    @header = new Pettanr.View.Show.Header(@item, {\r
-      label: {\r
-        url: @item.play_url(),\r
-      }\r
-    })\r
-    @author = new Pettanr.Views.Show.HeaderAuthor({item: @item})\r
-    @owner = new Pettanr.Views.Scroll.ShowModule.Owner({item: @item})\r
+    @header = new Pettanr.View.Show.Header(@item, this, @binder_header_options())\r
+    @authored_by = @item.authored_by()\r
+    @owner = new Pettanr.View.Show.Footer(@item, this, @default_footer_options())\r
     @listenTo(@header, 'click:pick', @click_pick)\r
-    @listenTo(@header, 'click:icon', @click_show)\r
-    @listenTo(@header, 'click:caption', @click_play)\r
-    @listenTo(@header, 'click:prof', @click_prof)\r
-    @listenTo(@author, 'click:author', @click_author)\r
-    @listenTo(@owner, 'click:edit', @click_edit)\r
-    @listenTo(@owner, 'click:destroy', @click_destroy)\r
+    @listenTo(@authored_by, 'click', @click_authored_by)\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(@authored_by.render().el)\r
     this.$el.append(@owner.render().el) if @item.is_own()\r
     this\r
   \r
-  click_show: () ->\r
-    @trigger('http_get', @item.show_url())\r
-  \r
-  click_play: () ->\r
-    @trigger('http_get', @item.play_url())\r
-  \r
-  click_prof: () ->\r
-    @trigger('http_get', @item.prof_url())\r
-  \r
-  click_author: () ->\r
-    @trigger('http_get', @item.author().show_url())\r
-  \r
-  click_edit: () ->\r
-    @trigger('http_get', @item.edit_url())\r
-  \r
-  click_destroy: () ->\r
-    redirect = (url) =>\r
-      @trigger('http_get', url)\r
-    Pettanr.Proxy.destroy(@item, {redirect: redirect})\r
-  \r
   click_pick: () ->\r
     @trigger('pick', @item)\r
   \r
index 8759ad8..83edbc2 100644 (file)
@@ -1,4 +1,4 @@
-class Pettanr.Views.Scroll.Summary extends Pettanr.Views.Common.Binder.Summary\r
+class Pettanr.Views.Scroll.Summary extends Pettanr.View.Summary.Binder\r
   \r
   initialize: (options) ->\r
     options['visible_t'] = 'scroll_visible_items'\r
index 461d0c3..d16e150 100644 (file)
@@ -1,4 +1,4 @@
-class Pettanr.Views.SheetPanel.Summary extends Pettanr.Views.Common.Summary\r
+class Pettanr.Views.SheetPanel.Summary extends Pettanr.View.Summary\r
   \r
   initialize: (options) ->\r
     super(options)\r
index a415763..fb44be7 100644 (file)
@@ -106,7 +106,7 @@ class Pettanr.Views.Sheet.PlayModule.Body extends Pettanr.View
   render: () ->\r
     this.$el.html('')\r
     # paginate(@pager)\r
-    credits = new Pettanr.Views.Common.Credits({parent: this})\r
+    credits = new Pettanr.View.Credits({parent: this})\r
     panels = new Pettanr.Views.Sheet.PlayModule.Panels({\r
       parent: this,\r
       items: @items,\r
@@ -118,34 +118,23 @@ class Pettanr.Views.Sheet.PlayModule.Body extends Pettanr.View
     # paginate(@pager)\r
     this\r
   \r
-class Pettanr.Views.Sheet.Play extends Pettanr.View\r
-  tagName: 'div'\r
-  className: 'show'\r
+class Pettanr.Views.Sheet.Play extends Pettanr.View.Show\r
   \r
-  initialize: (options) ->\r
-    @item = options.item\r
+  initialize: (@item, options) ->\r
     @list = options.list\r
-    icon_url = Pettanr.url(@item.table_name(), 'show', {id: @item.get('id')})\r
-    caption_url = Pettanr.url(@item.table_name(), 'play', {id: @item.get('id')})\r
-    prof_url = Pettanr.url(@item.table_name(), 'show', {id: @item.get('id'), format: 'prof'})\r
-    @header = new Pettanr.Views.Sheet.PlayModule.Header({\r
-      item: @item, \r
-      caption: @item.get('caption'), \r
-      icon_url: icon_url,\r
-      caption_url: caption_url,\r
-      prof_url: prof_url\r
-    })\r
-    @author = new Pettanr.Views.Show.HeaderAuthor({item: @item})\r
+    @header = new Pettanr.View.Show.Header(@item, this, @binder_header_options())\r
+    @authored_by = @item.authored_by()\r
     @body = new Pettanr.Views.Sheet.PlayModule.Body({\r
       parent: this,\r
       list: @list, \r
     })\r
     @owner = new Pettanr.Views.Sheet.PlayModule.Owner({item: @item})\r
+    @listenTo(@authored_by, 'click', @click_authored_by)\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(@authored_by.render().el)\r
     this.$el.append(@body.render().el)\r
     this.$el.append(@owner.render().el) if @item.is_own()\r
     this\r
index 0811a79..30cd617 100644 (file)
@@ -1,38 +1,16 @@
-class Pettanr.Views.Sheet.ShowModule\r
-class Pettanr.Views.Sheet.ShowModule.Header extends Pettanr.Views.Show.Header\r
+class Pettanr.Views.Sheet.Show extends Pettanr.View.Show\r
   \r
   initialize: (options) ->\r
-    super(options)\r
-  \r
-class Pettanr.Views.Sheet.ShowModule.Owner extends Pettanr.Views.Show.Owner\r
-  \r
-  initialize: (options) ->\r
-    super(options)\r
-  \r
-class Pettanr.Views.Sheet.Show extends Pettanr.View\r
-  tagName: 'div'\r
-  className: 'show'\r
-  \r
-  initialize: (options) ->\r
-    @item = options.item\r
-    icon_url = Pettanr.url(@item.table_name(), 'show', {id: @item.get('id')})\r
-    caption_url = Pettanr.url(@item.table_name(), 'play', {id: @item.get('id')})\r
-    prof_url = Pettanr.url(@item.table_name(), 'show', {id: @item.get('id'), format: 'prof'})\r
-    @header = new Pettanr.Views.Sheet.ShowModule.Header({\r
-      item: @item, \r
-      caption: @item.get('caption'), \r
-      icon_url: icon_url,\r
-      caption_url: caption_url,\r
-      prof_url: prof_url\r
-    })\r
-    @author = new Pettanr.Views.Show.HeaderAuthor({item: @item})\r
-    @owner = new Pettanr.Views.Sheet.ShowModule.Owner({item: @item})\r
+    @header = new Pettanr.View.Show.Header(@item, this, @binder_header_options())\r
+    @authored_by = @item.authored_by()\r
+    @owner = new Pettanr.View.Show.Footer(@item, this, @default_footer_options())\r
     @listenTo(@header, 'click:pick', @click_pick)\r
+    @listenTo(@authored_by, 'click', @click_authored_by)\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(@authored_by.render().el)\r
     this.$el.append(@owner.render().el) if @item.is_own()\r
     this\r
   \r
index 16d87ae..57f7b90 100644 (file)
@@ -1,4 +1,4 @@
-class Pettanr.Views.Sheet.Summary extends Pettanr.Views.Common.Binder.Summary\r
+class Pettanr.Views.Sheet.Summary extends Pettanr.View.Summary.Binder\r
   \r
   initialize: (options) ->\r
     options['visible_t'] = 'sheet_visible_items'\r
index ab3fb3c..f689287 100644 (file)
@@ -1,9 +1,20 @@
-class Pettanr.Views.SpeechBalloonTemplate.Show extends Pettanr.View\r
-  tagName: 'div'\r
+class Pettanr.Views.SpeechBalloonTemplate.Show extends Pettanr.View.Show\r
   \r
   initialize: (options) ->\r
+    @header = new Pettanr.View.Show.Header(@item, this, @binder_header_options())\r
+    @listenTo(@header, 'click:pick', @click_pick)\r
   \r
   render: () ->\r
     this.$el.html('')\r
+    this.$el.append(@header.render().el)\r
     this\r
   \r
+  click_pick: () ->\r
+    @trigger('pick', @item)\r
+  \r
+  is_pickable: () ->\r
+    true\r
+  \r
+  add_pick: (target_model) ->\r
+    @header.add_pick(target_model)\r
+  \r
index 740483a..c265315 100644 (file)
@@ -1,4 +1,4 @@
-class Pettanr.Views.SpeechBalloonTemplate.Summary extends Pettanr.Views.Common.Summary\r
+class Pettanr.Views.SpeechBalloonTemplate.Summary extends Pettanr.View.Summary\r
   \r
   initialize: (options) ->\r
     super(options)\r
index 44d604f..7cb05c2 100644 (file)
@@ -1,74 +1,28 @@
-class Pettanr.Views.SpeechBalloon.ShowModule\r
-class Pettanr.Views.SpeechBalloon.ShowModule.Header extends Pettanr.Views.Show.Header\r
+class Pettanr.Views.SpeechBalloon.Show extends Pettanr.View.Show\r
   \r
   initialize: (options) ->\r
-    super(options)\r
+    @header = new Pettanr.View.Show.Header(@item, this, @default_header_options())\r
   \r
-class Pettanr.Views.SpeechBalloon.Show extends Pettanr.View\r
-  tagName: 'div'\r
-  className: 'show'\r
-  \r
-  initialize: (options) ->\r
-    @item = options.item\r
-    icon_url = Pettanr.url(@item.table_name(), 'show', {id: @item.get('id')})\r
-    caption_url = icon_url\r
-    prof_url = Pettanr.url(@item.table_name(), 'show', {id: @item.get('id'), format: 'prof'})\r
-    @header = new Pettanr.Views.SpeechBalloon.ShowModule.Header({\r
-      item: @item, \r
-      caption: @item.get('caption'), \r
-      icon_url: icon_url,\r
-      caption_url: caption_url,\r
-      prof_url: prof_url\r
-    })\r
-    @listenTo(this, 'ready', @ready)\r
+  render: () ->\r
+    this.$el.html('')\r
     @item.get_parent('panel', this, {\r
       success: (item) =>\r
         @panel = item.with_elements()\r
         @panel.fetch().done =>\r
           @panel.attributes = @panel.replaced_attributes()\r
-          @author = new Pettanr.Views.Show.HeaderAuthor({item: @panel})\r
+          @authored_by = @panel.authored_by()\r
           @body = new Pettanr.Views.Panel.Body({\r
             panel: @panel,\r
             spot: @item\r
           })\r
-          @credits = new Pettanr.Views.Common.Credits({\r
-            parent: this\r
-          })\r
-          @listenTo(@header, 'click:pick', @click_pick)\r
-          @listenTo(@header, 'click:icon', @click_show)\r
-          @listenTo(@header, 'click:caption', @click_show)\r
-          @listenTo(@header, 'click:prof', @click_prof)\r
-          @listenTo(@author, 'click:author', @click_author)\r
-          @listenTo(@credits, 'click:credit:icon', @click_credit_icon)\r
-          @trigger('ready')\r
+          @listenTo(@authored_by, 'click', @click_authored_by)\r
+          this.$el.append(@header.render().el)\r
+          this.$el.append(@authored_by.render().el)\r
+          this.$el.append(@body.render().el)\r
+          @add_credits()\r
     })\r
-  \r
-  render: () ->\r
-    this.$el.html('')\r
     this\r
   \r
-  ready: () ->\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
-    @credits.clear()\r
-    @credits.push(@panel.licensed_pictures())\r
-    @rb()\r
-  \r
-  click_show: () ->\r
-    @trigger('http_get', @item.show_url())\r
-  \r
-  click_author: () ->\r
-    @trigger('http_get', @panel.author().show_url())\r
-  \r
-  click_prof: () ->\r
-    @trigger('http_get', @item.prof_url())\r
-  \r
-  click_credit_icon: (item) ->\r
-    @trigger('http_get', item.show_url())\r
-  \r
   click_pick: () ->\r
     @trigger('pick', @item)\r
   \r
index d4ed14b..cc212b2 100644 (file)
@@ -1,4 +1,4 @@
-class Pettanr.Views.SpeechBalloon.Summary extends Pettanr.Views.Common.Summary\r
+class Pettanr.Views.SpeechBalloon.Summary extends Pettanr.View.Summary\r
   \r
   initialize: (options) ->\r
     super(options)\r
index 2f2723e..5e5ca4c 100644 (file)
@@ -1,26 +1,10 @@
-class Pettanr.Views.Speech.ShowModule\r
-class Pettanr.Views.Speech.ShowModule.Header extends Pettanr.Views.Show.Header\r
+class Pettanr.Views.Speech.Show extends Pettanr.View.Show\r
   \r
   initialize: (options) ->\r
-    super(options)\r
+    @header = new Pettanr.View.Show.Header(@item, this, @default_header_options())\r
   \r
-class Pettanr.Views.Speech.Show extends Pettanr.View\r
-  tagName: 'div'\r
-  className: 'show'\r
-  \r
-  initialize: (options) ->\r
-    @item = options.item\r
-    icon_url = Pettanr.url(@item.table_name(), 'show', {id: @item.get('id')})\r
-    caption_url = icon_url\r
-    prof_url = Pettanr.url(@item.table_name(), 'show', {id: @item.get('id'), format: 'prof'})\r
-    @header = new Pettanr.Views.Speech.ShowModule.Header({\r
-      item: @item, \r
-      caption: '', \r
-      icon_url: icon_url,\r
-      caption_url: caption_url,\r
-      prof_url: prof_url\r
-    })\r
-    @listenTo(this, 'ready', @ready)\r
+  render: () ->\r
+    this.$el.html('')\r
     @item.get_parent('speech_balloon', this, {\r
       success: (@speech_balloon) =>\r
         @speech_balloon.get_parent('panel', this, {\r
@@ -28,50 +12,21 @@ class Pettanr.Views.Speech.Show extends Pettanr.View
             @panel = item.with_elements()\r
             @panel.fetch().done =>\r
               @panel.attributes = @panel.replaced_attributes()\r
-              @author = new Pettanr.Views.Show.HeaderAuthor({item: @panel})\r
+              @authored_by = @panel.authored_by()\r
               @body = new Pettanr.Views.Panel.Body({\r
                 panel: @panel,\r
                 spot: @item\r
               })\r
-              @credits = new Pettanr.Views.Common.Credits({\r
-                parent: this\r
-              })\r
               @listenTo(@header, 'click:pick', @click_pick)\r
-              @listenTo(@header, 'click:icon', @click_show)\r
-              @listenTo(@header, 'click:caption', @click_show)\r
-              @listenTo(@header, 'click:prof', @click_prof)\r
-              @listenTo(@author, 'click:author', @click_author)\r
-              @listenTo(@credits, 'click:credit:icon', @click_credit_icon)\r
-              @trigger('ready')\r
+              @listenTo(@authored_by, 'click', @click_authored_by)\r
+              this.$el.append(@header.render().el)\r
+              this.$el.append(@authored_by.render().el)\r
+              this.$el.append(@body.render().el)\r
+              @add_credits()\r
         })\r
     })\r
-  \r
-  render: () ->\r
-    this.$el.html('')\r
     this\r
   \r
-  ready: () ->\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
-    @credits.clear()\r
-    @credits.push(@panel.licensed_pictures())\r
-    @rb()\r
-  \r
-  click_show: () ->\r
-    @trigger('http_get', @item.show_url())\r
-  \r
-  click_author: () ->\r
-    @trigger('http_get', @panel.author().show_url())\r
-  \r
-  click_prof: () ->\r
-    @trigger('http_get', @item.prof_url())\r
-  \r
-  click_credit_icon: (item) ->\r
-    @trigger('http_get', item.show_url())\r
-  \r
   click_pick: () ->\r
     @trigger('pick', @item)\r
   \r
index 14503b8..0dc3795 100644 (file)
@@ -1,4 +1,4 @@
-class Pettanr.Views.Speech.Summary extends Pettanr.Views.Common.Summary\r
+class Pettanr.Views.Speech.Summary extends Pettanr.View.Summary\r
   \r
   initialize: (options) ->\r
     super(options)\r
index 512bd69..50e25db 100644 (file)
@@ -1,38 +1,16 @@
-class Pettanr.Views.Story.ShowModule\r
-class Pettanr.Views.Story.ShowModule.Header extends Pettanr.Views.Show.Header\r
+class Pettanr.Views.Story.Show extends Pettanr.View.Show\r
   \r
   initialize: (options) ->\r
-    super(options)\r
-  \r
-class Pettanr.Views.Story.ShowModule.Owner extends Pettanr.Views.Show.Owner\r
-  \r
-  initialize: (options) ->\r
-    super(options)\r
-  \r
-class Pettanr.Views.Story.Show extends Pettanr.View\r
-  tagName: 'div'\r
-  className: 'show'\r
-  \r
-  initialize: (options) ->\r
-    @item = options.item\r
-    icon_url = Pettanr.url(@item.table_name(), 'show', {id: @item.get('id')})\r
-    caption_url = Pettanr.url(@item.table_name(), 'play', {id: @item.get('id')})\r
-    prof_url = Pettanr.url(@item.table_name(), 'show', {id: @item.get('id'), format: 'prof'})\r
-    @header = new Pettanr.Views.Story.ShowModule.Header({\r
-      item: @item, \r
-      caption: @item.get('title'), \r
-      icon_url: icon_url,\r
-      caption_url: caption_url,\r
-      prof_url: prof_url\r
-    })\r
-    @author = new Pettanr.Views.Show.HeaderAuthor({item: @item})\r
-    @owner = new Pettanr.Views.Story.ShowModule.Owner({item: @item})\r
+    @header = new Pettanr.View.Show.Header(@item, this, @binder_header_options())\r
+    @authored_by = @item.authored_by()\r
+    @owner = new Pettanr.View.Show.Footer(@item, this, @default_footer_options())\r
     @listenTo(@header, 'click:pick', @click_pick)\r
+    @listenTo(@authored_by, 'click', @click_authored_by)\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(@authored_by.render().el)\r
     this.$el.append(@owner.render().el) if @item.is_own()\r
     this\r
   \r
index 22acf79..c75efef 100644 (file)
@@ -1,4 +1,4 @@
-class Pettanr.Views.Story.Summary extends Pettanr.Views.Common.Binder.Summary\r
+class Pettanr.Views.Story.Summary extends Pettanr.View.Summary.Binder\r
   \r
   initialize: (options) ->\r
     options['visible_t'] = 'story_visible_items'\r
index 95d86fa..529d54b 100644 (file)
@@ -1,4 +1,4 @@
-class Pettanr.Views.StorySheet.Summary extends Pettanr.Views.Common.Leaf.Summary\r
+class Pettanr.Views.StorySheet.Summary extends Pettanr.View.Summary.Leaf\r
   \r
   initialize: (options) ->\r
     options['binder_item_name'] = 'story'\r
index 7f2172e..0a55777 100644 (file)
@@ -1,9 +1,10 @@
-class Pettanr.Views.SystemPicture.Show extends Pettanr.View\r
-  tagName: 'div'\r
+class Pettanr.Views.SystemPicture.Show extends Pettanr.View.Show\r
   \r
   initialize: (options) ->\r
+    @header = new Pettanr.View.Show.Header(@item, this, @binder_header_options())\r
   \r
   render: () ->\r
     this.$el.html('')\r
+    this.$el.append(@header.render().el)\r
     this\r
   \r
index 9a4f910..913d0ab 100644 (file)
@@ -1,4 +1,4 @@
-class Pettanr.Views.SystemPicture.Summary extends Pettanr.Views.Common.Summary\r
+class Pettanr.Views.SystemPicture.Summary extends Pettanr.View.Summary\r
   \r
   initialize: (options) ->\r
     super(options)\r
index 955552b..9f59811 100644 (file)
@@ -1,9 +1,10 @@
-class Pettanr.Views.WritingFormat.Show extends Pettanr.View\r
-  tagName: 'div'\r
+class Pettanr.Views.WritingFormat.Show extends Pettanr.View.Show\r
   \r
   initialize: (options) ->\r
+    @header = new Pettanr.View.Show.Header(@item, this, @binder_header_options())\r
   \r
   render: () ->\r
     this.$el.html('')\r
+    this.$el.append(@header.render().el)\r
     this\r
   \r
index 9728722..4b3faab 100644 (file)
@@ -1,4 +1,4 @@
-class Pettanr.Views.WritingFormat.Summary extends Pettanr.Views.Common.Summary\r
+class Pettanr.Views.WritingFormat.Summary extends Pettanr.View.Summary\r
   \r
   initialize: (options) ->\r
     super(options)\r
index 8360f56..12877aa 100644 (file)
 //= require_directory ./view
 //= require_directory ./view/button
 //= require_directory ./view/show
+//= require_directory ./view/show/header
+//= require_directory ./view/show/footer
 //= require_directory ./view/play
+//= require_directory ./view/summary
 //= require_directory ./views
 //= require_directory ./views/folders
 //= require_directory ./views/artists