OSDN Git Service

fix event
authoryasushiito <yas@pen-chan.jp>
Sun, 1 Feb 2015 06:00:15 +0000 (15:00 +0900)
committeryasushiito <yas@pen-chan.jp>
Sun, 1 Feb 2015 06:00:15 +0000 (15:00 +0900)
59 files changed:
app/assets/javascripts/locmare/filer.js.coffee
app/assets/javascripts/locmare/filer/body.js.coffee
app/assets/javascripts/locmare/filer/body/file_body.js.coffee
app/assets/javascripts/locmare/filer/body/file_body/file_item.js.coffee
app/assets/javascripts/locmare/filer/body/file_body/file_item/caption/base.js.coffee
app/assets/javascripts/locmare/filer/body/file_body/file_item/caption/default.js.coffee
app/assets/javascripts/locmare/filer/body/file_body/file_item/caption/default/face/base.js.coffee
app/assets/javascripts/locmare/filer/body/file_body/file_item/caption/default/face/column.js.coffee
app/assets/javascripts/locmare/filer/body/file_body/file_item/caption/default/face/method.js.coffee
app/assets/javascripts/locmare/filer/body/file_body/file_item/edit/account.js.coffee
app/assets/javascripts/locmare/filer/body/file_body/file_item/edit/base.js.coffee
app/assets/javascripts/locmare/filer/body/file_body/file_item/edit/default.js.coffee
app/assets/javascripts/locmare/filer/body/file_body/file_item/edit/template.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/summary/template.js.coffee
app/assets/javascripts/locmare/filer/body/file_body/file_item/symbol/base.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/base.js.coffee
app/assets/javascripts/locmare/filer/body/file_body/file_item/symbol/default/face/image.js.coffee
app/assets/javascripts/locmare/filer/body/file_body/file_item/symbol/default/face/picture.js.coffee
app/assets/javascripts/locmare/filer/body/file_body/file_item/symbol/default/link/action.js.coffee
app/assets/javascripts/locmare/filer/body/file_body/file_item/symbol/default/link/base.js.coffee
app/assets/javascripts/locmare/filer/body/file_body/file_item/symbol/default/link/url_column.js.coffee
app/assets/javascripts/locmare/filer/body/file_body/file_item/symbol/template.js.coffee
app/assets/javascripts/locmare/filer/header.js.coffee
app/assets/javascripts/locmare/list_group/lib/pager.js.coffee
app/assets/javascripts/locmare/profiler/association.js.coffee
app/assets/javascripts/locmare/profiler/association/belongs_to.js.coffee
app/assets/javascripts/locmare/profiler/association/has_many.js.coffee
app/assets/javascripts/locmare/profiler/association/has_one.js.coffee
app/assets/javascripts/locmare/profiler/header.js.coffee
app/assets/javascripts/models/balloon.js.coffee
app/assets/javascripts/models/folder.js.coffee
app/assets/javascripts/models/ground_picture.js.coffee
app/assets/javascripts/models/license.js.coffee
app/assets/javascripts/models/original_picture.js.coffee
app/assets/javascripts/models/panel_picture.js.coffee
app/assets/javascripts/models/resource_picture.js.coffee
app/assets/javascripts/models/speech.js.coffee
app/assets/javascripts/models/speech_balloon.js.coffee
app/assets/javascripts/models/speech_balloon_template.js.coffee
app/assets/javascripts/models/system_picture.js.coffee
app/assets/javascripts/models/writing_format.js.coffee
app/assets/javascripts/peta/item.js.coffee
app/assets/javascripts/pettanr/picture.js.coffee
app/assets/javascripts/routes.js.coffee
app/assets/javascripts/views.js.coffee
app/assets/javascripts/views/balloons/summary.js.coffee
app/assets/javascripts/views/common.js.coffee
app/assets/javascripts/views/ground_colors/summary.js.coffee
app/assets/javascripts/views/ground_colors/symbol.js.coffee
app/assets/javascripts/views/ground_pictures/summary.js.coffee
app/assets/javascripts/views/original_pictures/publish.js.coffee [new file with mode: 0644]
app/assets/javascripts/views/original_pictures/summary.js.coffee
app/assets/javascripts/views/panel_pictures/summary.js.coffee
app/assets/javascripts/views/panels/summary.js.coffee
app/assets/javascripts/views/speech_balloons/summary.js.coffee
app/assets/javascripts/views/speeches/summary.js.coffee

index 98411cb..c57fbd9 100644 (file)
@@ -8,6 +8,12 @@ class Locmare.Filer extends Backbone.View
     @manifest = LocalManifest.manifest().filers[@item_name]\r
     @header = new Locmare.FilerModule.Header({'filer': this})\r
     @body = new Locmare.FilerModule.Body({'filer': this})\r
+    @listenTo(@header, 'click', @click_header)\r
+    @listenTo(@body, 'click:symbol', @click_symbol)\r
+    @listenTo(@body, 'click:caption', @click_caption)\r
+    @listenTo(@body, 'click:prof', @click_prof)\r
+    @listenTo(@body, 'navigate', @navigate)\r
+    @listenTo(@pager, 'navigate', @navigate) if @pager\r
     @render()\r
   \r
   render: () ->\r
@@ -27,5 +33,22 @@ class Locmare.Filer extends Backbone.View
   image_dir: () ->\r
     '/images/'\r
   \r
+  click_header: (url) ->\r
+    @trigger('click:header', url)\r
+    window.router.navigate(url, true)\r
+  \r
+  click_symbol: (item_view) ->\r
+    @trigger('click:symbol', item_view)\r
+  \r
+  click_caption: (item_view) ->\r
+    @trigger('click:caption', item_view)\r
+  \r
+  click_prof: (item_view) ->\r
+    @trigger('click:prof', item_view)\r
+  \r
+  navigate: (url) ->\r
+    @trigger('navigate', url)\r
+    window.router.navigate(url, true)\r
+  \r
 class Locmare.FilerModule\r
 \r
index b31c8fb..7fb1e70 100644 (file)
@@ -5,6 +5,8 @@ class Locmare.FilerModule.Body extends Backbone.View
     @filer = options.filer\r
     @file_header = new Locmare.FilerModule.BodyModule.FileHeader({'body': this})\r
     @file_body = new Locmare.FilerModule.BodyModule.FileBody({'body': this})\r
+    @listenTo(@file_body, 'click:symbol', @click_symbol)\r
+    @listenTo(@file_body, 'navigate', @navigate)\r
   \r
   render: () ->\r
     this.$el.append(@file_header.render().el)\r
@@ -31,5 +33,11 @@ class Locmare.FilerModule.Body extends Backbone.View
   items: () ->\r
     @filer.items\r
   \r
+  click_symbol: (symbol_view) ->\r
+    @trigger('click:symbol', symbol_view)\r
+  \r
+  navigate: (url) ->\r
+    @trigger('navigate', url)\r
+  \r
 class Locmare.FilerModule.BodyModule\r
 \r
index 191fa48..47d6b45 100644 (file)
@@ -6,9 +6,12 @@ class Locmare.FilerModule.BodyModule.FileBody extends Backbone.View
     @file_items = []\r
     @file_items = _.map @filer().items, (item) =>\r
       fi = @file_item_class()\r
-      new fi({'file_body': this, 'item': item})\r
+      file_item_view = new fi({'file_body': this, 'item': item})\r
+      @listenTo(file_item_view, 'click:symbol', @click_symbol)\r
+      @listenTo(file_item_view, 'navigate', @navigate)\r
+      file_item_view\r
     @render()\r
-\r
+  \r
   render: () ->\r
     this.$el.html('')\r
     _.each @file_items, (file_item) =>\r
@@ -33,13 +36,10 @@ class Locmare.FilerModule.BodyModule.FileBody extends Backbone.View
   items: () ->\r
     @filer().items\r
   \r
-  template_dir: () ->\r
-    @filer().template_dir\r
-  \r
-  template_file_name: () ->\r
-    "file_body"\r
+  click_symbol: (symbol_view) ->\r
+    @trigger('click:symbol', symbol_view)\r
   \r
-  template_name: () ->\r
-    @template_dir() + @template_file_name()\r
+  navigate: (url) ->\r
+    @trigger('navigate', url)\r
   \r
 class Locmare.FilerModule.BodyModule.FileBodyModule\r
index a91b3b6..5b68b3e 100644 (file)
@@ -11,6 +11,14 @@ class Locmare.FilerModule.BodyModule.FileBodyModule.FileItem extends Backbone.Vi
     @date = Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.DateItemColumnFactory.factory this, @manifest().date, @item\r
     @edit = Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.EditItemColumnFactory.factory this, @manifest().edit, @item\r
     @el.className = 'filer-item filer-item-' + @item.item_name()\r
+    @listenTo(@symbol, 'click:symbol', @click_symbol)\r
+    @listenTo(@caption, 'click:caption', @click_caption)\r
+    @listenTo(@icon, 'click:prof', @click_prof)\r
+    @listenTo(@symbol, 'navigate', @navigate)\r
+    @listenTo(@caption, 'navigate', @navigate)\r
+    @listenTo(@summary, 'navigate', @navigate)\r
+    @listenTo(@icon, 'navigate', @navigate)\r
+    @listenTo(@edit, 'navigate', @navigate)\r
   \r
   render: () ->\r
     if @symbol.is_visible()\r
@@ -42,14 +50,18 @@ class Locmare.FilerModule.BodyModule.FileBodyModule.FileItem extends Backbone.Vi
   items: () ->\r
     @filer().items\r
   \r
-  template_dir: () ->\r
-    @filer().template_dir\r
+  click_symbol: () ->\r
+    @trigger('click:symbol', this)\r
   \r
-  template_file_name: () ->\r
-    "file_item"\r
+  click_caption: () ->\r
+    @trigger('click:caption', this)\r
   \r
-  template_name: () ->\r
-    @template_dir() + @template_file_name()\r
+  click_prof: (url) ->\r
+    @trigger('click:prof', this)\r
+    @trigger('navigate', url)\r
+  \r
+  navigate: (url) ->\r
+    @trigger('navigate', url)\r
   \r
 class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule\r
 \r
index 21f26fe..b8deb9a 100644 (file)
@@ -11,6 +11,9 @@ class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.CaptionItemCo
   render: () ->\r
     this\r
   \r
+  has_link: () ->\r
+    @my_manifest.link.type != 'none'\r
+  \r
   filer: () ->\r
     @file_item.filer()\r
   \r
@@ -23,9 +26,3 @@ class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.CaptionItemCo
   is_visible: () ->\r
     true\r
   \r
-  template_dir: () ->\r
-    @filer().template_dir + @column_name + '-'\r
-  \r
-  template_name: () ->\r
-    @template_dir() + @template_file_name()\r
\r
index 60cce29..773f7d9 100644 (file)
@@ -1,24 +1,36 @@
 class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.CaptionItemColumnModule.Default extends Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.CaptionItemColumnModule.Base\r
   initialize: (options) ->\r
     super(options)\r
-    m = Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.CaptionItemColumnModule.DefaultModule\r
-    @face = m.FaceFactory.factory this, @my_manifest.face, @item\r
-    @link = m.LinkFactory.factory this, @my_manifest.link, @item\r
+    @face = @mdl().FaceFactory.factory this, @my_manifest.face, @item\r
+    @link = @mdl().LinkFactory.factory this, @my_manifest.link, @item\r
+    @listenTo(@face, 'ready:caption', @ready_caption)\r
   \r
   render: () ->\r
-    if @has_link()\r
-      this.$el.html(@link.render().el)\r
-      @delegateEvents({'click .face': 'show'}) \r
+    icon = new Pettanr.Views.Common.LoadIcon()\r
+    this.$el.html(icon.render().el)\r
+    @face.render()  # raise fetch\r
+    this\r
+  \r
+  ready_caption: (caption) ->\r
+    el = if @has_link()\r
+      linked_caption = new Tag.A({\r
+        attr: {href: @link.url()}, \r
+        content: caption\r
+      })\r
+      @listenTo(linked_caption, 'click', @click)\r
+      linked_caption.render().el\r
     else\r
-      this.$el.html(@face.el)\r
+      caption\r
+    this.$el.html(el)\r
     this\r
   \r
-  has_link: () ->\r
-    @my_manifest.link.type != 'none'\r
+  click: () ->\r
+    @trigger('click:caption')\r
+    @trigger('navigate', @link.url())\r
+    false\r
   \r
-  show: () ->\r
-    window.router.navigate(@link.url(), true);\r
-    return false\r
+  mdl: () ->\r
+    Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.CaptionItemColumnModule.DefaultModule\r
   \r
 class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.CaptionItemColumnModule.DefaultModule\r
   \r
index 7c555c9..2f825e0 100644 (file)
@@ -1,20 +1,16 @@
 class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.CaptionItemColumnModule.DefaultModule.FaceModule.BaseFace extends Backbone.View\r
-  tagName: 'div'\r
-  className: 'face'\r
   \r
   initialize: (options) ->\r
     @default_caption = options.default_caption\r
     @my_manifest = options.my_manifest\r
     @item = options.item\r
-    @clear()\r
-    @listenTo(@item, 'ready:caption', @render)\r
   \r
-  clear: () ->\r
-    icon = new Pettanr.Views.Common.LoadIcon()\r
-    this.$el.html(icon.render().el)\r
+  # not render\r
+  # get caption data and send message\r
+  render: () ->\r
     this\r
   \r
-  render: () ->\r
+  replace_empty: () ->\r
     if Pettanr.is_blank(@caption())\r
       empty = new Pettanr.Views.Common.EmptyCaption()\r
       this.$el.html(empty.render().el)\r
index a6f815c..f979f8c 100644 (file)
@@ -2,11 +2,10 @@ class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.CaptionItemCo
   \r
   initialize: (options) ->\r
     super(options)\r
-    @render()\r
   \r
-  face: () ->\r
-    @item.escape(@my_manifest.column_name)\r
-  \r
-  caption: () ->\r
-    @face()\r
+  # not render\r
+  # get caption data and send message\r
+  render: () ->\r
+    caption = Pettanr.Views.Common.replace_empty(@item.escape(@my_manifest.column_name))\r
+    @trigger('ready:caption', caption)\r
   \r
index 6277d79..aababa4 100644 (file)
@@ -2,12 +2,18 @@ class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.CaptionItemCo
   \r
   initialize: (options) ->\r
     super(options)\r
+  \r
+  # not render\r
+  # get caption data and send message\r
+  render: () ->\r
     if @item[@method_name()]\r
+      @listenTo(@item, 'ready:caption', @ready_caption)\r
+      # fetch caption by manifest method_name\r
       @item[@method_name()]()\r
   \r
   method_name: () ->\r
     @my_manifest.method_name\r
   \r
-  caption: () ->\r
-    @item.caption_text\r
+  ready_caption: (caption) ->\r
+    @trigger('ready:caption', Pettanr.Views.Common.replace_empty(caption))\r
   \r
index 91d0302..e50865b 100644 (file)
@@ -2,21 +2,20 @@ class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.EditItemColum
   \r
   initialize: (options) ->\r
     super(options)\r
-    @edit_icon = new Pettanr.Image.SymbolImg({\r
-      attr: {'src': @edit_img_file_name()}, \r
-      half: true\r
-    })\r
-    url = 'home/configure'\r
-    @edit_btn = new Tag.A({\r
-      attr: {href: '/' + url}, \r
-      handler_name: url,\r
-      content: @edit_icon.render().el\r
-    })\r
   \r
   render: () ->\r
     this.$el.html('')\r
     if @is_own()\r
-      this.$el.append(@edit_btn.render().el)\r
+      edit_icon = new Pettanr.Image.SymbolImg({\r
+        attr: {'src': @edit_img_file_name()}, \r
+        half: true\r
+      })\r
+      edit_btn = new Tag.A({\r
+        attr: {href: '/' + @edit_url()}, \r
+        content: edit_icon.render().el\r
+      })\r
+      @listenTo(edit_btn, 'click', @click_edit)\r
+      this.$el.append(edit_btn.render().el)\r
     this\r
   \r
   is_own: () ->\r
@@ -28,3 +27,9 @@ class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.EditItemColum
   edit_img_file_name: () ->\r
     @image_dir() + 'edit.png'\r
    \r
+  edit_url: () ->\r
+    'home/configure'\r
+   \r
+  click_edit: () ->\r
+    @trigger('navigate', @edit_url())\r
+  \r
index 17d9f17..671600c 100644 (file)
@@ -26,12 +26,3 @@ class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.EditItemColum
   is_visible: () ->\r
     true\r
   \r
-  template_dir: () ->\r
-    @filer().template_dir + 'edit-'\r
-  \r
-  template_file_name: () ->\r
-    ""\r
-  \r
-  template_name: () ->\r
-    @template_dir() + @template_file_name()\r
-  \r
index bc94ccd..e7164d5 100644 (file)
@@ -6,22 +6,20 @@ class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.EditItemColum
       attr: {'src': @edit_img_file_name()}, \r
       half: true\r
     })\r
-    url = Pettanr.url(@item.table_name(), 'edit', {id: @item.get('id')})\r
     @edit_btn = new Tag.A({\r
-      attr: {href: '/' + url}, \r
-      handler_name: url,\r
+      attr: {href: '/' + @item.edit_url()}, \r
       content: @edit_icon.render().el\r
     })\r
     @remove_icon = new Pettanr.Image.SymbolImg({\r
       attr: {'src': @remove_img_file_name()}, \r
       half: true\r
     })\r
-    url = Pettanr.url(@item.table_name(), 'destroy', {id: @item.get('id')})\r
     @remove_btn = new Tag.A({\r
-      attr: {href: '/' + url}, \r
-      handler_name: url,\r
+      attr: {href: '/' + @item.destroy_url()}, \r
       content: @remove_icon.render().el\r
     })\r
+    @listenTo(@edit_btn, 'click', @click_edit)\r
+    @listenTo(@remove_btn, 'click', @click_remove)\r
   \r
   render: () ->\r
     this.$el.html('')\r
@@ -42,3 +40,9 @@ class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.EditItemColum
   remove_img_file_name: () ->\r
     @image_dir() + 'remove.png'\r
   \r
+  click_edit: () ->\r
+    @trigger('navigate', @item.edit_url())\r
+  \r
+  click_remove: () ->\r
+    @trigger('navigate', @item.destroy_url())\r
+  \r
index 5fd8437..2cff29c 100644 (file)
@@ -2,19 +2,19 @@ class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.EditItemColum
   \r
   initialize: (options) ->\r
     super(options)\r
+    mdl = Pettanr.Views[@item.singular()]\r
+    templates = mdl.templates()\r
+    template_class = templates[@template_file_name()]\r
+    @view = new template_class(options)\r
   \r
-  column_template_file_name: () ->\r
-    'show'\r
-  \r
-  item_template_file_name: () ->\r
-    'template'\r
-  \r
-  template_dir: () ->\r
-    @item.path_name() + '-'\r
+  render: () ->\r
+    @listenTo(@view, 'navigate', @navigate)\r
+    this.$el.html(@view.render().el)\r
+    this\r
   \r
   template_file_name: () ->\r
-    @my_manifest.template_name()\r
+    @my_manifest.template_name\r
   \r
-  template_name: () ->\r
-    @template_dir() + @template_file_name()\r
+  navigate: (url) ->\r
+    @trigger('navigate', url)\r
   \r
index b8cf6c7..70ea7cf 100644 (file)
@@ -20,7 +20,7 @@ class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.IconItemColum
     this.$el.html(template(args))\r
     this\r
   \r
-  profiler: () ->\r
+  url: () ->\r
     controller = Manifest.manifest().controllers[@item.table_name()]\r
     action = controller.actions['show']\r
     params = {\r
@@ -29,8 +29,10 @@ class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.IconItemColum
       id: @item.get('id'),\r
       format: 'prof'\r
     }\r
-    window.router.navigate(action.url(params), true)\r
-    return false\r
+    action.url(params)\r
+  \r
+  click: () ->\r
+    @trigger('click:prof', @url())\r
   \r
   filer: () ->\r
     @file_item.filer()\r
index bb5eb7d..62986c5 100644 (file)
@@ -11,26 +11,13 @@ class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.IconItemColum
       }\r
     })\r
     a = new Tag.A({\r
-      attr: {href: @url()}, \r
+      attr: {href: '/' + @url()}, \r
       content: icon.render().el\r
     })\r
     this.$el.html(a.render().el)\r
-    @delegateEvents({\r
-      'click .face': 'profiler',\r
-    })\r
+    @listenTo(a, 'click', @click)\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
   icon_file_name: () ->\r
     '/images/prof.gif'\r
    \r
index 54a5347..9148ff0 100644 (file)
@@ -6,6 +6,10 @@ class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.SummaryItemCo
   render: () ->\r
     view = Pettanr.Views[@item.singular()]\r
     summary = new view[view.summary()]({item: @item})\r
+    @listenTo(summary, 'navigate', @navigate)\r
     this.$el.html(summary.el)\r
     this\r
\r
+  \r
+  navigate: (url) ->\r
+    @trigger('navigate', url)\r
+  \r
index c47105a..1db3f8e 100644 (file)
@@ -11,6 +11,9 @@ class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.SymbolItemCol
   render: () ->\r
     this\r
   \r
+  has_link: () ->\r
+    @my_manifest.link.type != 'none'\r
+  \r
   filer: () ->\r
     @file_item.filer()\r
   \r
@@ -23,9 +26,6 @@ class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.SymbolItemCol
   is_visible: () ->\r
     true\r
   \r
-  template_dir: () ->\r
-    @filer().template_dir + @column_name + '-'\r
+  click: () ->\r
+    # trigger click:symbol event with url\r
   \r
-  template_name: () ->\r
-    @template_dir() + @template_file_name()\r
\r
index 4e6534e..b497124 100644 (file)
@@ -1,23 +1,34 @@
 class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.SymbolItemColumnModule.Default extends Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.SymbolItemColumnModule.Base\r
   initialize: (options) ->\r
     super(options)\r
-    m = Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.SymbolItemColumnModule.DefaultModule\r
-    @face = m.FaceFactory.factory this, @my_manifest.face, @item\r
-    @link = m.LinkFactory.factory this, @my_manifest.link, @item\r
+    @face = @mdl().FaceFactory.factory this, @my_manifest.face, @item\r
+    @link = @mdl().LinkFactory.factory this, @my_manifest.link, @item\r
+    @listenTo(@face, 'ready:symbol', @ready_symbol)\r
   \r
   render: () ->\r
-    if @has_link()\r
-      this.$el.html(@link.render().el)\r
-      @delegateEvents({'click .face': 'show'}) \r
-    else\r
-      this.$el.html(@face.el)\r
+    icon = new Pettanr.Views.Common.LoadIcon()\r
+    this.$el.html(icon.render().el)\r
+    @face.render()  # raise fetch\r
     this\r
   \r
-  has_link: () ->\r
-    @my_manifest.link.type != 'none'\r
+  ready_symbol: (symbol) ->\r
+    view = if @has_link()\r
+      linked_symbol = new Tag.A({\r
+        attr: {href: @link.url()}, \r
+        content: symbol.render().el\r
+      })\r
+      @listenTo(linked_symbol, 'click', @click)\r
+      linked_symbol\r
+    else\r
+      symbol\r
+    this.$el.html(view.render().el)\r
+  \r
+  click: () ->\r
+    @trigger('click:symbol')\r
+    @trigger('navigate', @link.url())\r
+    false\r
   \r
-  show: () ->\r
-    window.router.navigate(@link.url(), true)\r
-    return false\r
+  mdl: () ->\r
+    Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.SymbolItemColumnModule.DefaultModule\r
   \r
 class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.SymbolItemColumnModule.DefaultModule\r
index a7ece41..7361a7d 100644 (file)
@@ -1,19 +1,12 @@
 class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.SymbolItemColumnModule.DefaultModule.FaceModule.BaseFace extends Backbone.View\r
-  tagName: 'div'\r
-  className: 'face'\r
   \r
   initialize: (options) ->\r
     @default_symbol = options.default_symbol\r
     @my_manifest = options.my_manifest\r
     @item = options.item\r
-    @clear()\r
-    @listenTo(@item, 'ready:symbol', @render)\r
-  \r
-  clear: () ->\r
-    icon = new Pettanr.Views.Common.LoadIcon()\r
-    this.$el.html(icon.render().el)\r
-    this\r
   \r
+  # not render\r
+  # get symbol data and send message\r
   render: () ->\r
     this\r
   \r
@@ -26,6 +19,3 @@ class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.SymbolItemCol
   item_name: () ->\r
     @filer().item_name\r
   \r
-  icon_size: () ->\r
-    Manifest.manifest().magic_numbers['thumbnail_width']\r
-  \r
index a366943..d92afcd 100644 (file)
@@ -2,16 +2,16 @@ class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.SymbolItemCol
   \r
   initialize: (options) ->\r
     super(options)\r
-    @picture = new Pettanr.Image.SymbolImg({\r
+  \r
+  # 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
-    @render()\r
-  \r
-  render: () ->\r
-    this.$el.html(@picture.render().el)\r
-    this\r
+    @trigger('ready:symbol', picture)\r
   \r
   url: () ->\r
     @my_manifest.url\r
index bb611db..e3179b0 100644 (file)
@@ -2,21 +2,19 @@ class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.SymbolItemCol
   \r
   initialize: (options) ->\r
     super(options)\r
-    if @item[@method_name()]\r
-      @item[@method_name()]()\r
   \r
+  # not render\r
+  # get symbol data and send message\r
   render: () ->\r
-    if @item.symbol_picture\r
-      this.$el.html(@item.symbol_picture.render().el)\r
-    else\r
-      picture = new Pettanr.Image.SymbolImg({\r
-        attr: {\r
-          src: '/images/error.png'\r
-        }\r
-      })\r
-      this.$el.html(picture.render().el)\r
+    if @item[@method_name()]\r
+      @listenTo(@item, 'ready:symbol', @ready_symbol)\r
+      # fetch symbol by symbol_option\r
+      @item[@method_name()]()\r
     this\r
   \r
   method_name: () ->\r
     @my_manifest.method_name\r
   \r
+  ready_symbol: (symbol) ->\r
+    @trigger('ready:symbol', symbol)\r
+  \r
index fa9a13e..bbd6b46 100644 (file)
@@ -3,11 +3,6 @@ class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.SymbolItemCol
   initialize: (options) ->\r
     super(options)\r
   \r
-  render: () ->\r
-    this.$el.attr('href', @url())\r
-    this.$el.html(@face.el)\r
-    this\r
-  \r
   url: () ->\r
     controller = Manifest.manifest().controllers[@item.table_name()]\r
     action = controller.actions[@my_manifest.action_name]\r
index 54ec7df..0d3f96d 100644 (file)
@@ -1,11 +1,9 @@
 class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.SymbolItemColumnModule.DefaultModule.LinkModule.BaseLink extends Backbone.View\r
-  tagName: 'a'\r
   \r
   initialize: (options) ->\r
     @default_symbol = options.default_symbol\r
     @my_manifest = options.my_manifest\r
     @item = options.item\r
-    @face = @default_symbol.face\r
   \r
   url: () ->\r
     raise "undefined url\n"\r
index 8ebf318..d5902cd 100644 (file)
@@ -3,14 +3,6 @@ class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.SymbolItemCol
   initialize: (options) ->\r
     super(options)\r
   \r
-  render: () ->\r
-    this.$el.attr('href', @url())\r
-    this.$el.html(@face.el)\r
-    this\r
-  \r
-  js_url: () ->\r
-    "javascript:void(0)"\r
-  \r
   url: () ->\r
     @item.get(@my_manifest.column_name)\r
   \r
index 8c0110c..46d9111 100644 (file)
@@ -2,22 +2,17 @@ class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.SymbolItemCol
   \r
   initialize: (options) ->\r
     super(options)\r
-    @face = new Pettanr.Views[@item.singular()].Symbol({\r
-      item: @item\r
-    })\r
   \r
   render: () ->\r
-    this.$el.html(@face.render().el)\r
-    @delegateEvents({\r
-      'click .face': 'show'\r
+    view = new Pettanr.Views[@item.singular()].Symbol({\r
+      item: @item\r
     })\r
+    @listenTo(view, 'click', @click)\r
+    this.$el.html(view.render().el)\r
     this\r
   \r
-  show: () ->\r
-    # unique template\r
-    window.router.navigate(@url(), true)\r
-    return false\r
-    \r
-  url: () ->\r
-    Pettanr.url(@item.table_name(), 'show', {id: @item.get('id')})\r
+  \r
+  click: () ->\r
+    @trigger('click:symbol')\r
+    @trigger('navigate', @item.show_url())\r
   \r
index 5e4f29f..6b4fbec 100644 (file)
@@ -8,13 +8,15 @@ class Locmare.FilerModule.Header extends Backbone.View
     this.$el.html('')\r
     icon = new Pettanr.Image.Icon({item: @model(), half: true})\r
     caption = Pettanr.AppHelper.t_m(@model().singular())\r
-    url = Pettanr.url(@model().table_name(), 'index', {})\r
+    url = @model().index_url()\r
     linked_icon = new Tag.A({\r
-      attr: {href: '/' + url}, handler_name: url, content: icon.render().el\r
+      attr: {href: '/' + url}, content: icon.render().el\r
     })\r
     linked_caption = new Tag.A({\r
-      attr: {href: '/' + url}, handler_name: url, content: caption\r
+      attr: {href: '/' + url}, content: caption\r
     })\r
+    @listenTo(linked_icon, 'click', @click)\r
+    @listenTo(linked_caption, 'click', @click)\r
     this.$el.append(linked_icon.render().el)\r
     this.$el.append(linked_caption.render().el)\r
     this\r
@@ -25,3 +27,6 @@ class Locmare.FilerModule.Header extends Backbone.View
   human_name: () ->\r
     @model.model_name.human\r
   \r
+  click: () ->\r
+    @trigger('click', @model().index_url())\r
+  \r
index e055aff..efbc3d7 100644 (file)
@@ -31,43 +31,48 @@ class Locmare.ListGroupModule.LibModule.PagerModule.Default extends Backbone.Vie
   render: () ->\r
     this.$el.html('')\r
     if @hasPreviousPage()\r
-      this.$el.append(\r
-        (new Locmare.ListGroupModule.LibModule.PagerModule.FirstPage({\r
-          parent: this, page: 1, class_name: 'first'\r
-        })).render().el\r
-      )\r
+      view = new Locmare.ListGroupModule.LibModule.PagerModule.FirstPage({\r
+        parent: this, page: 1, class_name: 'first'\r
+      })\r
+      @listenTo(view, 'navigate', @navigate)\r
+      @listenTo(view, 'page', @click)\r
+      this.$el.append(view.render().el)\r
     if @hasPreviousPage()\r
-      this.$el.append(\r
-        (new Locmare.ListGroupModule.LibModule.PagerModule.PrevPage({\r
-          parent: this, page: @current_page - 1, class_name: 'prev'\r
-        })).render().el\r
-      )\r
+      view = new Locmare.ListGroupModule.LibModule.PagerModule.PrevPage({\r
+        parent: this, page: @current_page - 1, class_name: 'prev'\r
+      })\r
+      @listenTo(view, 'navigate', @navigate)\r
+      @listenTo(view, 'page', @click)\r
+      this.$el.append(view.render().el)\r
     if @hasPreviousPageGap()\r
       this.$el.append(\r
         (new Locmare.ListGroupModule.LibModule.PagerModule.PageGap()).render().el\r
       )\r
     _.each @range(), (page) =>\r
-      this.$el.append(\r
-        (new Locmare.ListGroupModule.LibModule.PagerModule.Page({\r
-          parent: this, page: page, class_name: 'page'\r
-        })).render().el\r
-      )\r
+      view = new Locmare.ListGroupModule.LibModule.PagerModule.Page({\r
+        parent: this, page: page, class_name: 'page'\r
+      })\r
+      @listenTo(view, 'navigate', @navigate)\r
+      @listenTo(view, 'page', @click)\r
+      this.$el.append(view.render().el)\r
     if @hasNextPageGap()\r
       this.$el.append(\r
         (new Locmare.ListGroupModule.LibModule.PagerModule.PageGap()).render().el\r
       )\r
     if @hasNextPage()\r
-      this.$el.append(\r
-        (new Locmare.ListGroupModule.LibModule.PagerModule.NextPage({\r
-          parent: this, page: @current_page + 1, class_name: 'next'\r
-        })).render().el\r
-      )\r
+      view = new Locmare.ListGroupModule.LibModule.PagerModule.NextPage({\r
+        parent: this, page: @current_page + 1, class_name: 'next'\r
+      })\r
+      @listenTo(view, 'navigate', @navigate)\r
+      @listenTo(view, 'page', @click)\r
+      this.$el.append(view.render().el)\r
     if @hasNextPage()\r
-      this.$el.append(\r
-        (new Locmare.ListGroupModule.LibModule.PagerModule.LastPage({\r
-          parent: this, page: @total_page, class_name: 'last'\r
-        })).render().el\r
-      )\r
+      view = new Locmare.ListGroupModule.LibModule.PagerModule.LastPage({\r
+        parent: this, page: @total_page, class_name: 'last'\r
+      })\r
+      @listenTo(view, 'navigate', @navigate)\r
+      @listenTo(view, 'page', @click)\r
+      this.$el.append(view.render().el)\r
     rb = new Tag.RowBreak()\r
     this.$el.append(rb.render().el)\r
     this\r
@@ -103,6 +108,12 @@ class Locmare.ListGroupModule.LibModule.PagerModule.Default extends Backbone.Vie
     params['page_size'] = @per_page\r
     @action.url params\r
   \r
+  click: (page) ->\r
+    @trigger('page', page)\r
+  \r
+  navigate: (url) ->\r
+    @trigger('navigate', url)\r
+  \r
 class Locmare.ListGroupModule.LibModule.PagerModule.Part extends Backbone.View\r
   tagName: 'li'\r
   \r
@@ -112,26 +123,36 @@ class Locmare.ListGroupModule.LibModule.PagerModule.Part extends Backbone.View
     @el.className = options.class_name\r
   \r
   render: () ->\r
-    url = @parent.url(@page)\r
     if @page == @parent.current_page\r
       this.$el.html(@content())\r
     else\r
       linked_caption = new Tag.A({\r
-        attr: {href: '/' + url}, \r
-        handler_name: url,\r
+        attr: {href: '/' + @url()}, \r
         content: @content()\r
       })\r
+      @listenTo(linked_caption, 'click', @click)\r
       this.$el.html(linked_caption.render().el)\r
     this\r
   \r
   content: () ->\r
     ''\r
   \r
+  url: () ->\r
+    @parent.url(@page)\r
+  \r
+  click: () ->\r
+    @trigger('page', @page)\r
+    @trigger('navigate', @url())\r
+  \r
 class Locmare.ListGroupModule.LibModule.PagerModule.FirstPage extends Locmare.ListGroupModule.LibModule.PagerModule.Part\r
   \r
   content: () ->\r
     '<<'\r
   \r
+  click: () ->\r
+    @trigger('page', @page)\r
+    @trigger('navigate', @url())\r
+  \r
 class Locmare.ListGroupModule.LibModule.PagerModule.PrevPage extends Locmare.ListGroupModule.LibModule.PagerModule.Part\r
   \r
   content: () ->\r
index 2d6bb1f..2d12174 100644 (file)
@@ -19,14 +19,17 @@ class Locmare.ProfilerModule.Association extends Backbone.View
     caption = new Tag.Div({class_name: 'caption', content: 'belongs_to'})\r
     this.$el.append(caption.render().el)\r
     _.each @belongs_to, (f) =>\r
+      @listenTo(f, 'navigate', @navigate)\r
       this.$el.append(f.render().el)\r
     caption = new Tag.Div({class_name: 'caption', content: 'has_many'})\r
     this.$el.append(caption.render().el)\r
     _.each @has_many, (f) =>\r
+      @listenTo(f, 'navigate', @navigate)\r
       this.$el.append(f.render().el)\r
     caption = new Tag.Div({class_name: 'caption', content: 'has_one'})\r
     this.$el.append(caption.render().el)\r
     _.each @has_one, (f) =>\r
+      @listenTo(f, 'navigate', @navigate)\r
       this.$el.append(f.render().el)\r
     this\r
   \r
@@ -36,5 +39,8 @@ class Locmare.ProfilerModule.Association extends Backbone.View
   model_manifest: () ->\r
     Manifest.manifest().models[@profiler.item_name]\r
   \r
+  navigate: (url) ->\r
+    @trigger('navigate', url)\r
+  \r
 class Locmare.ProfilerModule.AssociationModule\r
 \r
index 7ac4046..3821362 100644 (file)
@@ -13,6 +13,7 @@ class Locmare.ProfilerModule.AssociationModule.BelongsTo extends Backbone.View
         pager: null, \r
         operators: @profiler().operators\r
       })\r
+      @listenTo(@filer, 'navigate', @navigate)\r
       @render()\r
   \r
   render: () ->\r
@@ -38,3 +39,6 @@ class Locmare.ProfilerModule.AssociationModule.BelongsTo extends Backbone.View
   profiler: () ->\r
     @association.profiler\r
   \r
+  navigate: (url) ->\r
+    @trigger('navigate', url)\r
+  \r
index d2475a1..eb3d129 100644 (file)
@@ -18,6 +18,7 @@ class Locmare.ProfilerModule.AssociationModule.HasMany extends Backbone.View
         pager: @pager, \r
         operators: @profiler().operators\r
       })\r
+      @listenTo(@filer, 'navigate', @navigate)\r
       @render()\r
     )\r
   \r
@@ -33,4 +34,7 @@ class Locmare.ProfilerModule.AssociationModule.HasMany extends Backbone.View
   \r
   profiler: () ->\r
     @association.profiler\r
+  \r
+  navigate: (url) ->\r
+    @trigger('navigate', url)\r
  \r
index a07f4f8..d9b9f8c 100644 (file)
@@ -18,6 +18,7 @@ class Locmare.ProfilerModule.AssociationModule.HasOne extends Backbone.View
         pager: @pager, \r
         operators: @profiler().operators\r
       })\r
+      @listenTo(@filer, 'navigate', @navigate)\r
       @render()\r
     )\r
   \r
@@ -36,3 +37,6 @@ class Locmare.ProfilerModule.AssociationModule.HasOne extends Backbone.View
   profiler: () ->\r
     @association.profiler\r
   \r
+  navigate: (url) ->\r
+    @trigger('navigate', url)\r
+  \r
index 2c3097f..96388e5 100644 (file)
@@ -10,8 +10,12 @@ class Locmare.ProfilerModule.Header extends Backbone.View
       pager: @pager, \r
       operators: @profiler.operators\r
     })\r
+    @listenTo(@filer, 'navigate', @navigate)\r
   \r
   render: () ->\r
     this.$el.html(@filer.el)\r
     this\r
   \r
+  navigate: (url) ->\r
+    @trigger('navigate', url)\r
+  \r
index 48c95de..0ed171f 100644 (file)
@@ -32,8 +32,7 @@ class Pettanr.Balloon extends Peta.Element
       sbt.fetch({cache: true}).done =>\r
         sp = sbt.system_picture()\r
         sp.fetch({cache: true}).done =>\r
-          @symbol_picture = sp.tmb_opt_img_tag()\r
-          @trigger('ready:symbol')\r
+          @trigger('ready:symbol', sp.tmb_opt_img_tag())\r
   \r
   initialize: () ->\r
     if @id\r
index 5e8e8b3..961396f 100644 (file)
@@ -16,8 +16,8 @@ class Pettanr.Folder extends Peta.Owner
     @get('name').replace(/\/$/, '').split('/').pop()\r
   \r
   filer_caption: () ->\r
-    @caption_text = _.escape(@caption())\r
-    @trigger('ready:caption')\r
+    caption = _.escape(@caption())\r
+    @trigger('ready:caption', caption)\r
   \r
   is_remote: () ->\r
     if @get('category_id') == 10\r
index 251b8ab..a699cce 100644 (file)
@@ -38,8 +38,7 @@ class Pettanr.GroundPicture extends Peta.Element
   symbol_option: () ->\r
     i = @picture()\r
     i.fetch({cache: true}).done =>\r
-      @symbol_picture = i.tmb_opt_img_tag()\r
-      @trigger('ready:symbol')\r
+      @trigger('ready:symbol', i.tmb_opt_img_tag())\r
   \r
   repeat_text: () ->\r
     Pettanr.GroundPicture.repeat_texts()[@get('repeat')]\r
index 7c4799f..d01e3b4 100644 (file)
@@ -20,14 +20,13 @@ class Pettanr.License extends Peta.SystemResource
   symbol_option: () ->\r
     i = @system_picture()\r
     i.fetch({cache: true}).done =>\r
-      @symbol_picture = i.tmb_opt_img_tag()\r
-      @trigger('ready:symbol')\r
+      @trigger('ready:symbol', i.tmb_opt_img_tag())\r
   \r
   caption_with_group: () ->\r
     i = @license_group()\r
     i.fetch({cache: true}).done =>\r
-      @caption_text = i.escape('caption') + '/' + @escape('caption')\r
-      @trigger('ready:caption')\r
+      caption = i.escape('caption') + '/' + @escape('caption')\r
+      @trigger('ready:caption', caption)\r
   \r
   initialize: () ->\r
     if @id\r
index 77015a3..00cf226 100644 (file)
@@ -40,18 +40,17 @@ class Pettanr.OriginalPicture extends Peta.Content
   \r
   symbol_option: () ->\r
     @fetch({cache: true}).done =>\r
-      @symbol_picture = @tmb_opt_img_tag()\r
-      @trigger('ready:symbol')\r
+      @trigger('ready:symbol', @tmb_opt_img_tag())\r
   \r
   filer_caption: () ->\r
     history = @history()\r
     history.fetch({cache: true}).done =>\r
-      @caption_text = if _.isEmpty(history.models)\r
+      caption = if _.isEmpty(history.models)\r
         'unpublished'\r
       else\r
         head = _.first(history.models)\r
         Pettanr.to_s(head.get('revision'))\r
-      @trigger('ready:caption')\r
+      @trigger('ready:caption', caption)\r
   \r
   revision: () ->\r
     new Pettanr.OriginalPicture.Head({original_picture: this})\r
index 7544193..eaac8a5 100644 (file)
@@ -56,8 +56,7 @@ class Pettanr.PanelPicture extends Peta.Element
   symbol_option: () ->\r
     i = @picture()\r
     i.fetch({cache: true}).done =>\r
-      @symbol_picture = i.tmb_opt_img_tag()\r
-      @trigger('ready:symbol')\r
+      @trigger('ready:symbol', i.tmb_opt_img_tag())\r
   \r
   element_face: () ->\r
     new Pettanr.Views.PanelPicture.ElementFace({element: this})\r
index 141b66c..86024e3 100644 (file)
@@ -51,8 +51,7 @@ class Pettanr.ResourcePicture extends Peta.Content
   \r
   symbol_option: () ->\r
     @fetch({cache: true}).done =>\r
-      @symbol_picture = @tmb_opt_img_tag()\r
-      @trigger('ready:symbol')\r
+      @trigger('ready:symbol', @tmb_opt_img_tag())\r
   \r
   credit_icon_view: () ->\r
     new Pettanr.Views.ResourcePicture.CreditIcon({item: this})\r
index 42e53d7..9914732 100644 (file)
@@ -28,8 +28,7 @@ class Pettanr.Speech extends Peta.Element
       sbt.fetch({cache: true}).done =>\r
         sp = sbt.system_picture()\r
         sp.fetch({cache: true}).done =>\r
-          @symbol_picture = sp.tmb_opt_img_tag()\r
-          @trigger('ready:symbol')\r
+          @trigger('ready:symbol', sp.tmb_opt_img_tag())\r
   \r
   text_align_text: () ->\r
     Pettanr.Speech.text_align_texts()[@get('text_align')]\r
index 0294f03..d5e5280 100644 (file)
@@ -27,13 +27,12 @@ class Pettanr.SpeechBalloon extends Peta.Element
     sbt.fetch({cache: true}).done =>\r
       sp = sbt.system_picture()\r
       sp.fetch({cache: true}).done =>\r
-        @symbol_picture = sp.tmb_opt_img_tag()\r
-        @trigger('ready:symbol')\r
+        @trigger('ready:symbol', sp.tmb_opt_img_tag())\r
   \r
   filer_caption: () ->\r
     @fetch({cache: true}).done =>\r
-      @caption_text = @escape('caption')\r
-      @trigger('ready:caption')\r
+      caption = @escape('caption')\r
+      @trigger('ready:caption', caption)\r
   \r
   plain_scenario: () ->\r
     @get('caption')\r
index 3698254..0e54f78 100644 (file)
@@ -17,8 +17,7 @@ class Pettanr.SpeechBalloonTemplate extends Peta.Template
   symbol_option: () ->\r
     i = @system_picture()\r
     i.fetch({cache: true}).done =>\r
-      @symbol_picture = i.tmb_opt_img_tag()\r
-      @trigger('ready:symbol')\r
+      @trigger('ready:symbol', i.tmb_opt_img_tag())\r
   \r
   parsed_settings: () ->\r
     JSON.parse(@get('settings'))\r
index 36db60a..e718fda 100644 (file)
@@ -36,8 +36,7 @@ class Pettanr.SystemPicture extends Peta.SystemResource
   \r
   symbol_option: () ->\r
     @fetch({cache: true}).done =>\r
-      @symbol_picture = @tmb_opt_img_tag()\r
-      @trigger('ready:symbol')\r
+      @trigger('ready:symbol', @tmb_opt_img_tag())\r
   \r
   initialize: () ->\r
     if @id\r
index 61e08fc..1c3c7b8 100644 (file)
@@ -17,8 +17,7 @@ class Pettanr.WritingFormat extends Peta.Template
   symbol_option: () ->\r
     i = @system_picture()\r
     i.fetch({cache: true}).done =>\r
-      @symbol_picture = i.tmb_opt_img_tag()\r
-      @trigger('ready:symbol')\r
+      @trigger('ready:symbol', i.tmb_opt_img_tag())\r
   \r
   initialize: () ->\r
     if @id\r
index 70c2056..477ad94 100644 (file)
@@ -145,8 +145,14 @@ class Peta.Item extends Backbone.Model
   icon_view: (half) ->\r
     new Pettanr.Views[@my_class().singular()].Icon({item: this, half: half})\r
   \r
+  @index_url: () ->\r
+    Pettanr.url(@table_name(), 'index', {id: null})\r
+  \r
   index_url: () ->\r
-    Pettanr.url(@table_name(), 'index', {id: @get('id')})\r
+    @my_class().index_url()\r
+  \r
+  list_url: (action_name = 'index') ->\r
+    Pettanr.url(@table_name(), action_name, {id: @get('id')})\r
   \r
   show_url: () ->\r
     Pettanr.url(@table_name(), 'show', {id: @get('id')})\r
index 7fb42b0..6f85281 100644 (file)
@@ -81,3 +81,11 @@ class Pettanr.Image.SymbolImg extends Tag.Img
     }\r
     super(opt)\r
   \r
+class Pettanr.Image.SymbolImg.Error extends Pettanr.Image.SymbolImg\r
+  \r
+  initialize: (options) ->\r
+    super(options)\r
+    options ||= {}\r
+    options.attr ||= {}\r
+    options.attr.src ||= '/images/error.png'\r
+    \r
index f1a3b42..4b77dbc 100644 (file)
@@ -100,7 +100,7 @@ class Pettanr.Router extends Backbone.Router
   # controller only case\r
   # ex) scrolls\r
   c: (controller, query_string) ->\r
-    params = @c_i_params(controller, query_string)\r
+    params = @c_params(controller, query_string)\r
     @fire(params)\r
   \r
   c_params: (controller, query_string) ->\r
index 734a7ee..7f417f0 100644 (file)
@@ -19,6 +19,8 @@ class Pettanr.Views.Speech extends Pettanr.Views.Base
 class Pettanr.Views.GroundPicture extends Pettanr.Views.Base\r
 class Pettanr.Views.GroundColor extends Pettanr.Views.Base\r
 class Pettanr.Views.OriginalPicture extends Pettanr.Views.Base\r
+  @templates: () ->\r
+    {publish: Pettanr.Views.OriginalPicture.Publish}\r
 class Pettanr.Views.Picture extends Pettanr.Views.Base\r
 class Pettanr.Views.ResourcePicture extends Pettanr.Views.Base\r
 class Pettanr.Views.OriginalPictureLicenseGroup extends Pettanr.Views.Base\r
index f594975..5027f4e 100644 (file)
@@ -11,9 +11,11 @@ class Pettanr.Views.Balloon.Summary extends Pettanr.Views.Common.Summary
       panel = @speech_balloon.panel()\r
       panel.fetch({cache: true}).done =>\r
         @panel_icon = new Pettanr.Views.Common.Icon({item: panel, half: true})\r
+        @listenTo(@panel_icon, 'click', @panel_click)\r
         author = panel.author()\r
         author.fetch({cache: true}).done =>\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
   render: () ->\r
@@ -22,3 +24,9 @@ class Pettanr.Views.Balloon.Summary extends Pettanr.Views.Common.Summary
     this.$el.append(@author_icon_with_caption.render().el)\r
     this\r
   \r
+  panel_click: () ->\r
+    @trigger('navigate', @panel_icon.url())\r
+  \r
+  author_click: () ->\r
+    @trigger('navigate', @author_icon_with_caption.url())\r
+  \r
index 9333ed7..7a00351 100644 (file)
@@ -1,4 +1,11 @@
 class Pettanr.Views.Common\r
+  @replace_empty: (caption) ->\r
+    if Pettanr.is_blank(caption)\r
+      empty = new Pettanr.Views.Common.EmptyCaption()\r
+      empty.render().el\r
+    else\r
+      caption\r
+  \r
 class Pettanr.Views.Common.LoadIcon extends Tag.Img\r
   \r
   initialize: () ->\r
@@ -132,6 +139,7 @@ class Pettanr.Views.Common.Binder.Summary extends Pettanr.Views.Common.Summary
     @author = @item.author()\r
     @author.fetch({cache: true}).done =>\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
   render: () ->\r
@@ -140,6 +148,9 @@ class Pettanr.Views.Common.Binder.Summary extends Pettanr.Views.Common.Summary
     this.$el.append(@author_icon_with_caption.render().el)\r
     this\r
   \r
+  author_click: () ->\r
+    @trigger('navigate', @author_icon_with_caption.url())\r
+  \r
 class Pettanr.Views.Common.Leaf\r
 class Pettanr.Views.Common.Leaf.Summary extends Pettanr.Views.Common.Summary\r
   \r
@@ -148,31 +159,59 @@ class Pettanr.Views.Common.Leaf.Summary extends Pettanr.Views.Common.Summary
     @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
     @binder = @item[@binder_item_name]()\r
     @binder.fetch({cache: true}).done =>\r
       @binder_icon = @binder.icon_view(true)\r
+      @listenTo(@binder_icon, 'click', @binder_click)\r
       @binder_author = @binder.author()\r
       @binder_author.fetch({cache: true}).done =>\r
         @binder_author_icon_with_caption = @binder_author.icon_with_caption_view(true, 'name', 12)\r
-        @trigger('ready')\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
+  load_destination: () ->\r
     @destination = @item[@destination_item_name]()\r
     @destination.fetch({cache: true}).done =>\r
       @destination_icon = @destination.icon_view(true)\r
+      @listenTo(@destination_icon, 'click', @destination_click)\r
       @destination_author = @destination.author()\r
       @destination_author.fetch({cache: true}).done =>\r
         @destination_author_icon_with_caption = @destination_author.icon_with_caption_view(true, 'name', 12)\r
-        @trigger('ready')\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
   render: () ->\r
     this.$el.html('')\r
-    if @binder_author_icon_with_caption\r
-      this.$el.append(@binder_icon.render().el)\r
-      this.$el.append(@binder_author_icon_with_caption.render().el)\r
-    if @destination_author_icon_with_caption\r
-      this.$el.append(@destination_icon.render().el)\r
-      this.$el.append(@destination_author_icon_with_caption.render().el)\r
+    this.$el.append(@binder_view.render().el)\r
+    this.$el.append(@destination_view.render().el)\r
     this\r
   \r
+  binder_click: () ->\r
+    @trigger('navigate', @binder_icon.url())\r
+  \r
+  destination_click: () ->\r
+    @trigger('navigate', @destination_icon.url())\r
+  \r
+  binder_author_click: () ->\r
+    @trigger('navigate', @binder_author_icon_with_caption.url())\r
+  \r
+  destination_author_click: () ->\r
+    @trigger('navigate', @destination_author_icon_with_caption.url())\r
+  \r
index faee4dd..992544c 100644 (file)
@@ -9,9 +9,11 @@ class Pettanr.Views.GroundColor.Summary extends Pettanr.Views.Common.Summary
     panel = @item.panel()\r
     panel.fetch({cache: true}).done =>\r
       @panel_icon = new Pettanr.Views.Common.Icon({item: panel, half: true})\r
+      @listenTo(@panel_icon, 'click', @panel_click)\r
       author = panel.author()\r
       author.fetch({cache: true}).done =>\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
   render: () ->\r
@@ -20,3 +22,9 @@ class Pettanr.Views.GroundColor.Summary extends Pettanr.Views.Common.Summary
     this.$el.append(@author_icon_with_caption.render().el)\r
     this\r
   \r
+  panel_click: () ->\r
+    @trigger('navigate', @panel_icon.url())\r
+  \r
+  author_click: () ->\r
+    @trigger('navigate', @author_icon_with_caption.url())\r
+  \r
index 6aeaa69..352ee79 100644 (file)
@@ -1,10 +1,17 @@
 class Pettanr.Views.GroundColor.Symbol extends Backbone.View\r
   tagName: 'div'\r
+  events: {\r
+    'click': 'click'\r
+  }\r
   \r
   initialize: (options) ->\r
     @item = options.item\r
     @class_name = options.class_name || 'face'\r
   \r
+  clear: () ->\r
+    @trigger('ready:symbol', symbol_picture)\r
+    this\r
+  \r
   render: () ->\r
     this.$el.addClass(@class_name)\r
     this.$el.html(@fore_color())\r
@@ -32,3 +39,6 @@ class Pettanr.Views.GroundColor.Symbol extends Backbone.View
       'background-color': '#' + @bg_color()\r
     }\r
   \r
+  click: () ->\r
+    @trigger('click')\r
+  \r
index cbecb18..0844f85 100644 (file)
@@ -12,6 +12,7 @@ class Pettanr.Views.GroundPicture.Summary extends Pettanr.Views.Common.Summary
       panel = @item.panel()\r
       panel.fetch({cache: true}).done =>\r
         @panel_icon = new Pettanr.Views.Common.Icon({item: panel, half: true})\r
+        @listenTo(@panel_icon, 'click', @panel_click)\r
         @trigger('ready')\r
   \r
   render: () ->\r
@@ -20,3 +21,6 @@ class Pettanr.Views.GroundPicture.Summary extends Pettanr.Views.Common.Summary
     this.$el.append(@panel_icon.render().el)\r
     this\r
   \r
+  panel_click: () ->\r
+    @trigger('navigate', @panel_icon.url())\r
+  \r
diff --git a/app/assets/javascripts/views/original_pictures/publish.js.coffee b/app/assets/javascripts/views/original_pictures/publish.js.coffee
new file mode 100644 (file)
index 0000000..2fb8e16
--- /dev/null
@@ -0,0 +1,64 @@
+class Pettanr.Views.OriginalPicture.Publish extends Backbone.View\r
+  \r
+  initialize: (options) ->\r
+    super(options)\r
+    @file_item = options.file_item\r
+    @my_manifest = options.my_manifest\r
+    @item = options.item\r
+    # if item.resource_picture\r
+    # @resource_picture.destroy_url()\r
+    @stop_btn = new Tag.A({\r
+      attr: {href: '/' + @item.destroy_url()}, \r
+      content: I18n.t('original_pictures.index.stop')\r
+    })\r
+    @edit_icon = new Pettanr.Image.SymbolImg({\r
+      attr: {'src': @edit_img_file_name()}, \r
+      half: true\r
+    })\r
+    @edit_btn = new Tag.A({\r
+      attr: {href: '/' + @item.edit_url()}, \r
+      content: @edit_icon.render().el\r
+    })\r
+    @remove_icon = new Pettanr.Image.SymbolImg({\r
+      attr: {'src': @remove_img_file_name()}, \r
+      half: true\r
+    })\r
+    @remove_btn = new Tag.A({\r
+      attr: {href: '/' + @item.destroy_url()}, \r
+      content: @remove_icon.render().el\r
+    })\r
+    @listenTo(@edit_btn, 'click', @click_edit)\r
+    @listenTo(@remove_btn, 'click', @click_remove)\r
+  \r
+  render: () ->\r
+    this.$el.html('')\r
+    if @is_own()\r
+      this.$el.append(@stop_btn.render().el)\r
+      this.$el.append(@edit_btn.render().el)\r
+      this.$el.append(@remove_btn.render().el)\r
+    this\r
+  \r
+  is_own: () ->\r
+    if @item.is_own(@filer().operators)\r
+      true\r
+    else\r
+      false\r
+   \r
+  filer: () ->\r
+    @file_item.filer()\r
+  \r
+  manifest: () ->\r
+    @filer().manifest\r
+  \r
+  item_name: () ->\r
+    @filer().item_name\r
+  \r
+  image_dir: () ->\r
+    @filer().image_dir()\r
+  \r
+  edit_img_file_name: () ->\r
+    @image_dir() + 'edit.png'\r
+  \r
+  remove_img_file_name: () ->\r
+    @image_dir() + 'remove.png'\r
+  \r
index 5c8cf7c..0f35509 100644 (file)
@@ -16,6 +16,7 @@ class Pettanr.Views.OriginalPicture.Summary extends Pettanr.Views.Common.Summary
       if ra = @item.get('resource_picture')\r
         resource_picture = new Pettanr.ResourcePicture(ra)\r
         @credit = resource_picture.credit_view(true)\r
+        @listenTo(@credit, 'click:icon', @resource_picture_click)\r
       @trigger('ready')\r
   \r
   render: () ->\r
@@ -27,3 +28,7 @@ class Pettanr.Views.OriginalPicture.Summary extends Pettanr.Views.Common.Summary
     this.$el.append(rb.render().el)\r
     this\r
   \r
+  # in credit\r
+  resource_picture_click: (resource_picture) ->\r
+    @trigger('navigate', resource_picture.show_url())\r
+  \r
index 89adb65..6298c36 100644 (file)
@@ -12,6 +12,7 @@ class Pettanr.Views.PanelPicture.Summary extends Pettanr.Views.Common.Summary
       panel = @item.panel()\r
       panel.fetch({cache: true}).done =>\r
         @panel_icon = new Pettanr.Views.Common.Icon({item: panel, half: true})\r
+        @listenTo(@panel_icon, 'click', @panel_click)\r
         @trigger('ready')\r
   \r
   render: () ->\r
@@ -20,3 +21,6 @@ class Pettanr.Views.PanelPicture.Summary extends Pettanr.Views.Common.Summary
     this.$el.append(@panel_icon.render().el)\r
     this\r
   \r
+  panel_click: () ->\r
+    @trigger('navigate', @panel_icon.url())\r
+  \r
index f89b242..33931f4 100644 (file)
@@ -16,6 +16,7 @@ class Pettanr.Views.Panel.Summary extends Pettanr.Views.Common.Summary
     @author = @item.author()\r
     @author.fetch({cache: true}).done =>\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
   render: () ->\r
@@ -24,3 +25,6 @@ class Pettanr.Views.Panel.Summary extends Pettanr.Views.Common.Summary
     this.$el.append(@author_icon_with_caption.render().el)\r
     this\r
   \r
+  author_click: () ->\r
+    @trigger('navigate', @author_icon_with_caption.url())\r
+  \r
index f23d763..06332e6 100644 (file)
@@ -9,9 +9,11 @@ class Pettanr.Views.SpeechBalloon.Summary extends Pettanr.Views.Common.Summary
     panel = @item.panel()\r
     panel.fetch({cache: true}).done =>\r
       @panel_icon = new Pettanr.Views.Common.Icon({item: panel, half: true})\r
+      @listenTo(@panel_icon, 'click', @panel_click)\r
       author = panel.author()\r
       author.fetch({cache: true}).done =>\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
   render: () ->\r
@@ -20,3 +22,9 @@ class Pettanr.Views.SpeechBalloon.Summary extends Pettanr.Views.Common.Summary
     this.$el.append(@author_icon_with_caption.render().el)\r
     this\r
   \r
+  panel_click: () ->\r
+    @trigger('navigate', @panel_icon.url())\r
+  \r
+  author_click: () ->\r
+    @trigger('navigate', @author_icon_with_caption.url())\r
+  \r
index d35d201..cf106ee 100644 (file)
@@ -11,9 +11,11 @@ class Pettanr.Views.Speech.Summary extends Pettanr.Views.Common.Summary
       panel = @speech_balloon.panel()\r
       panel.fetch({cache: true}).done =>\r
         @panel_icon = new Pettanr.Views.Common.Icon({item: panel, half: true})\r
+        @listenTo(@panel_icon, 'click', @panel_click)\r
         author = panel.author()\r
         author.fetch({cache: true}).done =>\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
   render: () ->\r
@@ -22,3 +24,9 @@ class Pettanr.Views.Speech.Summary extends Pettanr.Views.Common.Summary
     this.$el.append(@author_icon_with_caption.render().el)\r
     this\r
   \r
+  panel_click: () ->\r
+    @trigger('navigate', @panel_icon.url())\r
+  \r
+  author_click: () ->\r
+    @trigger('navigate', @author_icon_with_caption.url())\r
+  \r