OSDN Git Service

fix filer
authoryasushiito <yas@pen-chan.jp>
Sat, 30 Aug 2014 07:07:05 +0000 (16:07 +0900)
committeryasushiito <yas@pen-chan.jp>
Sat, 30 Aug 2014 07:07:05 +0000 (16:07 +0900)
32 files changed:
app/assets/javascripts/controllers/folders.js.coffee
app/assets/javascripts/locmare/filer.js.coffee
app/assets/javascripts/locmare/filer/body/file_body.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/symbol/default/face/picture.js.coffee
app/assets/javascripts/locmare/filer/pager.js.coffee
app/assets/javascripts/main.js.coffee
app/assets/javascripts/manifest/controller/action/base.js.coffee
app/assets/javascripts/manifest/controller/action/list.js.coffee
app/assets/javascripts/manifest/manifest.js.coffee
app/assets/javascripts/manifest/model.js.coffee
app/assets/javascripts/models/balloon.js.coffee
app/assets/javascripts/models/comic.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/license_group.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/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/pettanr.js.coffee
app/assets/javascripts/routes.js.coffee
app/assets/javascripts/work/controllers.js.coffee.erb
app/assets/javascripts/work/models.js.coffee.erb
app/controllers/folders_controller.rb
public/manifest.json

index 394af8a..6492fae 100644 (file)
@@ -4,32 +4,39 @@ class Pettanr.FoldersController extends Pettanr.AppController
     @filer_list()\r
   \r
   root: () ->\r
+    @set_model()\r
+    @item = new Pettanr.Folder.Root()\r
+    _this = this\r
+    @item.fetch({}).done () ->\r
+      _this.children_html()\r
   \r
   show_html_format: (format) -> \r
   \r
+  children_html: () -> \r
+    collection = new Pettanr.Folder.Children({id: @item.get('id')})\r
+    f = new Locmare.Filer({\r
+      item_name: 'folder', \r
+      collection: collection, \r
+      pager: null, \r
+      operators: window.operators\r
+    })\r
+    $("#pettanr").html(f.render().el)\r
+  \r
   show: () ->\r
     console.log(@params)\r
     id = @params['id']\r
-    item = new Pettanr.FolderWatch({id: id})\r
+    @item = new Pettanr.FolderWatch({id: id})\r
     _this = this\r
-    item.fetch({}).done () ->\r
-      if item.is_remote()\r
-        c = item.get('controller_name')\r
-        a = if Pettanr.is_blank(item.get('action_name'))\r
+    @item.fetch({}).done () ->\r
+      if _this.item.is_remote()\r
+        c = _this.item.get('controller_name')\r
+        a = if Pettanr.is_blank(_this.item.get('action_name'))\r
           'index'\r
         else\r
-          item.get('action_name')\r
+          _this.item.get('action_name')\r
         window.router['c_i'](c, a, '') # call action event in router for redirect\r
       else\r
-        list_result = new Pettanr.Folder.Children({id: item.id})\r
-        f = new Locmare.Filer({\r
-          item_name: 'folder', \r
-          items: [], \r
-          list_result: list_result, \r
-          pager_type: 'default', \r
-          operators: window.operators\r
-        })\r
-        $("#pettanr").html(f.render().el)\r
+        _this.children_html()\r
   \r
   count: () ->\r
   \r
index fd39579..6d3d278 100644 (file)
@@ -2,35 +2,22 @@ class Locmare.Filer extends Backbone.View
   tagName: 'div'\r
   initialize: (options) ->\r
     @item_name = options.item_name\r
-    @list_result = options.list_result\r
-    @items = options.items\r
-    @pager_type = options.pager_type\r
+    @collection = options.collection\r
+    @pager = options.pager\r
     @operators = options.operators\r
     @manifest = LocalManifest.manifest().filers[@item_name]\r
     @template_dir = 'templates-filer-'\r
     @header = new Locmare.FilerModule.Header({'filer': this})\r
     @body = new Locmare.FilerModule.Body({'filer': this})\r
-    @init_pager()\r
     @render()\r
   \r
   render: () ->\r
     this.$el.html('')\r
     this.$el.append(@header.render().el)\r
     this.$el.append(@body.render().el)\r
-    this.$el.append(@pager.render().el)\r
+    this.$el.append(@pager.render().el) if @pager\r
     this\r
   \r
-  init_pager: () ->\r
-    c = Locmare.Filer.pager()[@pager_type]\r
-    @pager = new c({filer: this})\r
-  \r
-  @pager: () ->\r
-    {\r
-      'none': Locmare.FilerModule.NonePager, \r
-      'default': Locmare.FilerModule.DefaultPager, \r
-      'more': Locmare.FilerModule.MorePager\r
-    }\r
-  \r
   model: () ->\r
     Manifest.item_name_to_model @item_name\r
   \r
index 26bb9e3..7508316 100644 (file)
@@ -5,7 +5,7 @@ class Locmare.FilerModule.BodyModule.FileBody extends Backbone.View
     @body = options.body\r
     @collection = []\r
     _this = this\r
-    c = @filer().list_result\r
+    c = @filer().collection\r
     c.fetch().done ->\r
       _this.filer().items = c.models\r
       _this.collection = _.map c.models, (item) ->\r
index 76b023e..030d596 100644 (file)
@@ -4,7 +4,11 @@ class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.CaptionItemCo
     super(options)\r
   \r
   render: () ->\r
-    this.$el.html(@face())\r
+    if Pettanr.is_a_string(@face())\r
+      this.$el.html(@face())\r
+    else\r
+      this.$el.html(@face().render().el)\r
+    \r
     this\r
   \r
   @template_file_name: () ->\r
index 11f6397..127a581 100644 (file)
@@ -3,10 +3,11 @@ class Locmare.FilerModule.BodyModule.FileBodyModule.FileItemModule.SymbolItemCol
   initialize: (options) ->\r
     super(options)\r
     _this = this\r
-    if i = @item[@method_name()]()\r
-      i.fetch().done ->\r
-        _this.picture = new Pettanr.AppHelperImg({src: i.r_url(), size: _this.icon_size()})\r
+    if @item[@method_name()]\r
+      @item[@method_name()]((pic) ->\r
+        _this.picture = pic\r
         _this.render()\r
+      )\r
     else\r
       @picture = new Pettanr.AppHelperImg({src: '/images/error.png', size: @icon_size()})\r
       _this.render()\r
index e0ed33d..9a14240 100644 (file)
@@ -1,5 +1,6 @@
 class Locmare.FilerModule.Pager extends Backbone.View\r
-  tagName: 'div'\r
+  tagName: 'ul'\r
+  className: 'pagination'\r
   \r
   initialize: (options) ->\r
     @filer = options.filer\r
@@ -17,9 +18,108 @@ class Locmare.FilerModule.Pager extends Backbone.View
   api_path: () ->\r
     list_result().path\r
   \r
-class Locmare.FilerModule.NonePager extends Locmare.FilerModule.Pager\r
-  \r
 class Locmare.FilerModule.DefaultPager extends Locmare.FilerModule.Pager\r
+  tagName: 'ul'\r
+  className: 'pagination'\r
+  \r
+  initialize: (options) ->\r
+    @filer = options.filer\r
+    @counter = @list_result.counter\r
+    @current_page = @list_result.page\r
+    @per_page = @list_result.page_size\r
+    @total_page = (@total / @per_page) + 1\r
+    @window_size = 3\r
+    @parts = []\r
+    _this = this\r
+    @counter.fetch().done ->\r
+      _this.total = @counter.count\r
+      _this.build()\r
+      _this.render()\r
+  \r
+  render: () ->\r
+    _this = this\r
+    this.$el.html('')\r
+    _.each @parts, (part) ->\r
+      _this.$el.append(part.render().el)\r
+    this\r
+  \r
+  build: () ->\r
+    @parts.push(new Locmare.FilerModule.DefaultPager.FirstPage({})) if hasPreviousPage()\r
+    @parts.push(new Locmare.FilerModule.DefaultPager.PrevPage({})) if hasPreviousPage()\r
+    @parts.push(new Locmare.FilerModule.DefaultPager.PageGap({})) if hasPreviousPageGap()\r
+    f = if @hasPreviousPageGap()\r
+      @current_page - @window_size\r
+    else\r
+      1\r
+    t = if @hasNextPageGap()\r
+      @current_page + @window_size\r
+    else\r
+      @total_page\r
+    for page in [f..t]\r
+      @parts.push(new Locmare.FilerModule.DefaultPager.Page({page: page}))\r
+    @parts.push(new Locmare.FilerModule.DefaultPager.NextPageGap({})) if hasNextPageGap()\r
+    @parts.push(new Locmare.FilerModule.DefaultPager.NextPage({})) if hasNextPage()\r
+    @parts.push(new Locmare.FilerModule.DefaultPager.LastPage({})) if hasNextPage()\r
+  \r
+  hasPreviousPage: () ->\r
+    @current_page > 1\r
+  \r
+  hasNextPage: () ->\r
+    @current_page < @total_page\r
+  \r
+  hasPreviousPageGap: () ->\r
+    @current_page > @window_size + 1\r
+  \r
+  hasNextPageGap: () ->\r
+    @total_page - @current_page > @window_size\r
+  \r
+class Locmare.FilerModule.DefaultPager.FirstPage extends Backbone.View\r
+  tagName: 'li'\r
+  className: 'first'\r
+  \r
+  render: () ->\r
+    this.$el.html('<<')\r
+    this\r
+  \r
+class Locmare.FilerModule.DefaultPager.PrevPage extends Backbone.View\r
+  tagName: 'li'\r
+  className: 'prev'\r
+  \r
+  render: () ->\r
+    this.$el.html('<')\r
+    this\r
+  \r
+class Locmare.FilerModule.DefaultPager.PageGap extends Backbone.View\r
+  tagName: 'li'\r
+  className: 'page-gap'\r
+  \r
+  render: () ->\r
+    this.$el.html('...')\r
+    this\r
+  \r
+class Locmare.FilerModule.DefaultPager.Page extends Backbone.View\r
+  tagName: 'li'\r
+  className: 'page'\r
+  \r
+  render: () ->\r
+    this.$el.html()\r
+    this\r
+  \r
+class Locmare.FilerModule.DefaultPager.NextPage extends Backbone.View\r
+  tagName: 'li'\r
+  className: 'next'\r
+  \r
+  render: () ->\r
+    this.$el.html('>')\r
+    this\r
+  \r
+class Locmare.FilerModule.DefaultPager.LastPage extends Backbone.View\r
+  tagName: 'li'\r
+  className: 'last'\r
+  \r
+  render: () ->\r
+    this.$el.html('>>')\r
+    this\r
   \r
 class Locmare.FilerModule.MorePager extends Locmare.FilerModule.Pager\r
   \r
index 603e6dc..1352297 100644 (file)
@@ -26,7 +26,7 @@ $ ->
   #new Pettanr.FilerRender('folder', list_result, 'default', window.operators)\r
   window.router = new Pettanr.Router()\r
   Backbone.history.start({pushState: true})\r
-  window.router.navigate('folders/root', true)\r
+  window.router.navigate('', true)\r
   \r
   test_router: () ->\r
     window.router.navigate('folders/98', true)\r
index 1ef6a23..a2dfa15 100644 (file)
@@ -3,9 +3,41 @@ class Manifest.ControllerModule.ActionModule.Base extends ManifestBase.TypeNameA
   set_default: () ->\r
     super()\r
     @args.item_name ||= @parent.item_name  # not parent.name. follow singularized name\r
+    @args.param_id ||= 'prefix'\r
     \r
   init: () ->\r
     super()\r
     @item_name = @args.item_name\r
+    @param_id = @args.param_id\r
+  \r
+  encode_query: (params) ->\r
+    q = []\r
+    q.push('page=' + Pettanr.to_s(params['page'])) if params['page']\r
+    q.push('page_size=' + Pettanr.to_s(params['page_size'])) if params['page_size']\r
+    if q.length > 0\r
+      '?' + q.join('&')\r
+    else\r
+      ''\r
+  \r
+  encode_url: (action_name, params) ->\r
+    c = @parent.name\r
+    a = if action_name != 'index'\r
+      '/' + action_name\r
+    else\r
+      ''\r
+    i = if params['id']\r
+      '/' + Pettanr.to_s(params['id'])\r
+    else\r
+      ''\r
+    q = @encode_query(params)\r
+    switch @param_id\r
+      when 'prefix'\r
+        c + i + a + q\r
+      when 'suffix'\r
+        c + a + i + q\r
+      else\r
+        c + a + q\r
+  \r
+  url: (params) ->\r
+    @encode_url(@name, params)\r
   \r
-\r
index 802f516..bd5aa45 100644 (file)
@@ -3,8 +3,17 @@ class Manifest.ControllerModule.ActionModule.ActionList extends Manifest.Control
   set_default: () ->\r
     super()\r
     @args.list_name ||= @name\r
+    @args.counter_name = if @name == 'index'\r
+      'count'\r
+    else\r
+      'count_'\r
     \r
   init: () ->\r
     super()\r
     @list_name = @args.list_name\r
+    @counter_name = @args.counter_name\r
+  \r
+  counter_url: (params) ->\r
+    @encode_url(@counter_name, params)\r
+    \r
   \r
index d0826de..77c1aba 100644 (file)
@@ -9,6 +9,11 @@ class Manifest
     @items = ManifestBase.load_type_name_args(this, @global_json, 'items', Manifest.ItemFactory)\r
     @controllers = Manifest.Controller.load(this, @global_json, 'controllers', Manifest.Controller)\r
     @models = Manifest.Model.load(this, @global_json, 'models', Manifest.Model)\r
+    @inflectors = {}\r
+    _this = this\r
+    _.each @models, (model_manifest, item_name) ->\r
+      if model_manifest.table_name\r
+        _this.inflectors[model_manifest.table_name] = item_name\r
     true\r
   \r
   @item_name_to_model: (item_name) ->\r
index 65e839a..bbbcc6a 100644 (file)
@@ -21,6 +21,7 @@ class Manifest.Model extends ManifestBase.Base
   \r
   init: () ->\r
     super\r
+    @table_name = @json.table_name\r
     @attributes = ManifestBase.load_name_values this, @json, 'attributes', Manifest.ModelModule.Attribute\r
     @associations = ManifestBase.load_value this, @json, 'associations', Manifest.ModelModule.Association\r
     @list = ManifestBase.load_value this, @json, 'list', Manifest.ModelModule.List\r
@@ -32,7 +33,7 @@ class Manifest.Model extends ManifestBase.Base
     Manifest.item_name_to_model @name\r
   \r
   table_name: () ->\r
-    @classify.table_name\r
+    @table_name\r
   \r
   valid_encode_columns: () ->\r
     r = []\r
index 8d6c55b..1c69934 100644 (file)
@@ -1,4 +1,6 @@
 class Pettanr.Balloon extends Peta.Element\r
+  url: '/balloons/'\r
+  \r
   @singular: () ->\r
     'Balloon'\r
   \r
@@ -14,11 +16,20 @@ class Pettanr.Balloon extends Peta.Element
     r: 0\r
   } \r
   \r
+  speech_balloon: () ->\r
+    new Pettanr.SpeechBalloon({id: @get('speech_balloon_id')})\r
+  \r
   url: () ->\r
     '/system_pictures/' + @system_picture().filename()\r
   \r
-  symbol_option: () ->\r
-    @speech_balloon().speech_balloon_template().symbol_option()\r
+  symbol_option: (cb) ->\r
+    sb = @speech_balloon()\r
+    sb.fetch().done ->\r
+      sbt = sb.speech_balloon_template()\r
+      sbt.fetch().done ->\r
+        sp = sbt.system_picture()\r
+        sp.fetch().done ->\r
+          cb(sp.tmb_opt_img_tag())\r
   \r
   style: () ->\r
     {\r
index c760c13..469774c 100644 (file)
@@ -1,4 +1,6 @@
 class Pettanr.Comic extends Peta.Binder\r
+  url: '/comics/'\r
+  \r
   @singular: () ->\r
     'Comic'\r
   \r
index db39a4b..554856e 100644 (file)
@@ -42,9 +42,9 @@ class Pettanr.FolderWatch extends Pettanr.Folder
 class Pettanr.Folder.Collection extends Backbone.Collection\r
   model: Pettanr.Folder\r
   url: 'folders'\r
-class Pettanr.Folder.Root extends Backbone.Collection\r
+class Pettanr.Folder.Root extends Pettanr.Folder\r
   model: Pettanr.Folder\r
-  url: '/folders/root'\r
+  url: '/folders/root?ref=1'\r
 class Pettanr.Folder.Children extends Backbone.Collection\r
   model: Pettanr.Folder\r
   initialize: (options) ->\r
index 1a18c15..2f112d4 100644 (file)
@@ -1,4 +1,6 @@
 class Pettanr.GroundPicture extends Peta.Element\r
+  url: '/ground_pictures/'\r
+  \r
   @singular: () ->\r
     'GroundPicture'\r
   \r
@@ -16,7 +18,7 @@ class Pettanr.GroundPicture extends Peta.Element
     ['repeat', 'repeat-x', 'repeat-y', 'no-repeat']\r
   \r
   picture: () ->\r
-    @get('picture')\r
+    new Pettanr.Picture({id: @get('picture_id')})\r
   \r
   has_picture: () ->\r
     true\r
@@ -34,12 +36,15 @@ class Pettanr.GroundPicture extends Peta.Element
     @merge_opacity(r, opacity) if spot and spot != this\r
     r\r
   \r
-  tmb_opt_img_tag: () ->\r
-    wh = Pettanr.Imager.thumbnail_size(@picture().get('width'), @picture().get('height'))\r
-    {src: @picture().r_url(), width: wh[0], height: wh[1], alt: @get('caption')}\r
+  tmb_opt_img_tag: (picture) ->\r
+    wh = Pettanr.Imager.thumbnail_size(picture().get('width'), picture().get('height'))\r
+    new Pettanr.AppHelperImg({src: picture.r_url(), size: Math.abs(wh[0]), alt: @get('caption')})\r
   \r
-  symbol_option: () ->\r
-    @tmb_opt_img_tag()\r
+  symbol_option: (cb) ->\r
+    i = @picture()\r
+    _this = this\r
+    i.fetch().done ->\r
+      cb(_this.tmb_opt_img_tag(i))\r
   \r
   repeat_text: () ->\r
     Pettanr.GroundPicture.repeat_texts()[@get('repeat')]\r
index 2e18e58..62bfd0c 100644 (file)
@@ -1,4 +1,6 @@
 class Pettanr.License extends Peta.SystemResource\r
+  url: '/licenses/'\r
+  \r
   @singular: () ->\r
     'License'\r
   \r
@@ -11,11 +13,17 @@ class Pettanr.License extends Peta.SystemResource
   \r
   license_group: () ->\r
     r = new Pettanr.LicenseGroup({id: @get('license_group_id')})\r
-    r.fetch({}).done () ->\r
-      r\r
+  \r
+  system_picture: () ->\r
+    new Pettanr.SystemPicture({id: @get('system_picture_id')})\r
+  \r
+  symbol_option: (cb) ->\r
+    i = @system_picture()\r
+    i.fetch().done ->\r
+      cb(i.tmb_opt_img_tag())\r
   \r
   caption_with_group: () ->\r
-    @license_group().get('caption') + '/' + @get('caption')\r
+    new Pettanr.License.Caption({license: this, license_group: @license_group()})\r
   \r
   initialize: () ->\r
     if @id\r
@@ -24,3 +32,16 @@ class Pettanr.License extends Peta.SystemResource
 class Pettanr.License.Collection extends Backbone.Collection\r
   model: Pettanr.License\r
   url: '/licenses'\r
+\r
+class Pettanr.License.Caption extends Backbone.View\r
+  tagName: 'span'\r
+  initialize: (options) ->\r
+    @license = options.license\r
+    @license_group = options.license_group\r
+    \r
+  render: () ->\r
+    _this = this\r
+    @license_group.fetch().done ->\r
+      _this.$el.html(_this.license_group.get('caption') + '/' + _this.license.get('caption'))\r
+    this\r
+  \r
index f0d70f9..5c22091 100644 (file)
@@ -1,4 +1,6 @@
 class Pettanr.LicenseGroup extends Peta.Template\r
+  url: '/license_groups/'\r
+  \r
   @singular: () ->\r
     'LicenseGroup'\r
   \r
index bd78f92..fe1ffa9 100644 (file)
@@ -1,4 +1,6 @@
 class Pettanr.OriginalPicture extends Peta.Content\r
+  url: '/original_pictures/'\r
+  \r
   @singular: () ->\r
     'OriginalPicture'\r
   \r
@@ -29,8 +31,10 @@ class Pettanr.OriginalPicture extends Peta.Content
     wh = Pettanr.Imager.thumbnail_size(@get('width'), @get('height'))\r
     {src: @r_url(), width: wh[0], height: wh[1]}\r
   \r
-  symbol_option: () ->\r
-    @tmb_opt_img_tag()\r
+  symbol_option: (cb) ->\r
+    _this = this\r
+    this.fetch().done ->\r
+      cb(_this.tmb_opt_img_tag())\r
   \r
   revision: () ->\r
     head = @history()[0]\r
index 794797c..f8f9be3 100644 (file)
@@ -1,4 +1,6 @@
 class Pettanr.PanelPicture extends Peta.Element\r
+  url: '/panel_pictures/'\r
+  \r
   @singular: () ->\r
     'PanelPicture'\r
   \r
@@ -9,6 +11,9 @@ class Pettanr.PanelPicture extends Peta.Element
     id: null\r
   } \r
   \r
+  picture: () ->\r
+    new Pettanr.Picture({id: @get('picture_id')})\r
+  \r
   @has_picture: () ->\r
     true\r
   \r
@@ -52,12 +57,15 @@ class Pettanr.PanelPicture extends Peta.Element
       style: "#{o}"\r
     })\r
   \r
-  tmb_opt_img_tag: () ->\r
+  tmb_opt_img_tag: (picture) ->\r
     wh = Pettanr.Imager.thumbnail_size(@get('width'), @get('height'))\r
-    {src: @r_url(), width: Math.abs(wh[0]), height: Math.abs(wh[1]), alt: @get('caption')}\r
+    new Pettanr.AppHelperImg({src: picture.r_url(), size: Math.abs(wh[0]), alt: @get('caption')})\r
   \r
-  symbol_option: () ->\r
-    @picture().symbol_option()\r
+  symbol_option: (cb) ->\r
+    i = @picture()\r
+    _this = this\r
+    i.fetch().done ->\r
+      cb(_this.tmb_opt_img_tag(i))\r
   \r
   initialize: () ->\r
     if @id\r
index ed592ff..2af7542 100644 (file)
@@ -1,4 +1,6 @@
 class Pettanr.Picture extends Peta.Content\r
+  url: '/pictures/'\r
+  \r
   @singular: () ->\r
     'Picture'\r
   \r
@@ -44,7 +46,7 @@ class Pettanr.Picture extends Peta.Content
     lgn + '[' + ln + ']'\r
   \r
   symbol_option: () ->\r
-    @tmb_opt_img_tag()\r
+    this\r
   \r
   is_enable: () ->\r
     if @head().resource_picture()\r
index fafa3dc..fb2cb02 100644 (file)
@@ -42,8 +42,10 @@ class Pettanr.ResourcePicture extends Peta.Content
     ln = Pettanr.to_s(@license().get('caption'))\r
     lgn + '[' + ln + ']'\r
   \r
-  symbol_option: () ->\r
-    @tmb_opt_img_tag()\r
+  symbol_option: (cb) ->\r
+    _this = this\r
+    this.fetch().done ->\r
+      cb(_this.tmb_opt_img_tag())\r
   \r
   initialize: () ->\r
     if @id\r
index 7c158fd..92b8bd4 100644 (file)
@@ -1,4 +1,6 @@
 class Pettanr.Speech extends Peta.Element\r
+  url: '/speeches/'\r
+  \r
   @singular: () ->\r
     'Speech'\r
   \r
@@ -13,11 +15,20 @@ class Pettanr.Speech extends Peta.Element
     height: 100\r
   } \r
   \r
+  speech_balloon: () ->\r
+    new Pettanr.SpeechBalloon({id: @get('speech_balloon_id')})\r
+  \r
   @text_align_texts: () -> \r
     ['left', 'left', 'right', 'center']\r
   \r
-  symbol_option: () ->\r
-    @speech_balloon().speech_balloon_template().symbol_option()\r
+  symbol_option: (cb) ->\r
+    sb = @speech_balloon()\r
+    sb.fetch().done ->\r
+      sbt = sb.speech_balloon_template()\r
+      sbt.fetch().done ->\r
+        sp = sbt.system_picture()\r
+        sp.fetch().done ->\r
+          cb(sp.tmb_opt_img_tag())\r
   \r
   outer_style: () ->\r
     {\r
index e1dc8ce..55841ef 100644 (file)
@@ -1,4 +1,6 @@
 class Pettanr.SpeechBalloon extends Peta.Element\r
+  url: '/speech_balloons/'\r
+  \r
   @singular: () ->\r
     'SpeechBalloon'\r
   \r
@@ -11,11 +13,21 @@ class Pettanr.SpeechBalloon extends Peta.Element
     t: null\r
   } \r
   \r
+  speech_balloon_template: () ->\r
+    new Pettanr.SpeechBalloonTemplate({id: @get('speech_balloon_template_id')})\r
+  \r
   @has_picture: () ->\r
     false\r
   \r
-  @symbol_option: () ->\r
-    @speech_balloon_template.symbol_option\r
+  symbol_option: (cb) ->\r
+    sbt = @speech_balloon_template()\r
+    sbt.fetch().done ->\r
+      sp = sbt.system_picture()\r
+      sp.fetch().done ->\r
+        cb(sp.tmb_opt_img_tag())\r
+  \r
+  plain_scenario: () ->\r
+    @get('caption')\r
   \r
   initialize: () ->\r
     if @id\r
index 55dafaf..d85de45 100644 (file)
@@ -14,8 +14,10 @@ class Pettanr.SpeechBalloonTemplate extends Peta.Template
   system_picture: () ->\r
     new Pettanr.SystemPicture({id: @get('system_picture_id')})\r
   \r
-  symbol_option: () ->\r
-    @system_picture()\r
+  symbol_option: (cb) ->\r
+    i = @system_picture()\r
+    i.fetch().done ->\r
+      cb(i.tmb_opt_img_tag())\r
   \r
   initialize: () ->\r
     if @id\r
index 82e60c8..1ddeced 100644 (file)
@@ -25,10 +25,12 @@ class Pettanr.SystemPicture extends Peta.SystemResource
   \r
   tmb_opt_img_tag: () ->\r
     wh = Pettanr.Imager.thumbnail_size(@get('width'), @get('height'))\r
-    {src: @r_url(), width: wh[0], height: wh[1]}\r
+    new Pettanr.AppHelperImg({src: @r_url(), size: wh[0]})\r
   \r
-  symbol_option: () ->\r
-    @tmb_opt_img_tag()\r
+  symbol_option: (cb) ->\r
+    _this = this\r
+    this.fetch().done ->\r
+      cb(_this.tmb_opt_img_tag())\r
   \r
   initialize: () ->\r
     if @id\r
index f5fb137..ca7cd7b 100644 (file)
@@ -9,6 +9,14 @@ class Pettanr.WritingFormat extends Peta.Template
     id: null\r
   } \r
   \r
+  system_picture: () ->\r
+    new Pettanr.SystemPicture({id: @get('system_picture_id')})\r
+  \r
+  symbol_option: (cb) ->\r
+    i = @system_picture()\r
+    i.fetch().done ->\r
+      cb(i.tmb_opt_img_tag())\r
+  \r
   initialize: () ->\r
     if @id\r
       @url = @url + @id\r
index c5ed2df..1de7dd2 100644 (file)
@@ -113,31 +113,30 @@ class Pettanr
     initialize: (attr, options) ->\r
       @url = options['url']\r
     \r
+    count: () ->\r
+      @get('count')\r
+    \r
+  class Pettanr.Pager extends Backbone.View\r
+    \r
+    initialize: (options) ->\r
+      @action = options['action']\r
+      @params = options['params']\r
+      @current_page = @params['page']\r
+      @per_page = @params['page_size']\r
+      @window_size = 3\r
+      @counter = new Pettanr.CounterModel({}, {url: '/' + @action.counter_url(@params)})\r
+      _this = this\r
+      @counter.fetch().done ->\r
+        _this.total_page = (@total / _this.per_page) + 1\r
+  \r
   class Pettanr.FilerCollection extends Backbone.Collection\r
     \r
     initialize: (models, options) ->\r
-      params = options['params']\r
-      i = if params['id']\r
-        params['id'] + '/'\r
-      else\r
-        ''\r
-      a = if params['action'] != 'index'\r
-        params['action']\r
-      else\r
-        ''\r
-      \r
-      @page = params['page']\r
-      @page_size = params['page_size']\r
-      q = []\r
-      q.push('page=' + Pettanr.to_s(@page)) if @page\r
-      q.push('page_size=' + Pettanr.to_s(@page_size)) if @page_size\r
-      qry = if q.length > 0\r
-        '?' + q.join('&')\r
-      else\r
-        ''\r
-      @url = '/' + params['controller'] + '/' + i + a + qry\r
-      @total = new Pettanr.CounterModel({}, {url: '/' + params['controller'] + '/' + i + 'count_' + a})\r
       @model = options['model']\r
+      @action = options['action']\r
+      @params = options['params']\r
+      \r
+      @url = '/' + @action.url(@params)\r
   \r
   class Pettanr.AppController\r
     constructor: () ->\r
@@ -153,16 +152,16 @@ class Pettanr
       @set_model()\r
       @my_list_model = Manifest.manifest().models[@my_action.item_name]\r
       @my_list_model_class = @my_list_model.classify()\r
-      @list = new Pettanr.FilerCollection({}, {model: @my_list_model_class, params: @params})\r
+      @pager = new Pettanr.Pager({action: @my_action, params: @params})\r
+      @list = new Pettanr.FilerCollection({}, {model: @my_list_model_class, action: @my_action, params: @params})\r
     \r
     filer_list: () ->\r
       @set_list()\r
       f = new Locmare.Filer({\r
         el: "#pettanr",\r
         item_name: @my_list_model_class.item_name(), \r
-        items: [], \r
-        list_result: @list, \r
-        pager_type: 'default', \r
+        collection: @list, \r
+        pager: @pager, \r
         operators: window.operators\r
       })\r
   \r
index b0c9db1..12b333d 100644 (file)
@@ -74,11 +74,18 @@ class Pettanr.Router extends Backbone.Router
       else\r
         params['action'] = 'index'\r
       this.fire(params)\r
+    this.route('', 'home')\r
     this.route(':controller/:id/:action?*query_string', 'c_i_a')\r
     this.route(':controller/:id/:action', 'c_i_a')\r
     this.route(':controller/:id?*query_string', 'c_i')\r
     this.route(':controller/:id', 'c_i')\r
   \r
+  home: () ->\r
+    params = {}\r
+    params['controller'] = 'folders'\r
+    params['action'] = 'root'\r
+    @fire(params)\r
+  \r
   hoge: () ->\r
     names = _.map Manifest.manifest().controllers, (controller_manifest, controller_name) ->\r
       c = Pettanr[Pettanr.camelize(controller_name) + 'Controller']\r
index cbc03ff..45da9b9 100644 (file)
@@ -10,6 +10,7 @@
         type: 'list',\r
         args: {\r
           list_name: 'public',\r
+          param_id: 'none',\r
         },\r
       },\r
       show: {\r
         type: 'list',\r
         args: {\r
           list_name: 'public',\r
+          param_id: 'none',\r
         },\r
       },\r
       by_author: {\r
         type: 'list',\r
+        args: {\r
+          param_id: 'suffix',\r
+        },\r
       },\r
       by_panel: {\r
         type: 'list',\r
+        args: {\r
+          param_id: 'suffix',\r
+        },\r
       },\r
       play: {\r
         type: 'list',\r
         type: 'list',\r
         args: {\r
           list_name: 'public',\r
-          \r
+          param_id: 'none',\r
         },\r
       },\r
       by_panel: {\r
         type: 'list',\r
+        args: {\r
+          param_id: 'suffix',\r
+        },\r
       },\r
       by_scroll: {\r
         type: 'list',\r
+        args: {\r
+          param_id: 'suffix',\r
+        },\r
       },\r
       by_author: {\r
         type: 'list',\r
+        args: {\r
+          param_id: 'suffix',\r
+        },\r
       },\r
       show: {\r
         type: 'show',\r
         type: 'list',\r
         args: {\r
           list_name: 'public',\r
-          \r
+          param_id: 'none',\r
         },\r
       },\r
       by_story: {\r
         type: 'list',\r
+        args: {\r
+          param_id: 'suffix',\r
+        },\r
       },\r
       by_author: {\r
         type: 'list',\r
+        args: {\r
+          param_id: 'suffix',\r
+        },\r
       },\r
       play: {\r
         type: 'list',\r
         type: 'list',\r
         args: {\r
           list_name: 'public',\r
-          \r
+          param_id: 'none',\r
         },\r
       },\r
       by_comic: {\r
         type: 'list',\r
+        args: {\r
+          param_id: 'suffix',\r
+        },\r
       },\r
       by_story: {\r
         type: 'list',\r
+        args: {\r
+          param_id: 'suffix',\r
+        },\r
       },\r
       show: {\r
         type: 'show',\r
         type: 'list',\r
         args: {\r
           list_name: 'public',\r
-          \r
+          param_id: 'none',\r
         },\r
       },\r
       by_comic: {\r
         type: 'list',\r
+        args: {\r
+          param_id: 'suffix',\r
+        },\r
       },\r
       by_sheet: {\r
         type: 'list',\r
+        args: {\r
+          param_id: 'suffix',\r
+        },\r
       },\r
       by_author: {\r
         type: 'list',\r
+        args: {\r
+          param_id: 'suffix',\r
+        },\r
       },\r
       play: {\r
         type: 'list',\r
         type: 'list',\r
         args: {\r
           list_name: 'public',\r
-          \r
+          param_id: 'none',\r
         },\r
       },\r
       by_story: {\r
         type: 'list',\r
+        args: {\r
+          param_id: 'suffix',\r
+        },\r
       },\r
       by_sheet: {\r
         type: 'list',\r
+        args: {\r
+          param_id: 'suffix',\r
+        },\r
       },\r
       by_author: {\r
         type: 'list',\r
+        args: {\r
+          param_id: 'suffix',\r
+        },\r
       },\r
       show: {\r
         type: 'show',\r
         type: 'list',\r
         args: {\r
           list_name: 'public',\r
-          \r
+          param_id: 'none',\r
         },\r
       },\r
       by_story: {\r
         type: 'list',\r
+        args: {\r
+          param_id: 'suffix',\r
+        },\r
       },\r
       by_panel: {\r
         type: 'list',\r
+        args: {\r
+          param_id: 'suffix',\r
+        },\r
       },\r
       by_author: {\r
         type: 'list',\r
+        args: {\r
+          param_id: 'suffix',\r
+        },\r
       },\r
       play: {\r
         type: 'list',\r
         type: 'list',\r
         args: {\r
           list_name: 'public',\r
-          \r
+          param_id: 'none',\r
         },\r
       },\r
       by_sheet: {\r
         type: 'list',\r
+        args: {\r
+          param_id: 'suffix',\r
+        },\r
       },\r
       by_panel: {\r
         type: 'list',\r
+        args: {\r
+          param_id: 'suffix',\r
+        },\r
       },\r
       by_author: {\r
         type: 'list',\r
+        args: {\r
+          param_id: 'suffix',\r
+        },\r
       },\r
       show: {\r
         type: 'show',\r
         type: 'list',\r
         args: {\r
           list_name: 'public',\r
-          \r
+          param_id: 'none',\r
         },\r
       },\r
       by_scroll: {\r
         type: 'list',\r
+        args: {\r
+          param_id: 'suffix',\r
+        },\r
       },\r
       by_sheet: {\r
         type: 'list',\r
+        args: {\r
+          param_id: 'suffix',\r
+        },\r
       },\r
       by_author: {\r
         type: 'list',\r
+        args: {\r
+          param_id: 'suffix',\r
+        },\r
       },\r
       by_speech_balloon_template: {\r
         type: 'list',\r
+        args: {\r
+          param_id: 'suffix',\r
+        },\r
       },\r
       show: {\r
         type: 'show',\r
         type: 'list',\r
         args: {\r
           list_name: 'public',\r
-          \r
+          param_id: 'none',\r
         },\r
       },\r
       by_panel: {\r
         type: 'list',\r
+        args: {\r
+          param_id: 'suffix',\r
+        },\r
       },\r
       by_author: {\r
         type: 'list',\r
+        args: {\r
+          param_id: 'suffix',\r
+        },\r
       },\r
       show: {\r
         type: 'show',\r
         type: 'list',\r
         args: {\r
           list_name: 'public',\r
-          \r
+          param_id: 'none',\r
         },\r
       },\r
       by_panel: {\r
         type: 'list',\r
+        args: {\r
+          param_id: 'suffix',\r
+        },\r
       },\r
       by_author: {\r
         type: 'list',\r
+        args: {\r
+          param_id: 'suffix',\r
+        },\r
       },\r
       by_speech_balloon_template: {\r
         type: 'list',\r
+        args: {\r
+          param_id: 'suffix',\r
+        },\r
       },\r
       show: {\r
         type: 'show',\r
         type: 'list',\r
         args: {\r
           list_name: 'public',\r
-          \r
+          param_id: 'none',\r
         },\r
       },\r
       by_author: {\r
         type: 'list',\r
+        args: {\r
+          param_id: 'suffix',\r
+        },\r
       },\r
       show: {\r
         type: 'show',\r
         type: 'list',\r
         args: {\r
           list_name: 'public',\r
-          \r
+          param_id: 'none',\r
         },\r
       },\r
       by_author: {\r
         type: 'list',\r
+        args: {\r
+          param_id: 'suffix',\r
+        },\r
       },\r
       show: {\r
         type: 'show',\r
         type: 'list',\r
         args: {\r
           list_name: 'public',\r
-          \r
+          param_id: 'none',\r
         },\r
       },\r
       by_panel: {\r
         type: 'list',\r
+        args: {\r
+          param_id: 'suffix',\r
+        },\r
       },\r
       by_author: {\r
         type: 'list',\r
+        args: {\r
+          param_id: 'suffix',\r
+        },\r
       },\r
       show: {\r
         type: 'show',\r
         type: 'list',\r
         args: {\r
           list_name: 'public',\r
-          \r
+          param_id: 'none',\r
         },\r
       },\r
       by_panel: {\r
         type: 'list',\r
+        args: {\r
+          param_id: 'suffix',\r
+        },\r
       },\r
       by_author: {\r
         type: 'list',\r
+        args: {\r
+          param_id: 'suffix',\r
+        },\r
       },\r
       show: {\r
         type: 'show',\r
         type: 'list',\r
         args: {\r
           list_name: 'private',\r
+          param_id: 'none',\r
         },\r
       },\r
       show: {\r
         type: 'list',\r
         args: {\r
           list_name: 'public',\r
-          \r
+          param_id: 'none',\r
         },\r
       },\r
       by_artist: {\r
         type: 'list',\r
+        args: {\r
+          param_id: 'suffix',\r
+        },\r
       },\r
       show: {\r
         type: 'show',\r
         type: 'list',\r
         args: {\r
           list_name: 'public',\r
-          \r
+          param_id: 'none',\r
         },\r
       },\r
       by_license_group: {\r
         type: 'list',\r
+        args: {\r
+          param_id: 'suffix',\r
+        },\r
       },\r
       by_license: {\r
         type: 'list',\r
+        args: {\r
+          param_id: 'suffix',\r
+        },\r
       },\r
       by_artist: {\r
         type: 'list',\r
+        args: {\r
+          param_id: 'suffix',\r
+        },\r
       },\r
       show: {\r
         type: 'show',\r
         type: 'list',\r
         args: {\r
           list_name: 'public',\r
-          \r
+          param_id: 'none',\r
         },\r
       },\r
       by_panel: {\r
         type: 'list',\r
+        args: {\r
+          param_id: 'suffix',\r
+        },\r
       },\r
       show: {\r
         type: 'show',\r
         type: 'list',\r
         args: {\r
           list_name: 'public',\r
-          \r
+          param_id: 'none',\r
         },\r
       },\r
       by_system_picture: {\r
         type: 'list',\r
+        args: {\r
+          param_id: 'suffix',\r
+        },\r
       },\r
       show: {\r
         type: 'show',\r
         type: 'list',\r
         args: {\r
           list_name: 'public',\r
-          \r
+          param_id: 'none',\r
         },\r
       },\r
       show: {\r
         type: 'list',\r
         args: {\r
           list_name: 'public',\r
-          \r
+          param_id: 'none',\r
         },\r
       },\r
       by_license_group: {\r
         type: 'list',\r
+        args: {\r
+          param_id: 'suffix',\r
+        },\r
       },\r
       by_system_picture: {\r
         type: 'list',\r
+        args: {\r
+          param_id: 'suffix',\r
+        },\r
       },\r
       show: {\r
         type: 'show',\r
         type: 'list',\r
         args: {\r
           list_name: 'public',\r
-          \r
+          param_id: 'none',\r
         },\r
       },\r
       show: {\r
         type: 'list',\r
         args: {\r
           list_name: 'public',\r
-          \r
+          param_id: 'none',\r
         },\r
       },\r
       show: {\r
         type: 'list',\r
         args: {\r
           list_name: 'public',\r
-          \r
+          param_id: 'none',\r
         },\r
       },\r
       show: {\r
         args: {\r
           item_name: 'scroll',\r
           list_name: 'private',\r
-          \r
+          param_id: 'none',\r
         },\r
       },\r
       scroll_panels: {\r
         args: {\r
           item_name: 'scroll_panel',\r
           list_name: 'private',\r
-          \r
+          param_id: 'none',\r
         },\r
       },\r
       comics: {\r
         args: {\r
           item_name: 'comic',\r
           list_name: 'private',\r
-          \r
+          param_id: 'none',\r
         },\r
       },\r
       stories: {\r
         args: {\r
           item_name: 'story',\r
           list_name: 'private',\r
-          \r
+          param_id: 'none',\r
         },\r
       },\r
       story_sheets: {\r
         args: {\r
           item_name: 'story_sheet',\r
           list_name: 'private',\r
-          \r
+          param_id: 'none',\r
         },\r
       },\r
       sheets: {\r
         args: {\r
           item_name: 'sheet',\r
           list_name: 'private',\r
-          \r
+          param_id: 'none',\r
         },\r
       },\r
       sheet_panels: {\r
         args: {\r
           item_name: 'sheet_panel',\r
           list_name: 'private',\r
-          \r
+          param_id: 'none',\r
         },\r
       },\r
       panels: {\r
         args: {\r
           item_name: 'panel',\r
           list_name: 'private',\r
-          \r
+          param_id: 'none',\r
         },\r
       },\r
       panel_pictures: {\r
         args: {\r
           item_name: 'panel_picture',\r
           list_name: 'private',\r
-          \r
+          param_id: 'none',\r
         },\r
       },\r
       speech_balloons: {\r
         args: {\r
           item_name: 'speech_balloon',\r
           list_name: 'private',\r
-          \r
+          param_id: 'none',\r
         },\r
       },\r
       speeches: {\r
         args: {\r
           item_name: 'speech',\r
           list_name: 'private',\r
-          \r
+          param_id: 'none',\r
         },\r
       },\r
       balloons: {\r
         args: {\r
           item_name: 'balloon',\r
           list_name: 'private',\r
-          \r
+          param_id: 'none',\r
         },\r
       },\r
       ground_pictures: {\r
         args: {\r
           item_name: 'ground_picture',\r
           list_name: 'private',\r
-          \r
+          param_id: 'none',\r
         },\r
       },\r
       ground_colors: {\r
         args: {\r
           item_name: 'ground_color',\r
           list_name: 'private',\r
-          \r
+          param_id: 'none',\r
         },\r
       },\r
       original_pictures: {\r
         args: {\r
           item_name: 'original_picture',\r
           list_name: 'private',\r
-          \r
+          param_id: 'none',\r
         },\r
       },\r
       resource_pictures: {\r
         args: {\r
           item_name: 'resource_picture',\r
           list_name: 'private',\r
-          \r
+          param_id: 'none',\r
         },\r
       },\r
     },\r
index ad431b0..03a4112 100644 (file)
@@ -1,6 +1,7 @@
 #マニフェスト\r
 @models = {\r
   folder: {\r
+    table_name: 'folders',\r
     associations: {\r
       belongs_to: {\r
       },\r
@@ -65,6 +66,7 @@
     },\r
   },\r
   scroll: {\r
+    table_name: 'scrolls',\r
     associations: {\r
       belongs_to: {\r
         author: {\r
     },\r
   },\r
   scroll_panel: {\r
+    table_name: 'scroll_panels',\r
     associations: {\r
       belongs_to: {\r
         panel: {\r
     },\r
   },\r
   comic: {\r
+    table_name: 'comics',\r
     associations: {\r
       belongs_to: {\r
         author: {\r
     },\r
   },\r
   comic_story: {\r
+    table_name: 'comic_stories',\r
     associations: {\r
       belongs_to: {\r
         comic: {\r
     },\r
   },\r
   story: {\r
+    table_name: 'stories',\r
     associations: {\r
       belongs_to: {\r
         author: {\r
     },\r
   },\r
   story_sheet: {\r
+    table_name: 'story_sheets',\r
     associations: {\r
       belongs_to: {\r
         story: {\r
     },\r
   },\r
   sheet: {\r
+    table_name: 'sheets',\r
     associations: {\r
       belongs_to: {\r
         author: {\r
     },\r
   },\r
   sheet_panel: {\r
+    table_name: 'sheet_panels',\r
     associations: {\r
       belongs_to: {\r
         sheet: {\r
     },\r
   },\r
   panel: {\r
+    table_name: 'panels',\r
     associations: {\r
       belongs_to: {\r
         author: {\r
     },\r
   },\r
   panel_picture: {\r
+    table_name: 'panel_pictures',\r
     associations: {\r
       belongs_to: {\r
         panel: {\r
     },\r
   },\r
   speech_balloon: {\r
+    table_name: 'speech_balloons',\r
     associations: {\r
       belongs_to: {\r
         panel: {\r
     },\r
   }, \r
   balloon: {\r
+    table_name: 'balloons',\r
     associations: {\r
       belongs_to: {\r
         speech_balloon: {\r
     },\r
   },\r
   speech: {\r
+    table_name: 'speeches',\r
     associations: {\r
       belongs_to: {\r
         speech_balloon: {\r
     },\r
   },\r
   ground_picture: {\r
+    table_name: 'ground_pictures',\r
     associations: {\r
       belongs_to: {\r
         panel: {\r
     },\r
   },\r
   ground_color: {\r
+    table_name: 'ground_colors',\r
     associations: {\r
       belongs_to: {\r
         panel: {\r
     },\r
   },\r
   original_picture: {\r
+    table_name: 'original_pictures',\r
     associations: {\r
       belongs_to: {\r
         artist: {\r
     },\r
   },\r
   picture: {\r
+    table_name: 'pictures',\r
     associations: {\r
       belongs_to: {\r
         license: {\r
     }\r
   },\r
   resource_picture: {\r
+    table_name: 'resource_pictures',\r
     associations: {\r
       belongs_to: {\r
         original_picture: {\r
     },\r
   },\r
   original_picture_license_group: {\r
+    table_name: 'original_picture_license_groups',\r
     associations: {\r
       belongs_to: {\r
         original_picture: {\r
     },\r
   },\r
   original_picture_license: {\r
+    table_name: 'original_picture_licenses',\r
     associations: {\r
       belongs_to: {\r
         original_picture: {\r
     },\r
   },\r
   speech_balloon_template: {\r
+    table_name: 'speech_balloon_templates',\r
     associations: {\r
       belongs_to: {\r
         system_picture: {\r
     },\r
   },\r
   writing_format: {\r
+    table_name: 'writing_formats',\r
     associations: {\r
       belongs_to: {\r
         system_picture: {\r
     },\r
   },\r
   license_group: {\r
+    table_name: 'license_groups',\r
     associations: {\r
       belongs_to: {\r
       },\r
     },\r
   },\r
   license: {\r
+    table_name: 'licenses',\r
     associations: {\r
       belongs_to: {\r
         license_group: {\r
     },\r
   },\r
   author: {\r
+    table_name: 'authors',\r
     associations: {\r
       belongs_to: {\r
       },\r
     },\r
   },\r
   artist: {\r
+    table_name: 'artists',\r
     associations: {\r
       belongs_to: {\r
       },\r
     },\r
   },\r
   system_picture: {\r
+    table_name: 'system_pictures',\r
     associations: {\r
       belongs_to: {\r
       },\r
index e57b03b..cbf5918 100644 (file)
@@ -13,9 +13,15 @@ class FoldersController < ApplicationController
   def root
     set_model
     @item = Folder.root
-    respond_to do |format|
-      children_html_format format
-      children_json_format format
+    if params[:ref]
+      respond_to do |format|
+        show_json_format format
+      end
+    else
+      respond_to do |format|
+        children_html_format format
+        children_json_format format
+      end
     end
   end
   
index 7626f7a..df95c3d 100644 (file)
         "index": {\r
           "type": "list",\r
           "args": {\r
-            "list_name": "public"\r
+            "list_name": "public",\r
+            "param_id": "none"\r
           }\r
         },\r
         "show": {\r
         "index": {\r
           "type": "list",\r
           "args": {\r
-            "list_name": "public"\r
+            "list_name": "public",\r
+            "param_id": "none"\r
           }\r
         },\r
         "by_author": {\r
-          "type": "list"\r
+          "type": "list",\r
+          "args": {\r
+            "param_id": "suffix"\r
+          }\r
         },\r
         "by_panel": {\r
-          "type": "list"\r
+          "type": "list",\r
+          "args": {\r
+            "param_id": "suffix"\r
+          }\r
         },\r
         "play": {\r
           "type": "list",\r
         "index": {\r
           "type": "list",\r
           "args": {\r
-            "list_name": "public"\r
+            "list_name": "public",\r
+            "param_id": "none"\r
           }\r
         },\r
         "by_panel": {\r
-          "type": "list"\r
+          "type": "list",\r
+          "args": {\r
+            "param_id": "suffix"\r
+          }\r
         },\r
         "by_scroll": {\r
-          "type": "list"\r
+          "type": "list",\r
+          "args": {\r
+            "param_id": "suffix"\r
+          }\r
         },\r
         "by_author": {\r
-          "type": "list"\r
+          "type": "list",\r
+          "args": {\r
+            "param_id": "suffix"\r
+          }\r
         },\r
         "show": {\r
           "type": "show"\r
         "index": {\r
           "type": "list",\r
           "args": {\r
-            "list_name": "public"\r
+            "list_name": "public",\r
+            "param_id": "none"\r
           }\r
         },\r
         "by_story": {\r
-          "type": "list"\r
+          "type": "list",\r
+          "args": {\r
+            "param_id": "suffix"\r
+          }\r
         },\r
         "by_author": {\r
-          "type": "list"\r
+          "type": "list",\r
+          "args": {\r
+            "param_id": "suffix"\r
+          }\r
         },\r
         "play": {\r
           "type": "list",\r
         "index": {\r
           "type": "list",\r
           "args": {\r
-            "list_name": "public"\r
+            "list_name": "public",\r
+            "param_id": "none"\r
           }\r
         },\r
         "by_comic": {\r
-          "type": "list"\r
+          "type": "list",\r
+          "args": {\r
+            "param_id": "suffix"\r
+          }\r
         },\r
         "by_story": {\r
-          "type": "list"\r
+          "type": "list",\r
+          "args": {\r
+            "param_id": "suffix"\r
+          }\r
         },\r
         "show": {\r
           "type": "show"\r
         "index": {\r
           "type": "list",\r
           "args": {\r
-            "list_name": "public"\r
+            "list_name": "public",\r
+            "param_id": "none"\r
           }\r
         },\r
         "by_comic": {\r
-          "type": "list"\r
+          "type": "list",\r
+          "args": {\r
+            "param_id": "suffix"\r
+          }\r
         },\r
         "by_sheet": {\r
-          "type": "list"\r
+          "type": "list",\r
+          "args": {\r
+            "param_id": "suffix"\r
+          }\r
         },\r
         "by_author": {\r
-          "type": "list"\r
+          "type": "list",\r
+          "args": {\r
+            "param_id": "suffix"\r
+          }\r
         },\r
         "play": {\r
           "type": "list",\r
         "index": {\r
           "type": "list",\r
           "args": {\r
-            "list_name": "public"\r
+            "list_name": "public",\r
+            "param_id": "none"\r
           }\r
         },\r
         "by_story": {\r
-          "type": "list"\r
+          "type": "list",\r
+          "args": {\r
+            "param_id": "suffix"\r
+          }\r
         },\r
         "by_sheet": {\r
-          "type": "list"\r
+          "type": "list",\r
+          "args": {\r
+            "param_id": "suffix"\r
+          }\r
         },\r
         "by_author": {\r
-          "type": "list"\r
+          "type": "list",\r
+          "args": {\r
+            "param_id": "suffix"\r
+          }\r
         },\r
         "show": {\r
           "type": "show"\r
         "index": {\r
           "type": "list",\r
           "args": {\r
-            "list_name": "public"\r
+            "list_name": "public",\r
+            "param_id": "none"\r
           }\r
         },\r
         "by_story": {\r
-          "type": "list"\r
+          "type": "list",\r
+          "args": {\r
+            "param_id": "suffix"\r
+          }\r
         },\r
         "by_panel": {\r
-          "type": "list"\r
+          "type": "list",\r
+          "args": {\r
+            "param_id": "suffix"\r
+          }\r
         },\r
         "by_author": {\r
-          "type": "list"\r
+          "type": "list",\r
+          "args": {\r
+            "param_id": "suffix"\r
+          }\r
         },\r
         "play": {\r
           "type": "list",\r
         "index": {\r
           "type": "list",\r
           "args": {\r
-            "list_name": "public"\r
+            "list_name": "public",\r
+            "param_id": "none"\r
           }\r
         },\r
         "by_sheet": {\r
-          "type": "list"\r
+          "type": "list",\r
+          "args": {\r
+            "param_id": "suffix"\r
+          }\r
         },\r
         "by_panel": {\r
-          "type": "list"\r
+          "type": "list",\r
+          "args": {\r
+            "param_id": "suffix"\r
+          }\r
         },\r
         "by_author": {\r
-          "type": "list"\r
+          "type": "list",\r
+          "args": {\r
+            "param_id": "suffix"\r
+          }\r
         },\r
         "show": {\r
           "type": "show"\r
         "index": {\r
           "type": "list",\r
           "args": {\r
-            "list_name": "public"\r
+            "list_name": "public",\r
+            "param_id": "none"\r
           }\r
         },\r
         "by_scroll": {\r
-          "type": "list"\r
+          "type": "list",\r
+          "args": {\r
+            "param_id": "suffix"\r
+          }\r
         },\r
         "by_sheet": {\r
-          "type": "list"\r
+          "type": "list",\r
+          "args": {\r
+            "param_id": "suffix"\r
+          }\r
         },\r
         "by_author": {\r
-          "type": "list"\r
+          "type": "list",\r
+          "args": {\r
+            "param_id": "suffix"\r
+          }\r
         },\r
         "by_speech_balloon_template": {\r
-          "type": "list"\r
+          "type": "list",\r
+          "args": {\r
+            "param_id": "suffix"\r
+          }\r
         },\r
         "show": {\r
           "type": "show"\r
         "index": {\r
           "type": "list",\r
           "args": {\r
-            "list_name": "public"\r
+            "list_name": "public",\r
+            "param_id": "none"\r
           }\r
         },\r
         "by_panel": {\r
-          "type": "list"\r
+          "type": "list",\r
+          "args": {\r
+            "param_id": "suffix"\r
+          }\r
         },\r
         "by_author": {\r
-          "type": "list"\r
+          "type": "list",\r
+          "args": {\r
+            "param_id": "suffix"\r
+          }\r
         },\r
         "show": {\r
           "type": "show"\r
         "index": {\r
           "type": "list",\r
           "args": {\r
-            "list_name": "public"\r
+            "list_name": "public",\r
+            "param_id": "none"\r
           }\r
         },\r
         "by_panel": {\r
-          "type": "list"\r
+          "type": "list",\r
+          "args": {\r
+            "param_id": "suffix"\r
+          }\r
         },\r
         "by_author": {\r
-          "type": "list"\r
+          "type": "list",\r
+          "args": {\r
+            "param_id": "suffix"\r
+          }\r
         },\r
         "by_speech_balloon_template": {\r
-          "type": "list"\r
+          "type": "list",\r
+          "args": {\r
+            "param_id": "suffix"\r
+          }\r
         },\r
         "show": {\r
           "type": "show"\r
         "index": {\r
           "type": "list",\r
           "args": {\r
-            "list_name": "public"\r
+            "list_name": "public",\r
+            "param_id": "none"\r
           }\r
         },\r
         "by_author": {\r
-          "type": "list"\r
+          "type": "list",\r
+          "args": {\r
+            "param_id": "suffix"\r
+          }\r
         },\r
         "show": {\r
           "type": "show"\r
         "index": {\r
           "type": "list",\r
           "args": {\r
-            "list_name": "public"\r
+            "list_name": "public",\r
+            "param_id": "none"\r
           }\r
         },\r
         "by_author": {\r
-          "type": "list"\r
+          "type": "list",\r
+          "args": {\r
+            "param_id": "suffix"\r
+          }\r
         },\r
         "show": {\r
           "type": "show"\r
         "index": {\r
           "type": "list",\r
           "args": {\r
-            "list_name": "public"\r
+            "list_name": "public",\r
+            "param_id": "none"\r
           }\r
         },\r
         "by_panel": {\r
-          "type": "list"\r
+          "type": "list",\r
+          "args": {\r
+            "param_id": "suffix"\r
+          }\r
         },\r
         "by_author": {\r
-          "type": "list"\r
+          "type": "list",\r
+          "args": {\r
+            "param_id": "suffix"\r
+          }\r
         },\r
         "show": {\r
           "type": "show"\r
         "index": {\r
           "type": "list",\r
           "args": {\r
-            "list_name": "public"\r
+            "list_name": "public",\r
+            "param_id": "none"\r
           }\r
         },\r
         "by_panel": {\r
-          "type": "list"\r
+          "type": "list",\r
+          "args": {\r
+            "param_id": "suffix"\r
+          }\r
         },\r
         "by_author": {\r
-          "type": "list"\r
+          "type": "list",\r
+          "args": {\r
+            "param_id": "suffix"\r
+          }\r
         },\r
         "show": {\r
           "type": "show"\r
         "index": {\r
           "type": "list",\r
           "args": {\r
-            "list_name": "private"\r
+            "list_name": "private",\r
+            "param_id": "none"\r
           }\r
         },\r
         "show": {\r
         "index": {\r
           "type": "list",\r
           "args": {\r
-            "list_name": "public"\r
+            "list_name": "public",\r
+            "param_id": "none"\r
           }\r
         },\r
         "by_artist": {\r
-          "type": "list"\r
+          "type": "list",\r
+          "args": {\r
+            "param_id": "suffix"\r
+          }\r
         },\r
         "show": {\r
           "type": "show"\r
         "index": {\r
           "type": "list",\r
           "args": {\r
-            "list_name": "public"\r
+            "list_name": "public",\r
+            "param_id": "none"\r
           }\r
         },\r
         "by_license_group": {\r
-          "type": "list"\r
+          "type": "list",\r
+          "args": {\r
+            "param_id": "suffix"\r
+          }\r
         },\r
         "by_license": {\r
-          "type": "list"\r
+          "type": "list",\r
+          "args": {\r
+            "param_id": "suffix"\r
+          }\r
         },\r
         "by_artist": {\r
-          "type": "list"\r
+          "type": "list",\r
+          "args": {\r
+            "param_id": "suffix"\r
+          }\r
         },\r
         "show": {\r
           "type": "show"\r
         "index": {\r
           "type": "list",\r
           "args": {\r
-            "list_name": "public"\r
+            "list_name": "public",\r
+            "param_id": "none"\r
           }\r
         },\r
         "by_panel": {\r
-          "type": "list"\r
+          "type": "list",\r
+          "args": {\r
+            "param_id": "suffix"\r
+          }\r
         },\r
         "show": {\r
           "type": "show"\r
         "index": {\r
           "type": "list",\r
           "args": {\r
-            "list_name": "public"\r
+            "list_name": "public",\r
+            "param_id": "none"\r
           }\r
         },\r
         "by_system_picture": {\r
-          "type": "list"\r
+          "type": "list",\r
+          "args": {\r
+            "param_id": "suffix"\r
+          }\r
         },\r
         "show": {\r
           "type": "show"\r
         "index": {\r
           "type": "list",\r
           "args": {\r
-            "list_name": "public"\r
+            "list_name": "public",\r
+            "param_id": "none"\r
           }\r
         },\r
         "show": {\r
         "index": {\r
           "type": "list",\r
           "args": {\r
-            "list_name": "public"\r
+            "list_name": "public",\r
+            "param_id": "none"\r
           }\r
         },\r
         "by_license_group": {\r
-          "type": "list"\r
+          "type": "list",\r
+          "args": {\r
+            "param_id": "suffix"\r
+          }\r
         },\r
         "by_system_picture": {\r
-          "type": "list"\r
+          "type": "list",\r
+          "args": {\r
+            "param_id": "suffix"\r
+          }\r
         },\r
         "show": {\r
           "type": "show"\r
         "index": {\r
           "type": "list",\r
           "args": {\r
-            "list_name": "public"\r
+            "list_name": "public",\r
+            "param_id": "none"\r
           }\r
         },\r
         "show": {\r
         "index": {\r
           "type": "list",\r
           "args": {\r
-            "list_name": "public"\r
+            "list_name": "public",\r
+            "param_id": "none"\r
           }\r
         },\r
         "show": {\r
         "index": {\r
           "type": "list",\r
           "args": {\r
-            "list_name": "public"\r
+            "list_name": "public",\r
+            "param_id": "none"\r
           }\r
         },\r
         "show": {\r
           "type": "list",\r
           "args": {\r
             "item_name": "scroll",\r
-            "list_name": "private"\r
+            "list_name": "private",\r
+            "param_id": "none"\r
           }\r
         },\r
         "scroll_panels": {\r
           "type": "list",\r
           "args": {\r
             "item_name": "scroll_panel",\r
-            "list_name": "private"\r
+            "list_name": "private",\r
+            "param_id": "none"\r
           }\r
         },\r
         "comics": {\r
           "type": "list",\r
           "args": {\r
             "item_name": "comic",\r
-            "list_name": "private"\r
+            "list_name": "private",\r
+            "param_id": "none"\r
           }\r
         },\r
         "stories": {\r
           "type": "list",\r
           "args": {\r
             "item_name": "story",\r
-            "list_name": "private"\r
+            "list_name": "private",\r
+            "param_id": "none"\r
           }\r
         },\r
         "story_sheets": {\r
           "type": "list",\r
           "args": {\r
             "item_name": "story_sheet",\r
-            "list_name": "private"\r
+            "list_name": "private",\r
+            "param_id": "none"\r
           }\r
         },\r
         "sheets": {\r
           "type": "list",\r
           "args": {\r
             "item_name": "sheet",\r
-            "list_name": "private"\r
+            "list_name": "private",\r
+            "param_id": "none"\r
           }\r
         },\r
         "sheet_panels": {\r
           "type": "list",\r
           "args": {\r
             "item_name": "sheet_panel",\r
-            "list_name": "private"\r
+            "list_name": "private",\r
+            "param_id": "none"\r
           }\r
         },\r
         "panels": {\r
           "type": "list",\r
           "args": {\r
             "item_name": "panel",\r
-            "list_name": "private"\r
+            "list_name": "private",\r
+            "param_id": "none"\r
           }\r
         },\r
         "panel_pictures": {\r
           "type": "list",\r
           "args": {\r
             "item_name": "panel_picture",\r
-            "list_name": "private"\r
+            "list_name": "private",\r
+            "param_id": "none"\r
           }\r
         },\r
         "speech_balloons": {\r
           "type": "list",\r
           "args": {\r
             "item_name": "speech_balloon",\r
-            "list_name": "private"\r
+            "list_name": "private",\r
+            "param_id": "none"\r
           }\r
         },\r
         "speeches": {\r
           "type": "list",\r
           "args": {\r
             "item_name": "speech",\r
-            "list_name": "private"\r
+            "list_name": "private",\r
+            "param_id": "none"\r
           }\r
         },\r
         "balloons": {\r
           "type": "list",\r
           "args": {\r
             "item_name": "balloon",\r
-            "list_name": "private"\r
+            "list_name": "private",\r
+            "param_id": "none"\r
           }\r
         },\r
         "ground_pictures": {\r
           "type": "list",\r
           "args": {\r
             "item_name": "ground_picture",\r
-            "list_name": "private"\r
+            "list_name": "private",\r
+            "param_id": "none"\r
           }\r
         },\r
         "ground_colors": {\r
           "type": "list",\r
           "args": {\r
             "item_name": "ground_color",\r
-            "list_name": "private"\r
+            "list_name": "private",\r
+            "param_id": "none"\r
           }\r
         },\r
         "original_pictures": {\r
           "type": "list",\r
           "args": {\r
             "item_name": "original_picture",\r
-            "list_name": "private"\r
+            "list_name": "private",\r
+            "param_id": "none"\r
           }\r
         },\r
         "resource_pictures": {\r
           "type": "list",\r
           "args": {\r
             "item_name": "resource_picture",\r
-            "list_name": "private"\r
+            "list_name": "private",\r
+            "param_id": "none"\r
           }\r
         }\r
       }\r
   },\r
   "models": {\r
     "folder": {\r
+      "table_name": "folders",\r
       "associations": {\r
         "belongs_to": {},\r
         "has_many": {}\r
       }\r
     },\r
     "scroll": {\r
+      "table_name": "scrolls",\r
       "associations": {\r
         "belongs_to": {\r
           "author": {}\r
       }\r
     },\r
     "scroll_panel": {\r
+      "table_name": "scroll_panels",\r
       "associations": {\r
         "belongs_to": {\r
           "panel": {},\r
       }\r
     },\r
     "comic": {\r
+      "table_name": "comics",\r
       "associations": {\r
         "belongs_to": {\r
           "author": {}\r
       }\r
     },\r
     "comic_story": {\r
+      "table_name": "comic_stories",\r
       "associations": {\r
         "belongs_to": {\r
           "comic": {},\r
       }\r
     },\r
     "story": {\r
+      "table_name": "stories",\r
       "associations": {\r
         "belongs_to": {\r
           "author": {}\r
       }\r
     },\r
     "story_sheet": {\r
+      "table_name": "story_sheets",\r
       "associations": {\r
         "belongs_to": {\r
           "story": {},\r
       }\r
     },\r
     "sheet": {\r
+      "table_name": "sheets",\r
       "associations": {\r
         "belongs_to": {\r
           "author": {}\r
       }\r
     },\r
     "sheet_panel": {\r
+      "table_name": "sheet_panels",\r
       "associations": {\r
         "belongs_to": {\r
           "sheet": {},\r
       }\r
     },\r
     "panel": {\r
+      "table_name": "panels",\r
       "associations": {\r
         "belongs_to": {\r
           "author": {}\r
       }\r
     },\r
     "panel_picture": {\r
+      "table_name": "panel_pictures",\r
       "associations": {\r
         "belongs_to": {\r
           "panel": {}\r
       }\r
     },\r
     "speech_balloon": {\r
+      "table_name": "speech_balloons",\r
       "associations": {\r
         "belongs_to": {\r
           "panel": {},\r
       }\r
     },\r
     "balloon": {\r
+      "table_name": "balloons",\r
       "associations": {\r
         "belongs_to": {\r
           "speech_balloon": {},\r
       }\r
     },\r
     "speech": {\r
+      "table_name": "speeches",\r
       "associations": {\r
         "belongs_to": {\r
           "speech_balloon": {},\r
       }\r
     },\r
     "ground_picture": {\r
+      "table_name": "ground_pictures",\r
       "associations": {\r
         "belongs_to": {\r
           "panel": {}\r
       }\r
     },\r
     "ground_color": {\r
+      "table_name": "ground_colors",\r
       "associations": {\r
         "belongs_to": {\r
           "panel": {}\r
       }\r
     },\r
     "original_picture": {\r
+      "table_name": "original_pictures",\r
       "associations": {\r
         "belongs_to": {\r
           "artist": {}\r
       }\r
     },\r
     "picture": {\r
+      "table_name": "pictures",\r
       "associations": {\r
         "belongs_to": {\r
           "license": {},\r
       }\r
     },\r
     "resource_picture": {\r
+      "table_name": "resource_pictures",\r
       "associations": {\r
         "belongs_to": {\r
           "original_picture": {},\r
       }\r
     },\r
     "original_picture_license_group": {\r
+      "table_name": "original_picture_license_groups",\r
       "associations": {\r
         "belongs_to": {\r
           "original_picture": {},\r
       }\r
     },\r
     "original_picture_license": {\r
+      "table_name": "original_picture_licenses",\r
       "associations": {\r
         "belongs_to": {\r
           "original_picture": {},\r
       }\r
     },\r
     "speech_balloon_template": {\r
+      "table_name": "speech_balloon_templates",\r
       "associations": {\r
         "belongs_to": {\r
           "system_picture": {}\r
       }\r
     },\r
     "writing_format": {\r
+      "table_name": "writing_formats",\r
       "associations": {\r
         "belongs_to": {\r
           "system_picture": {}\r
       }\r
     },\r
     "license_group": {\r
+      "table_name": "license_groups",\r
       "associations": {\r
         "belongs_to": {},\r
         "has_many": {\r
       }\r
     },\r
     "license": {\r
+      "table_name": "licenses",\r
       "associations": {\r
         "belongs_to": {\r
           "license_group": {},\r
       }\r
     },\r
     "author": {\r
+      "table_name": "authors",\r
       "associations": {\r
         "belongs_to": {},\r
         "has_many": {\r
       }\r
     },\r
     "artist": {\r
+      "table_name": "artists",\r
       "associations": {\r
         "belongs_to": {},\r
         "has_many": {\r
       }\r
     },\r
     "system_picture": {\r
+      "table_name": "system_pictures",\r
       "associations": {\r
         "belongs_to": {},\r
         "has_many": {\r