OSDN Git Service

t#32471:add profiles
authoryasushiito <yas@pen-chan.jp>
Sat, 23 Nov 2013 22:26:00 +0000 (07:26 +0900)
committeryasushiito <yas@pen-chan.jp>
Sat, 23 Nov 2013 22:26:00 +0000 (07:26 +0900)
59 files changed:
app/assets/images/writing_format.gif [new file with mode: 0644]
app/assets/javascripts/application.js
app/assets/javascripts/configurations.js.coffee.erb
app/controllers/application_controller.rb
app/controllers/artists_controller.rb
app/controllers/authors_controller.rb
app/controllers/balloons_controller.rb
app/controllers/comics_controller.rb
app/controllers/ground_colors_controller.rb
app/controllers/ground_pictures_controller.rb
app/controllers/license_groups_controller.rb
app/controllers/licenses_controller.rb
app/controllers/original_pictures_controller.rb
app/controllers/panel_pictures_controller.rb
app/controllers/panels_controller.rb
app/controllers/pictures_controller.rb
app/controllers/resource_pictures_controller.rb
app/controllers/scroll_panels_controller.rb
app/controllers/scrolls_controller.rb
app/controllers/sheet_panels_controller.rb
app/controllers/sheets_controller.rb
app/controllers/speech_balloon_templates_controller.rb
app/controllers/speech_balloons_controller.rb
app/controllers/speeches_controller.rb
app/controllers/stories_controller.rb
app/controllers/story_sheets_controller.rb
app/controllers/system_pictures_controller.rb
app/controllers/writing_formats_controller.rb
app/helpers/application_helper.rb
app/models/balloon.rb
app/models/comic.rb
app/models/ground_color.rb
app/models/ground_picture.rb
app/models/license.rb
app/models/license_group.rb
app/models/panel.rb
app/models/panel_picture.rb
app/models/picture.rb
app/models/resource_picture.rb
app/models/scroll.rb
app/models/scroll_panel.rb
app/models/sheet.rb
app/models/sheet_panel.rb
app/models/speech.rb
app/models/speech_balloon.rb
app/models/story.rb
app/models/story_sheet.rb
app/views/comics/_summary.html.erb [new file with mode: 0644]
app/views/pictures/_summary.html.erb [new file with mode: 0644]
app/views/system/_filer.html.erb [new file with mode: 0644]
app/views/system/filer.html.erb
app/views/system/prof.prof.erb [new file with mode: 0644]
app/views/top/index.html.erb
app/views/top/prof.prof.erb [deleted file]
config/locales/pettanr.ja.yml
config/routes.rb
vendor/plugins/content/lib/content.rb
vendor/plugins/element/lib/element.rb
vendor/plugins/item/lib/item.rb

diff --git a/app/assets/images/writing_format.gif b/app/assets/images/writing_format.gif
new file mode 100644 (file)
index 0000000..7b69910
Binary files /dev/null and b/app/assets/images/writing_format.gif differ
index 07ab6a0..5d00b9f 100644 (file)
@@ -14,9 +14,6 @@
 //= require underscore
 //= require backbone
 //= require configurations
-//= require item
-//= require element
-//= require_directory ./models
 //= require pettanr_editor
 //= require pettanr_sheeter
 //= require writing_formats
index 030eeb8..144f48e 100644 (file)
 @configurations = {\r
-  filers: {\r
+  models: {\r
+    Scroll: 'scroll',\r
     scroll: {\r
-      symbol: {\r
-        type: 'image',\r
-        name: '<%= asset_path('item.png') %>',\r
-      },\r
-      caption: {\r
-        type: 'column',\r
-        name: 'title',\r
-        link: {\r
-          type: 'action'\r
-          name: 'play',\r
+      class_name: 'Scroll',\r
+      table_name: 'scrolls',\r
+      associations: {\r
+        belongs_to: {\r
+          author: {\r
+            id_column: 'author_id'\r
+          }, \r
+        },\r
+        has_many: {\r
+          scroll_panels: {\r
+            foreign_key: 'scroll_id',\r
+            list_method: 'list_by_scroll',\r
+          }, \r
+          panels: {\r
+            through: 'scroll_panels',\r
+            foreign_key: 'scroll_id'\r
+            list_method: 'list_by_scroll',\r
+          }, \r
         },\r
       },\r
-      summary: {\r
-        type: 'template',\r
-        name: 'summary',\r
-      },\r
-      edit: {\r
-        type: 'default',\r
-      },\r
+      attributes: {\r
+        id: {\r
+          type: 'number',\r
+          primary_key: 1,\r
+          rules : {\r
+            number: true,\r
+          }\r
+        },\r
+        title: {\r
+          type: 'text',\r
+          rules : {\r
+            required: true,\r
+          }\r
+        },\r
+        description: {\r
+          type: 'text',\r
+          rules : {\r
+          }\r
+        },\r
+        visible: {\r
+          type: 'number',\r
+          rules : {\r
+            required: true,\r
+            number: true,\r
+          }\r
+        },\r
+        author_id: {\r
+          type: 'number',\r
+          rules : {\r
+            required: true,\r
+            number: true,\r
+          }\r
+        },\r
+        created_at: {\r
+          type: 'datetime',\r
+        },\r
+        updated_at: {\r
+          type: 'datetime',\r
+        }\r
+      }\r
     },\r
+    ScrollPanel: 'scroll_panel',\r
     scroll_panel: {\r
-      symbol: {\r
-        type: 'image',\r
-        name: '<%= asset_path('item.png') %>',\r
-        link: {\r
-          type: 'none'\r
+      class_name: 'ScrollPanel',\r
+      table_name: 'scroll_panels',\r
+      associations: {\r
+        belongs_to: {\r
+          panel: {\r
+            id_column: 'panel_id'\r
+          }, \r
+          scroll: {\r
+            id_column: 'scroll_id'\r
+          }, \r
+        },\r
+        has_many: {\r
         },\r
       },\r
-      caption: {\r
-        type: 'none',\r
-      },\r
-      summary: {\r
-        type: 'template',\r
-        name: 'summary',\r
-      },\r
-      edit: {\r
-        type: 'none'\r
-      },\r
+      attributes: {\r
+        id: {\r
+          type: 'number',\r
+          primary_key: 1,\r
+          rules : {\r
+            number: true,\r
+          }\r
+        },\r
+        scroll_id: {\r
+          type: 'number',\r
+          rules : {\r
+            required: true,\r
+            number: true,\r
+          }\r
+        },\r
+        panel_id: {\r
+          type: 'number',\r
+          rules : {\r
+            required: true,\r
+            number: true,\r
+          }\r
+        },\r
+        t: {\r
+          type: 'number',\r
+          rules : {\r
+            required: true,\r
+            number: true,\r
+            min: 0,\r
+          }\r
+        },\r
+        author_id: {\r
+          type: 'number',\r
+          rules : {\r
+            required: true,\r
+            number: true,\r
+          }\r
+        },\r
+        created_at: {\r
+          type: 'datetime',\r
+        },\r
+        updated_at: {\r
+          type: 'datetime',\r
+        }\r
+      }\r
     },\r
+    Comic: 'comic',\r
     comic: {\r
-      symbol: {\r
-        type: 'image',\r
-        name: '<%= asset_path('item.png') %>',\r
-      },\r
-      caption: {\r
-        type: 'column',\r
-        name: 'title',\r
-      },\r
-      summary: {\r
-        type: 'template',\r
-        name: 'summary',\r
-      },\r
-      edit: {\r
-        type: 'default',\r
+      class_name: 'Comic',\r
+      table_name: 'comics',\r
+      associations: {\r
+        belongs_to: {\r
+          author: {\r
+            id_column: 'author_id'\r
+          }, \r
+        },\r
+        has_many: {\r
+          stories: {\r
+            foreign_key: 'comic_id'\r
+            list_method: 'list_by_comic',\r
+          }, \r
+        },\r
+        has_many_through: {\r
+        },\r
       },\r
+      attributes: {\r
+        id: {\r
+          type: 'number',\r
+          primary_key: 1,\r
+          rules : {\r
+            number: true,\r
+          }\r
+        },\r
+        title: {\r
+          type: 'text',\r
+          rules : {\r
+            required: true,\r
+          }\r
+        },\r
+        description: {\r
+          type: 'text',\r
+          rules : {\r
+          }\r
+        },\r
+        visible: {\r
+          type: 'number',\r
+          rules : {\r
+            required: true,\r
+            number: true,\r
+          }\r
+        },\r
+        author_id: {\r
+          type: 'number',\r
+          rules : {\r
+            required: true,\r
+            number: true,\r
+          }\r
+        },\r
+        created_at: {\r
+          type: 'datetime',\r
+        },\r
+        updated_at: {\r
+          type: 'datetime',\r
+        }\r
+      }\r
     },\r
+    Story: 'story',\r
     story: {\r
-      symbol: {\r
-        type: 'image',\r
-        name: '<%= asset_path('item.png') %>',\r
-      },\r
-      caption: {\r
-        type: 'method',\r
-        name: 'title_with_t',\r
-        link: {\r
-          type: 'action'\r
-          name: 'play',\r
+      class_name: 'Story',\r
+      table_name: 'stories',\r
+      associations: {\r
+        belongs_to: {\r
+          comic: {\r
+            id_column: 'comic_id'\r
+          }, \r
+        },\r
+        has_many: {\r
+          story_sheets: {\r
+            foreign_key: 'story_id',\r
+            list_method: 'list_by_story',\r
+          }, \r
+          sheets: {\r
+            through: 'story_sheets',\r
+            foreign_key: 'story_id'\r
+            list_method: 'list_by_story',\r
+          }, \r
         },\r
       },\r
-      summary: {\r
-        type: 'template',\r
-        name: 'summary',\r
-      },\r
-      edit: {\r
-        type: 'default',\r
-      },\r
+      attributes: {\r
+        id: {\r
+          type: 'number',\r
+          primary_key: 1,\r
+          rules : {\r
+            number: true,\r
+          }\r
+        },\r
+        comic_id: {\r
+          type: 'number',\r
+          rules : {\r
+            number: true,\r
+          }\r
+        },\r
+        title: {\r
+          type: 'text',\r
+          rules : {\r
+          }\r
+        },\r
+        description: {\r
+          type: 'text',\r
+          rules : {\r
+          }\r
+        },\r
+        t: {\r
+          type: 'number',\r
+          rules : {\r
+            required: true,\r
+            number: true,\r
+            min: 0,\r
+          }\r
+        },\r
+        visible: {\r
+          type: 'number',\r
+          rules : {\r
+            required: true,\r
+            number: true,\r
+          }\r
+        },\r
+        created_at: {\r
+          type: 'datetime',\r
+        },\r
+        updated_at: {\r
+          type: 'datetime',\r
+        }\r
+      }\r
     },\r
+    StorySheet: 'story_sheet',\r
     story_sheet: {\r
-      symbol: {\r
-        type: 'image',\r
-        name: '<%= asset_path('item.png') %>',\r
-        link: {\r
-          type: 'none'\r
+      class_name: 'StorySheet',\r
+      table_name: 'story_sheets',\r
+      associations: {\r
+        belongs_to: {\r
+          story: {\r
+            id_column: 'story_id'\r
+          }, \r
+          sheet: {\r
+            id_column: 'sheet_id'\r
+          }, \r
+        },\r
+        has_many: {\r
         },\r
       },\r
-      caption: {\r
-        type: 'none',\r
-      },\r
-      summary: {\r
-        type: 'template',\r
-        name: 'summary',\r
-      },\r
-      edit: {\r
-        type: 'none'\r
-      },\r
+      attributes: {\r
+        id: {\r
+          type: 'number',\r
+          primary_key: 1,\r
+          rules : {\r
+            number: true,\r
+          }\r
+        },\r
+        story_id: {\r
+          type: 'number',\r
+          rules : {\r
+            number: true,\r
+          }\r
+        },\r
+        sheet_id: {\r
+          type: 'number',\r
+          rules : {\r
+            number: true,\r
+          }\r
+        },\r
+        t: {\r
+          type: 'number',\r
+          rules : {\r
+            required: true,\r
+            number: true,\r
+            min: 0,\r
+          }\r
+        },\r
+        author_id: {\r
+          type: 'number',\r
+          rules : {\r
+            required: true,\r
+            number: true,\r
+          }\r
+        },\r
+        created_at: {\r
+          type: 'datetime',\r
+        },\r
+        updated_at: {\r
+          type: 'datetime',\r
+        }\r
+      }\r
     },\r
+    Sheet: 'sheet',\r
     sheet: {\r
-      symbol: {\r
-        type: 'image',\r
-        name: '<%= asset_path('item.png') %>',\r
-      },\r
-      caption: {\r
-        type: 'column',\r
-        name: 'caption',\r
-        link: {\r
-          type: 'action'\r
-          name: 'play',\r
+      class_name: 'Sheet',\r
+      table_name: 'sheets',\r
+      associations: {\r
+        belongs_to: {\r
+          author: {\r
+            id_column: 'author_id'\r
+          }, \r
+        },\r
+        has_many: {\r
+          story_sheets: {\r
+            foreign_key: 'story_id',\r
+            list_method: 'list_by_sheet',\r
+          }, \r
+          stories: {\r
+            through: 'story_sheets',\r
+            foreign_key: 'sheet_id'\r
+            list_method: 'list_by_sheet',\r
+          }, \r
+          sheet_panels: {\r
+            foreign_key: 'sheet_id',\r
+            list_method: 'list_by_sheet',\r
+          }, \r
+          panels: {\r
+            through: 'sheet_panels',\r
+            foreign_key: 'sheet_id'\r
+            list_method: 'list_by_sheet',\r
+          }, \r
         },\r
       },\r
-      summary: {\r
-        type: 'template',\r
-        name: 'summary',\r
-      },\r
-      edit: {\r
-        type: 'default',\r
-      },\r
+      attributes: {\r
+        id: {\r
+          type: 'number',\r
+          primary_key: 1,\r
+          rules : {\r
+            number: true,\r
+          }\r
+        },\r
+        caption: {\r
+          type: 'text',\r
+          rules : {\r
+          }\r
+        },\r
+        width: {\r
+          type: 'number',\r
+          rules : {\r
+            required: true,\r
+            number: true,\r
+          }\r
+        },\r
+        height: {\r
+          type: 'number',\r
+          rules : {\r
+            required: true,\r
+            number: true,\r
+          }\r
+        },\r
+        visible: {\r
+          type: 'number',\r
+          rules : {\r
+            required: true,\r
+            number: true,\r
+          }\r
+        },\r
+        author_id: {\r
+          type: 'number',\r
+          rules : {\r
+            required: true,\r
+            number: true,\r
+          }\r
+        },\r
+        created_at: {\r
+          type: 'datetime',\r
+        },\r
+        updated_at: {\r
+          type: 'datetime',\r
+        }\r
+      }\r
     },\r
+    SheetPanel: 'sheet_panel',\r
     sheet_panel: {\r
-      symbol: {\r
-        type: 'image',\r
-        name: '<%= asset_path('item.png') %>',\r
-        link: {\r
-          type: 'none'\r
+      class_name: 'SheetPanel',\r
+      table_name: 'sheet_panels',\r
+      associations: {\r
+        belongs_to: {\r
+          sheet: {\r
+            id_column: 'sheet_id'\r
+          }, \r
+          panel: {\r
+            id_column: 'panel_id'\r
+          }, \r
+        },\r
+        has_many: {\r
         },\r
       },\r
-      caption: {\r
-        type: 'none',\r
-      },\r
-      summary: {\r
-        type: 'template',\r
-        name: 'summary',\r
-      },\r
-      edit: {\r
-        type: 'none'\r
-      },\r
+      attributes: {\r
+        id: {\r
+          type: 'number',\r
+          primary_key: 1,\r
+          rules : {\r
+            number: true,\r
+          }\r
+        },\r
+        sheet_id: {\r
+          type: 'number',\r
+          rules : {\r
+            number: true,\r
+          }\r
+        },\r
+        panel_id: {\r
+          type: 'number',\r
+          rules : {\r
+            number: true,\r
+          }\r
+        },\r
+        x: {\r
+          type: 'number',\r
+          rules : {\r
+            required: true,\r
+            number: true,\r
+          }\r
+        },\r
+        y: {\r
+          type: 'number',\r
+          rules : {\r
+            required: true,\r
+            number: true,\r
+          }\r
+        },\r
+        z: {\r
+          type: 'number',\r
+          rules : {\r
+            required: true,\r
+            number: true,\r
+            min: 1,\r
+          }\r
+        },\r
+        t: {\r
+          type: 'number',\r
+          rules : {\r
+            required: true,\r
+            number: true,\r
+            min: 0,\r
+          }\r
+        },\r
+        author_id: {\r
+          type: 'number',\r
+          rules : {\r
+            number: true,\r
+          }\r
+        },\r
+        created_at: {\r
+          type: 'datetime',\r
+        },\r
+        updated_at: {\r
+          type: 'datetime',\r
+        }\r
+      }\r
     },\r
+    Panel: 'panel',\r
     panel: {\r
-      symbol: {\r
-        type: 'image',\r
-        name: '<%= asset_path('item.png') %>',\r
-      },\r
-      caption: {\r
-        type: 'method',\r
-        name: 'plain_scenario',\r
-        link: {\r
-          type: 'none'\r
+      class_name: 'Panel',\r
+      table_name: 'panels',\r
+      associations: {\r
+        belongs_to: {\r
+          author: {\r
+            id_column: 'author_id'\r
+          }, \r
         },\r
-      },\r
-      summary: {\r
-        type: 'template',\r
-        name: 'summary',\r
-      },\r
-      edit: {\r
-        type: 'default',\r
-      },\r
-    },\r
-    panel_picture: {\r
-      symbol: {\r
-        type: 'picture',\r
-        name: 'symbol_option',\r
-      },\r
-      caption: {\r
-        type: 'column',\r
-        name: 'caption',\r
-      },\r
-      summary: {\r
-        type: 'template',\r
-        name: 'summary',\r
-      },\r
-      edit: {\r
-        type: 'none',\r
-      },\r
-    },\r
-    speech_balloon: {\r
-      symbol: {\r
-        type: 'picture',\r
-        name: 'symbol_option',\r
-      },\r
-      caption: {\r
-        type: 'method',\r
-        name: 'plain_scenario',\r
-        link: {\r
-          type: 'none'\r
+        has_many: {\r
+          scroll_panels: {\r
+            foreign_key: 'panel_id',\r
+            list_method: 'list_by_panel',\r
+          }, \r
+          scrolls: {\r
+            through: 'scroll_panels',\r
+            foreign_key: 'panel_id'\r
+            list_method: 'list_by_panel',\r
+          }, \r
+          sheet_panels: {\r
+            foreign_key: 'panel_id',\r
+            list_method: 'list_by_panel',\r
+          }, \r
+          sheets: {\r
+            through: 'sheet_panels',\r
+            foreign_key: 'panel_id'\r
+            list_method: 'list_by_panel',\r
+          }, \r
+          panel_pictures: {\r
+            foreign_key: 'panel_id',\r
+            list_method: 'list_by_panel',\r
+          }, \r
+          speech_balloons: {\r
+            foreign_key: 'panel_id',\r
+            list_method: 'list_by_panel',\r
+          }, \r
+          ground_pictures: {\r
+            foreign_key: 'panel_id',\r
+            list_method: 'list_by_panel',\r
+          }, \r
+          ground_colors: {\r
+            foreign_key: 'panel_id',\r
+            list_method: 'list_by_panel',\r
+          }, \r
         },\r
       },\r
-      summary: {\r
-        type: 'template',\r
-        name: 'summary',\r
-      },\r
-      edit: {\r
-        type: 'none',\r
-      },\r
-    },\r
-    speech: {\r
-      symbol: {\r
-        type: 'picture',\r
-        name: 'symbol_option',\r
-      },\r
-      caption: {\r
-        type: 'column',\r
-        name: 'content',\r
-        link: {\r
-          type: 'none'\r
-        },\r
-      },\r
-      summary: {\r
-        type: 'template',\r
-        name: 'summary',\r
-      },\r
-      edit: {\r
-        type: 'none',\r
-      },\r
-    },\r
-    balloon: {\r
-      symbol: {\r
-        type: 'picture',\r
-        name: 'symbol_option',\r
-      },\r
-      caption: {\r
-        type: 'none',\r
-      },\r
-      summary: {\r
-        type: 'template',\r
-        name: 'summary',\r
-      },\r
-      edit: {\r
-        type: 'none',\r
-      },\r
-    },\r
-    ground_picture: {\r
-      symbol: {\r
-        type: 'picture',\r
-        name: 'symbol_option',\r
-      },\r
-      caption: {\r
-        type: 'column',\r
-        name: 'caption',\r
-      },\r
-      summary: {\r
-        type: 'template',\r
-        name: 'summary',\r
-      },\r
-      edit: {\r
-        type: 'none',\r
-      },\r
-    },\r
-    ground_color: {\r
-      symbol: {\r
-        type: 'template',\r
-        name: 'symbol',\r
-      },\r
-      caption: {\r
-        type: 'column',\r
-        name: 'caption',\r
-      },\r
-      summary: {\r
-        type: 'template',\r
-        name: 'summary',\r
-      },\r
-      edit: {\r
-        type: 'none',\r
-      },\r
-    },\r
-    original_picture: {\r
-      symbol: {\r
-        type: 'picture',\r
-        name: 'symbol_option',\r
-      },\r
-      caption: {\r
-        type: 'method',\r
-        name: 'revision',\r
-        link: {\r
-          type: 'action'\r
-          name: 'history',\r
-        },\r
-      },\r
-      summary: {\r
-        type: 'template',\r
-        name: 'summary',\r
-      },\r
-      edit: {\r
-        type: 'template',\r
-        name: 'publish',\r
-      },\r
-    },\r
-    picture: {\r
-    },\r
-    resource_picture: {\r
-      symbol: {\r
-        type: 'picture',\r
-        name: 'symbol_option',\r
-      },\r
-      caption: {\r
-        type: 'none',\r
-      },\r
-      summary: {\r
-        type: 'template',\r
-        name: 'summary',\r
-      },\r
-      edit: {\r
-        type: 'none',\r
-      },\r
-    },\r
-    speech_balloon_template: {\r
-      symbol: {\r
-        type: 'picture',\r
-        name: 'symbol_option',\r
-      },\r
-      caption: {\r
-        type: 'column',\r
-        name: 'caption',\r
-      },\r
-      summary: {\r
-        type: 'none',\r
-      },\r
-      edit: {\r
-        type: 'none',\r
-      },\r
-    },\r
-    writing_format: {\r
-      symbol: {\r
-        type: 'image',\r
-        name: '<%= asset_path('item.png') %>',\r
-      },\r
-      caption: {\r
-        type: 'column',\r
-        name: 'caption',\r
-      },\r
-      summary: {\r
-        type: 'none',\r
-      },\r
-      edit: {\r
-        type: 'none',\r
-      },\r
-    },\r
-    license_group: {\r
-      symbol: {\r
-        type: 'image',\r
-        name: '<%= asset_path('item.png') %>',\r
-      },\r
-      caption: {\r
-        type: 'column',\r
-        name: 'caption',\r
-        link: {\r
-          type: 'url_column'\r
-          name: 'url',\r
-        },\r
-      },\r
-      summary: {\r
-        type: 'none',\r
-      },\r
-      edit: {\r
-        type: 'none',\r
-      },\r
-    },\r
-    license: {\r
-      symbol: {\r
-        type: 'image',\r
-        name: '<%= asset_path('item.png') %>',\r
-      },\r
-      caption: {\r
-        type: 'method',\r
-        name: 'caption_with_group',\r
-        link: {\r
-          type: 'url_column'\r
-          name: 'url',\r
-        },\r
-      },\r
-      summary: {\r
-        type: 'template',\r
-        name: 'summary',\r
-      },\r
-      edit: {\r
-        type: 'none',\r
-      },\r
-    },\r
-    author: {\r
-      symbol: {\r
-        type: 'image',\r
-        name: '<%= asset_path('item.png') %>',\r
-      },\r
-      caption: {\r
-        type: 'column',\r
-        name: 'name',\r
-      },\r
-      summary: {\r
-        type: 'template',\r
-        name: 'summary',\r
-      },\r
-      edit: {\r
-        type: 'account',\r
-      },\r
-    },\r
-    artist: {\r
-      symbol: {\r
-        type: 'image',\r
-        name: '<%= asset_path('item.png') %>',\r
-      },\r
-      caption: {\r
-        type: 'column',\r
-        name: 'name',\r
-      },\r
-      summary: {\r
-        type: 'template',\r
-        name: 'summary',\r
-      },\r
-      edit: {\r
-        type: 'account',\r
-      },\r
-    },\r
-    system_picture: {\r
-      symbol: {\r
-        type: 'picture',\r
-        name: 'symbol_option',\r
-      },\r
-      caption: {\r
-        type: 'none',\r
-      },\r
-      summary: {\r
-        type: 'none',\r
-      },\r
-      edit: {\r
-        type: 'none',\r
-      },\r
-    },\r
-  },\r
-  models: {\r
-    Sheet: 'sheet',\r
-    sheet: {\r
-      class_name: 'Sheet',\r
-      table_name: 'sheets',\r
-      attributes: {\r
-        id: {\r
-          type: 'number',\r
-          primary_key: 1,\r
-          rules : {\r
-            number: true,\r
-          }\r
-        },\r
-      }\r
-    },\r
-    Panel: 'panel',\r
-    panel: {\r
-      class_name: 'Panel',\r
-      table_name: 'panels',\r
       attributes: {\r
         id: {\r
           type: 'number',\r
     panel_picture: {\r
       class_name: 'PanelPicture',\r
       table_name: 'panel_pictures',\r
+      associations: {\r
+        belongs_to: {\r
+          panel: {\r
+            id_column: 'panel_id'\r
+          }, \r
+        },\r
+        has_many: {\r
+        },\r
+      },\r
       attributes: {\r
         id: {\r
           type: 'number',\r
       class_name: 'SpeechBalloon',\r
       table_name: 'speech_balloons',\r
       extend: 'classname', \r
+      associations: {\r
+        belongs_to: {\r
+          panel: {\r
+            id_column: 'panel_id'\r
+          }, \r
+        },\r
+        has_many: {\r
+        },\r
+        has_one: {\r
+          balloon: {\r
+            foreign_key: 'speech_balloon_id',\r
+            list_method: 'list_by_speech_balloon',\r
+          }, \r
+          speech: {\r
+            foreign_key: 'speech_balloon_id',\r
+            list_method: 'list_by_speech_balloon',\r
+          }, \r
+        },\r
+      },\r
       attributes: {\r
         id: {\r
           type: 'number',\r
     balloon: {\r
       class_name: 'Balloon',\r
       table_name: 'balloons',\r
+      associations: {\r
+        belongs_to: {\r
+          speech_balloon: {\r
+            id_column: 'speech_balloon_id'\r
+          }, \r
+          system_picture: {\r
+            id_column: 'system_picture_id'\r
+          }, \r
+        },\r
+        has_many: {\r
+        },\r
+      },\r
       attributes: {\r
         id: {\r
           type: 'number',\r
     speech: {\r
       class_name: 'Speech',\r
       table_name: 'speeches',\r
+      associations: {\r
+        belongs_to: {\r
+          speech_balloon: {\r
+            id_column: 'speech_balloon_id'\r
+          }, \r
+          writing_format: {\r
+            id_column: 'writing_format_id'\r
+          }, \r
+        },\r
+        has_many: {\r
+        },\r
+      },\r
       attributes: {\r
         id: {\r
           type: 'number',\r
     ground_picture: {\r
       class_name: 'GroundPicture',\r
       table_name: 'ground_pictures',\r
+      associations: {\r
+        belongs_to: {\r
+          panel: {\r
+            id_column: 'panel_id'\r
+          }, \r
+        },\r
+        has_many: {\r
+        },\r
+      },\r
       attributes: {\r
         id: {\r
           type: 'number',\r
     ground_color: {\r
       class_name: 'GroundColor',\r
       table_name: 'ground_colors',\r
+      associations: {\r
+        belongs_to: {\r
+          panel: {\r
+            id_column: 'panel_id'\r
+          }, \r
+        },\r
+        has_many: {\r
+        },\r
+      },\r
       attributes: {\r
         id: {\r
           type: 'number',\r
         }\r
       }\r
     },\r
-    WritingFormat: 'writing_format',\r
-    writing_format: {\r
-      class_name: 'WritingFormat',\r
-      table_name: 'writing_formats',\r
+    OriginalPicture: 'original_picture',\r
+    original_picture: {\r
+      class_name: 'OriginalPicture',\r
+      table_name: 'original_pictures',\r
+      associations: {\r
+        belongs_to: {\r
+          artist: {\r
+            id_column: 'artist_id'\r
+          }, \r
+        },\r
+        has_many: {\r
+          pictures: {\r
+            foreign_key: 'original_picture_id',\r
+            list_method: 'list_by_original_picture',\r
+          }, \r
+        },\r
+        has_one: {\r
+          resource_picture: {\r
+            foreign_key: 'original_picture_id',\r
+            list_method: 'list_by_original_picture',\r
+          }, \r
+        },\r
+      },\r
       attributes: {\r
         id: {\r
           type: 'number',\r
             number: true,\r
           }\r
         },\r
-        name: {\r
+        ext: {\r
           type: 'text',\r
           rules : {\r
             required: true,\r
           }\r
         },\r
-        classname: {\r
+        width: {\r
+          type: 'number',\r
+          rules : {\r
+            required: true,\r
+            number: true,\r
+          }\r
+        },\r
+        height: {\r
+          type: 'number',\r
+          rules : {\r
+            required: true,\r
+            number: true,\r
+          }\r
+        },\r
+        filesize: {\r
+          type: 'number',\r
+          rules : {\r
+            required: true,\r
+            number: true,\r
+          }\r
+        },\r
+        artist_id: {\r
+          type: 'number',\r
+          rules : {\r
+            required: true,\r
+            number: true,\r
+          }\r
+        },\r
+        md5: {\r
           type: 'text',\r
           rules : {\r
             required: true,\r
+            required: true,\r
           }\r
         },\r
-        caption: {\r
+        uploaded_at: {\r
+          type: 'datetime',\r
+        },\r
+        published_at: {\r
+          type: 'datetime',\r
+        },\r
+        stopped_at: {\r
+          type: 'datetime',\r
+        },\r
+        created_at: {\r
+          type: 'datetime',\r
+        },\r
+        updated_at: {\r
+          type: 'datetime',\r
+        }\r
+      }\r
+    },\r
+    Picture: 'picture',\r
+    picture: {\r
+      class_name: 'Picture',\r
+      table_name: 'pictures',\r
+      associations: {\r
+        belongs_to: {\r
+          license: {\r
+            id_column: 'license_id'\r
+          }, \r
+          artist: {\r
+            id_column: 'artist_id'\r
+          }, \r
+        },\r
+        has_many: {\r
+        },\r
+        has_one: {\r
+        },\r
+      },\r
+      attributes: {\r
+        id: {\r
+          type: 'number',\r
+          primary_key: 1,\r
+          rules : {\r
+            number: true,\r
+          }\r
+        },\r
+        original_picture_id: {\r
+          type: 'number',\r
+          rules : {\r
+            required: true,\r
+            number: true,\r
+          }\r
+        },\r
+        revision: {\r
+          type: 'number',\r
+          rules : {\r
+            required: true,\r
+            number: true,\r
+          }\r
+        },\r
+        ext: {\r
           type: 'text',\r
           rules : {\r
             required: true,\r
           }\r
         },\r
-        system_picture_id: {\r
+        width: {\r
+          type: 'number',\r
+          rules : {\r
+            required: true,\r
+            number: true,\r
+          }\r
+        },\r
+        height: {\r
+          type: 'number',\r
+          rules : {\r
+            required: true,\r
+            number: true,\r
+          }\r
+        },\r
+        filesize: {\r
+          type: 'number',\r
+          rules : {\r
+            required: true,\r
+            number: true,\r
+          }\r
+        },\r
+        artist_id: {\r
+          type: 'number',\r
+          rules : {\r
+            required: true,\r
+            number: true,\r
+          }\r
+        },\r
+        license_id: {\r
           type: 'number',\r
           rules : {\r
             required: true,\r
             number: true,\r
           }\r
         },\r
+        md5: {\r
+          type: 'text',\r
+          rules : {\r
+            required: true,\r
+          }\r
+        },\r
+        artist_name: {\r
+          type: 'text',\r
+          rules : {\r
+            required: true,\r
+          }\r
+        },\r
+        credit: {\r
+          type: 'text',\r
+          rules : {\r
+          }\r
+        },\r
         settings: {\r
           type: 'text',\r
           rules : {\r
+          }\r
+        },\r
+        classname: {\r
+          type: 'text',\r
+          rules : {\r
             required: true,\r
           }\r
         },\r
         }\r
       }\r
     },\r
-\r
+    ResourcePicture: 'resource_picture',\r
+    resource_picture: {\r
+      class_name: 'ResourcePicture',\r
+      table_name: 'resource_pictures',\r
+      associations: {\r
+        belongs_to: {\r
+          license: {\r
+            id_column: 'license_id'\r
+          }, \r
+          artist: {\r
+            id_column: 'artist_id'\r
+          }, \r
+        },\r
+        has_many: {\r
+        },\r
+        has_one: {\r
+        },\r
+      },\r
+      attributes: {\r
+        id: {\r
+          type: 'number',\r
+          primary_key: 1,\r
+          rules : {\r
+            number: true,\r
+          }\r
+        },\r
+        original_picture_id: {\r
+          type: 'number',\r
+          rules : {\r
+            required: true,\r
+            number: true,\r
+          }\r
+        },\r
+        revision: {\r
+          type: 'number',\r
+          rules : {\r
+            required: true,\r
+            number: true,\r
+          }\r
+        },\r
+        ext: {\r
+          type: 'text',\r
+          rules : {\r
+            required: true,\r
+          }\r
+        },\r
+        width: {\r
+          type: 'number',\r
+          rules : {\r
+            required: true,\r
+            number: true,\r
+          }\r
+        },\r
+        height: {\r
+          type: 'number',\r
+          rules : {\r
+            required: true,\r
+            number: true,\r
+          }\r
+        },\r
+        filesize: {\r
+          type: 'number',\r
+          rules : {\r
+            required: true,\r
+            number: true,\r
+          }\r
+        },\r
+        artist_id: {\r
+          type: 'number',\r
+          rules : {\r
+            required: true,\r
+            number: true,\r
+          }\r
+        },\r
+        license_id: {\r
+          type: 'number',\r
+          rules : {\r
+            required: true,\r
+            number: true,\r
+          }\r
+        },\r
+        md5: {\r
+          type: 'text',\r
+          rules : {\r
+            required: true,\r
+          }\r
+        },\r
+        artist_name: {\r
+          type: 'text',\r
+          rules : {\r
+            required: true,\r
+          }\r
+        },\r
+        credit: {\r
+          type: 'text',\r
+          rules : {\r
+          }\r
+        },\r
+        settings: {\r
+          type: 'text',\r
+          rules : {\r
+          }\r
+        },\r
+        picture_id: {\r
+          type: 'number',\r
+          rules : {\r
+            required: true,\r
+            number: true,\r
+          }\r
+        },\r
+        classname: {\r
+          type: 'text',\r
+          rules : {\r
+            required: true,\r
+          }\r
+        },\r
+        created_at: {\r
+          type: 'datetime',\r
+        },\r
+        updated_at: {\r
+          type: 'datetime',\r
+        }\r
+      }\r
+    },\r
+    SpeechBalloonTemplate: 'speech_balloon_template',\r
+    speech_balloon_template: {\r
+      class_name: 'SpeechBalloonTemplate',\r
+      table_name: 'speech_balloon_templates',\r
+      associations: {\r
+        belongs_to: {\r
+          system_picture: {\r
+            id_column: 'system_picture_id'\r
+          }, \r
+        },\r
+        has_many: {\r
+          speech_balloons: {\r
+            foreign_key: 'speech_balloon_template_id',\r
+            list_method: 'list_by_speech_balloon_template',\r
+          }, \r
+          panels: {\r
+            through: 'speech_balloons',\r
+            foreign_key: 'speech_balloon_template_id',\r
+            list_method: 'list_by_speech_balloon_template',\r
+          }, \r
+        },\r
+        has_one: {\r
+        },\r
+      },\r
+      attributes: {\r
+        id: {\r
+          type: 'number',\r
+          primary_key: 1,\r
+          rules : {\r
+            number: true,\r
+          }\r
+        },\r
+        name: {\r
+          type: 'text',\r
+          rules : {\r
+            required: true,\r
+          }\r
+        },\r
+        classname: {\r
+          type: 'text',\r
+          rules : {\r
+            required: true,\r
+          }\r
+        },\r
+        caption: {\r
+          type: 'text',\r
+          rules : {\r
+            required: true,\r
+          }\r
+        },\r
+        t: {\r
+          type: 'number',\r
+          rules : {\r
+            required: true,\r
+            number: true,\r
+            min: 0,\r
+          }\r
+        },\r
+        system_picture_id: {\r
+          type: 'number',\r
+          rules : {\r
+            required: true,\r
+            number: true,\r
+          }\r
+        },\r
+        settings: {\r
+          type: 'text',\r
+          rules : {\r
+            required: true,\r
+          }\r
+        },\r
+        created_at: {\r
+          type: 'datetime',\r
+        },\r
+        updated_at: {\r
+          type: 'datetime',\r
+        }\r
+      }\r
+    },\r
+    WritingFormat: 'writing_format',\r
+    writing_format: {\r
+      class_name: 'WritingFormat',\r
+      table_name: 'writing_formats',\r
+      associations: {\r
+        belongs_to: {\r
+          system_picture: {\r
+            id_column: 'system_picture_id'\r
+          }, \r
+        },\r
+        has_many: {\r
+          speeches: {\r
+            foreign_key: 'writing_format_id',\r
+            list_method: 'list_by_writing_format',\r
+          }, \r
+        },\r
+        has_one: {\r
+        },\r
+      },\r
+      attributes: {\r
+        id: {\r
+          type: 'number',\r
+          primary_key: 1,\r
+          rules : {\r
+            number: true,\r
+          }\r
+        },\r
+        name: {\r
+          type: 'text',\r
+          rules : {\r
+            required: true,\r
+          }\r
+        },\r
+        classname: {\r
+          type: 'text',\r
+          rules : {\r
+            required: true,\r
+          }\r
+        },\r
+        caption: {\r
+          type: 'text',\r
+          rules : {\r
+            required: true,\r
+          }\r
+        },\r
+        system_picture_id: {\r
+          type: 'number',\r
+          rules : {\r
+            required: true,\r
+            number: true,\r
+          }\r
+        },\r
+        settings: {\r
+          type: 'text',\r
+          rules : {\r
+            required: true,\r
+          }\r
+        },\r
+        created_at: {\r
+          type: 'datetime',\r
+        },\r
+        updated_at: {\r
+          type: 'datetime',\r
+        }\r
+      }\r
+    },\r
+    LicenseGroup: 'license_group',\r
+    license_group: {\r
+      class_name: 'LicenseGroup',\r
+      table_name: 'license_groups',\r
+      associations: {\r
+        belongs_to: {\r
+        },\r
+        has_many: {\r
+          licenses: {\r
+            foreign_key: 'license_group_id',\r
+            list_method: 'list_by_license_group',\r
+          }, \r
+        },\r
+        has_one: {\r
+        },\r
+      },\r
+      attributes: {\r
+        id: {\r
+          type: 'number',\r
+          primary_key: 1,\r
+          rules : {\r
+            number: true,\r
+          }\r
+        },\r
+        name: {\r
+          type: 'text',\r
+          rules : {\r
+            required: true,\r
+          }\r
+        },\r
+        classname: {\r
+          type: 'text',\r
+          rules : {\r
+            required: true,\r
+          }\r
+        },\r
+        caption: {\r
+          type: 'text',\r
+          rules : {\r
+            required: true,\r
+          }\r
+        },\r
+        url: {\r
+          type: 'text',\r
+          rules : {\r
+            required: true,\r
+          }\r
+        },\r
+        created_at: {\r
+          type: 'datetime',\r
+        },\r
+        updated_at: {\r
+          type: 'datetime',\r
+        }\r
+      }\r
+    },\r
+    License: 'license',\r
+    license: {\r
+      class_name: 'License',\r
+      table_name: 'licenses',\r
+      associations: {\r
+        belongs_to: {\r
+          license_group: {\r
+            id_column: 'license_group_id'\r
+          }, \r
+          system_picture: {\r
+            id_column: 'system_picture_id'\r
+          }, \r
+        },\r
+        has_many: {\r
+          resource_pictures: {\r
+            foreign_key: 'license_id',\r
+            list_method: 'list_by_license',\r
+          }, \r
+        },\r
+        has_one: {\r
+        },\r
+      },\r
+      attributes: {\r
+        id: {\r
+          type: 'number',\r
+          primary_key: 1,\r
+          rules : {\r
+            number: true,\r
+          }\r
+        },\r
+        license_group_id: {\r
+          type: 'number',\r
+          rules : {\r
+            number: true,\r
+          }\r
+        },\r
+        name: {\r
+          type: 'text',\r
+          rules : {\r
+            required: true,\r
+          }\r
+        },\r
+        caption: {\r
+          type: 'text',\r
+          rules : {\r
+            required: true,\r
+          }\r
+        },\r
+        system_picture_id: {\r
+          type: 'number',\r
+          rules : {\r
+            required: true,\r
+            number: true,\r
+          }\r
+        },\r
+        url: {\r
+          type: 'text',\r
+          rules : {\r
+            required: true,\r
+          }\r
+        },\r
+        settings: {\r
+          type: 'text',\r
+          rules : {\r
+          }\r
+        },\r
+        credit_pictures: {\r
+          type: 'text',\r
+          rules : {\r
+          }\r
+        },\r
+        created_at: {\r
+          type: 'datetime',\r
+        },\r
+        updated_at: {\r
+          type: 'datetime',\r
+        }\r
+      }\r
+    },\r
+    Author: 'author',\r
+    author: {\r
+      class_name: 'Author',\r
+      table_name: 'authors',\r
+      associations: {\r
+        belongs_to: {\r
+        },\r
+        has_many: {\r
+          scrolls: {\r
+            foreign_key: 'author_id',\r
+            list_method: 'list_by_author',\r
+          }, \r
+          comics: {\r
+            foreign_key: 'author_id',\r
+            list_method: 'list_by_author',\r
+          }, \r
+          stories: {\r
+            foreign_key: 'author_id',\r
+            list_method: 'list_by_author',\r
+          }, \r
+          sheets: {\r
+            foreign_key: 'author_id',\r
+            list_method: 'list_by_author',\r
+          }, \r
+          panels: {\r
+            foreign_key: 'author_id',\r
+            list_method: 'list_by_author',\r
+          }, \r
+        },\r
+        has_one: {\r
+        },\r
+      },\r
+      attributes: {\r
+        id: {\r
+          type: 'number',\r
+          primary_key: 1,\r
+          rules : {\r
+            number: true,\r
+          }\r
+        },\r
+        name: {\r
+          type: 'text',\r
+          rules : {\r
+            required: true,\r
+          }\r
+        },\r
+        user_id: {\r
+          type: 'number',\r
+          rules : {\r
+            required: true,\r
+            number: true,\r
+          }\r
+        },\r
+        created_at: {\r
+          type: 'datetime',\r
+        },\r
+        updated_at: {\r
+          type: 'datetime',\r
+        }\r
+      }\r
+    },\r
+    Artist: 'artist',\r
+    artist: {\r
+      class_name: 'Artist',\r
+      table_name: 'artists',\r
+      associations: {\r
+        belongs_to: {\r
+        },\r
+        has_many: {\r
+          resource_pictures: {\r
+            foreign_key: 'artist_id',\r
+            list_method: 'list_by_artist',\r
+          }, \r
+        },\r
+        has_one: {\r
+        },\r
+      },\r
+      attributes: {\r
+        id: {\r
+          type: 'number',\r
+          primary_key: 1,\r
+          rules : {\r
+            number: true,\r
+          }\r
+        },\r
+        name: {\r
+          type: 'text',\r
+          rules : {\r
+            required: true,\r
+          }\r
+        },\r
+        author_id: {\r
+          type: 'number',\r
+          rules : {\r
+            required: true,\r
+            number: true,\r
+          }\r
+        },\r
+        created_at: {\r
+          type: 'datetime',\r
+        },\r
+        updated_at: {\r
+          type: 'datetime',\r
+        }\r
+      }\r
+    },\r
+    SystemPicture: 'system_picture',\r
+    system_picture: {\r
+      class_name: 'SystemPicture',\r
+      table_name: 'system_pictures',\r
+      associations: {\r
+        belongs_to: {\r
+        },\r
+        has_many: {\r
+        },\r
+        has_one: {\r
+        },\r
+      },\r
+      attributes: {\r
+        id: {\r
+          type: 'number',\r
+          primary_key: 1,\r
+          rules : {\r
+            number: true,\r
+          }\r
+        },\r
+        ext: {\r
+          type: 'text',\r
+          rules : {\r
+            required: true,\r
+          }\r
+        },\r
+        width: {\r
+          type: 'number',\r
+          rules : {\r
+            required: true,\r
+            number: true,\r
+          }\r
+        },\r
+        height: {\r
+          type: 'number',\r
+          rules : {\r
+            required: true,\r
+            number: true,\r
+          }\r
+        },\r
+        filesize: {\r
+          type: 'number',\r
+          rules : {\r
+            required: true,\r
+            number: true,\r
+          }\r
+        },\r
+        md5: {\r
+          type: 'text',\r
+          rules : {\r
+            required: true,\r
+            required: true,\r
+          }\r
+        },\r
+        created_at: {\r
+          type: 'datetime',\r
+        },\r
+        updated_at: {\r
+          type: 'datetime',\r
+        }\r
+      }\r
+    },\r
+  },\r
+  profiles: {\r
+    scroll: {\r
+      fields: [\r
+        'id', \r
+        'title', \r
+        'description', \r
+        'visible', \r
+        'author_id', \r
+        'created_at', \r
+        'updated_at',\r
+      ],\r
+      associations: {\r
+        belongs_to: [\r
+          'author',\r
+        ],\r
+        has_many: [\r
+          'scroll_panels', \r
+          'panels'\r
+        ],\r
+      }, \r
+    },\r
+    scroll_panel: {\r
+      fields: [\r
+        'id', \r
+        'scroll_id', \r
+        'panel_id', \r
+        't', \r
+        'author_id', \r
+        'created_at', \r
+        'updated_at',\r
+      ],\r
+      associations: {\r
+        belongs_to: [\r
+          'scroll', \r
+          'panel'\r
+        ],\r
+        has_many: [\r
+        ],\r
+      }, \r
+    },\r
+    comic: {\r
+      fields: [\r
+        'id', \r
+        'title', \r
+        'description', \r
+        'visible', \r
+        'author_id', \r
+        'created_at', \r
+        'updated_at',\r
+      ],\r
+      associations: {\r
+        belongs_to: [\r
+          'author',\r
+        ],\r
+        has_many: [\r
+          'stories', \r
+        ],\r
+      }, \r
+    },\r
+    story: {\r
+      fields: [\r
+        'id', \r
+        'comic_id', \r
+        'title', \r
+        'description', \r
+        't', \r
+        'visible', \r
+        'created_at', \r
+        'updated_at',\r
+      ],\r
+      associations: {\r
+        belongs_to: [\r
+          'comic',\r
+        ],\r
+        has_many: [\r
+          'story_sheets', \r
+          'sheets'\r
+        ],\r
+      }, \r
+    },\r
+    story_sheet: {\r
+      fields: [\r
+        'id', \r
+        'story_id', \r
+        'sheet_id', \r
+        't', \r
+        'author_id', \r
+        'created_at', \r
+        'updated_at',\r
+      ],\r
+      associations: {\r
+        belongs_to: [\r
+          'story',\r
+          'sheet',\r
+        ],\r
+        has_many: [\r
+        ],\r
+      }, \r
+    },\r
+    sheet: {\r
+      fields: [\r
+        'id', \r
+        'caption', \r
+        'width', \r
+        'height', \r
+        'visible', \r
+        'author_id', \r
+        'created_at', \r
+        'updated_at',\r
+      ],\r
+      associations: {\r
+        belongs_to: [\r
+          'author',\r
+        ],\r
+        has_many: [\r
+          'story_sheets', \r
+          'stories', \r
+          'sheet_panels'\r
+          'panels'\r
+        ],\r
+      }, \r
+    },\r
+    sheet_panel: {\r
+      fields: [\r
+        'id', \r
+        'sheet_id', \r
+        'panel_id', \r
+        'x', \r
+        'y', \r
+        'z', \r
+        't', \r
+        'author_id', \r
+        'created_at', \r
+        'updated_at',\r
+      ],\r
+      associations: {\r
+        belongs_to: [\r
+          'sheet',\r
+          'panel',\r
+        ],\r
+        has_many: [\r
+        ],\r
+      }, \r
+    },\r
+    panel: {\r
+      fields: [\r
+        'id', \r
+        'width', \r
+        'height', \r
+        'border', \r
+        'caption', \r
+        'publish', \r
+        'author_id', \r
+        'created_at', \r
+        'updated_at',\r
+      ],\r
+      associations: {\r
+        belongs_to: [\r
+          'author',\r
+        ],\r
+        has_many: [\r
+          'scroll_panels',\r
+          'scrolls',\r
+          'sheet_panels',\r
+          'sheets',\r
+          'panel_pictures',\r
+          'speech_balloons',\r
+          'ground_pictures',\r
+          'ground_colors',\r
+        ],\r
+      }, \r
+    },\r
+    panel_picture: {\r
+      fields: [\r
+        'id', \r
+        'panel_id', \r
+        'picture_id', \r
+        'caption', \r
+        'x', \r
+        'y', \r
+        'width', \r
+        'height', \r
+        'link', \r
+        'z', \r
+        't', \r
+        'created_at', \r
+        'updated_at',\r
+      ],\r
+      associations: {\r
+        belongs_to: [\r
+          'panel',\r
+        ],\r
+        has_many: [\r
+        ],\r
+      }, \r
+    },\r
+    speech_balloon: {\r
+      fields: [\r
+        'id', \r
+        'panel_id', \r
+        'speech_balloon_template_id', \r
+        'classname', \r
+        'z', \r
+        't', \r
+        'settings', \r
+        'caption', \r
+        'created_at', \r
+        'updated_at',\r
+      ],\r
+      associations: {\r
+        belongs_to: [\r
+          'panel',\r
+        ],\r
+        has_many: [\r
+        ],\r
+        has_one: [\r
+          'balloon',\r
+          'speech',\r
+        ],\r
+      }, \r
+    },\r
+    speech: {\r
+      fields: [\r
+        'id', \r
+        'speech_balloon_id', \r
+        'writing_format_id', \r
+        'content', \r
+        'font_size', \r
+        'text_align', \r
+        'fore_color', \r
+        'x', \r
+        'y', \r
+        'width', \r
+        'height', \r
+        'quotes', \r
+        'settings', \r
+        'created_at', \r
+        'updated_at',\r
+      ],\r
+      associations: {\r
+        belongs_to: [\r
+          'speech_balloon',\r
+          'writing_format',\r
+        ],\r
+        has_many: [\r
+        ],\r
+      }, \r
+    },\r
+    balloon: {\r
+      fields: [\r
+        'id', \r
+        'speech_balloon_id', \r
+        'system_picture_id', \r
+        'x', \r
+        'y', \r
+        'width', \r
+        'height', \r
+        'r', \r
+        'settings', \r
+        'created_at', \r
+        'updated_at',\r
+      ],\r
+      associations: {\r
+        belongs_to: [\r
+          'speech_balloon',\r
+          'system_picture',\r
+        ],\r
+        has_many: [\r
+        ],\r
+      }, \r
+    },\r
+    ground_picture: {\r
+      fields: [\r
+        'id', \r
+        'panel_id', \r
+        'picture_id', \r
+        'caption', \r
+        'repeat', \r
+        'x', \r
+        'y', \r
+        'z', \r
+        't', \r
+        'created_at', \r
+        'updated_at',\r
+      ],\r
+      associations: {\r
+        belongs_to: [\r
+          'panel',\r
+        ],\r
+        has_many: [\r
+        ],\r
+      }, \r
+    },\r
+    ground_color: {\r
+      fields: [\r
+        'id', \r
+        'panel_id', \r
+        'caption', \r
+        'code', \r
+        'orientation', \r
+        'xy', \r
+        'wh', \r
+        'z', \r
+        't', \r
+        'created_at', \r
+        'updated_at',\r
+      ],\r
+      associations: {\r
+        belongs_to: [\r
+          'panel',\r
+        ],\r
+        has_many: [\r
+        ],\r
+      }, \r
+    },\r
+    original_picture: {\r
+      fields: [\r
+        'id', \r
+        'ext', \r
+        'width', \r
+        'height', \r
+        'filesize', \r
+        'artist_id', \r
+        'md5', \r
+        'uploaded_at', \r
+        'published_at', \r
+        'stopped_at', \r
+        'created_at', \r
+        'updated_at',\r
+      ],\r
+      associations: {\r
+        belongs_to: [\r
+          'artist',\r
+        ],\r
+        has_many: [\r
+          'pictures',\r
+        ],\r
+        has_one: [\r
+          'resource_picture',\r
+        ],\r
+      }, \r
+    },\r
+    picture: {\r
+      fields: [\r
+        'id', \r
+        'original_picture_id', \r
+        'revision', \r
+        'ext', \r
+        'width', \r
+        'height', \r
+        'filesize', \r
+        'artist_id', \r
+        'license_id', \r
+        'md5', \r
+        'artist_name', \r
+        'credit', \r
+        'settings', \r
+        'classname', \r
+        'created_at', \r
+        'updated_at',\r
+      ],\r
+      associations: {\r
+        belongs_to: [\r
+          'license',\r
+          'artist',\r
+        ],\r
+        has_many: [\r
+        ],\r
+        has_one: [\r
+        ],\r
+      }, \r
+    },\r
+    resource_picture: {\r
+      fields: [\r
+        'id', \r
+        'original_picture_id', \r
+        'revision', \r
+        'ext', \r
+        'width', \r
+        'height', \r
+        'filesize', \r
+        'artist_id', \r
+        'license_id', \r
+        'md5', \r
+        'artist_name', \r
+        'credit', \r
+        'settings', \r
+        'picture_id', \r
+        'classname', \r
+        'created_at', \r
+        'updated_at',\r
+      ],\r
+      associations: {\r
+        belongs_to: [\r
+          'license',\r
+          'artist',\r
+        ],\r
+        has_many: [\r
+        ],\r
+        has_one: [\r
+        ],\r
+      }, \r
+    },\r
+    speech_balloon_template: {\r
+      fields: [\r
+        'id', \r
+        'name', \r
+        'classname', \r
+        'caption', \r
+        't', \r
+        'system_picture_id', \r
+        'settings', \r
+        'created_at', \r
+        'updated_at',\r
+      ],\r
+      associations: {\r
+        belongs_to: [\r
+          'system_picture',\r
+        ],\r
+        has_many: [\r
+          'speech_balloons', \r
+          'panels', \r
+        ],\r
+        has_one: [\r
+        ],\r
+      }, \r
+    },\r
+    writing_format: {\r
+      fields: [\r
+        'id', \r
+        'name', \r
+        'classname', \r
+        'caption', \r
+        'system_picture_id', \r
+        'settings', \r
+        'created_at', \r
+        'updated_at',\r
+      ],\r
+      associations: {\r
+        belongs_to: [\r
+          'system_picture',\r
+        ],\r
+        has_many: [\r
+          'speeches', \r
+        ],\r
+        has_one: [\r
+        ],\r
+      }, \r
+    },\r
+    license_group: {\r
+      fields: [\r
+        'id', \r
+        'name', \r
+        'classname', \r
+        'caption', \r
+        'url', \r
+        'created_at', \r
+        'updated_at',\r
+      ],\r
+      associations: {\r
+        belongs_to: [\r
+        ],\r
+        has_many: [\r
+          'licenses', \r
+        ],\r
+        has_one: [\r
+        ],\r
+      }, \r
+    },\r
+    license: {\r
+      fields: [\r
+        'id', \r
+        'license_group_id', \r
+        'name', \r
+        'caption', \r
+        'system_picture_id', \r
+        'url', \r
+        'settings', \r
+        'credit_pictures', \r
+        'created_at', \r
+        'updated_at',\r
+      ],\r
+      associations: {\r
+        belongs_to: [\r
+          'license_group', \r
+          'system_picture', \r
+        ],\r
+        has_many: [\r
+          'resource_pictures', \r
+        ],\r
+        has_one: [\r
+        ],\r
+      }, \r
+    },\r
+    author: {\r
+      fields: [\r
+        'id', \r
+        'name', \r
+        'user_id', \r
+        'created_at', \r
+        'updated_at',\r
+      ],\r
+      associations: {\r
+        belongs_to: [\r
+        ],\r
+        has_many: [\r
+          'scrolls', \r
+          'comics', \r
+          'stories', \r
+          'sheets', \r
+          'panels', \r
+        ],\r
+        has_one: [\r
+        ],\r
+      }, \r
+    },\r
+    artist: {\r
+      fields: [\r
+        'id', \r
+        'name', \r
+        'author_id', \r
+        'created_at', \r
+        'updated_at',\r
+      ],\r
+      associations: {\r
+        belongs_to: [\r
+        ],\r
+        has_many: [\r
+          'resource_pictures', \r
+        ],\r
+        has_one: [\r
+        ],\r
+      }, \r
+    },\r
+    system_picture: {\r
+      fields: [\r
+        'id', \r
+        'ext', \r
+        'width', \r
+        'height', \r
+        'filesize', \r
+        'md5', \r
+        'created_at', \r
+        'updated_at',\r
+      ],\r
+      associations: {\r
+        belongs_to: [\r
+        ],\r
+        has_many: [\r
+        ],\r
+        has_one: [\r
+        ],\r
+      }, \r
+    },\r
+  },\r
+  filers: {\r
+    scroll: {\r
+      symbol: {\r
+        type: 'image',\r
+        name: '<%= asset_path('item.png') %>',\r
+      },\r
+      caption: {\r
+        type: 'column',\r
+        name: 'title',\r
+        link: {\r
+          type: 'action'\r
+          name: 'play',\r
+        },\r
+      },\r
+      summary: {\r
+        type: 'template',\r
+        name: 'summary',\r
+      },\r
+      edit: {\r
+        type: 'default',\r
+      },\r
+    },\r
+    scroll_panel: {\r
+      symbol: {\r
+        type: 'image',\r
+        name: '<%= asset_path('item.png') %>',\r
+        link: {\r
+          type: 'none'\r
+        },\r
+      },\r
+      caption: {\r
+        type: 'none',\r
+      },\r
+      summary: {\r
+        type: 'template',\r
+        name: 'summary',\r
+      },\r
+      edit: {\r
+        type: 'none'\r
+      },\r
+    },\r
+    comic: {\r
+      symbol: {\r
+        type: 'image',\r
+        name: '<%= asset_path('item.png') %>',\r
+      },\r
+      caption: {\r
+        type: 'column',\r
+        name: 'title',\r
+      },\r
+      summary: {\r
+        type: 'template',\r
+        name: 'summary',\r
+      },\r
+      edit: {\r
+        type: 'default',\r
+      },\r
+    },\r
+    story: {\r
+      symbol: {\r
+        type: 'image',\r
+        name: '<%= asset_path('item.png') %>',\r
+      },\r
+      caption: {\r
+        type: 'method',\r
+        name: 'title_with_t',\r
+        link: {\r
+          type: 'action'\r
+          name: 'play',\r
+        },\r
+      },\r
+      summary: {\r
+        type: 'template',\r
+        name: 'summary',\r
+      },\r
+      edit: {\r
+        type: 'default',\r
+      },\r
+    },\r
+    story_sheet: {\r
+      symbol: {\r
+        type: 'image',\r
+        name: '<%= asset_path('item.png') %>',\r
+        link: {\r
+          type: 'none'\r
+        },\r
+      },\r
+      caption: {\r
+        type: 'none',\r
+      },\r
+      summary: {\r
+        type: 'template',\r
+        name: 'summary',\r
+      },\r
+      edit: {\r
+        type: 'none'\r
+      },\r
+    },\r
+    sheet: {\r
+      symbol: {\r
+        type: 'image',\r
+        name: '<%= asset_path('item.png') %>',\r
+      },\r
+      caption: {\r
+        type: 'column',\r
+        name: 'caption',\r
+        link: {\r
+          type: 'action'\r
+          name: 'play',\r
+        },\r
+      },\r
+      summary: {\r
+        type: 'template',\r
+        name: 'summary',\r
+      },\r
+      edit: {\r
+        type: 'default',\r
+      },\r
+    },\r
+    sheet_panel: {\r
+      symbol: {\r
+        type: 'image',\r
+        name: '<%= asset_path('item.png') %>',\r
+        link: {\r
+          type: 'none'\r
+        },\r
+      },\r
+      caption: {\r
+        type: 'none',\r
+      },\r
+      summary: {\r
+        type: 'template',\r
+        name: 'summary',\r
+      },\r
+      edit: {\r
+        type: 'none'\r
+      },\r
+    },\r
+    panel: {\r
+      symbol: {\r
+        type: 'image',\r
+        name: '<%= asset_path('item.png') %>',\r
+      },\r
+      caption: {\r
+        type: 'method',\r
+        name: 'plain_scenario',\r
+        link: {\r
+          type: 'none'\r
+        },\r
+      },\r
+      summary: {\r
+        type: 'template',\r
+        name: 'summary',\r
+      },\r
+      edit: {\r
+        type: 'default',\r
+      },\r
+    },\r
+    panel_picture: {\r
+      symbol: {\r
+        type: 'picture',\r
+        name: 'symbol_option',\r
+      },\r
+      caption: {\r
+        type: 'column',\r
+        name: 'caption',\r
+      },\r
+      summary: {\r
+        type: 'template',\r
+        name: 'summary',\r
+      },\r
+      edit: {\r
+        type: 'none',\r
+      },\r
+    },\r
+    speech_balloon: {\r
+      symbol: {\r
+        type: 'picture',\r
+        name: 'symbol_option',\r
+      },\r
+      caption: {\r
+        type: 'method',\r
+        name: 'plain_scenario',\r
+        link: {\r
+          type: 'none'\r
+        },\r
+      },\r
+      summary: {\r
+        type: 'template',\r
+        name: 'summary',\r
+      },\r
+      edit: {\r
+        type: 'none',\r
+      },\r
+    },\r
+    speech: {\r
+      symbol: {\r
+        type: 'picture',\r
+        name: 'symbol_option',\r
+      },\r
+      caption: {\r
+        type: 'column',\r
+        name: 'content',\r
+        link: {\r
+          type: 'none'\r
+        },\r
+      },\r
+      summary: {\r
+        type: 'template',\r
+        name: 'summary',\r
+      },\r
+      edit: {\r
+        type: 'none',\r
+      },\r
+    },\r
+    balloon: {\r
+      symbol: {\r
+        type: 'picture',\r
+        name: 'symbol_option',\r
+      },\r
+      caption: {\r
+        type: 'none',\r
+      },\r
+      summary: {\r
+        type: 'template',\r
+        name: 'summary',\r
+      },\r
+      edit: {\r
+        type: 'none',\r
+      },\r
+    },\r
+    ground_picture: {\r
+      symbol: {\r
+        type: 'picture',\r
+        name: 'symbol_option',\r
+      },\r
+      caption: {\r
+        type: 'column',\r
+        name: 'caption',\r
+      },\r
+      summary: {\r
+        type: 'template',\r
+        name: 'summary',\r
+      },\r
+      edit: {\r
+        type: 'none',\r
+      },\r
+    },\r
+    ground_color: {\r
+      symbol: {\r
+        type: 'template',\r
+        name: 'symbol',\r
+      },\r
+      caption: {\r
+        type: 'column',\r
+        name: 'caption',\r
+      },\r
+      summary: {\r
+        type: 'template',\r
+        name: 'summary',\r
+      },\r
+      edit: {\r
+        type: 'none',\r
+      },\r
+    },\r
+    original_picture: {\r
+      symbol: {\r
+        type: 'picture',\r
+        name: 'symbol_option',\r
+      },\r
+      caption: {\r
+        type: 'method',\r
+        name: 'revision',\r
+        link: {\r
+          type: 'action'\r
+          name: 'history',\r
+        },\r
+      },\r
+      summary: {\r
+        type: 'template',\r
+        name: 'summary',\r
+      },\r
+      edit: {\r
+        type: 'template',\r
+        name: 'publish',\r
+      },\r
+    },\r
+    picture: {\r
+      symbol: {\r
+        type: 'picture',\r
+        name: 'symbol_option',\r
+      },\r
+      caption: {\r
+        type: 'column',\r
+        name: 'revision',\r
+      },\r
+      summary: {\r
+        type: 'template',\r
+        name: 'summary',\r
+      },\r
+      edit: {\r
+        type: 'none',\r
+      },\r
+    },\r
+    resource_picture: {\r
+      symbol: {\r
+        type: 'picture',\r
+        name: 'symbol_option',\r
+      },\r
+      caption: {\r
+        type: 'none',\r
+      },\r
+      summary: {\r
+        type: 'template',\r
+        name: 'summary',\r
+      },\r
+      edit: {\r
+        type: 'none',\r
+      },\r
+    },\r
+    speech_balloon_template: {\r
+      symbol: {\r
+        type: 'picture',\r
+        name: 'symbol_option',\r
+      },\r
+      caption: {\r
+        type: 'column',\r
+        name: 'caption',\r
+      },\r
+      summary: {\r
+        type: 'none',\r
+      },\r
+      edit: {\r
+        type: 'none',\r
+      },\r
+    },\r
+    writing_format: {\r
+      symbol: {\r
+        type: 'image',\r
+        name: '<%= asset_path('item.png') %>',\r
+      },\r
+      caption: {\r
+        type: 'column',\r
+        name: 'caption',\r
+      },\r
+      summary: {\r
+        type: 'none',\r
+      },\r
+      edit: {\r
+        type: 'none',\r
+      },\r
+    },\r
+    license_group: {\r
+      symbol: {\r
+        type: 'image',\r
+        name: '<%= asset_path('item.png') %>',\r
+      },\r
+      caption: {\r
+        type: 'column',\r
+        name: 'caption',\r
+        link: {\r
+          type: 'url_column'\r
+          name: 'url',\r
+        },\r
+      },\r
+      summary: {\r
+        type: 'none',\r
+      },\r
+      edit: {\r
+        type: 'none',\r
+      },\r
+    },\r
+    license: {\r
+      symbol: {\r
+        type: 'image',\r
+        name: '<%= asset_path('item.png') %>',\r
+      },\r
+      caption: {\r
+        type: 'method',\r
+        name: 'caption_with_group',\r
+        link: {\r
+          type: 'url_column'\r
+          name: 'url',\r
+        },\r
+      },\r
+      summary: {\r
+        type: 'template',\r
+        name: 'summary',\r
+      },\r
+      edit: {\r
+        type: 'none',\r
+      },\r
+    },\r
+    author: {\r
+      symbol: {\r
+        type: 'image',\r
+        name: '<%= asset_path('item.png') %>',\r
+      },\r
+      caption: {\r
+        type: 'column',\r
+        name: 'name',\r
+      },\r
+      summary: {\r
+        type: 'template',\r
+        name: 'summary',\r
+      },\r
+      edit: {\r
+        type: 'account',\r
+      },\r
+    },\r
+    artist: {\r
+      symbol: {\r
+        type: 'image',\r
+        name: '<%= asset_path('item.png') %>',\r
+      },\r
+      caption: {\r
+        type: 'column',\r
+        name: 'name',\r
+      },\r
+      summary: {\r
+        type: 'template',\r
+        name: 'summary',\r
+      },\r
+      edit: {\r
+        type: 'account',\r
+      },\r
+    },\r
+    system_picture: {\r
+      symbol: {\r
+        type: 'picture',\r
+        name: 'symbol_option',\r
+      },\r
+      caption: {\r
+        type: 'none',\r
+      },\r
+      summary: {\r
+        type: 'none',\r
+      },\r
+      edit: {\r
+        type: 'none',\r
+      },\r
+    },\r
   },\r
   elements: [\r
     {\r
index 5c5b63a..0a4273f 100644 (file)
@@ -93,6 +93,14 @@ class ApplicationController < ActionController::Base
     end
   end
   
+  def format_prof format
+    format.prof { 
+      render :template => 'system/prof', :locals => {
+        :item => @item, :roles => [@user, @admin]
+      }
+    }
+  end
+  
   def set_image(file)
     if file.respond_to?(:read)
       file.read
index 4c523ed..1983fc9 100644 (file)
@@ -28,12 +28,12 @@ class ArtistsController < ApplicationController
   end
 
   def show
-    @ar = Artist.show(params[:id], [@user, @admin, @demand_user])
+    @item = Artist.show(params[:id], [@user, @admin, @demand_user])
 
     respond_to do |format|
       format.html # show.html.erb
-      format.prof  { render :template => 'top/prof', :layout => true }
-      format.json { render :json => @ar.to_json(Artist.show_json_opt) }
+      format_prof format
+      format.json { render :json => @item.to_json(Artist.show_json_opt) }
     end
   end
 
index 117051b..c8f10ee 100644 (file)
@@ -28,12 +28,12 @@ class AuthorsController < ApplicationController
   end
 
   def show
-    @au = Author.show(params[:id], [@user, @admin])
+    @item = Author.show(params[:id], [@user, @admin])
 
     respond_to do |format|
       format.html
-      format.prof  { render :template => 'top/prof', :layout => true }
-      format.json { render :json => @au.to_json(Author.show_json_opt) }
+      format_prof format
+      format.json { render :json => @item.to_json(Author.show_json_opt) }
     end
   end
 
index eecefdc..ce277e4 100644 (file)
@@ -28,11 +28,11 @@ class BalloonsController < ApplicationController
   end
   
   def show
-    @balloon = Balloon.show(params[:id], [@user, @admin])
+    @item = Balloon.show(params[:id], [@user, @admin])
     respond_to do |format|
       format.html # show.html.erb
-      format.prof  { render :template => 'top/prof', :layout => true }
-      format.json { render json: @balloon.to_json(Balloon.show_json_opt) }
+      format_prof format
+      format.json { render json: @item.to_json(Balloon.show_json_opt) }
     end
   end
   
index 789d1a1..af7373d 100644 (file)
@@ -29,12 +29,11 @@ class ComicsController < ApplicationController
   end
 
   def show
-    @comic = Comic.show(params[:id], [@user, @admin])
-
+    @item = Comic.show(params[:id], [@user, @admin])
     respond_to do |format|
       format.html 
-      format.prof  { render :template => 'top/prof', :layout => true }
-      format.json { render json: @comic.to_json(Comic.show_json_opt) }
+      format_prof format
+      format.json { render json: @item.to_json(Comic.show_json_opt) }
       format.atom 
       format.rss 
     end
index e98c710..b169bd9 100644 (file)
@@ -27,11 +27,11 @@ class GroundColorsController < ApplicationController
   end
   
   def show
-    @ground_color = GroundColor.show(params[:id], [@user, @admin])
+    @item = GroundColor.show(params[:id], [@user, @admin])
     respond_to do |format|
       format.html # show.html.erb
-      format.prof  { render :template => 'top/prof', :layout => true }
-      format.json { render json: @ground_color.to_json(GroundColor.show_json_opt) }
+      format_prof format
+      format.json { render json: @item.to_json(GroundColor.show_json_opt) }
     end
   end
   
index 04b164f..ce88802 100644 (file)
@@ -27,11 +27,11 @@ class GroundPicturesController < ApplicationController
   end
 
   def show
-    @ground_picture = GroundPicture.show(params[:id], [@user, @admin])
+    @item = GroundPicture.show(params[:id], [@user, @admin])
     respond_to do |format|
       format.html # show.html.erb
-      format.prof  { render :template => 'top/prof', :layout => true }
-      format.json { render json: @ground_picture.to_json(GroundPicture.show_json_opt) }
+      format_prof format
+      format.json { render json: @item.to_json(GroundPicture.show_json_opt) }
     end
   end
   
index 41787c2..262035d 100644 (file)
@@ -21,11 +21,11 @@ class LicenseGroupsController < ApplicationController
   # GET /license_groups/1
   # GET /license_groups/1.json
   def show
-    @license_group = LicenseGroup.show(params[:id])
+    @item = LicenseGroup.show(params[:id])
     respond_to do |format|
       format.html # show.html.erb
-      format.prof  { render :template => 'top/prof', :layout => true }
-      format.json { render json: @license_group.to_json(LicenseGroup.show_json_opt) }
+      format_prof format
+      format.json { render json: @item.to_json(LicenseGroup.show_json_opt) }
     end
   end
 
index 2754dd2..e530a04 100644 (file)
@@ -21,11 +21,11 @@ class LicensesController < ApplicationController
   # GET /licenses/1
   # GET /licenses/1.json
   def show
-    @license = License.show(params[:id])
+    @item = License.show(params[:id])
     respond_to do |format|
       format.html # show.html.erb
-      format.prof  { render :template => 'top/prof', :layout => true }
-      format.json { render json: @license.to_json(License.show_json_opt) }
+      format_prof format
+      format.json { render json: @item.to_json(License.show_json_opt) }
     end
   end
 
index 63f5129..e1c24b1 100644 (file)
@@ -24,20 +24,20 @@ class OriginalPicturesController < ApplicationController
   end
 
   def show
-    @original_picture = OriginalPicture.show(params[:id], [@artist, @admin])
+    @item = OriginalPicture.show(params[:id], [@artist, @admin])
     
     respond_to do |format|
-      opt = {:type => @original_picture.mime_type, :disposition=>"inline"}
-      format.png { send_data(@original_picture.restore, opt ) }
-      format.gif { send_data(@original_picture.restore, opt ) }
-      format.jpeg { send_data(@original_picture.restore, opt ) }
+      opt = {:type => @item.mime_type, :disposition=>"inline"}
+      format.png { send_data(@item.restore, opt ) }
+      format.gif { send_data(@item.restore, opt ) }
+      format.jpeg { send_data(@item.restore, opt ) }
       format.html {
         #ライセンス付与のために原画ライセンスグループ作成準備
-        @original_picture_license_group  = OriginalPictureLicenseGroup.new :original_picture_id => @original_picture.id
+        @original_picture_license_group  = OriginalPictureLicenseGroup.new :original_picture_id => @item.id
         render
       }
-      format.prof  { render :template => 'top/prof', :layout => true }
-      format.json { render json: @original_picture.to_json(OriginalPicture.show_json_opt)}
+      format_prof format
+      format.json { render json: @item.to_json(OriginalPicture.show_json_opt)}
     end
   end
 
index b48915b..04d4067 100644 (file)
@@ -28,12 +28,12 @@ class PanelPicturesController < ApplicationController
   end
 
   def show
-    @panel_picture = PanelPicture.show(params[:id], [@user, @admin])
+    @item = PanelPicture.show(params[:id], [@user, @admin])
 
     respond_to do |format|
       format.html
-      format.prof  { render :template => 'top/prof', :layout => true }
-      format.json { render :json => @panel_picture.to_json(PanelPicture.show_json_opt) }
+      format_prof format
+      format.json { render :json => @item.to_json(PanelPicture.show_json_opt) }
     end
   end
 
index df0028c..14adc89 100644 (file)
@@ -34,7 +34,7 @@ class PanelsController < ApplicationController
   end
 
   def show
-    @panel = Panel.show(params[:id], [@user, @admin])
+    @item = Panel.show(params[:id], [@user, @admin])
 
     respond_to do |format|
       format.html {
@@ -45,10 +45,10 @@ class PanelsController < ApplicationController
           @fresh_sheets = SheetPanel.mylist(@author, 1, 5).map {|sp| sp.sheet}
         end
       }
-      format.prof  { render :template => 'top/prof', :layout => true }
-      format.json { render json: @panel.panel_elements_as_json }
+      format_prof format
+      format.json { render json: @item.panel_elements_as_json }
       format.jsonp {
-        render :json => "callback(" + @panel.panel_elements_as_json + ");"
+        render :json => "callback(" + @item.panel_elements_as_json + ");"
       }
     end
   end
index d124c9e..043bad7 100644 (file)
@@ -11,16 +11,16 @@ class PicturesController < ApplicationController
   before_filter :authenticate_admin!, :only => [:list, :browse]
   
   def show
-    @picture = Picture.show(params[:id], [@user, @admin, @demand_user])
+    @item = Picture.show(params[:id], [@user, @admin, @demand_user])
 
     respond_to do |format|
-      opt = {:type => @picture.mime_type, :disposition=>"inline"}
-      format.png { send_data(@picture.restore(params[:subdir]), opt ) }
-      format.gif { send_data(@picture.restore(params[:subdir]), opt ) }
-      format.jpeg { send_data(@picture.restore(params[:subdir]), opt ) }
+      opt = {:type => @item.mime_type, :disposition=>"inline"}
+      format.png { send_data(@item.restore(params[:subdir]), opt ) }
+      format.gif { send_data(@item.restore(params[:subdir]), opt ) }
+      format.jpeg { send_data(@item.restore(params[:subdir]), opt ) }
       format.html 
-      format.prof  { render :template => 'top/prof', :layout => true }
-      format.json { render :json => @picture.to_json}
+      format_prof format
+      format.json { render :json => @item.to_json}
     end
   end
   
index 1188090..f782d8f 100644 (file)
@@ -28,16 +28,16 @@ class ResourcePicturesController < ApplicationController
   end
 
   def show
-    @resource_picture = ResourcePicture.show(params[:id], [@user, @admin, @demand_user])
+    @item = ResourcePicture.show(params[:id], [@user, @admin, @demand_user])
 
     respond_to do |format|
-      opt = {:type => @resource_picture.mime_type, :disposition=>"inline"}
-      format.png { send_data(@resource_picture.restore(params[:subdir]), opt ) }
-      format.gif { send_data(@resource_picture.restore(params[:subdir]), opt ) }
-      format.jpeg { send_data(@resource_picture.restore(params[:subdir]), opt ) }
+      opt = {:type => @item.mime_type, :disposition=>"inline"}
+      format.png { send_data(@item.restore(params[:subdir]), opt ) }
+      format.gif { send_data(@item.restore(params[:subdir]), opt ) }
+      format.jpeg { send_data(@item.restore(params[:subdir]), opt ) }
       format.html # show.html.erb
-      format.prof  { render :template => 'top/prof', :layout => true }
-      format.json { render :json => @resource_picture.to_json(ResourcePicture.show_json_opt)}
+      format_prof format
+      format.json { render :json => @item.to_json(ResourcePicture.show_json_opt)}
     end
   end
   
index 2fb8d04..cd94d5a 100644 (file)
@@ -28,12 +28,12 @@ class ScrollPanelsController < ApplicationController
   end
 
   def show
-    @scroll_panel = ScrollPanel.show(params[:id], [@user, @admin])
+    @item = ScrollPanel.show(params[:id], [@user, @admin])
 
     respond_to do |format|
       format.html # show.html.erb
-      format.prof  { render :template => 'top/prof', :layout => true }
-      format.json { render json: @scroll_panel.scroll_panel_as_json(@author) }
+      format_prof format
+      format.json { render json: @item.scroll_panel_as_json(@author) }
     end
   end
   
index ff43f46..2c2ba97 100644 (file)
@@ -29,7 +29,7 @@ class ScrollsController < ApplicationController
   end
 
   def show
-    @scroll = Scroll.show(params[:id], [@user, @admin])
+    @item = Scroll.show(params[:id], [@user, @admin])
 
     respond_to do |format|
       format.html {
@@ -37,8 +37,8 @@ class ScrollsController < ApplicationController
           @new_panels = Panel.mylist(@author, 1, 5)
         end
       }
-      format.json { render json: @scroll.to_json(Scroll.show_json_opt) }
-      format.prof  { render :template => 'top/prof', :layout => true }
+      format.json { render json: @item.to_json(Scroll.show_json_opt) }
+      format_prof format
       format.atom 
       format.rss 
     end
index d95f77e..e45ea12 100644 (file)
@@ -28,12 +28,12 @@ class SheetPanelsController < ApplicationController
   end
 
   def show
-    @sheet_panel = SheetPanel.show(params[:id], [@user, @admin])
+    @item = SheetPanel.show(params[:id], [@user, @admin])
 
     respond_to do |format|
       format.html # show.html.erb
-      format.prof  { render :template => 'top/prof', :layout => true }
-      format.json { render json: @sheet_panel.sheet_panel_as_json(@author) }
+      format_prof format
+      format.json { render json: @item.sheet_panel_as_json(@author) }
     end
   end
   
index 1d7505b..e6ac951 100644 (file)
@@ -29,7 +29,7 @@ class SheetsController < ApplicationController
   end
 
   def show
-    @sheet = Sheet.show(params[:id], [@user, @admin])
+    @item = Sheet.show(params[:id], [@user, @admin])
 
     respond_to do |format|
       format.html {
@@ -39,8 +39,8 @@ class SheetsController < ApplicationController
           @fresh_stories = StorySheet.mylist(@author, 1, 5).map {|ss| ss.story}
         end
       }
-      format.prof  { render :template => 'top/prof', :layout => true }
-      format.json { render json: @sheet.to_json(Sheet.show_json_opt) }
+      format_prof format
+      format.json { render json: @item.to_json(Sheet.show_json_opt) }
       format.atom 
       format.rss 
     end
index 6494e04..f69d496 100644 (file)
@@ -23,16 +23,16 @@ class SpeechBalloonTemplatesController < ApplicationController
   end
 
   def show
-    @speech_balloon_template = SpeechBalloonTemplate.show(params[:id], [@user, @admin])
+    @item = SpeechBalloonTemplate.show(params[:id], [@user, @admin])
 
     respond_to do |format|
       format.html # show.html.erb
-      format.prof  { render :template => 'top/prof', :layout => true }
+      format_prof format
       format.json {
-        render :json => @speech_balloon_template.to_json(SpeechBalloonTemplate.show_json_opt)
+        render :json => @item.to_json(SpeechBalloonTemplate.show_json_opt)
       }
       format.jsonp {
-        render :json => "callback(" + @speech_balloon_template.to_json() + ")"
+        render :json => "callback(" + @item.to_json() + ")"
       }
     end
   end
index 8bfe140..d79e81f 100644 (file)
@@ -28,12 +28,11 @@ class SpeechBalloonsController < ApplicationController
   end
   
   def show
-    @speech_balloon = SpeechBalloon.show(params[:id], [@user, @admin])
+    @item = SpeechBalloon.show(params[:id], [@user, @admin])
     respond_to do |format|
       format.html # show.html.erb
-      format.prof  { render :template => 'top/prof', :layout => true }
-      format.prof  { render :template => 'top/prof', :layout => true }
-      format.json { render json: @speech_balloon.to_json(SpeechBalloon.show_json_opt) }
+      format_prof format
+      format.json { render json: @item.to_json(SpeechBalloon.show_json_opt) }
     end
   end
   
index 8aa7789..732ce55 100644 (file)
@@ -28,11 +28,11 @@ class SpeechesController < ApplicationController
   end
   
   def show
-    @speech = Speech.show(params[:id], [@user, @admin])
+    @item = Speech.show(params[:id], [@user, @admin])
     respond_to do |format|
       format.html # show.html.erb
-      format.prof  { render :template => 'top/prof', :layout => true }
-      format.json { render json: @speech.to_json(Speech.show_json_opt) }
+      format_prof format
+      format.json { render json: @item.to_json(Speech.show_json_opt) }
     end
   end
   
index f27fa68..c8a8365 100644 (file)
@@ -28,7 +28,7 @@ class StoriesController < ApplicationController
   end
 
   def show
-    @story = Story.show(params[:id], [@user, @admin])
+    @item = Story.show(params[:id], [@user, @admin])
 
     respond_to do |format|
       format.html { 
@@ -36,8 +36,8 @@ class StoriesController < ApplicationController
           @new_sheets = Sheet.mylist(@author, 1, 5)
         end
       }
-      format.prof  { render :template => 'top/prof', :layout => true }
-      format.json { render json: @story.to_json(Story.show_json_opt) }
+      format_prof format
+      format.json { render json: @item.to_json(Story.show_json_opt) }
     end
   end
   
index 66e7fe9..7444c0b 100644 (file)
@@ -28,12 +28,12 @@ class StorySheetsController < ApplicationController
   end
 
   def show
-    @story_sheet = StorySheet.show(params[:id], [@user, @admin])
+    @item = StorySheet.show(params[:id], [@user, @admin])
 
     respond_to do |format|
       format.html # show.html.erb
-      format.prof  { render :template => 'top/prof', :layout => true }
-      format.json { render json: @story_sheet.to_json(StorySheet.show_json_opt) }
+      format_prof format
+      format.json { render json: @item.to_json(StorySheet.show_json_opt) }
     end
   end
   
index 7b6da92..16a0db5 100644 (file)
@@ -32,16 +32,16 @@ class SystemPicturesController < ApplicationController
   # GET /system_pictures/1
   # GET /system_pictures/1.json
   def show
-    @system_picture = SystemPicture.show(params[:id], [@user, @admin, @demand_user])
+    @item = SystemPicture.show(params[:id], [@user, @admin, @demand_user])
     
     respond_to do |format|
-      opt = {:type => @system_picture.mime_type, :disposition=>"inline"}
-      format.png { send_data(@system_picture.restore, opt ) }
-      format.gif { send_data(@system_picture.restore, opt ) }
-      format.jpeg { send_data(@system_picture.restore, opt ) }
+      opt = {:type => @item.mime_type, :disposition=>"inline"}
+      format.png { send_data(@item.restore, opt ) }
+      format.gif { send_data(@item.restore, opt ) }
+      format.jpeg { send_data(@item.restore, opt ) }
       format.html # show.html.erb
-      format.prof  { render :template => 'top/prof', :layout => true }
-      format.json { render json: @system_picture.to_json(SystemPicture.show_json_opt)}
+      format_prof format
+      format.json { render json: @item.to_json(SystemPicture.show_json_opt)}
     end
   end
 
index 25f1ef9..0e952f5 100644 (file)
@@ -1,2 +1,40 @@
 class WritingFormatsController < ApplicationController
+  layout 'test' if MagicNumber['test_layout']
+  if MagicNumber['run_mode'] == 0
+    before_filter :authenticate_user, :only => []
+  else
+    before_filter :authenticate_reader, :only => [:index, :show]
+    before_filter :authenticate_user, :only => []
+  end
+  before_filter :authenticate_admin!, :only => [:list, :browse, :destroy]
+
+  def index
+    @writing_formats = WritingFormat.enable_list
+
+    respond_to do |format|
+      format.html {
+        render :template => 'system/filer', :locals => {
+          :items => @writing_formats, :model => WritingFormat, 
+          :roles => [@user, @admin], :pager => nil
+        }
+      }
+      format.json { render json: @writing_formats.to_json(WritingFormat.list_json_opt) }
+    end
+  end
+
+  def show
+    @item = WritingFormat.show(params[:id], [@user, @admin])
+
+    respond_to do |format|
+      format.html # show.html.erb
+      format_prof format
+      format.json {
+        render :json => @item.to_json(WritingFormat.show_json_opt)
+      }
+      format.jsonp {
+        render :json => "callback(" + @item.to_json() + ")"
+      }
+    end
+  end
+
 end
index 6c04d1c..b1fae86 100644 (file)
@@ -90,452 +90,517 @@ module ApplicationHelper
   def configurations
     JSON.parse(<<HD
 {
-    "filers": {
+    "models": {
+        "Scroll": "scroll",
         "scroll": {
-            "symbol": {
-                "type": "image",
-                "name": "/assets/item.png"
-            },
-            "caption": {
-                "type": "column",
-                "name": "title",
-                "link": {
-                    "type": "action",
-                    "name": "play"
+            "class_name": "Scroll",
+            "table_name": "scrolls",
+            "associations": {
+                "belongs_to": {
+                    "author": {
+                        "id_column": "author_id"
+                    }
+                },
+                "has_many": {
+                    "scroll_panels": {
+                        "foreign_key": "scroll_id",
+                        "list_method": "list_by_scroll"
+                    },
+                    "panels": {
+                        "through": "scroll_panels",
+                        "foreign_key": "scroll_id",
+                        "list_method": "list_by_scroll"
+                    }
                 }
             },
-            "summary": {
-                "type": "template",
-                "name": "summary"
-            },
-            "edit": {
-                "type": "default"
+            "attributes": {
+                "id": {
+                    "type": "number",
+                    "primary_key": 1,
+                    "rules": {
+                        "number": true
+                    }
+                },
+                "title": {
+                    "type": "text",
+                    "rules": {
+                        "required": true
+                    }
+                },
+                "description": {
+                    "type": "text",
+                    "rules": {}
+                },
+                "visible": {
+                    "type": "number",
+                    "rules": {
+                        "required": true,
+                        "number": true
+                    }
+                },
+                "author_id": {
+                    "type": "number",
+                    "rules": {
+                        "required": true,
+                        "number": true
+                    }
+                },
+                "created_at": {
+                    "type": "datetime"
+                },
+                "updated_at": {
+                    "type": "datetime"
+                }
             }
         },
+        "ScrollPanel": "scroll_panel",
         "scroll_panel": {
-            "symbol": {
-                "type": "image",
-                "name": "/assets/item.png",
-                "link": {
-                    "type": "none"
-                }
-            },
-            "caption": {
-                "type": "none"
-            },
-            "summary": {
-                "type": "template",
-                "name": "summary"
+            "class_name": "ScrollPanel",
+            "table_name": "scroll_panels",
+            "associations": {
+                "belongs_to": {
+                    "panel": {
+                        "id_column": "panel_id"
+                    },
+                    "scroll": {
+                        "id_column": "scroll_id"
+                    }
+                },
+                "has_many": {}
             },
-            "edit": {
-                "type": "none"
+            "attributes": {
+                "id": {
+                    "type": "number",
+                    "primary_key": 1,
+                    "rules": {
+                        "number": true
+                    }
+                },
+                "scroll_id": {
+                    "type": "number",
+                    "rules": {
+                        "required": true,
+                        "number": true
+                    }
+                },
+                "panel_id": {
+                    "type": "number",
+                    "rules": {
+                        "required": true,
+                        "number": true
+                    }
+                },
+                "t": {
+                    "type": "number",
+                    "rules": {
+                        "required": true,
+                        "number": true,
+                        "min": 0
+                    }
+                },
+                "author_id": {
+                    "type": "number",
+                    "rules": {
+                        "required": true,
+                        "number": true
+                    }
+                },
+                "created_at": {
+                    "type": "datetime"
+                },
+                "updated_at": {
+                    "type": "datetime"
+                }
             }
         },
+        "Comic": "comic",
         "comic": {
-            "symbol": {
-                "type": "image",
-                "name": "/assets/item.png"
-            },
-            "caption": {
-                "type": "column",
-                "name": "title"
-            },
-            "summary": {
-                "type": "template",
-                "name": "summary"
+            "class_name": "Comic",
+            "table_name": "comics",
+            "associations": {
+                "belongs_to": {
+                    "author": {
+                        "id_column": "author_id"
+                    }
+                },
+                "has_many": {
+                    "stories": {
+                        "foreign_key": "comic_id",
+                        "list_method": "list_by_comic"
+                    }
+                },
+                "has_many_through": {}
             },
-            "edit": {
-                "type": "default"
+            "attributes": {
+                "id": {
+                    "type": "number",
+                    "primary_key": 1,
+                    "rules": {
+                        "number": true
+                    }
+                },
+                "title": {
+                    "type": "text",
+                    "rules": {
+                        "required": true
+                    }
+                },
+                "description": {
+                    "type": "text",
+                    "rules": {}
+                },
+                "visible": {
+                    "type": "number",
+                    "rules": {
+                        "required": true,
+                        "number": true
+                    }
+                },
+                "author_id": {
+                    "type": "number",
+                    "rules": {
+                        "required": true,
+                        "number": true
+                    }
+                },
+                "created_at": {
+                    "type": "datetime"
+                },
+                "updated_at": {
+                    "type": "datetime"
+                }
             }
         },
+        "Story": "story",
         "story": {
-            "symbol": {
-                "type": "image",
-                "name": "/assets/item.png"
-            },
-            "caption": {
-                "type": "method",
-                "name": "title_with_t",
-                "link": {
-                    "type": "action",
-                    "name": "play"
+            "class_name": "Story",
+            "table_name": "stories",
+            "associations": {
+                "belongs_to": {
+                    "comic": {
+                        "id_column": "comic_id"
+                    }
+                },
+                "has_many": {
+                    "story_sheets": {
+                        "foreign_key": "story_id",
+                        "list_method": "list_by_story"
+                    },
+                    "sheets": {
+                        "through": "story_sheets",
+                        "foreign_key": "story_id",
+                        "list_method": "list_by_story"
+                    }
                 }
             },
-            "summary": {
-                "type": "template",
-                "name": "summary"
-            },
-            "edit": {
-                "type": "default"
-            }
-        },
-        "story_sheet": {
-            "symbol": {
-                "type": "image",
-                "name": "/assets/item.png",
-                "link": {
-                    "type": "none"
+            "attributes": {
+                "id": {
+                    "type": "number",
+                    "primary_key": 1,
+                    "rules": {
+                        "number": true
+                    }
+                },
+                "comic_id": {
+                    "type": "number",
+                    "rules": {
+                        "number": true
+                    }
+                },
+                "title": {
+                    "type": "text",
+                    "rules": {}
+                },
+                "description": {
+                    "type": "text",
+                    "rules": {}
+                },
+                "t": {
+                    "type": "number",
+                    "rules": {
+                        "required": true,
+                        "number": true,
+                        "min": 0
+                    }
+                },
+                "visible": {
+                    "type": "number",
+                    "rules": {
+                        "required": true,
+                        "number": true
+                    }
+                },
+                "created_at": {
+                    "type": "datetime"
+                },
+                "updated_at": {
+                    "type": "datetime"
                 }
-            },
-            "caption": {
-                "type": "none"
-            },
-            "summary": {
-                "type": "template",
-                "name": "summary"
-            },
-            "edit": {
-                "type": "none"
             }
         },
-        "sheet": {
-            "symbol": {
-                "type": "image",
-                "name": "/assets/item.png"
+        "StorySheet": "story_sheet",
+        "story_sheet": {
+            "class_name": "StorySheet",
+            "table_name": "story_sheets",
+            "associations": {
+                "belongs_to": {
+                    "story": {
+                        "id_column": "story_id"
+                    },
+                    "sheet": {
+                        "id_column": "sheet_id"
+                    }
+                },
+                "has_many": {}
             },
-            "caption": {
-                "type": "column",
-                "name": "caption",
-                "link": {
-                    "type": "action",
-                    "name": "play"
-                }
-            },
-            "summary": {
-                "type": "template",
-                "name": "summary"
-            },
-            "edit": {
-                "type": "default"
-            }
-        },
-        "sheet_panel": {
-            "symbol": {
-                "type": "image",
-                "name": "/assets/item.png",
-                "link": {
-                    "type": "none"
+            "attributes": {
+                "id": {
+                    "type": "number",
+                    "primary_key": 1,
+                    "rules": {
+                        "number": true
+                    }
+                },
+                "story_id": {
+                    "type": "number",
+                    "rules": {
+                        "number": true
+                    }
+                },
+                "sheet_id": {
+                    "type": "number",
+                    "rules": {
+                        "number": true
+                    }
+                },
+                "t": {
+                    "type": "number",
+                    "rules": {
+                        "required": true,
+                        "number": true,
+                        "min": 0
+                    }
+                },
+                "author_id": {
+                    "type": "number",
+                    "rules": {
+                        "required": true,
+                        "number": true
+                    }
+                },
+                "created_at": {
+                    "type": "datetime"
+                },
+                "updated_at": {
+                    "type": "datetime"
                 }
-            },
-            "caption": {
-                "type": "none"
-            },
-            "summary": {
-                "type": "template",
-                "name": "summary"
-            },
-            "edit": {
-                "type": "none"
             }
         },
-        "panel": {
-            "symbol": {
-                "type": "image",
-                "name": "/assets/item.png"
-            },
-            "caption": {
-                "type": "method",
-                "name": "plain_scenario",
-                "link": {
-                    "type": "none"
+        "Sheet": "sheet",
+        "sheet": {
+            "class_name": "Sheet",
+            "table_name": "sheets",
+            "associations": {
+                "belongs_to": {
+                    "author": {
+                        "id_column": "author_id"
+                    }
+                },
+                "has_many": {
+                    "story_sheets": {
+                        "foreign_key": "story_id",
+                        "list_method": "list_by_sheet"
+                    },
+                    "stories": {
+                        "through": "story_sheets",
+                        "foreign_key": "sheet_id",
+                        "list_method": "list_by_sheet"
+                    },
+                    "sheet_panels": {
+                        "foreign_key": "sheet_id",
+                        "list_method": "list_by_sheet"
+                    },
+                    "panels": {
+                        "through": "sheet_panels",
+                        "foreign_key": "sheet_id",
+                        "list_method": "list_by_sheet"
+                    }
                 }
             },
-            "summary": {
-                "type": "template",
-                "name": "summary"
-            },
-            "edit": {
-                "type": "default"
-            }
-        },
-        "panel_picture": {
-            "symbol": {
-                "type": "picture",
-                "name": "symbol_option"
-            },
-            "caption": {
-                "type": "column",
-                "name": "caption"
-            },
-            "summary": {
-                "type": "template",
-                "name": "summary"
-            },
-            "edit": {
-                "type": "none"
+            "attributes": {
+                "id": {
+                    "type": "number",
+                    "primary_key": 1,
+                    "rules": {
+                        "number": true
+                    }
+                },
+                "caption": {
+                    "type": "text",
+                    "rules": {}
+                },
+                "width": {
+                    "type": "number",
+                    "rules": {
+                        "required": true,
+                        "number": true
+                    }
+                },
+                "height": {
+                    "type": "number",
+                    "rules": {
+                        "required": true,
+                        "number": true
+                    }
+                },
+                "visible": {
+                    "type": "number",
+                    "rules": {
+                        "required": true,
+                        "number": true
+                    }
+                },
+                "author_id": {
+                    "type": "number",
+                    "rules": {
+                        "required": true,
+                        "number": true
+                    }
+                },
+                "created_at": {
+                    "type": "datetime"
+                },
+                "updated_at": {
+                    "type": "datetime"
+                }
             }
         },
-        "speech_balloon": {
-            "symbol": {
-                "type": "picture",
-                "name": "symbol_option"
+        "SheetPanel": "sheet_panel",
+        "sheet_panel": {
+            "class_name": "SheetPanel",
+            "table_name": "sheet_panels",
+            "associations": {
+                "belongs_to": {
+                    "sheet": {
+                        "id_column": "sheet_id"
+                    },
+                    "panel": {
+                        "id_column": "panel_id"
+                    }
+                },
+                "has_many": {}
             },
-            "caption": {
-                "type": "method",
-                "name": "plain_scenario",
-                "link": {
-                    "type": "none"
+            "attributes": {
+                "id": {
+                    "type": "number",
+                    "primary_key": 1,
+                    "rules": {
+                        "number": true
+                    }
+                },
+                "sheet_id": {
+                    "type": "number",
+                    "rules": {
+                        "number": true
+                    }
+                },
+                "panel_id": {
+                    "type": "number",
+                    "rules": {
+                        "number": true
+                    }
+                },
+                "x": {
+                    "type": "number",
+                    "rules": {
+                        "required": true,
+                        "number": true
+                    }
+                },
+                "y": {
+                    "type": "number",
+                    "rules": {
+                        "required": true,
+                        "number": true
+                    }
+                },
+                "z": {
+                    "type": "number",
+                    "rules": {
+                        "required": true,
+                        "number": true,
+                        "min": 1
+                    }
+                },
+                "t": {
+                    "type": "number",
+                    "rules": {
+                        "required": true,
+                        "number": true,
+                        "min": 0
+                    }
+                },
+                "author_id": {
+                    "type": "number",
+                    "rules": {
+                        "number": true
+                    }
+                },
+                "created_at": {
+                    "type": "datetime"
+                },
+                "updated_at": {
+                    "type": "datetime"
                 }
-            },
-            "summary": {
-                "type": "template",
-                "name": "summary"
-            },
-            "edit": {
-                "type": "none"
             }
         },
-        "speech": {
-            "symbol": {
-                "type": "picture",
-                "name": "symbol_option"
-            },
-            "caption": {
-                "type": "column",
-                "name": "content",
-                "link": {
-                    "type": "none"
+        "Panel": "panel",
+        "panel": {
+            "class_name": "Panel",
+            "table_name": "panels",
+            "associations": {
+                "belongs_to": {
+                    "author": {
+                        "id_column": "author_id"
+                    }
+                },
+                "has_many": {
+                    "scroll_panels": {
+                        "foreign_key": "panel_id",
+                        "list_method": "list_by_panel"
+                    },
+                    "scrolls": {
+                        "through": "scroll_panels",
+                        "foreign_key": "panel_id",
+                        "list_method": "list_by_panel"
+                    },
+                    "sheet_panels": {
+                        "foreign_key": "panel_id",
+                        "list_method": "list_by_panel"
+                    },
+                    "sheets": {
+                        "through": "sheet_panels",
+                        "foreign_key": "panel_id",
+                        "list_method": "list_by_panel"
+                    },
+                    "panel_pictures": {
+                        "foreign_key": "panel_id",
+                        "list_method": "list_by_panel"
+                    },
+                    "speech_balloons": {
+                        "foreign_key": "panel_id",
+                        "list_method": "list_by_panel"
+                    },
+                    "ground_pictures": {
+                        "foreign_key": "panel_id",
+                        "list_method": "list_by_panel"
+                    },
+                    "ground_colors": {
+                        "foreign_key": "panel_id",
+                        "list_method": "list_by_panel"
+                    }
                 }
             },
-            "summary": {
-                "type": "template",
-                "name": "summary"
-            },
-            "edit": {
-                "type": "none"
-            }
-        },
-        "balloon": {
-            "symbol": {
-                "type": "picture",
-                "name": "symbol_option"
-            },
-            "caption": {
-                "type": "none"
-            },
-            "summary": {
-                "type": "template",
-                "name": "summary"
-            },
-            "edit": {
-                "type": "none"
-            }
-        },
-        "ground_picture": {
-            "symbol": {
-                "type": "picture",
-                "name": "symbol_option"
-            },
-            "caption": {
-                "type": "column",
-                "name": "caption"
-            },
-            "summary": {
-                "type": "template",
-                "name": "summary"
-            },
-            "edit": {
-                "type": "none"
-            }
-        },
-        "ground_color": {
-            "symbol": {
-                "type": "template",
-                "name": "symbol"
-            },
-            "caption": {
-                "type": "column",
-                "name": "caption"
-            },
-            "summary": {
-                "type": "template",
-                "name": "summary"
-            },
-            "edit": {
-                "type": "none"
-            }
-        },
-        "original_picture": {
-            "symbol": {
-                "type": "picture",
-                "name": "symbol_option"
-            },
-            "caption": {
-                "type": "method",
-                "name": "revision",
-                "link": {
-                    "type": "action",
-                    "name": "history"
-                }
-            },
-            "summary": {
-                "type": "template",
-                "name": "summary"
-            },
-            "edit": {
-                "type": "template",
-                "name": "publish"
-            }
-        },
-        "picture": {},
-        "resource_picture": {
-            "symbol": {
-                "type": "picture",
-                "name": "symbol_option"
-            },
-            "caption": {
-                "type": "none"
-            },
-            "summary": {
-                "type": "template",
-                "name": "summary"
-            },
-            "edit": {
-                "type": "none"
-            }
-        },
-        "speech_balloon_template": {
-            "symbol": {
-                "type": "picture",
-                "name": "symbol_option"
-            },
-            "caption": {
-                "type": "column",
-                "name": "caption"
-            },
-            "summary": {
-                "type": "none"
-            },
-            "edit": {
-                "type": "none"
-            }
-        },
-        "writing_format": {
-            "symbol": {
-                "type": "image",
-                "name": "/assets/item.png"
-            },
-            "caption": {
-                "type": "column",
-                "name": "caption"
-            },
-            "summary": {
-                "type": "none"
-            },
-            "edit": {
-                "type": "none"
-            }
-        },
-        "license_group": {
-            "symbol": {
-                "type": "image",
-                "name": "/assets/item.png"
-            },
-            "caption": {
-                "type": "column",
-                "name": "caption",
-                "link": {
-                    "type": "url_column",
-                    "name": "url"
-                }
-            },
-            "summary": {
-                "type": "none"
-            },
-            "edit": {
-                "type": "none"
-            }
-        },
-        "license": {
-            "symbol": {
-                "type": "image",
-                "name": "/assets/item.png"
-            },
-            "caption": {
-                "type": "method",
-                "name": "caption_with_group",
-                "link": {
-                    "type": "url_column",
-                    "name": "url"
-                }
-            },
-            "summary": {
-                "type": "template",
-                "name": "summary"
-            },
-            "edit": {
-                "type": "none"
-            }
-        },
-        "author": {
-            "symbol": {
-                "type": "image",
-                "name": "/assets/item.png"
-            },
-            "caption": {
-                "type": "column",
-                "name": "name"
-            },
-            "summary": {
-                "type": "template",
-                "name": "summary"
-            },
-            "edit": {
-                "type": "account"
-            }
-        },
-        "artist": {
-            "symbol": {
-                "type": "image",
-                "name": "/assets/item.png"
-            },
-            "caption": {
-                "type": "column",
-                "name": "name"
-            },
-            "summary": {
-                "type": "template",
-                "name": "summary"
-            },
-            "edit": {
-                "type": "account"
-            }
-        },
-        "system_picture": {
-            "symbol": {
-                "type": "picture",
-                "name": "symbol_option"
-            },
-            "caption": {
-                "type": "none"
-            },
-            "summary": {
-                "type": "none"
-            },
-            "edit": {
-                "type": "none"
-            }
-        }
-    },
-    "models": {
-        "Sheet": "sheet",
-        "sheet": {
-            "class_name": "Sheet",
-            "table_name": "sheets",
-            "attributes": {
-                "id": {
-                    "type": "number",
-                    "primary_key": 1,
-                    "rules": {
-                        "number": true
-                    }
-                }
-            }
-        },
-        "Panel": "panel",
-        "panel": {
-            "class_name": "Panel",
-            "table_name": "panels",
             "attributes": {
                 "id": {
                     "type": "number",
@@ -598,6 +663,14 @@ module ApplicationHelper
         "panel_picture": {
             "class_name": "PanelPicture",
             "table_name": "panel_pictures",
+            "associations": {
+                "belongs_to": {
+                    "panel": {
+                        "id_column": "panel_id"
+                    }
+                },
+                "has_many": {}
+            },
             "attributes": {
                 "id": {
                     "type": "number",
@@ -686,6 +759,24 @@ module ApplicationHelper
             "class_name": "SpeechBalloon",
             "table_name": "speech_balloons",
             "extend": "classname",
+            "associations": {
+                "belongs_to": {
+                    "panel": {
+                        "id_column": "panel_id"
+                    }
+                },
+                "has_many": {},
+                "has_one": {
+                    "balloon": {
+                        "foreign_key": "speech_balloon_id",
+                        "list_method": "list_by_speech_balloon"
+                    },
+                    "speech": {
+                        "foreign_key": "speech_balloon_id",
+                        "list_method": "list_by_speech_balloon"
+                    }
+                }
+            },
             "attributes": {
                 "id": {
                     "type": "number",
@@ -749,6 +840,17 @@ module ApplicationHelper
         "balloon": {
             "class_name": "Balloon",
             "table_name": "balloons",
+            "associations": {
+                "belongs_to": {
+                    "speech_balloon": {
+                        "id_column": "speech_balloon_id"
+                    },
+                    "system_picture": {
+                        "id_column": "system_picture_id"
+                    }
+                },
+                "has_many": {}
+            },
             "attributes": {
                 "id": {
                     "type": "number",
@@ -823,6 +925,17 @@ module ApplicationHelper
         "speech": {
             "class_name": "Speech",
             "table_name": "speeches",
+            "associations": {
+                "belongs_to": {
+                    "speech_balloon": {
+                        "id_column": "speech_balloon_id"
+                    },
+                    "writing_format": {
+                        "id_column": "writing_format_id"
+                    }
+                },
+                "has_many": {}
+            },
             "attributes": {
                 "id": {
                     "type": "number",
@@ -928,8 +1041,16 @@ module ApplicationHelper
         "ground_picture": {
             "class_name": "GroundPicture",
             "table_name": "ground_pictures",
-            "attributes": {
-                "id": {
+            "associations": {
+                "belongs_to": {
+                    "panel": {
+                        "id_column": "panel_id"
+                    }
+                },
+                "has_many": {}
+            },
+            "attributes": {
+                "id": {
                     "type": "number",
                     "primary_key": 1,
                     "rules": {
@@ -1006,6 +1127,14 @@ module ApplicationHelper
         "ground_color": {
             "class_name": "GroundColor",
             "table_name": "ground_colors",
+            "associations": {
+                "belongs_to": {
+                    "panel": {
+                        "id_column": "panel_id"
+                    }
+                },
+                "has_many": {}
+            },
             "attributes": {
                 "id": {
                     "type": "number",
@@ -1082,10 +1211,29 @@ module ApplicationHelper
                 }
             }
         },
-        "WritingFormat": "writing_format",
-        "writing_format": {
-            "class_name": "WritingFormat",
-            "table_name": "writing_formats",
+        "OriginalPicture": "original_picture",
+        "original_picture": {
+            "class_name": "OriginalPicture",
+            "table_name": "original_pictures",
+            "associations": {
+                "belongs_to": {
+                    "artist": {
+                        "id_column": "artist_id"
+                    }
+                },
+                "has_many": {
+                    "pictures": {
+                        "foreign_key": "original_picture_id",
+                        "list_method": "list_by_original_picture"
+                    }
+                },
+                "has_one": {
+                    "resource_picture": {
+                        "foreign_key": "original_picture_id",
+                        "list_method": "list_by_original_picture"
+                    }
+                }
+            },
             "attributes": {
                 "id": {
                     "type": "number",
@@ -1094,33 +1242,284 @@ module ApplicationHelper
                         "number": true
                     }
                 },
-                "name": {
+                "ext": {
+                    "type": "text",
+                    "rules": {
+                        "required": true
+                    }
+                },
+                "width": {
+                    "type": "number",
+                    "rules": {
+                        "required": true,
+                        "number": true
+                    }
+                },
+                "height": {
+                    "type": "number",
+                    "rules": {
+                        "required": true,
+                        "number": true
+                    }
+                },
+                "filesize": {
+                    "type": "number",
+                    "rules": {
+                        "required": true,
+                        "number": true
+                    }
+                },
+                "artist_id": {
+                    "type": "number",
+                    "rules": {
+                        "required": true,
+                        "number": true
+                    }
+                },
+                "md5": {
+                    "type": "text",
+                    "rules": {
+                        "required": true
+                    }
+                },
+                "uploaded_at": {
+                    "type": "datetime"
+                },
+                "published_at": {
+                    "type": "datetime"
+                },
+                "stopped_at": {
+                    "type": "datetime"
+                },
+                "created_at": {
+                    "type": "datetime"
+                },
+                "updated_at": {
+                    "type": "datetime"
+                }
+            }
+        },
+        "Picture": "picture",
+        "picture": {
+            "class_name": "Picture",
+            "table_name": "pictures",
+            "associations": {
+                "belongs_to": {
+                    "license": {
+                        "id_column": "license_id"
+                    },
+                    "artist": {
+                        "id_column": "artist_id"
+                    }
+                },
+                "has_many": {},
+                "has_one": {}
+            },
+            "attributes": {
+                "id": {
+                    "type": "number",
+                    "primary_key": 1,
+                    "rules": {
+                        "number": true
+                    }
+                },
+                "original_picture_id": {
+                    "type": "number",
+                    "rules": {
+                        "required": true,
+                        "number": true
+                    }
+                },
+                "revision": {
+                    "type": "number",
+                    "rules": {
+                        "required": true,
+                        "number": true
+                    }
+                },
+                "ext": {
+                    "type": "text",
+                    "rules": {
+                        "required": true
+                    }
+                },
+                "width": {
+                    "type": "number",
+                    "rules": {
+                        "required": true,
+                        "number": true
+                    }
+                },
+                "height": {
+                    "type": "number",
+                    "rules": {
+                        "required": true,
+                        "number": true
+                    }
+                },
+                "filesize": {
+                    "type": "number",
+                    "rules": {
+                        "required": true,
+                        "number": true
+                    }
+                },
+                "artist_id": {
+                    "type": "number",
+                    "rules": {
+                        "required": true,
+                        "number": true
+                    }
+                },
+                "license_id": {
+                    "type": "number",
+                    "rules": {
+                        "required": true,
+                        "number": true
+                    }
+                },
+                "md5": {
+                    "type": "text",
+                    "rules": {
+                        "required": true
+                    }
+                },
+                "artist_name": {
                     "type": "text",
                     "rules": {
                         "required": true
                     }
                 },
+                "credit": {
+                    "type": "text",
+                    "rules": {}
+                },
+                "settings": {
+                    "type": "text",
+                    "rules": {}
+                },
                 "classname": {
                     "type": "text",
                     "rules": {
                         "required": true
                     }
                 },
-                "caption": {
+                "created_at": {
+                    "type": "datetime"
+                },
+                "updated_at": {
+                    "type": "datetime"
+                }
+            }
+        },
+        "ResourcePicture": "resource_picture",
+        "resource_picture": {
+            "class_name": "ResourcePicture",
+            "table_name": "resource_pictures",
+            "associations": {
+                "belongs_to": {
+                    "license": {
+                        "id_column": "license_id"
+                    },
+                    "artist": {
+                        "id_column": "artist_id"
+                    }
+                },
+                "has_many": {},
+                "has_one": {}
+            },
+            "attributes": {
+                "id": {
+                    "type": "number",
+                    "primary_key": 1,
+                    "rules": {
+                        "number": true
+                    }
+                },
+                "original_picture_id": {
+                    "type": "number",
+                    "rules": {
+                        "required": true,
+                        "number": true
+                    }
+                },
+                "revision": {
+                    "type": "number",
+                    "rules": {
+                        "required": true,
+                        "number": true
+                    }
+                },
+                "ext": {
                     "type": "text",
                     "rules": {
                         "required": true
                     }
                 },
-                "system_picture_id": {
+                "width": {
+                    "type": "number",
+                    "rules": {
+                        "required": true,
+                        "number": true
+                    }
+                },
+                "height": {
+                    "type": "number",
+                    "rules": {
+                        "required": true,
+                        "number": true
+                    }
+                },
+                "filesize": {
+                    "type": "number",
+                    "rules": {
+                        "required": true,
+                        "number": true
+                    }
+                },
+                "artist_id": {
+                    "type": "number",
+                    "rules": {
+                        "required": true,
+                        "number": true
+                    }
+                },
+                "license_id": {
                     "type": "number",
                     "rules": {
                         "required": true,
                         "number": true
                     }
                 },
+                "md5": {
+                    "type": "text",
+                    "rules": {
+                        "required": true
+                    }
+                },
+                "artist_name": {
+                    "type": "text",
+                    "rules": {
+                        "required": true
+                    }
+                },
+                "credit": {
+                    "type": "text",
+                    "rules": {}
+                },
                 "settings": {
                     "type": "text",
+                    "rules": {}
+                },
+                "picture_id": {
+                    "type": "number",
+                    "rules": {
+                        "required": true,
+                        "number": true
+                    }
+                },
+                "classname": {
+                    "type": "text",
                     "rules": {
                         "required": true
                     }
@@ -1132,6 +1531,1412 @@ module ApplicationHelper
                     "type": "datetime"
                 }
             }
+        },
+        "SpeechBalloonTemplate": "speech_balloon_template",
+        "speech_balloon_template": {
+            "class_name": "SpeechBalloonTemplate",
+            "table_name": "speech_balloon_templates",
+            "associations": {
+                "belongs_to": {
+                    "system_picture": {
+                        "id_column": "system_picture_id"
+                    }
+                },
+                "has_many": {
+                    "speech_balloons": {
+                        "foreign_key": "speech_balloon_template_id",
+                        "list_method": "list_by_speech_balloon_template"
+                    },
+                    "panels": {
+                        "through": "speech_balloons",
+                        "foreign_key": "speech_balloon_template_id",
+                        "list_method": "list_by_speech_balloon_template"
+                    }
+                },
+                "has_one": {}
+            },
+            "attributes": {
+                "id": {
+                    "type": "number",
+                    "primary_key": 1,
+                    "rules": {
+                        "number": true
+                    }
+                },
+                "name": {
+                    "type": "text",
+                    "rules": {
+                        "required": true
+                    }
+                },
+                "classname": {
+                    "type": "text",
+                    "rules": {
+                        "required": true
+                    }
+                },
+                "caption": {
+                    "type": "text",
+                    "rules": {
+                        "required": true
+                    }
+                },
+                "t": {
+                    "type": "number",
+                    "rules": {
+                        "required": true,
+                        "number": true,
+                        "min": 0
+                    }
+                },
+                "system_picture_id": {
+                    "type": "number",
+                    "rules": {
+                        "required": true,
+                        "number": true
+                    }
+                },
+                "settings": {
+                    "type": "text",
+                    "rules": {
+                        "required": true
+                    }
+                },
+                "created_at": {
+                    "type": "datetime"
+                },
+                "updated_at": {
+                    "type": "datetime"
+                }
+            }
+        },
+        "WritingFormat": "writing_format",
+        "writing_format": {
+            "class_name": "WritingFormat",
+            "table_name": "writing_formats",
+            "associations": {
+                "belongs_to": {
+                    "system_picture": {
+                        "id_column": "system_picture_id"
+                    }
+                },
+                "has_many": {
+                    "speeches": {
+                        "foreign_key": "writing_format_id",
+                        "list_method": "list_by_writing_format"
+                    }
+                },
+                "has_one": {}
+            },
+            "attributes": {
+                "id": {
+                    "type": "number",
+                    "primary_key": 1,
+                    "rules": {
+                        "number": true
+                    }
+                },
+                "name": {
+                    "type": "text",
+                    "rules": {
+                        "required": true
+                    }
+                },
+                "classname": {
+                    "type": "text",
+                    "rules": {
+                        "required": true
+                    }
+                },
+                "caption": {
+                    "type": "text",
+                    "rules": {
+                        "required": true
+                    }
+                },
+                "system_picture_id": {
+                    "type": "number",
+                    "rules": {
+                        "required": true,
+                        "number": true
+                    }
+                },
+                "settings": {
+                    "type": "text",
+                    "rules": {
+                        "required": true
+                    }
+                },
+                "created_at": {
+                    "type": "datetime"
+                },
+                "updated_at": {
+                    "type": "datetime"
+                }
+            }
+        },
+        "LicenseGroup": "license_group",
+        "license_group": {
+            "class_name": "LicenseGroup",
+            "table_name": "license_groups",
+            "associations": {
+                "belongs_to": {},
+                "has_many": {
+                    "licenses": {
+                        "foreign_key": "license_group_id",
+                        "list_method": "list_by_license_group"
+                    }
+                },
+                "has_one": {}
+            },
+            "attributes": {
+                "id": {
+                    "type": "number",
+                    "primary_key": 1,
+                    "rules": {
+                        "number": true
+                    }
+                },
+                "name": {
+                    "type": "text",
+                    "rules": {
+                        "required": true
+                    }
+                },
+                "classname": {
+                    "type": "text",
+                    "rules": {
+                        "required": true
+                    }
+                },
+                "caption": {
+                    "type": "text",
+                    "rules": {
+                        "required": true
+                    }
+                },
+                "url": {
+                    "type": "text",
+                    "rules": {
+                        "required": true
+                    }
+                },
+                "created_at": {
+                    "type": "datetime"
+                },
+                "updated_at": {
+                    "type": "datetime"
+                }
+            }
+        },
+        "License": "license",
+        "license": {
+            "class_name": "License",
+            "table_name": "licenses",
+            "associations": {
+                "belongs_to": {
+                    "license_group": {
+                        "id_column": "license_group_id"
+                    },
+                    "system_picture": {
+                        "id_column": "system_picture_id"
+                    }
+                },
+                "has_many": {
+                    "resource_pictures": {
+                        "foreign_key": "license_id",
+                        "list_method": "list_by_license"
+                    }
+                },
+                "has_one": {}
+            },
+            "attributes": {
+                "id": {
+                    "type": "number",
+                    "primary_key": 1,
+                    "rules": {
+                        "number": true
+                    }
+                },
+                "license_group_id": {
+                    "type": "number",
+                    "rules": {
+                        "number": true
+                    }
+                },
+                "name": {
+                    "type": "text",
+                    "rules": {
+                        "required": true
+                    }
+                },
+                "caption": {
+                    "type": "text",
+                    "rules": {
+                        "required": true
+                    }
+                },
+                "system_picture_id": {
+                    "type": "number",
+                    "rules": {
+                        "required": true,
+                        "number": true
+                    }
+                },
+                "url": {
+                    "type": "text",
+                    "rules": {
+                        "required": true
+                    }
+                },
+                "settings": {
+                    "type": "text",
+                    "rules": {}
+                },
+                "credit_pictures": {
+                    "type": "text",
+                    "rules": {}
+                },
+                "created_at": {
+                    "type": "datetime"
+                },
+                "updated_at": {
+                    "type": "datetime"
+                }
+            }
+        },
+        "Author": "author",
+        "author": {
+            "class_name": "Author",
+            "table_name": "authors",
+            "associations": {
+                "belongs_to": {},
+                "has_many": {
+                    "scrolls": {
+                        "foreign_key": "author_id",
+                        "list_method": "list_by_author"
+                    },
+                    "comics": {
+                        "foreign_key": "author_id",
+                        "list_method": "list_by_author"
+                    },
+                    "stories": {
+                        "foreign_key": "author_id",
+                        "list_method": "list_by_author"
+                    },
+                    "sheets": {
+                        "foreign_key": "author_id",
+                        "list_method": "list_by_author"
+                    },
+                    "panels": {
+                        "foreign_key": "author_id",
+                        "list_method": "list_by_author"
+                    }
+                },
+                "has_one": {}
+            },
+            "attributes": {
+                "id": {
+                    "type": "number",
+                    "primary_key": 1,
+                    "rules": {
+                        "number": true
+                    }
+                },
+                "name": {
+                    "type": "text",
+                    "rules": {
+                        "required": true
+                    }
+                },
+                "user_id": {
+                    "type": "number",
+                    "rules": {
+                        "required": true,
+                        "number": true
+                    }
+                },
+                "created_at": {
+                    "type": "datetime"
+                },
+                "updated_at": {
+                    "type": "datetime"
+                }
+            }
+        },
+        "Artist": "artist",
+        "artist": {
+            "class_name": "Artist",
+            "table_name": "artists",
+            "associations": {
+                "belongs_to": {},
+                "has_many": {
+                    "resource_pictures": {
+                        "foreign_key": "artist_id",
+                        "list_method": "list_by_artist"
+                    }
+                },
+                "has_one": {}
+            },
+            "attributes": {
+                "id": {
+                    "type": "number",
+                    "primary_key": 1,
+                    "rules": {
+                        "number": true
+                    }
+                },
+                "name": {
+                    "type": "text",
+                    "rules": {
+                        "required": true
+                    }
+                },
+                "author_id": {
+                    "type": "number",
+                    "rules": {
+                        "required": true,
+                        "number": true
+                    }
+                },
+                "created_at": {
+                    "type": "datetime"
+                },
+                "updated_at": {
+                    "type": "datetime"
+                }
+            }
+        },
+        "SystemPicture": "system_picture",
+        "system_picture": {
+            "class_name": "SystemPicture",
+            "table_name": "system_pictures",
+            "associations": {
+                "belongs_to": {},
+                "has_many": {},
+                "has_one": {}
+            },
+            "attributes": {
+                "id": {
+                    "type": "number",
+                    "primary_key": 1,
+                    "rules": {
+                        "number": true
+                    }
+                },
+                "ext": {
+                    "type": "text",
+                    "rules": {
+                        "required": true
+                    }
+                },
+                "width": {
+                    "type": "number",
+                    "rules": {
+                        "required": true,
+                        "number": true
+                    }
+                },
+                "height": {
+                    "type": "number",
+                    "rules": {
+                        "required": true,
+                        "number": true
+                    }
+                },
+                "filesize": {
+                    "type": "number",
+                    "rules": {
+                        "required": true,
+                        "number": true
+                    }
+                },
+                "md5": {
+                    "type": "text",
+                    "rules": {
+                        "required": true
+                    }
+                },
+                "created_at": {
+                    "type": "datetime"
+                },
+                "updated_at": {
+                    "type": "datetime"
+                }
+            }
+        }
+    },
+    "profiles": {
+        "scroll": {
+            "fields": [
+                "id",
+                "title",
+                "description",
+                "visible",
+                "author_id",
+                "created_at",
+                "updated_at"
+            ],
+            "associations": {
+                "belongs_to": [
+                    "author"
+                ],
+                "has_many": [
+                    "scroll_panels",
+                    "panels"
+                ]
+            }
+        },
+        "scroll_panel": {
+            "fields": [
+                "id",
+                "scroll_id",
+                "panel_id",
+                "t",
+                "author_id",
+                "created_at",
+                "updated_at"
+            ],
+            "associations": {
+                "belongs_to": [
+                    "scroll",
+                    "panel"
+                ],
+                "has_many": []
+            }
+        },
+        "comic": {
+            "fields": [
+                "id",
+                "title",
+                "description",
+                "visible",
+                "author_id",
+                "created_at",
+                "updated_at"
+            ],
+            "associations": {
+                "belongs_to": [
+                    "author"
+                ],
+                "has_many": [
+                    "stories"
+                ]
+            }
+        },
+        "story": {
+            "fields": [
+                "id",
+                "comic_id",
+                "title",
+                "description",
+                "t",
+                "visible",
+                "created_at",
+                "updated_at"
+            ],
+            "associations": {
+                "belongs_to": [
+                    "comic"
+                ],
+                "has_many": [
+                    "story_sheets",
+                    "sheets"
+                ]
+            }
+        },
+        "story_sheet": {
+            "fields": [
+                "id",
+                "story_id",
+                "sheet_id",
+                "t",
+                "author_id",
+                "created_at",
+                "updated_at"
+            ],
+            "associations": {
+                "belongs_to": [
+                    "story",
+                    "sheet"
+                ],
+                "has_many": []
+            }
+        },
+        "sheet": {
+            "fields": [
+                "id",
+                "caption",
+                "width",
+                "height",
+                "visible",
+                "author_id",
+                "created_at",
+                "updated_at"
+            ],
+            "associations": {
+                "belongs_to": [
+                    "author"
+                ],
+                "has_many": [
+                    "story_sheets",
+                    "stories",
+                    "sheet_panels",
+                    "panels"
+                ]
+            }
+        },
+        "sheet_panel": {
+            "fields": [
+                "id",
+                "sheet_id",
+                "panel_id",
+                "x",
+                "y",
+                "z",
+                "t",
+                "author_id",
+                "created_at",
+                "updated_at"
+            ],
+            "associations": {
+                "belongs_to": [
+                    "sheet",
+                    "panel"
+                ],
+                "has_many": []
+            }
+        },
+        "panel": {
+            "fields": [
+                "id",
+                "width",
+                "height",
+                "border",
+                "caption",
+                "publish",
+                "author_id",
+                "created_at",
+                "updated_at"
+            ],
+            "associations": {
+                "belongs_to": [
+                    "author"
+                ],
+                "has_many": [
+                    "scroll_panels",
+                    "scrolls",
+                    "sheet_panels",
+                    "sheets",
+                    "panel_pictures",
+                    "speech_balloons",
+                    "ground_pictures",
+                    "ground_colors"
+                ]
+            }
+        },
+        "panel_picture": {
+            "fields": [
+                "id",
+                "panel_id",
+                "picture_id",
+                "caption",
+                "x",
+                "y",
+                "width",
+                "height",
+                "link",
+                "z",
+                "t",
+                "created_at",
+                "updated_at"
+            ],
+            "associations": {
+                "belongs_to": [
+                    "panel"
+                ],
+                "has_many": []
+            }
+        },
+        "speech_balloon": {
+            "fields": [
+                "id",
+                "panel_id",
+                "speech_balloon_template_id",
+                "classname",
+                "z",
+                "t",
+                "settings",
+                "caption",
+                "created_at",
+                "updated_at"
+            ],
+            "associations": {
+                "belongs_to": [
+                    "panel"
+                ],
+                "has_many": [],
+                "has_one": [
+                    "balloon",
+                    "speech"
+                ]
+            }
+        },
+        "speech": {
+            "fields": [
+                "id",
+                "speech_balloon_id",
+                "writing_format_id",
+                "content",
+                "font_size",
+                "text_align",
+                "fore_color",
+                "x",
+                "y",
+                "width",
+                "height",
+                "quotes",
+                "settings",
+                "created_at",
+                "updated_at"
+            ],
+            "associations": {
+                "belongs_to": [
+                    "speech_balloon",
+                    "writing_format"
+                ],
+                "has_many": []
+            }
+        },
+        "balloon": {
+            "fields": [
+                "id",
+                "speech_balloon_id",
+                "system_picture_id",
+                "x",
+                "y",
+                "width",
+                "height",
+                "r",
+                "settings",
+                "created_at",
+                "updated_at"
+            ],
+            "associations": {
+                "belongs_to": [
+                    "speech_balloon",
+                    "system_picture"
+                ],
+                "has_many": []
+            }
+        },
+        "ground_picture": {
+            "fields": [
+                "id",
+                "panel_id",
+                "picture_id",
+                "caption",
+                "repeat",
+                "x",
+                "y",
+                "z",
+                "t",
+                "created_at",
+                "updated_at"
+            ],
+            "associations": {
+                "belongs_to": [
+                    "panel"
+                ],
+                "has_many": []
+            }
+        },
+        "ground_color": {
+            "fields": [
+                "id",
+                "panel_id",
+                "caption",
+                "code",
+                "orientation",
+                "xy",
+                "wh",
+                "z",
+                "t",
+                "created_at",
+                "updated_at"
+            ],
+            "associations": {
+                "belongs_to": [
+                    "panel"
+                ],
+                "has_many": []
+            }
+        },
+        "original_picture": {
+            "fields": [
+                "id",
+                "ext",
+                "width",
+                "height",
+                "filesize",
+                "artist_id",
+                "md5",
+                "uploaded_at",
+                "published_at",
+                "stopped_at",
+                "created_at",
+                "updated_at"
+            ],
+            "associations": {
+                "belongs_to": [
+                    "artist"
+                ],
+                "has_many": [
+                    "pictures"
+                ],
+                "has_one": [
+                    "resource_picture"
+                ]
+            }
+        },
+        "picture": {
+            "fields": [
+                "id",
+                "original_picture_id",
+                "revision",
+                "ext",
+                "width",
+                "height",
+                "filesize",
+                "artist_id",
+                "license_id",
+                "md5",
+                "artist_name",
+                "credit",
+                "settings",
+                "classname",
+                "created_at",
+                "updated_at"
+            ],
+            "associations": {
+                "belongs_to": [
+                    "license",
+                    "artist"
+                ],
+                "has_many": [],
+                "has_one": []
+            }
+        },
+        "resource_picture": {
+            "fields": [
+                "id",
+                "original_picture_id",
+                "revision",
+                "ext",
+                "width",
+                "height",
+                "filesize",
+                "artist_id",
+                "license_id",
+                "md5",
+                "artist_name",
+                "credit",
+                "settings",
+                "picture_id",
+                "classname",
+                "created_at",
+                "updated_at"
+            ],
+            "associations": {
+                "belongs_to": [
+                    "license",
+                    "artist"
+                ],
+                "has_many": [],
+                "has_one": []
+            }
+        },
+        "speech_balloon_template": {
+            "fields": [
+                "id",
+                "name",
+                "classname",
+                "caption",
+                "t",
+                "system_picture_id",
+                "settings",
+                "created_at",
+                "updated_at"
+            ],
+            "associations": {
+                "belongs_to": [
+                    "system_picture"
+                ],
+                "has_many": [
+                    "speech_balloons",
+                    "panels"
+                ],
+                "has_one": []
+            }
+        },
+        "writing_format": {
+            "fields": [
+                "id",
+                "name",
+                "classname",
+                "caption",
+                "system_picture_id",
+                "settings",
+                "created_at",
+                "updated_at"
+            ],
+            "associations": {
+                "belongs_to": [
+                    "system_picture"
+                ],
+                "has_many": [
+                    "speeches"
+                ],
+                "has_one": []
+            }
+        },
+        "license_group": {
+            "fields": [
+                "id",
+                "name",
+                "classname",
+                "caption",
+                "url",
+                "created_at",
+                "updated_at"
+            ],
+            "associations": {
+                "belongs_to": [],
+                "has_many": [
+                    "licenses"
+                ],
+                "has_one": []
+            }
+        },
+        "license": {
+            "fields": [
+                "id",
+                "license_group_id",
+                "name",
+                "caption",
+                "system_picture_id",
+                "url",
+                "settings",
+                "credit_pictures",
+                "created_at",
+                "updated_at"
+            ],
+            "associations": {
+                "belongs_to": [
+                    "license_group",
+                    "system_picture"
+                ],
+                "has_many": [
+                    "resource_pictures"
+                ],
+                "has_one": []
+            }
+        },
+        "author": {
+            "fields": [
+                "id",
+                "name",
+                "user_id",
+                "created_at",
+                "updated_at"
+            ],
+            "associations": {
+                "belongs_to": [],
+                "has_many": [
+                    "scrolls",
+                    "comics",
+                    "stories",
+                    "sheets",
+                    "panels"
+                ],
+                "has_one": []
+            }
+        },
+        "artist": {
+            "fields": [
+                "id",
+                "name",
+                "author_id",
+                "created_at",
+                "updated_at"
+            ],
+            "associations": {
+                "belongs_to": [],
+                "has_many": [
+                    "resource_pictures"
+                ],
+                "has_one": []
+            }
+        },
+        "system_picture": {
+            "fields": [
+                "id",
+                "ext",
+                "width",
+                "height",
+                "filesize",
+                "md5",
+                "created_at",
+                "updated_at"
+            ],
+            "associations": {
+                "belongs_to": [],
+                "has_many": [],
+                "has_one": []
+            }
+        }
+    },
+    "filers": {
+        "scroll": {
+            "symbol": {
+                "type": "image",
+                "name": "/assets/item.png"
+            },
+            "caption": {
+                "type": "column",
+                "name": "title",
+                "link": {
+                    "type": "action",
+                    "name": "play"
+                }
+            },
+            "summary": {
+                "type": "template",
+                "name": "summary"
+            },
+            "edit": {
+                "type": "default"
+            }
+        },
+        "scroll_panel": {
+            "symbol": {
+                "type": "image",
+                "name": "/assets/item.png",
+                "link": {
+                    "type": "none"
+                }
+            },
+            "caption": {
+                "type": "none"
+            },
+            "summary": {
+                "type": "template",
+                "name": "summary"
+            },
+            "edit": {
+                "type": "none"
+            }
+        },
+        "comic": {
+            "symbol": {
+                "type": "image",
+                "name": "/assets/item.png"
+            },
+            "caption": {
+                "type": "column",
+                "name": "title"
+            },
+            "summary": {
+                "type": "template",
+                "name": "summary"
+            },
+            "edit": {
+                "type": "default"
+            }
+        },
+        "story": {
+            "symbol": {
+                "type": "image",
+                "name": "/assets/item.png"
+            },
+            "caption": {
+                "type": "method",
+                "name": "title_with_t",
+                "link": {
+                    "type": "action",
+                    "name": "play"
+                }
+            },
+            "summary": {
+                "type": "template",
+                "name": "summary"
+            },
+            "edit": {
+                "type": "default"
+            }
+        },
+        "story_sheet": {
+            "symbol": {
+                "type": "image",
+                "name": "/assets/item.png",
+                "link": {
+                    "type": "none"
+                }
+            },
+            "caption": {
+                "type": "none"
+            },
+            "summary": {
+                "type": "template",
+                "name": "summary"
+            },
+            "edit": {
+                "type": "none"
+            }
+        },
+        "sheet": {
+            "symbol": {
+                "type": "image",
+                "name": "/assets/item.png"
+            },
+            "caption": {
+                "type": "column",
+                "name": "caption",
+                "link": {
+                    "type": "action",
+                    "name": "play"
+                }
+            },
+            "summary": {
+                "type": "template",
+                "name": "summary"
+            },
+            "edit": {
+                "type": "default"
+            }
+        },
+        "sheet_panel": {
+            "symbol": {
+                "type": "image",
+                "name": "/assets/item.png",
+                "link": {
+                    "type": "none"
+                }
+            },
+            "caption": {
+                "type": "none"
+            },
+            "summary": {
+                "type": "template",
+                "name": "summary"
+            },
+            "edit": {
+                "type": "none"
+            }
+        },
+        "panel": {
+            "symbol": {
+                "type": "image",
+                "name": "/assets/item.png"
+            },
+            "caption": {
+                "type": "method",
+                "name": "plain_scenario",
+                "link": {
+                    "type": "none"
+                }
+            },
+            "summary": {
+                "type": "template",
+                "name": "summary"
+            },
+            "edit": {
+                "type": "default"
+            }
+        },
+        "panel_picture": {
+            "symbol": {
+                "type": "picture",
+                "name": "symbol_option"
+            },
+            "caption": {
+                "type": "column",
+                "name": "caption"
+            },
+            "summary": {
+                "type": "template",
+                "name": "summary"
+            },
+            "edit": {
+                "type": "none"
+            }
+        },
+        "speech_balloon": {
+            "symbol": {
+                "type": "picture",
+                "name": "symbol_option"
+            },
+            "caption": {
+                "type": "method",
+                "name": "plain_scenario",
+                "link": {
+                    "type": "none"
+                }
+            },
+            "summary": {
+                "type": "template",
+                "name": "summary"
+            },
+            "edit": {
+                "type": "none"
+            }
+        },
+        "speech": {
+            "symbol": {
+                "type": "picture",
+                "name": "symbol_option"
+            },
+            "caption": {
+                "type": "column",
+                "name": "content",
+                "link": {
+                    "type": "none"
+                }
+            },
+            "summary": {
+                "type": "template",
+                "name": "summary"
+            },
+            "edit": {
+                "type": "none"
+            }
+        },
+        "balloon": {
+            "symbol": {
+                "type": "picture",
+                "name": "symbol_option"
+            },
+            "caption": {
+                "type": "none"
+            },
+            "summary": {
+                "type": "template",
+                "name": "summary"
+            },
+            "edit": {
+                "type": "none"
+            }
+        },
+        "ground_picture": {
+            "symbol": {
+                "type": "picture",
+                "name": "symbol_option"
+            },
+            "caption": {
+                "type": "column",
+                "name": "caption"
+            },
+            "summary": {
+                "type": "template",
+                "name": "summary"
+            },
+            "edit": {
+                "type": "none"
+            }
+        },
+        "ground_color": {
+            "symbol": {
+                "type": "template",
+                "name": "symbol"
+            },
+            "caption": {
+                "type": "column",
+                "name": "caption"
+            },
+            "summary": {
+                "type": "template",
+                "name": "summary"
+            },
+            "edit": {
+                "type": "none"
+            }
+        },
+        "original_picture": {
+            "symbol": {
+                "type": "picture",
+                "name": "symbol_option"
+            },
+            "caption": {
+                "type": "method",
+                "name": "revision",
+                "link": {
+                    "type": "action",
+                    "name": "history"
+                }
+            },
+            "summary": {
+                "type": "template",
+                "name": "summary"
+            },
+            "edit": {
+                "type": "template",
+                "name": "publish"
+            }
+        },
+        "picture": {
+            "symbol": {
+                "type": "picture",
+                "name": "symbol_option"
+            },
+            "caption": {
+                "type": "column",
+                "name": "revision"
+            },
+            "summary": {
+                "type": "template",
+                "name": "summary"
+            },
+            "edit": {
+                "type": "none"
+            }
+        },
+        "resource_picture": {
+            "symbol": {
+                "type": "picture",
+                "name": "symbol_option"
+            },
+            "caption": {
+                "type": "none"
+            },
+            "summary": {
+                "type": "template",
+                "name": "summary"
+            },
+            "edit": {
+                "type": "none"
+            }
+        },
+        "speech_balloon_template": {
+            "symbol": {
+                "type": "picture",
+                "name": "symbol_option"
+            },
+            "caption": {
+                "type": "column",
+                "name": "caption"
+            },
+            "summary": {
+                "type": "none"
+            },
+            "edit": {
+                "type": "none"
+            }
+        },
+        "writing_format": {
+            "symbol": {
+                "type": "image",
+                "name": "/assets/item.png"
+            },
+            "caption": {
+                "type": "column",
+                "name": "caption"
+            },
+            "summary": {
+                "type": "none"
+            },
+            "edit": {
+                "type": "none"
+            }
+        },
+        "license_group": {
+            "symbol": {
+                "type": "image",
+                "name": "/assets/item.png"
+            },
+            "caption": {
+                "type": "column",
+                "name": "caption",
+                "link": {
+                    "type": "url_column",
+                    "name": "url"
+                }
+            },
+            "summary": {
+                "type": "none"
+            },
+            "edit": {
+                "type": "none"
+            }
+        },
+        "license": {
+            "symbol": {
+                "type": "image",
+                "name": "/assets/item.png"
+            },
+            "caption": {
+                "type": "method",
+                "name": "caption_with_group",
+                "link": {
+                    "type": "url_column",
+                    "name": "url"
+                }
+            },
+            "summary": {
+                "type": "template",
+                "name": "summary"
+            },
+            "edit": {
+                "type": "none"
+            }
+        },
+        "author": {
+            "symbol": {
+                "type": "image",
+                "name": "/assets/item.png"
+            },
+            "caption": {
+                "type": "column",
+                "name": "name"
+            },
+            "summary": {
+                "type": "template",
+                "name": "summary"
+            },
+            "edit": {
+                "type": "account"
+            }
+        },
+        "artist": {
+            "symbol": {
+                "type": "image",
+                "name": "/assets/item.png"
+            },
+            "caption": {
+                "type": "column",
+                "name": "name"
+            },
+            "summary": {
+                "type": "template",
+                "name": "summary"
+            },
+            "edit": {
+                "type": "account"
+            }
+        },
+        "system_picture": {
+            "symbol": {
+                "type": "picture",
+                "name": "symbol_option"
+            },
+            "caption": {
+                "type": "none"
+            },
+            "summary": {
+                "type": "none"
+            },
+            "edit": {
+                "type": "none"
+            }
         }
     },
     "elements": [
index 110a3aa..611481f 100644 (file)
@@ -98,6 +98,14 @@ self.system_picture_id = 1
     Kaminari.paginate_array(Array.new(Balloon.where(self.list_where()).includes(Balloon.list_opt).count, nil)).page(page).per(page_size)
   end
   
+  def self.list_by_speech_balloon_where speech_balloon_id
+    ['balloons.speech_balloon_id = ?', speech_balloon_id]
+  end
+  
+  def self.list_by_speech_balloon speech_balloon_id, roles, page = 1, page_size = self.default_page_size
+    self.where(self.list_by_speech_balloon_where(speech_balloon_id)).includes(self.list_opt).order('balloons.updated_at desc').offset((page -1) * page_size).limit(page_size)
+  end
+  
   def self.list_opt
     {:speech_balloon => {:panel => {:author => {}}, :speech => {}, :speech_balloon_template => {} }}
   end
index 3a27abc..98fd4ab 100644 (file)
@@ -114,6 +114,14 @@ class Comic < ActiveRecord::Base
     Kaminari.paginate_array(Array.new(Comic.where(self.himlist_where(au)).count, nil)).page(page).per(page_size)
   end
   
+  def self.list_by_author_where author_id
+    ['comics.author_id = ?', author_id]
+  end
+  
+  def self.list_by_author author_id, roles, page = 1, page_size = self.default_page_size
+    self.where(self.list_by_author_where(author_id)).includes(self.list_opt).order('comics.updated_at desc').offset((page -1) * page_size).limit(page_size)
+  end
+  
   def self.list_opt
     {:stories => {}, :author => {} }
   end
index 5204a02..2f61ce1 100644 (file)
@@ -183,6 +183,14 @@ class GroundColor < ActiveRecord::Base
     Kaminari.paginate_array(Array.new(GroundColor.where(self.himlist_where(au)).includes(GroundColor.list_opt).count, nil)).page(page).per(page_size)
   end
   
+  def self.list_by_panel_where panel_id
+    ['ground_colors.panel_id = ?', panel_id]
+  end
+  
+  def self.list_by_panel panel_id, roles, page = 1, page_size = self.default_page_size
+    self.where(self.list_by_panel_where(panel_id)).includes(self.list_opt).order('ground_colors.updated_at desc').offset((page -1) * page_size).limit(page_size)
+  end
+  
   def self.list_opt
     {:panel => {:author => {}} }
   end
index 3740a9f..647bf23 100644 (file)
@@ -155,6 +155,14 @@ class GroundPicture < ActiveRecord::Base
     Kaminari.paginate_array(Array.new(GroundPicture.where(self.himlist_where(au)).includes(GroundPicture.list_opt).count, nil)).page(page).per(page_size)
   end
   
+  def self.list_by_panel_where panel_id
+    ['ground_pictures.panel_id = ?', panel_id]
+  end
+  
+  def self.list_by_panel panel_id, roles, page = 1, page_size = self.default_page_size
+    self.where(self.list_by_panel_where(panel_id)).includes(self.list_opt).order('ground_pictures.updated_at desc').offset((page -1) * page_size).limit(page_size)
+  end
+  
   def self.list_opt
     {:panel => {:author => {}}, :picture => {:artist => {}, :license => {}} }
   end
index f98d601..50c5116 100644 (file)
@@ -2,6 +2,7 @@
 class License < ActiveRecord::Base
   belongs_to :license_group
   belongs_to :system_picture
+  has_many :resource_pictures
   
   validates :license_group_id, :presence => true, :numericality => true, :existence => {:both => false}
   validates :name, :presence => true, :length => {:maximum => 50}
@@ -28,22 +29,31 @@ class License < ActiveRecord::Base
     self.license_group.caption + '/' + self.caption
   end
   
+  def self.list_where
+    ''
+  end
+  
   def self.list
-    opt = {}
-    opt.merge!(License.list_opt)
-    opt.merge!({:order => 'name'})
-    License.find(:all, opt)
+    self.where(self.list_where()).includes(self.list_opt).order('licenses.name')
+  end
+  
+  def self.list_by_license_group_where license_group_id
+    ['licenses.license_group_id = ?', license_group_id]
+  end
+  
+  def self.list_by_license_group license_group_id, roles, page = 1, page_size = self.default_page_size
+    self.where(self.list_by_license_group_where(license_group_id)).includes(self.list_opt).order('licenses.updated_at desc').offset((page -1) * page_size).limit(page_size)
   end
   
   def self.list_opt
-    {:include => {:license_group => {}}}
+    {:license_group => {}}
   end
   
   def self.list_json_opt
     {:include => {:license_group => {}}}
   end
   
-  def self.show rid
+  def self.show rid, roles = nil
     opt = {}
     opt.merge!(License.show_opt)
     res = License.find(rid, opt)
index 65079dd..cc09080 100644 (file)
@@ -37,7 +37,7 @@ class LicenseGroup < ActiveRecord::Base
     {:include => {:licenses => {}}}
   end
   
-  def self.show rid
+  def self.show rid, roles = nil
     opt = {}
     opt.merge!(self.show_opt)
     res = LicenseGroup.find(rid, opt)
index cc1dc82..e988223 100644 (file)
@@ -1,8 +1,8 @@
 #コマ
 class Panel < ActiveRecord::Base
   belongs_to :author
-  belongs_to :resource_picture
   has_many :scroll_panels
+  has_many :sheet_panels
   has_many :panel_pictures, :dependent => :destroy
   has_many :speech_balloons, :dependent => :destroy
   has_many :ground_pictures, :dependent => :destroy
@@ -180,6 +180,32 @@ class Panel < ActiveRecord::Base
     Kaminari.paginate_array(Array.new(Panel.where(self.himlist_where(au)).count, nil)).page(page).per(page_size)
   end
   
+  def self.list_by_scroll scroll_id, roles, page = 1, page_size = self.default_page_size
+    self.where(ScrollPanel.list_by_scroll_where(scroll_id)).includes(
+      {:scroll_panels => {}}
+    ).order('scroll_panels.updated_at desc').offset((page -1) * page_size).limit(page_size)
+  end
+  
+  def self.list_by_sheet sheet_id, roles, page = 1, page_size = self.default_page_size
+    self.where(SheetPanel.list_by_sheet_where(sheet_id)).includes(
+      {:sheet_panels => {}}
+    ).order('sheet_panels.updated_at desc').offset((page -1) * page_size).limit(page_size)
+  end
+  
+  def self.list_by_speech_balloon_template speech_balloon_template_id, roles, page = 1, page_size = self.default_page_size
+    self.where(SpeechBalloon.list_by_speech_balloon_template_where(speech_balloon_template_id)).includes(
+      {:speech_balloons => {}}
+    ).order('speech_balloons.updated_at desc').offset((page -1) * page_size).limit(page_size)
+  end
+  
+  def self.list_by_author_where author_id
+    ['panels.author_id = ?', author_id]
+  end
+  
+  def self.list_by_author author_id, roles, page = 1, page_size = self.default_page_size
+    self.where(self.list_by_author_where(author_id)).includes(self.list_opt).order('panels.updated_at desc').offset((page -1) * page_size).limit(page_size)
+  end
+  
   def self.list_opt
     r = {
       :author => {}
index de574a7..8aa6809 100644 (file)
@@ -186,6 +186,14 @@ class PanelPicture < ActiveRecord::Base
     Kaminari.paginate_array(Array.new(PanelPicture.where(self.himlist_where(au)).includes(PanelPicture.list_opt).count, nil)).page(page).per(page_size)
   end
   
+  def self.list_by_panel_where panel_id
+    ['panel_pictures.panel_id = ?', panel_id]
+  end
+  
+  def self.list_by_panel panel_id, roles, page = 1, page_size = self.default_page_size
+    self.where(self.list_by_panel_where(panel_id)).includes(self.list_opt).order('panel_pictures.updated_at desc').offset((page -1) * page_size).limit(page_size)
+  end
+  
   def self.list_opt
     {:panel => {:author => {}}, :picture => {:artist => {}, :license => {}} }
   end
index f0cc995..dc04329 100644 (file)
@@ -139,6 +139,22 @@ class Picture < ActiveRecord::Base
     Picture.list_by_md5(md5, opid).empty? ? false : true
   end
   
+  def self.list_by_original_picture_where original_picture_id
+    ['pictures.original_picture_id = ?', original_picture_id]
+  end
+  
+  def self.list_by_original_picture original_picture_id, roles, page = 1, page_size = self.default_page_size
+    self.where(self.list_by_original_picture_where(original_picture_id)).includes(self.list_opt).order('pictures.revision desc').offset((page -1) * page_size).limit(page_size)
+  end
+  
+  def self.list_opt
+    {:license => {}, :artist => {}}
+  end
+  
+  def self.list_json_opt
+    {:include => {:license => {}, :artist => {}} }
+  end
+  
   def self.show rid, roles
     opt = {}
     r = Picture.find(rid, opt)
index 992be9f..935c3e2 100644 (file)
@@ -3,7 +3,6 @@ class ResourcePicture < ActiveRecord::Base
   belongs_to :artist
   belongs_to :license
   belongs_to :picture
-  has_many :panel_pictures
   belongs_to :original_picture
   
   validates :ext, :presence => true, :length => {:maximum => 4}, :inclusion => {:in => ['png', 'jpeg', 'gif']}
@@ -144,6 +143,30 @@ class ResourcePicture < ActiveRecord::Base
     Kaminari.paginate_array(Array.new(ResourcePicture.where(self.himlist_where(ar)).count, nil)).page(page).per(page_size)
   end
   
+  def self.list_by_original_picture_where original_picture_id
+    ['resource_pictures.original_picture_id = ?', original_picture_id]
+  end
+  
+  def self.list_by_original_picture original_picture_id, roles, page = 1, page_size = self.default_page_size
+    self.where(self.list_by_original_picture_where(original_picture_id)).includes(self.list_opt).order('resource_pictures.updated_at desc').offset((page -1) * page_size).limit(page_size)
+  end
+  
+  def self.list_by_license_where license_id
+    ['resource_pictures.license_id = ?', license_id]
+  end
+  
+  def self.list_by_license license_id, roles, page = 1, page_size = self.default_page_size
+    self.where(self.list_by_license_where(license_id)).includes(self.list_opt).order('resource_pictures.updated_at desc').offset((page -1) * page_size).limit(page_size)
+  end
+  
+  def self.list_by_artist_where artist_id
+    ['resource_pictures.artist_id = ?', artist_id]
+  end
+  
+  def self.list_by_artist artist_id, roles, page = 1, page_size = self.default_page_size
+    self.where(self.list_by_artist_where(artist_id)).includes(self.list_opt).order('resource_pictures.updated_at desc').offset((page -1) * page_size).limit(page_size)
+  end
+  
   def self.list_opt
     {:license => {}, :artist => {}, :picture => {} }
   end
index b51aff3..0768000 100644 (file)
@@ -110,6 +110,20 @@ class Scroll < ActiveRecord::Base
     Kaminari.paginate_array(Array.new(Scroll.where(self.himlist_where(au)).count, nil)).page(page).per(page_size)
   end
   
+  def self.list_by_panel panel_id, roles, page = 1, page_size = self.default_page_size
+    self.where(ScrollPanel.list_by_panel_where(panel_id)).includes(
+      {:scroll_panels => {}}
+    ).order('scroll_panels.updated_at desc').offset((page -1) * page_size).limit(page_size)
+  end
+  
+  def self.list_by_author_where author_id
+    ['scrolls.author_id = ?', author_id]
+  end
+  
+  def self.list_by_author author_id, roles, page = 1, page_size = self.default_page_size
+    self.where(self.list_by_author_where(author_id)).includes(self.list_opt).order('scrolls.updated_at desc').offset((page -1) * page_size).limit(page_size)
+  end
+  
   def self.list_opt
     {:scroll_panels => {:panel => {}}, :author => {} }
   end
index 798a0c9..f1314b4 100644 (file)
@@ -124,6 +124,22 @@ class ScrollPanel < ActiveRecord::Base
     Kaminari.paginate_array(Array.new(ScrollPanel.where(self.himlist_where(au)).includes(ScrollPanel.list_opt).count, nil)).page(page).per(page_size)
   end
   
+  def self.list_by_scroll_where scroll_id
+    ['scroll_panels.scroll_id = ?', scroll_id]
+  end
+  
+  def self.list_by_scroll scroll_id, roles, page = 1, page_size = self.default_page_size
+    self.where(self.list_by_scroll_where(scroll_id)).includes(self.list_opt).order('scroll_panels.updated_at desc').offset((page -1) * page_size).limit(page_size)
+  end
+  
+  def self.list_by_panel_where panel_id
+    ['scroll_panels.panel_id = ?', panel_id]
+  end
+  
+  def self.list_by_panel panel_id, roles, page = 1, page_size = self.default_page_size
+    self.where(self.list_by_panel_where(panel_id)).includes(self.list_opt).order('scroll_panels.updated_at desc').offset((page -1) * page_size).limit(page_size)
+  end
+  
   def self.list_opt
     {
       :author => {}, 
index c891593..780cdbe 100644 (file)
@@ -149,6 +149,26 @@ class Sheet < ActiveRecord::Base
     Kaminari.paginate_array(Array.new(Sheet.where(self.himlist_where(au)).count, nil)).page(page).per(page_size)
   end
   
+  def self.list_by_story story_id, roles, page = 1, page_size = self.default_page_size
+    self.where(StorySheet.list_by_story_where(story_id)).includes(
+      {:story_sheets => {}}
+    ).order('story_sheets.updated_at desc').offset((page -1) * page_size).limit(page_size)
+  end
+  
+  def self.list_by_panel panel_id, roles, page = 1, page_size = self.default_page_size
+    self.where(SheetPanel.list_by_panel_where(panel_id)).includes(
+      {:sheet_panels => {}}
+    ).order('sheet_panels.updated_at desc').offset((page -1) * page_size).limit(page_size)
+  end
+  
+  def self.list_by_author_where author_id
+    ['sheets.author_id = ?', author_id]
+  end
+  
+  def self.list_by_author author_id, roles, page = 1, page_size = self.default_page_size
+    self.where(self.list_by_author_where(author_id)).includes(self.list_opt).order('sheets.updated_at desc').offset((page -1) * page_size).limit(page_size)
+  end
+  
   def self.list_opt
     {:sheet_panels => {:panel => {}}, :author => {} }
   end
index b1b48ff..1ff1de2 100644 (file)
@@ -113,6 +113,22 @@ class SheetPanel < ActiveRecord::Base
     Kaminari.paginate_array(Array.new(SheetPanel.where(self.himlist_where(au)).includes(SheetPanel.list_opt).count, nil)).page(page).per(page_size)
   end
   
+  def self.list_by_sheet_where sheet_id
+    ['sheet_panels.sheet_id = ?', sheet_id]
+  end
+  
+  def self.list_by_sheet sheet_id, roles, page = 1, page_size = self.default_page_size
+    self.where(self.list_by_sheet_where(sheet_id)).includes(self.list_opt).order('sheet_panels.updated_at desc').offset((page -1) * page_size).limit(page_size)
+  end
+  
+  def self.list_by_panel_where panel_id
+    ['sheet_panels.panel_id = ?', panel_id]
+  end
+  
+  def self.list_by_panel panel_id, roles, page = 1, page_size = self.default_page_size
+    self.where(self.list_by_panel_where(panel_id)).includes(self.list_opt).order('sheet_panels.updated_at desc').offset((page -1) * page_size).limit(page_size)
+  end
+  
   def self.list_opt
     {
       :author => {}, 
index 2b33f65..7f31064 100644 (file)
@@ -100,6 +100,22 @@ class Speech < ActiveRecord::Base
     Kaminari.paginate_array(Array.new(Speech.where(self.list_where()).includes(Speech.list_opt).count, nil)).page(page).per(page_size)
   end
   
+  def self.list_by_speech_balloon_where speech_balloon_id
+    ['speeches.speech_balloon_id = ?', speech_balloon_id]
+  end
+  
+  def self.list_by_speech_balloon speech_balloon_id, roles, page = 1, page_size = self.default_page_size
+    self.where(self.list_by_speech_balloon_where(speech_balloon_id)).includes(self.list_opt).order('speeches.updated_at desc').offset((page -1) * page_size).limit(page_size)
+  end
+  
+  def self.list_by_writing_format_where writing_format_id
+    ['speeches.writing_format_id = ?', writing_format_id]
+  end
+  
+  def self.list_by_writing_format writing_format_id, roles, page = 1, page_size = self.default_page_size
+    self.where(self.list_by_writing_format_where(writing_format_id)).includes(self.list_opt).order('speeches.updated_at desc').offset((page -1) * page_size).limit(page_size)
+  end
+  
   def self.list_opt
     {:speech_balloon => {:panel => {:author => {}}, :balloon => {}, :speech_balloon_template => {}} }
   end
index e58d0b7..fe9f919 100644 (file)
@@ -204,6 +204,22 @@ class SpeechBalloon < ActiveRecord::Base
     Kaminari.paginate_array(Array.new(SpeechBalloon.where(self.himlist_where(au)).includes(SpeechBalloon.list_opt).count, nil)).page(page).per(page_size)
   end
   
+  def self.list_by_panel_where panel_id
+    ['speech_balloons.panel_id = ?', panel_id]
+  end
+  
+  def self.list_by_panel panel_id, roles, page = 1, page_size = self.default_page_size
+    self.where(self.list_by_panel_where(panel_id)).includes(self.list_opt).order('speech_balloons.updated_at desc').offset((page -1) * page_size).limit(page_size)
+  end
+  
+  def self.list_by_speech_balloon_template_where speech_balloon_template_id
+    ['speech_balloons.speech_balloon_template_id = ?', speech_balloon_template_id]
+  end
+  
+  def self.list_by_speech_balloon_template speech_balloon_template_id, roles, page = 1, page_size = self.default_page_size
+    self.where(self.list_by_speech_balloon_template_where(speech_balloon_template_id)).includes(self.list_opt).order('speech_balloons.updated_at desc').offset((page -1) * page_size).limit(page_size)
+  end
+  
   def self.list_opt
     {:panel => {:author => {}}, :balloon => {}, :speech => {}, :speech_balloon_template => {} }
   end
index 804c586..3d20165 100644 (file)
@@ -123,6 +123,28 @@ class Story < ActiveRecord::Base
     Kaminari.paginate_array(Array.new(Story.where(self.himlist_where(au)).includes(Story.list_opt).count, nil)).page(page).per(page_size)
   end
   
+  def self.list_by_comic_where comic_id
+    ['stories.comic_id = ?', comic_id]
+  end
+  
+  def self.list_by_comic comic_id, roles, page = 1, page_size = self.default_page_size
+    self.where(self.list_by_comic_where(comic_id)).includes(self.list_opt).order('stories.updated_at desc').offset((page -1) * page_size).limit(page_size)
+  end
+  
+  def self.list_by_sheet sheet_id, roles, page = 1, page_size = self.default_page_size
+    self.where(StorySheet.list_by_sheet_where(sheet_id)).includes(
+      {:story_sheets => {}}
+    ).order('story_sheets.updated_at desc').offset((page -1) * page_size).limit(page_size)
+  end
+  
+  def self.list_by_author_where author_id
+    ['stories.author_id = ?', author_id]
+  end
+  
+  def self.list_by_author author_id, roles, page = 1, page_size = self.default_page_size
+    self.where(self.list_by_author_where(author_id)).includes(self.list_opt).order('stories.updated_at desc').offset((page -1) * page_size).limit(page_size)
+  end
+  
   def self.list_opt
     {:comic => {:author => {}} }
   end
index 2ab6e17..0f493b1 100644 (file)
@@ -130,6 +130,22 @@ class StorySheet < ActiveRecord::Base
     Kaminari.paginate_array(Array.new(StorySheet.where(self.play_sheet_where(story.id)).includes(StorySheet.list_opt).count, nil)).page(page).per(1)
   end
   
+  def self.list_by_story_where story_id
+    ['story_sheets.story_id = ?', story_id]
+  end
+  
+  def self.list_by_story story_id, roles, page = 1, page_size = self.default_page_size
+    self.where(self.list_by_story_where(story_id)).includes(self.list_opt).order('story_sheets.updated_at desc').offset((page -1) * page_size).limit(page_size)
+  end
+  
+  def self.list_by_sheet_where sheet_id
+    ['story_sheets.sheet_id = ?', sheet_id]
+  end
+  
+  def self.list_by_sheet sheet_id, roles, page = 1, page_size = self.default_page_size
+    self.where(self.list_by_sheet_where(sheet_id)).includes(self.list_opt).order('story_sheets.updated_at desc').offset((page -1) * page_size).limit(page_size)
+  end
+  
   def self.list_opt
     {
       :author => {}, 
diff --git a/app/views/comics/_summary.html.erb b/app/views/comics/_summary.html.erb
new file mode 100644 (file)
index 0000000..4911dee
--- /dev/null
@@ -0,0 +1,7 @@
+<div>
+  <%= t_selected_item('comic_visible_items', item.visible) %>
+  <%= t('comics.comic_stories_count', :c => item.comic_stories_count) %>
+</div>
+<div>
+  <%= link_to h(truncate(item.author.name, :length => 12)), author_path(item.author) %>
+</div>
diff --git a/app/views/pictures/_summary.html.erb b/app/views/pictures/_summary.html.erb
new file mode 100644 (file)
index 0000000..fcc9da7
--- /dev/null
@@ -0,0 +1,4 @@
+<div>
+  <%= link_to h(truncate(item.artist.name, :length => 12)), artist_path(item.artist) %>
+  <%= render item.credit_template, :picture => item %>
+</div>
diff --git a/app/views/system/_filer.html.erb b/app/views/system/_filer.html.erb
new file mode 100644 (file)
index 0000000..7d5544b
--- /dev/null
@@ -0,0 +1,150 @@
+<% model_name = model.to_s.underscore %>
+<% path_name = model.to_s.tableize %>
+<% filer_configurations = configurations['filers'][model.to_s.underscore] || {} %>
+<% symbol = filer_configurations['symbol'] || {} %>
+<% symbol_type = symbol['type'] || 'src' %>
+<% caption = filer_configurations['caption'] || {} %>
+<% caption_type = caption['type'] || 'column' %>
+<% summary = filer_configurations['summary'] || {} %>
+<% summary_type = summary['type'] || 'none' %>
+<% edit = filer_configurations['edit'] || {} %>
+<% edit_type = edit['type'] || 'default' %>
+<div>
+  <%= model.model_name.human %>
+</div>
+<ul class="filer">
+  <li id="" class="filer-head filer-head-<%= model.to_s.underscore -%>">
+    <div id="" class="filer-head-symbol">
+      symbol
+    </div>
+    <% unless caption_type == 'none' %>
+      <div id="" class="filer-head-caption">
+        caption
+      </div>
+    <% end %>
+    <% unless summary_type == 'none' %>
+      <div id="" class="filer-head-summary">
+        summary
+      </div>
+    <% end %>
+    <div id="" class="filer-head-icon">
+      icon
+    </div>
+    <div id="" class="filer-head-date">
+      date
+    </div>
+    <% unless edit_type == 'none' %>
+      <div id="" class="filer-head-edit">
+        edit
+      </div>
+    <% end %>
+  </li>
+  <% items.each do |item| %>
+    <li id="" class="filer-item filer-item-<%= model.to_s.underscore -%>">
+      <div id="" class="filer-item-symbol">
+        <% link = symbol['link'] || {'type' => 'action', 'name' => 'show'} %>
+        <% path = case link['type'] %>
+        <% when 'action' %>
+          <% case link['name'] %>
+          <% when 'show' %>
+            <% polymorphic_path(item) %>
+          <% else %>
+            <% polymorphic_path(item, :action => link['name']) %>
+          <% end %>
+        <% when 'none' %>
+          <% '' %>
+        <% when 'url_column' %>
+          <% item.__send__(link['name']).to_s %>
+        <% else %>
+          <% '' %>
+        <% end %>
+        <% str = case symbol_type %>
+        <% when 'image' %>
+          <% tag(:img, :src => symbol['name'], :width => 64, :height => 64) %>
+        <% when 'picture' %>
+          <% tag(:img, item.__send__(symbol['name'])) %>
+        <% when 'template' %>
+          <%= render path_name + '/' + symbol['name'], :item => item %>
+          <% nil %>
+        <% else %>
+          <% 'no.png' %>
+        <% end %>
+        <% unless str.blank? %>
+          <%= link_to_unless path.blank?, str, path %>
+        <% end %>
+      </div>
+      <% unless caption_type == 'none' %>
+        <div id="" class="filer-item-caption">
+          <% link = caption['link'] || {'type' => 'action', 'name' => 'show'} %>
+          <% path = case link['type'] %>
+          <% when 'action' %>
+            <% case link['name'] %>
+            <% when 'show' %>
+              <% polymorphic_path(item) %>
+            <% else %>
+              <% polymorphic_path(item, :action => link['name']) %>
+            <% end %>
+          <% when 'none' %>
+            <% '' %>
+          <% when 'url_column' %>
+            <% item.__send__(link['name']).to_s %>
+          <% else %>
+            <% polymorphic_path(item) %>
+          <% end %>
+          <% str = case caption_type %>
+          <% when 'column' %>
+            <% item.attributes[caption['name']] %>
+          <% when 'method' %>
+            <% item.__send__(caption['name']).to_s %>
+          <% else %>
+            <% 'no caption' %>
+          <% end %>
+          <% str = 'no caption' if str.blank? %>
+          <% unless str.blank? %>
+            <%= link_to_unless path.blank?, str, path %>
+          <% end %>
+        </div>
+      <% end %>
+      <% unless summary_type == 'none' %>
+        <div id="" class="filer-item-summary">
+          <% case summary_type %>
+          <% when 'template' %>
+            <%= render path_name + '/' + summary['name'], :item => item %>
+          <% else %>
+            <% 'no config' %>
+          <% end %>
+        </div>
+      <% end %>
+      <div id="" class="filer-item-icon">
+        <%= link_to icon_tag(item.class.to_s, :object => item, :size => 64), polymorphic_path(item, :format => :prof) %>
+      </div>
+      <div id="" class="filer-item-date">
+        <%= distance_of_time_in_words_to_now item.updated_at %>
+      </div>
+      <% unless edit_type == 'none' %>
+        <div id="" class="filer-item-edit">
+          <% case edit_type %>
+          <% when 'default' %>
+            <% if item.own? roles %>
+              <%= link_to tag(:img, :src => asset_path('edit.png'), :width => 32, :height => 32), polymorphic_path(item, :action => :edit) %>
+              <%= link_to tag(:img, :src => asset_path('remove.png'), :width => 32, :height => 32), item, confirm: 'Are you sure?', :method => :delete %>
+            <% end %>
+          <% when 'account' %>
+            <% if item.own? roles %>
+              <%= link_to tag(:img, :src => asset_path('edit.png'), :width => 32, :height => 32), '/home/configure' %>
+            <% end %>
+         <% when 'template' %>
+            <%= render path_name + '/' + edit['name'], :item => item %>
+         <% else %>
+            <% 'no config' %>
+          <% end %>
+        </div>
+      <% end %>
+    </li>
+  <% end %>
+</ul>
+<div class="row_break">
+</div>
+<% if pager %>
+  <%= paginate(pager) %>
+<% end %>
index a29d8a2..60d6650 100644 (file)
@@ -1,147 +1 @@
-<% model_name = model.to_s.underscore %>
-<% path_name = model.to_s.tableize %>
-<% filer_configurations = configurations['filers'][model.to_s.underscore] || {} %>
-<% symbol = filer_configurations['symbol'] || {} %>
-<% symbol_type = symbol['type'] || 'src' %>
-<% caption = filer_configurations['caption'] || {} %>
-<% caption_type = caption['type'] || 'column' %>
-<% summary = filer_configurations['summary'] || {} %>
-<% summary_type = summary['type'] || 'none' %>
-<% edit = filer_configurations['edit'] || {} %>
-<% edit_type = edit['type'] || 'default' %>
-<ul class="filer">
-  <li id="" class="filer-head filer-head-<%= model.to_s.underscore -%>">
-    <div id="" class="filer-head-symbol">
-      symbol
-    </div>
-    <% unless caption_type == 'none' %>
-      <div id="" class="filer-head-caption">
-        caption
-      </div>
-    <% end %>
-    <% unless summary_type == 'none' %>
-      <div id="" class="filer-head-summary">
-        summary
-      </div>
-    <% end %>
-    <div id="" class="filer-head-icon">
-      icon
-    </div>
-    <div id="" class="filer-head-date">
-      date
-    </div>
-    <% unless edit_type == 'none' %>
-      <div id="" class="filer-head-edit">
-        edit
-      </div>
-    <% end %>
-  </li>
-  <% items.each do |item| %>
-    <li id="" class="filer-item filer-item-<%= model.to_s.underscore -%>">
-      <div id="" class="filer-item-symbol">
-        <% link = symbol['link'] || {'type' => 'action', 'name' => 'show'} %>
-        <% path = case link['type'] %>
-        <% when 'action' %>
-          <% case link['name'] %>
-          <% when 'show' %>
-            <% polymorphic_path(item) %>
-          <% else %>
-            <% polymorphic_path(item, :action => link['name']) %>
-          <% end %>
-        <% when 'none' %>
-          <% '' %>
-        <% when 'url_column' %>
-          <% item.__send__(link['name']).to_s %>
-        <% else %>
-          <% '' %>
-        <% end %>
-        <% str = case symbol_type %>
-        <% when 'image' %>
-          <% tag(:img, :src => symbol['name'], :width => 64, :height => 64) %>
-        <% when 'picture' %>
-          <% tag(:img, item.__send__(symbol['name'])) %>
-        <% when 'template' %>
-          <%= render path_name + '/' + symbol['name'], :item => item %>
-          <% nil %>
-        <% else %>
-          <% 'no.png' %>
-        <% end %>
-        <% unless str.blank? %>
-          <%= link_to_unless path.blank?, str, path %>
-        <% end %>
-      </div>
-      <% unless caption_type == 'none' %>
-        <div id="" class="filer-item-caption">
-          <% link = caption['link'] || {'type' => 'action', 'name' => 'show'} %>
-          <% path = case link['type'] %>
-          <% when 'action' %>
-            <% case link['name'] %>
-            <% when 'show' %>
-              <% polymorphic_path(item) %>
-            <% else %>
-              <% polymorphic_path(item, :action => link['name']) %>
-            <% end %>
-          <% when 'none' %>
-            <% '' %>
-          <% when 'url_column' %>
-            <% item.__send__(link['name']).to_s %>
-          <% else %>
-            <% polymorphic_path(item) %>
-          <% end %>
-          <% str = case caption_type %>
-          <% when 'column' %>
-            <% item.attributes[caption['name']] %>
-          <% when 'method' %>
-            <% item.__send__(caption['name']).to_s %>
-          <% else %>
-            <% 'no caption' %>
-          <% end %>
-          <% str = 'no caption' if str.blank? %>
-          <% unless str.blank? %>
-            <%= link_to_unless path.blank?, str, path %>
-          <% end %>
-        </div>
-      <% end %>
-      <% unless summary_type == 'none' %>
-        <div id="" class="filer-item-summary">
-          <% case summary_type %>
-          <% when 'template' %>
-            <%= render path_name + '/' + summary['name'], :item => item %>
-          <% else %>
-            <% 'no config' %>
-          <% end %>
-        </div>
-      <% end %>
-      <div id="" class="filer-item-icon">
-        <%= link_to icon_tag(item.class.to_s, :object => item, :size => 64), polymorphic_path(item, :format => :prof) %>
-      </div>
-      <div id="" class="filer-item-date">
-        <%= distance_of_time_in_words_to_now item.updated_at %>
-      </div>
-      <% unless edit_type == 'none' %>
-        <div id="" class="filer-item-edit">
-          <% case edit_type %>
-          <% when 'default' %>
-            <% if item.own? roles %>
-              <%= link_to tag(:img, :src => asset_path('edit.png'), :width => 32, :height => 32), polymorphic_path(item, :action => :edit) %>
-              <%= link_to tag(:img, :src => asset_path('remove.png'), :width => 32, :height => 32), item, confirm: 'Are you sure?', :method => :delete %>
-            <% end %>
-          <% when 'account' %>
-            <% if item.own? roles %>
-              <%= link_to tag(:img, :src => asset_path('edit.png'), :width => 32, :height => 32), '/home/configure' %>
-            <% end %>
-         <% when 'template' %>
-            <%= render path_name + '/' + edit['name'], :item => item %>
-         <% else %>
-            <% 'no config' %>
-          <% end %>
-        </div>
-      <% end %>
-    </li>
-  <% end %>
-</ul>
-<div class="row_break">
-</div>
-<% if pager %>
-  <%= paginate(pager) %>
-<% end %>
+<%= render 'system/filer', {:items => items, :model => model, :roles => roles, :pager => pager} %>
diff --git a/app/views/system/prof.prof.erb b/app/views/system/prof.prof.erb
new file mode 100644 (file)
index 0000000..6a20134
--- /dev/null
@@ -0,0 +1,62 @@
+<% item_name = item.class.to_s.underscore %>\r
+<% profile = configurations['profiles'][item_name] || {} %>\r
+<% model_conf = configurations['models'][item_name] || {} %>\r
+<% model_attributes = model_conf['attributes'] || {} %>\r
+<% model_associations = model_conf['associations'] || {} %>\r
+<% profile_associations = profile['associations'] || {} %>\r
+<%= render 'system/filer.html', :items => [item], :model => item.class, :roles => roles, :pager => nil %>\r
+<% profile['fields'].each do |field_name| %>\r
+  <% field_conf = model_attributes[field_name] || {} %>\r
+  <div>\r
+    <%= item.class.human_attribute_name(field_name) %>\r
+    <% case field_conf['type'] %>\r
+    <% when 'datetime' %>\r
+      <% if item.attributes[field_name] %>\r
+        <%= l item.attributes[field_name] %>\r
+      <% else %>\r
+        <%= item.attributes[field_name] %>\r
+      <% end %>\r
+    <% else %>\r
+      <%= item.attributes[field_name] %>\r
+    <% end %>\r
+  </div>\r
+<% end %>\r
+<div>\r
+  <%= 'associations' %>\r
+</div>\r
+<div>\r
+  <%= 'belongs_to' %>\r
+</div>\r
+<% (profile_associations['belongs_to'] || []).each do |association_model_name| %>\r
+  <% belongs_to_conf = model_associations['belongs_to'][association_model_name] %>\r
+  <% parent_model = association_model_name.classify.constantize %>\r
+  <% id_column = belongs_to_conf['id_column'] %>\r
+  <% parent = nil %>\r
+  <% begin %>\r
+    <% parent = parent_model.show(item.attributes[id_column], roles) %>\r
+  <% rescue ActiveRecord::RecordNotFound %>\r
+  <% end %>\r
+  <% if parent %>\r
+    <%= render 'system/filer.html', :items => [parent], :model => parent.class, :roles => roles, :pager => nil %>\r
+  <% end %>\r
+<% end %>\r
+<div>\r
+  <%= 'has_many' %>\r
+</div>\r
+<% (profile_associations['has_many'] || []).each do |association_model_name| %>\r
+  <% has_many_conf = model_associations['has_many'][association_model_name] %>\r
+  <% child_model = association_model_name.classify.constantize %>\r
+  <% foreign_key = has_many_conf['foreign_key'] %>\r
+  <% children = child_model.__send__(has_many_conf['list_method'], item.attributes['id'], roles, 1, 3) %>\r
+  <%= render 'system/filer.html', :items => children, :model => child_model, :roles => roles, :pager => nil %>\r
+<% end %>\r
+<div>\r
+  <%= 'has_one' %>\r
+</div>\r
+<% (profile_associations['has_one'] || []).each do |association_model_name| %>\r
+  <% has_one_conf = model_associations['has_one'][association_model_name] %>\r
+  <% child_model = association_model_name.classify.constantize %>\r
+  <% foreign_key = has_one_conf['foreign_key'] %>\r
+  <% children = child_model.__send__(has_one_conf['list_method'], item.attributes['id'], roles, 1, 3) %>\r
+  <%= render 'system/filer.html', :items => children, :model => child_model, :roles => roles, :pager => nil %>\r
+<% end %>\r
index 214e407..80de95a 100644 (file)
       <%= link_to t_m('SystemPicture'), main_app.system_pictures_path %>\r
     </td>\r
   </tr>\r
+  <tr height="100px">\r
+    <td width="200px" align="center" valign="middle">\r
+      <%= link_to t_m('WritingFormat'), main_app.writing_formats_path %>\r
+    </td>\r
+    <td width="200px" align="center" valign="middle">\r
+    </td>\r
+    <td width="200px" align="center" valign="middle">\r
+    </td>\r
+    <td width="200px" align="center" valign="middle">\r
+    </td>\r
+  </tr>\r
 </table>\r
diff --git a/app/views/top/prof.prof.erb b/app/views/top/prof.prof.erb
deleted file mode 100644 (file)
index c8d5ec2..0000000
+++ /dev/null
@@ -1 +0,0 @@
-prof\r
index 82c0d52..647e382 100644 (file)
@@ -935,6 +935,11 @@ ja:
     browse:
       title: フキダシテンプレート 生単票
     add_to_panel: このフキダシをつかんだコマに追加する
+  writing_formats:
+    index:
+      title: 記法一覧
+    show:
+      title: 記法詳細
   license_groups:
     index:
       title: ライセンスグループ一覧
index 0730724..1c0c1d5 100644 (file)
@@ -345,6 +345,16 @@ Pettanr::Application.routes.draw do
       delete :destroy
     end
   end
+  resources :writing_formats do
+    collection do
+      get :index
+      get :show
+      get :list
+    end
+    member do
+      get :browse
+    end
+  end
   resources :licenses do
     collection do
       get :index
index 2357006..a631988 100644 (file)
@@ -1,3 +1,4 @@
+=begin
 module ActiveRecord
   class Base
     module Content
@@ -73,3 +74,5 @@ module ActiveRecord
   end
 end
 
+
+=end
index 154a9ba..20f3fb7 100644 (file)
@@ -1,3 +1,4 @@
+=begin
 module ActiveRecord
   class Base
     module Element
@@ -21,3 +22,5 @@ module ActiveRecord
   end
 end
 
+
+=end
index 986bd82..e1ec412 100644 (file)
@@ -1,3 +1,4 @@
+=begin
 module ActiveRecord
   class Base
     module Item
@@ -158,3 +159,4 @@ module ActiveRecord
   end
 end
 
+=end