X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=app%2Fassets%2Fjavascripts%2Fmanifest%2Fwork%2Fmodels.js.coffee.erb;h=70340de6a7b351eb5a3e733aa574dda20ddae97d;hb=610257311287236d2abb7d13d048d51e7701cbbd;hp=5e9b60e7c0a90809109a4710f549a8e8ad9e9d32;hpb=36f37a28d730600d00e304182dfd4034ce72a104;p=pettanr%2Fpettanr.git diff --git a/app/assets/javascripts/manifest/work/models.js.coffee.erb b/app/assets/javascripts/manifest/work/models.js.coffee.erb index 5e9b60e7..70340de6 100644 --- a/app/assets/javascripts/manifest/work/models.js.coffee.erb +++ b/app/assets/javascripts/manifest/work/models.js.coffee.erb @@ -1,34 +1,20 @@ #マニフェスト @models = { scroll: { - class_name: 'Scroll', - table_name: 'scrolls', associations: { belongs_to: { author: { - id_column: 'author_id' }, }, has_many: { scroll_panels: { - foreign_key: 'scroll_id', - model_name: 'scroll_panel', }, panels: { through: 'scroll_panel', - foreign_key: 'scroll_id', - model_name: 'panel', }, }, }, attributes: { - id: { - type: 'number', - primary_key: 1, - rules : { - number: true, - } - }, title: { type: 'text', rules : { @@ -60,54 +46,47 @@ number: true, }, }, - created_at: { - type: 'datetime', - }, - updated_at: { - type: 'datetime', - } }, lists: { - public_list: { + public: { type: 'public', }, - private_list: { + private: { type: 'private', }, by_author: { type: 'filter', + args: { + }, }, by_panel: { type: 'through_filter', + args: { + through: 'scroll_panels', + }, }, play: { type: 'play', + args: { + filter_item_name: 'scroll', + filter_model_name: 'scroll_panel', + filter_key: 'scroll_id', + }, }, }, }, scroll_panel: { - class_name: 'ScrollPanel', - table_name: 'scroll_panels', associations: { belongs_to: { panel: { - id_column: 'panel_id' }, scroll: { - id_column: 'scroll_id' }, }, has_many: { }, }, attributes: { - id: { - type: 'number', - primary_key: 1, - rules : { - number: true, - } - }, scroll_id: { type: 'number', rules : { @@ -137,18 +116,15 @@ number: true, } }, - created_at: { - type: 'datetime', - }, - updated_at: { - type: 'datetime', - } + }, + tree: { + owner: 'scroll', }, lists: { - public_list: { + public: { type: 'public', }, - private_list: { + private: { type: 'private', }, by_scroll: { @@ -160,31 +136,17 @@ }, }, comic: { - class_name: 'Comic', - table_name: 'comics', associations: { belongs_to: { author: { - id_column: 'author_id' }, }, has_many: { stories: { - foreign_key: 'comic_id', - model_name: 'story', }, }, - has_many_through: { - }, }, attributes: { - id: { - type: 'number', - primary_key: 1, - rules : { - number: true, - } - }, title: { type: 'text', rules : { @@ -216,18 +178,12 @@ number: true, } }, - created_at: { - type: 'datetime', - }, - updated_at: { - type: 'datetime', - } }, lists: { - public_list: { + public: { type: 'public', }, - private_list: { + private: { type: 'private', }, by_author: { @@ -236,34 +192,20 @@ }, }, story: { - class_name: 'Story', - table_name: 'stories', associations: { belongs_to: { comic: { - id_column: 'comic_id' }, }, has_many: { story_sheets: { - foreign_key: 'story_id', - model_name: 'story_sheet', }, sheets: { through: 'story_sheets', - foreign_key: 'story_id', - model_name: 'sheet', }, }, }, attributes: { - id: { - type: 'number', - primary_key: 1, - rules : { - number: true, - } - }, comic_id: { type: 'number', rules : { @@ -301,18 +243,15 @@ }, }, }, - created_at: { - type: 'datetime', - }, - updated_at: { - type: 'datetime', - } + }, + tree: { + owner: 'comic', }, lists: { - public_list: { + public: { type: 'public', }, - private_list: { + private: { type: 'private', }, by_comic: { @@ -320,9 +259,12 @@ }, by_sheet: { type: 'through_filter', + args: { + through: 'story_sheets', + }, }, by_author: { - type: 'element_filter', + type: 'foreign_filter', }, play: { type: 'play', @@ -330,28 +272,17 @@ }, }, story_sheet: { - class_name: 'StorySheet', - table_name: 'story_sheets', associations: { belongs_to: { story: { - id_column: 'story_id' }, sheet: { - id_column: 'sheet_id' }, }, has_many: { }, }, attributes: { - id: { - type: 'number', - primary_key: 1, - rules : { - number: true, - } - }, story_id: { type: 'number', rules : { @@ -379,18 +310,15 @@ number: true, } }, - created_at: { - type: 'datetime', - }, - updated_at: { - type: 'datetime', - } + }, + tree: { + owner: 'story', }, lists: { - public_list: { + public: { type: 'public', }, - private_list: { + private: { type: 'private', }, by_story: { @@ -402,43 +330,25 @@ }, }, sheet: { - class_name: 'Sheet', - table_name: 'sheets', associations: { belongs_to: { author: { - id_column: 'author_id' }, }, has_many: { story_sheets: { - foreign_key: 'story_id', - model_name: 'story_sheet', }, stories: { through: 'story_sheets', - foreign_key: 'sheet_id', - model_name: 'story', }, sheet_panels: { - foreign_key: 'sheet_id', - model_name: 'sheet_panel', }, panels: { through: 'sheet_panels', - foreign_key: 'sheet_id', - model_name: 'panel', }, }, }, attributes: { - id: { - type: 'number', - primary_key: 1, - rules : { - number: true, - } - }, caption: { type: 'text', rules : { @@ -478,25 +388,25 @@ number: true, } }, - created_at: { - type: 'datetime', - }, - updated_at: { - type: 'datetime', - } }, lists: { - public_list: { + public: { type: 'public', }, - private_list: { + private: { type: 'private', }, by_story: { type: 'through_filter', + args: { + through: 'story_sheets', + }, }, by_panel: { type: 'through_filter', + args: { + through: 'sheet_panels', + }, }, by_author: { type: 'filter', @@ -507,28 +417,17 @@ }, }, sheet_panel: { - class_name: 'SheetPanel', - table_name: 'sheet_panels', associations: { belongs_to: { sheet: { - id_column: 'sheet_id' }, panel: { - id_column: 'panel_id' }, }, has_many: { }, }, attributes: { - id: { - type: 'number', - primary_key: 1, - rules : { - number: true, - } - }, sheet_id: { type: 'number', rules : { @@ -577,18 +476,15 @@ number: true, } }, - created_at: { - type: 'datetime', - }, - updated_at: { - type: 'datetime', - } + }, + tree: { + owner: 'sheet', }, lists: { - public_list: { + public: { type: 'public', }, - private_list: { + private: { type: 'private', }, by_sheet: { @@ -600,59 +496,39 @@ }, }, panel: { - class_name: 'Panel', - table_name: 'panels', + peta: { + type: 'root', + args: { + element_tree_name: 'panel', + }, + }, associations: { belongs_to: { author: { - id_column: 'author_id' }, }, has_many: { scroll_panels: { - foreign_key: 'panel_id', - model_name: 'scroll_panel', }, scrolls: { through: 'scroll_panels', - foreign_key: 'panel_id', - model_name: 'scroll', }, sheet_panels: { - foreign_key: 'panel_id', - model_name: 'sheet_panel', }, sheets: { through: 'sheet_panels', - foreign_key: 'panel_id', - model_name: 'sheet', }, panel_pictures: { - foreign_key: 'panel_id', - model_name: 'panel_picture', }, speech_balloons: { - foreign_key: 'panel_id', - model_name: 'speech_balloon', }, ground_pictures: { - foreign_key: 'panel_id', - model_name: 'ground_picture', }, ground_colors: { - foreign_key: 'panel_id', - model_name: 'ground_color', }, }, }, attributes: { - id: { - type: 'number', - primary_key: 1, - rules : { - number: true, - } - }, width: { type: 'number', rules : { @@ -702,25 +578,25 @@ number: true, } }, - created_at: { - type: 'datetime', - }, - updated_at: { - type: 'datetime', - } }, lists: { - public_list: { + public: { type: 'public', }, - private_list: { + private: { type: 'private', }, by_scroll: { type: 'through_filter', + args: { + through: 'scroll_panels', + }, }, by_sheet: { type: 'through_filter', + args: { + through: 'sheet_panels', + }, }, by_author: { type: 'filter', @@ -731,25 +607,15 @@ }, }, panel_picture: { - class_name: 'PanelPicture', - table_name: 'panel_pictures', associations: { belongs_to: { panel: { - id_column: 'panel_id' }, }, has_many: { }, }, attributes: { - id: { - type: 'number', - primary_key: 1, - rules : { - number: true, - } - }, panel_id: { type: 'number', rules : { @@ -818,59 +684,43 @@ min: 0, } }, - created_at: { - type: 'datetime', - }, - updated_at: { - type: 'datetime', - } + }, + tree: { + owner: 'panel', + panel: 'panel', }, lists: { - public_list: { + public: { type: 'public', }, - private_list: { + private: { type: 'private', }, by_panel: { type: 'filter', }, by_author: { - type: 'element_filter', + type: 'foreign_filter', }, }, }, speech_balloon: { - class_name: 'SpeechBalloon', - table_name: 'speech_balloons', - extend: 'classname', + extend_column_name: 'classname', associations: { belongs_to: { panel: { - id_column: 'panel_id' }, }, has_many: { }, has_one: { balloon: { - foreign_key: 'speech_balloon_id', - model_name: 'balloon', }, speech: { - foreign_key: 'speech_balloon_id', - model_name: 'speech', }, }, }, attributes: { - id: { - type: 'number', - primary_key: 1, - rules : { - number: true, - } - }, panel_id: { type: 'number', rules : { @@ -916,18 +766,16 @@ rules : { } }, - created_at: { - type: 'datetime', - }, - updated_at: { - type: 'datetime', - } + }, + tree: { + owner: 'panel', + panel: 'panel', }, lists: { - public_list: { + public: { type: 'public', }, - private_list: { + private: { type: 'private', }, by_panel: { @@ -937,33 +785,22 @@ type: 'filter', }, by_author: { - type: 'element_filter', + type: 'foreign_filter', }, }, }, 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', - primary_key: 1, - rules : { - number: true, - } - }, speech_balloon_id: { type: 'number', rules : { @@ -1019,18 +856,16 @@ rules : { } }, - created_at: { - type: 'datetime', - }, - updated_at: { - type: 'datetime', - } + }, + tree: { + owner: 'speech_balloon', + panel: 'speech_balloon', }, lists: { - public_list: { + public: { type: 'public', }, - private_list: { + private: { type: 'private', }, by_panel: { @@ -1040,33 +875,22 @@ type: 'filter', }, by_author: { - type: 'element_filter', + type: 'foreign_filter', }, }, }, 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', - primary_key: 1, - rules : { - number: true, - } - }, speech_balloon_id: { type: 'number', rules : { @@ -1164,15 +988,13 @@ rules : { } }, - created_at: { - type: 'datetime', - }, - updated_at: { - type: 'datetime', - } + }, + tree: { + owner: 'speech_balloon', + panel: 'speech_balloon', }, lists: { - public_list: { + public: { type: 'public', }, by_speech_balloon: { @@ -1184,25 +1006,15 @@ }, }, ground_picture: { - class_name: 'GroundPicture', - table_name: 'ground_pictures', associations: { belongs_to: { panel: { - id_column: 'panel_id' }, }, has_many: { }, }, attributes: { - id: { - type: 'number', - primary_key: 1, - rules : { - number: true, - } - }, panel_id: { type: 'number', rules : { @@ -1265,48 +1077,36 @@ min: 0, } }, - created_at: { - type: 'datetime', - }, - updated_at: { - type: 'datetime', - } + }, + tree: { + owner: 'panel', + panel: 'panel', }, lists: { - public_list: { + public: { type: 'public', }, - private_list: { + private: { type: 'private', }, by_panel: { type: 'filter', }, by_author: { - type: 'element_filter', + type: 'foreign_filter', }, }, }, ground_color: { - class_name: 'GroundColor', - table_name: 'ground_colors', associations: { belongs_to: { panel: { - id_column: 'panel_id' }, }, has_many: { }, }, attributes: { - id: { - type: 'number', - primary_key: 1, - rules : { - number: true, - } - }, panel_id: { type: 'number', rules : { @@ -1368,58 +1168,42 @@ min: 0, } }, - created_at: { - type: 'datetime', - }, - updated_at: { - type: 'datetime', - } + }, + tree: { + owner: 'panel', + panel: 'panel', }, lists: { - public_list: { + public: { type: 'public', }, - private_list: { + private: { type: 'private', }, by_panel: { type: 'filter', }, by_author: { - type: 'element_filter', + type: 'foreign_filter', }, }, }, 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', - model_name: 'picture', }, }, has_one: { resource_picture: { - foreign_key: 'original_picture_id', - model_name: 'resource_picture', }, }, }, attributes: { - id: { - type: 'number', - primary_key: 1, - rules : { - number: true, - } - }, ext: { type: 'text', rules : { @@ -1470,29 +1254,19 @@ stopped_at: { type: 'datetime', }, - created_at: { - type: 'datetime', - }, - updated_at: { - type: 'datetime', - } }, lists: { - private_list: { + private: { type: 'private', }, }, }, picture: { - class_name: 'Picture', - table_name: 'pictures', associations: { belongs_to: { license: { - id_column: 'license_id' }, artist: { - id_column: 'artist_id' }, }, has_many: { @@ -1501,13 +1275,6 @@ }, }, attributes: { - id: { - type: 'number', - primary_key: 1, - rules : { - number: true, - } - }, original_picture_id: { type: 'number', rules : { @@ -1591,27 +1358,16 @@ required: true, } }, - created_at: { - type: 'datetime', - }, - updated_at: { - type: 'datetime', - } } }, resource_picture: { - class_name: 'ResourcePicture', - table_name: 'resource_pictures', associations: { belongs_to: { original_picture: { - id_column: 'original_picture_id' }, license: { - id_column: 'license_id' }, artist: { - id_column: 'artist_id' }, }, has_many: { @@ -1620,13 +1376,6 @@ }, }, attributes: { - id: { - type: 'number', - primary_key: 1, - rules : { - number: true, - } - }, original_picture_id: { type: 'number', rules : { @@ -1717,20 +1466,17 @@ required: true, } }, - created_at: { - type: 'datetime', - }, - updated_at: { - type: 'datetime', - } }, lists: { - public_list: { + public: { type: 'public', }, - private_list: { + private: { type: 'private', }, + by_original_picture: { + type: 'filter', + }, by_license: { type: 'filter', }, @@ -1740,36 +1486,23 @@ }, }, speech_balloon_template: { - class_name: 'SpeechBalloonTemplate', - table_name: 'speech_balloon_templates', + extend_column_name: 'classname', associations: { belongs_to: { system_picture: { - id_column: 'system_picture_id' }, }, has_many: { speech_balloons: { - foreign_key: 'speech_balloon_template_id', - model_name: 'speech_balloon', }, panels: { through: 'speech_balloons', - foreign_key: 'speech_balloon_template_id', - model_name: 'panel', }, }, has_one: { }, }, attributes: { - id: { - type: 'number', - primary_key: 1, - rules : { - number: true, - } - }, name: { type: 'text', rules : { @@ -1809,15 +1542,9 @@ required: true, } }, - created_at: { - type: 'datetime', - }, - updated_at: { - type: 'datetime', - } }, lists: { - public_list: { + public: { type: 'public', }, select_items: { @@ -1829,31 +1556,20 @@ }, }, writing_format: { - class_name: 'WritingFormat', - table_name: 'writing_formats', + extend_column_name: 'classname', associations: { belongs_to: { system_picture: { - id_column: 'system_picture_id' }, }, has_many: { speeches: { - foreign_key: 'writing_format_id', - model_name: 'speech', }, }, has_one: { }, }, attributes: { - id: { - type: 'number', - primary_key: 1, - rules : { - number: true, - } - }, name: { type: 'text', rules : { @@ -1885,15 +1601,9 @@ required: true, } }, - created_at: { - type: 'datetime', - }, - updated_at: { - type: 'datetime', - } }, lists: { - public_list: { + public: { type: 'public', }, select_items: { @@ -1905,28 +1615,18 @@ }, }, license_group: { - class_name: 'LicenseGroup', - table_name: 'license_groups', + extend_column_name: 'classname', associations: { belongs_to: { }, has_many: { licenses: { - foreign_key: 'license_group_id', - model_name: 'license', }, }, has_one: { }, }, attributes: { - id: { - type: 'number', - primary_key: 1, - rules : { - number: true, - } - }, name: { type: 'text', rules : { @@ -1951,15 +1651,9 @@ required: true, } }, - created_at: { - type: 'datetime', - }, - updated_at: { - type: 'datetime', - } }, lists: { - public_list: { + public: { type: 'public', }, select_items: { @@ -1968,34 +1662,21 @@ }, }, 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', - model_name: 'resource_picture', }, }, has_one: { }, }, attributes: { - id: { - type: 'number', - primary_key: 1, - rules : { - number: true, - } - }, license_group_id: { type: 'number', rules : { @@ -2037,15 +1718,9 @@ rules : { } }, - created_at: { - type: 'datetime', - }, - updated_at: { - type: 'datetime', - } }, lists: { - public_list: { + public: { type: 'public', }, by_license_group: { @@ -2057,44 +1732,25 @@ }, }, author: { - class_name: 'Author', - table_name: 'authors', associations: { belongs_to: { }, has_many: { scrolls: { - foreign_key: 'author_id', - model_name: 'scroll', }, comics: { - foreign_key: 'author_id', - model_name: 'comic', }, stories: { - foreign_key: 'author_id', - model_name: 'story', }, sheets: { - foreign_key: 'author_id', - model_name: 'sheet', }, panels: { - foreign_key: 'author_id', - model_name: 'panel', }, }, has_one: { }, }, attributes: { - id: { - type: 'number', - primary_key: 1, - rules : { - number: true, - } - }, name: { type: 'text', rules : { @@ -2108,42 +1764,25 @@ number: true, } }, - created_at: { - type: 'datetime', - }, - updated_at: { - type: 'datetime', - } }, lists: { - public_list: { + public: { type: 'public', }, }, }, artist: { - class_name: 'Artist', - table_name: 'artists', associations: { belongs_to: { }, has_many: { resource_pictures: { - foreign_key: 'artist_id', - model_name: 'resource_picture', }, }, has_one: { }, }, attributes: { - id: { - type: 'number', - primary_key: 1, - rules : { - number: true, - } - }, name: { type: 'text', rules : { @@ -2157,50 +1796,29 @@ number: true, } }, - created_at: { - type: 'datetime', - }, - updated_at: { - type: 'datetime', - } }, lists: { - public_list: { + public: { type: 'public', }, }, }, system_picture: { - class_name: 'SystemPicture', - table_name: 'system_pictures', associations: { belongs_to: { }, has_many: { balloons: { - foreign_key: 'system_picture_id', - model_name: 'balloon', }, - balloon_templates: { - foreign_key: 'system_picture_id', - model_name: 'balloon_template', + speech_balloon_templates: { }, licenses: { - foreign_key: 'system_picture_id', - model_name: 'license', }, }, has_one: { }, }, attributes: { - id: { - type: 'number', - primary_key: 1, - rules : { - number: true, - } - }, ext: { type: 'text', rules : { @@ -2235,15 +1853,9 @@ required: true, } }, - created_at: { - type: 'datetime', - }, - updated_at: { - type: 'datetime', - } }, lists: { - public_list: { + public: { type: 'public', }, },