super()\r
@json\r
@json.actions ||= {}\r
- @json.item_name ||= @name\r
\r
init: () ->\r
super()\r
\r
set_default: () ->\r
super()\r
- @args.item_name ||= @parent.item_name # not parent.name. follow singularized name\r
@args.param_id ||= 'prefix'\r
\r
init: () ->\r
@pluralize: (name) ->\r
name.pluralize\r
\r
+ @singularize: (name) ->\r
+ @inflectors[name]\r
+ \r
@manifest: () ->\r
@mani\r
\r
\r
set_default: () ->\r
super()\r
- @values['model_name'] ||= Manifest.manifest().controllers[@name].item_name\r
@values['foreign_key'] ||= @parent.model_name + '_id'\r
\r
init: () ->\r
is_through: () ->\r
!@through\r
\r
+ model_name: () ->\r
+ @model_name || Manifest.manifest().singularize(@name)\r
+ \r
model: () ->\r
- Manifest.item_name_to_model @model_name\r
+ Manifest.item_name_to_model(@model_name())\r
\r
association_name: () ->\r
@parent.association_name\r
@set_model()\r
@my_list_model = Manifest.manifest().models[@my_action.item_name]\r
@my_list_model_class = @my_list_model.classify()\r
- @list = Locmare.ListGroup.list(@my_action.item_name, @my_action.list_name)\r
+ @list = Locmare.ListGroup.list(@my_action.item_name, @my_action.name)\r
\r
set_show: () ->\r
@set_model()\r
$ ->\r
manifest = {\r
+ inflectors: window.inflectors,\r
items: window.items,\r
controllers: window.controllers,\r
models: window.models,\r
#マニフェスト\r
@controllers = {\r
folders: {\r
- item_name: 'folder',\r
actions: {\r
root: {\r
type: 'show',\r
index: {\r
type: 'list',\r
args: {\r
- list_name: 'public',\r
param_id: 'none',\r
},\r
},\r
count: {\r
type: 'count',\r
args: {\r
- list_name: 'public',\r
+ action_name: 'index',\r
},\r
},\r
new: {\r
},\r
},\r
scrolls: {\r
- item_name: 'scroll',\r
actions: {\r
index: {\r
type: 'list',\r
args: {\r
- list_name: 'public',\r
param_id: 'none',\r
},\r
},\r
play: {\r
type: 'list',\r
args: {\r
- item_name: 'scroll_panel',\r
- list_name: 'by_scroll',\r
+ alias: 'scroll_panels.by_scroll',\r
order: 't',\r
- direction: 'asc'\r
+ direction: 1\r
},\r
},\r
show: {\r
count: {\r
type: 'count',\r
args: {\r
- list_name: 'public',\r
+ action_name: 'index',\r
},\r
},\r
count_by_author: {\r
},\r
},\r
scroll_panels: {\r
- item_name: 'scroll_panel',\r
actions: {\r
index: {\r
type: 'list',\r
args: {\r
- list_name: 'public',\r
param_id: 'none',\r
},\r
},\r
param_id: 'suffix',\r
},\r
},\r
- play: {\r
- type: 'list',\r
- args: {\r
- },\r
- },\r
show: {\r
type: 'show',\r
},\r
count: {\r
type: 'count',\r
args: {\r
- list_name: 'public',\r
+ action_name: 'index',\r
},\r
},\r
count_by_panel: {\r
count_by_author: {\r
type: 'count',\r
},\r
- count_play: {\r
- type: 'count',\r
- },\r
new: {\r
type: 'new',\r
},\r
},\r
},\r
comics: {\r
- item_name: 'comic',\r
actions: {\r
index: {\r
type: 'list',\r
args: {\r
- list_name: 'public',\r
param_id: 'none',\r
},\r
},\r
play: {\r
type: 'list',\r
args: {\r
- item_name: 'comic_story',\r
- list_name: 'play',\r
+ alias: 'comic_stories.by_comic',\r
+ order: 't',\r
+ direction: 1\r
},\r
},\r
show: {\r
count: {\r
type: 'count',\r
args: {\r
- list_name: 'public',\r
+ action_name: 'index',\r
},\r
},\r
count_by_story: {\r
},\r
},\r
comic_stories: {\r
- item_name: 'comic_story',\r
actions: {\r
index: {\r
type: 'list',\r
args: {\r
- list_name: 'public',\r
param_id: 'none',\r
},\r
},\r
count: {\r
type: 'count',\r
args: {\r
- list_name: 'public',\r
+ action_name: 'index',\r
},\r
},\r
count_by_comic: {\r
},\r
},\r
stories: {\r
- item_name: 'story',\r
actions: {\r
index: {\r
type: 'list',\r
args: {\r
- list_name: 'public',\r
param_id: 'none',\r
},\r
},\r
play: {\r
type: 'list',\r
args: {\r
- item_name: 'story_sheet',\r
- list_name: 'play',\r
+ alias: 'story_sheets.by_story',\r
+ order: 't',\r
+ direction: 1\r
},\r
},\r
show: {\r
count: {\r
type: 'count',\r
args: {\r
- list_name: 'public',\r
+ action_name: 'index',\r
},\r
},\r
count_by_comic: {\r
},\r
},\r
story_sheets: {\r
- item_name: 'story_sheet',\r
actions: {\r
index: {\r
type: 'list',\r
args: {\r
- list_name: 'public',\r
param_id: 'none',\r
},\r
},\r
count: {\r
type: 'count',\r
args: {\r
- list_name: 'public',\r
+ action_name: 'index',\r
},\r
},\r
count_by_story: {\r
},\r
},\r
sheets: {\r
- item_name: 'sheet',\r
actions: {\r
index: {\r
type: 'list',\r
args: {\r
- list_name: 'public',\r
param_id: 'none',\r
},\r
},\r
play: {\r
type: 'list',\r
args: {\r
- item_name: 'sheet_panel',\r
- list_name: 'play',\r
+ alias: 'sheet_panels.by_sheet',\r
+ order: 't',\r
+ direction: 1\r
},\r
},\r
show: {\r
count: {\r
type: 'count',\r
args: {\r
- list_name: 'public',\r
+ action_name: 'index',\r
},\r
},\r
count_by_story: {\r
},\r
},\r
sheet_panels: {\r
- item_name: 'sheet_panel',\r
actions: {\r
index: {\r
type: 'list',\r
args: {\r
- list_name: 'public',\r
param_id: 'none',\r
},\r
},\r
count: {\r
type: 'count',\r
args: {\r
- list_name: 'public',\r
+ action_name: 'index',\r
},\r
},\r
count_by_sheet: {\r
},\r
},\r
panels: {\r
- item_name: 'panel',\r
actions: {\r
index: {\r
type: 'list',\r
args: {\r
- list_name: 'public',\r
param_id: 'none',\r
},\r
},\r
count: {\r
type: 'count',\r
args: {\r
- list_name: 'public',\r
+ action_name: 'index',\r
},\r
},\r
count_by_scroll: {\r
},\r
},\r
panel_pictures: {\r
- item_name: 'panel_picture',\r
actions: {\r
index: {\r
type: 'list',\r
args: {\r
- list_name: 'public',\r
param_id: 'none',\r
},\r
},\r
count: {\r
type: 'count',\r
args: {\r
- list_name: 'public',\r
+ action_name: 'index',\r
},\r
},\r
count_by_panel: {\r
},\r
},\r
speech_balloons: {\r
- item_name: 'speech_balloon',\r
actions: {\r
index: {\r
type: 'list',\r
args: {\r
- list_name: 'public',\r
param_id: 'none',\r
},\r
},\r
count: {\r
type: 'count',\r
args: {\r
- list_name: 'public',\r
+ action_name: 'index',\r
},\r
},\r
count_by_panel: {\r
},\r
},\r
speeches: {\r
- item_name: 'speech',\r
actions: {\r
index: {\r
type: 'list',\r
args: {\r
- list_name: 'public',\r
param_id: 'none',\r
},\r
},\r
count: {\r
type: 'count',\r
args: {\r
- list_name: 'public',\r
+ action_name: 'index',\r
},\r
},\r
count_by_author: {\r
},\r
},\r
balloons: {\r
- item_name: 'balloon',\r
actions: {\r
index: {\r
type: 'list',\r
args: {\r
- list_name: 'public',\r
param_id: 'none',\r
},\r
},\r
count: {\r
type: 'count',\r
args: {\r
- list_name: 'public',\r
+ action_name: 'index',\r
},\r
},\r
count_by_author: {\r
},\r
},\r
ground_pictures: {\r
- item_name: 'ground_picture',\r
actions: {\r
index: {\r
type: 'list',\r
args: {\r
- list_name: 'public',\r
param_id: 'none',\r
},\r
},\r
count: {\r
type: 'count',\r
args: {\r
- list_name: 'public',\r
+ action_name: 'index',\r
},\r
},\r
count_by_panel: {\r
},\r
},\r
ground_colors: {\r
- item_name: 'ground_color',\r
actions: {\r
index: {\r
type: 'list',\r
args: {\r
- list_name: 'public',\r
param_id: 'none',\r
},\r
},\r
count: {\r
type: 'count',\r
args: {\r
- list_name: 'public',\r
+ action_name: 'index',\r
},\r
},\r
count_by_panel: {\r
},\r
},\r
original_pictures: {\r
- item_name: 'original_picture',\r
actions: {\r
index: {\r
type: 'list',\r
args: {\r
- list_name: 'private',\r
param_id: 'none',\r
},\r
},\r
count: {\r
type: 'count',\r
args: {\r
- list_name: 'private',\r
+ action_name: 'index',\r
},\r
},\r
new: {\r
},\r
},\r
pictures: {\r
- item_name: 'picture',\r
actions: {\r
index: {\r
type: 'list',\r
args: {\r
- list_name: 'public',\r
param_id: 'none',\r
},\r
},\r
count: {\r
type: 'count',\r
args: {\r
- list_name: 'public',\r
+ action_name: 'index',\r
},\r
},\r
count_by_artist: {\r
},\r
},\r
resource_pictures: {\r
- item_name: 'resource_picture',\r
actions: {\r
index: {\r
type: 'list',\r
args: {\r
- list_name: 'public',\r
param_id: 'none',\r
},\r
},\r
count: {\r
type: 'count',\r
args: {\r
- list_name: 'public',\r
+ action_name: 'index',\r
},\r
},\r
count_by_license_group: {\r
},\r
},\r
speech_balloon_templates: {\r
- item_name: 'speech_balloon_template',\r
actions: {\r
index: {\r
type: 'list',\r
args: {\r
- list_name: 'public',\r
param_id: 'none',\r
},\r
},\r
count: {\r
type: 'count',\r
args: {\r
- list_name: 'public',\r
+ action_name: 'index',\r
},\r
},\r
count_by_panel: {\r
},\r
},\r
writing_formats: {\r
- item_name: 'writing_format',\r
actions: {\r
index: {\r
type: 'list',\r
args: {\r
- list_name: 'public',\r
param_id: 'none',\r
},\r
},\r
count: {\r
type: 'count',\r
args: {\r
- list_name: 'public',\r
+ action_name: 'index',\r
},\r
},\r
count_by_system_picture: {\r
},\r
},\r
license_groups: {\r
- item_name: 'license_group',\r
actions: {\r
index: {\r
type: 'list',\r
args: {\r
- list_name: 'public',\r
param_id: 'none',\r
},\r
},\r
count: {\r
type: 'count',\r
args: {\r
- list_name: 'public',\r
+ action_name: 'index',\r
},\r
},\r
new: {\r
},\r
},\r
licenses: {\r
- item_name: 'license',\r
actions: {\r
index: {\r
type: 'list',\r
args: {\r
- list_name: 'public',\r
param_id: 'none',\r
},\r
},\r
count: {\r
type: 'count',\r
args: {\r
- list_name: 'public',\r
+ action_name: 'index',\r
},\r
},\r
count_by_license_group: {\r
},\r
},\r
authors: {\r
- item_name: 'author',\r
actions: {\r
index: {\r
type: 'list',\r
args: {\r
- list_name: 'public',\r
param_id: 'none',\r
},\r
},\r
count: {\r
type: 'count',\r
args: {\r
- list_name: 'public',\r
+ action_name: 'index',\r
},\r
},\r
new: {\r
},\r
},\r
artists: {\r
- item_name: 'artist',\r
actions: {\r
index: {\r
type: 'list',\r
args: {\r
- list_name: 'public',\r
param_id: 'none',\r
},\r
},\r
count: {\r
type: 'count',\r
args: {\r
- list_name: 'public',\r
+ action_name: 'index',\r
},\r
},\r
new: {\r
},\r
},\r
system_pictures: {\r
- item_name: 'system_picture',\r
actions: {\r
index: {\r
type: 'list',\r
args: {\r
- list_name: 'public',\r
param_id: 'none',\r
},\r
},\r
count: {\r
type: 'count',\r
args: {\r
- list_name: 'public',\r
+ action_name: 'index',\r
},\r
},\r
},\r
type: 'list',\r
args: {\r
item_name: 'scroll',\r
- list_name: 'private',\r
param_id: 'none',\r
counter_name: 'scrolls_count',\r
},\r
type: 'list',\r
args: {\r
item_name: 'scroll_panel',\r
- list_name: 'private',\r
param_id: 'none',\r
counter_name: 'scroll_panels_count',\r
},\r
type: 'list',\r
args: {\r
item_name: 'comic',\r
- list_name: 'private',\r
param_id: 'none',\r
counter_name: 'comics_count',\r
},\r
type: 'list',\r
args: {\r
item_name: 'comic_story',\r
- list_name: 'private',\r
param_id: 'none',\r
counter_name: 'comic_stories_count',\r
},\r
type: 'list',\r
args: {\r
item_name: 'story',\r
- list_name: 'private',\r
param_id: 'none',\r
counter_name: 'stories_count',\r
},\r
type: 'list',\r
args: {\r
item_name: 'story_sheet',\r
- list_name: 'private',\r
param_id: 'none',\r
counter_name: 'story_sheets_count',\r
},\r
type: 'list',\r
args: {\r
item_name: 'sheet',\r
- list_name: 'private',\r
param_id: 'none',\r
counter_name: 'sheets_count',\r
},\r
type: 'list',\r
args: {\r
item_name: 'sheet_panel',\r
- list_name: 'private',\r
param_id: 'none',\r
counter_name: 'sheet_panels_count',\r
},\r
type: 'list',\r
args: {\r
item_name: 'panel',\r
- list_name: 'private',\r
param_id: 'none',\r
counter_name: 'panels_count',\r
},\r
type: 'list',\r
args: {\r
item_name: 'panel_picture',\r
- list_name: 'private',\r
param_id: 'none',\r
counter_name: 'panel_pictures_count',\r
},\r
type: 'list',\r
args: {\r
item_name: 'speech_balloon',\r
- list_name: 'private',\r
param_id: 'none',\r
counter_name: 'speech_balloons_count',\r
},\r
type: 'list',\r
args: {\r
item_name: 'speech',\r
- list_name: 'private',\r
param_id: 'none',\r
counter_name: 'speeches_count',\r
},\r
type: 'list',\r
args: {\r
item_name: 'balloon',\r
- list_name: 'private',\r
param_id: 'none',\r
counter_name: 'balloons_count',\r
},\r
type: 'list',\r
args: {\r
item_name: 'ground_picture',\r
- list_name: 'private',\r
param_id: 'none',\r
counter_name: 'ground_pictures_count',\r
},\r
type: 'list',\r
args: {\r
item_name: 'ground_color',\r
- list_name: 'private',\r
param_id: 'none',\r
counter_name: 'ground_colors_count',\r
},\r
type: 'list',\r
args: {\r
item_name: 'original_picture',\r
- list_name: 'private',\r
param_id: 'none',\r
counter_name: 'count',\r
},\r
type: 'list',\r
args: {\r
item_name: 'resource_picture',\r
- list_name: 'private',\r
param_id: 'none',\r
counter_name: 'resource_pictures_count',\r
},\r
type: 'count',\r
args: {\r
item_name: 'scroll',\r
- list_name: 'private',\r
param_id: 'none',\r
},\r
},\r
type: 'count',\r
args: {\r
item_name: 'scroll_panel',\r
- list_name: 'private',\r
param_id: 'none',\r
},\r
},\r
type: 'count',\r
args: {\r
item_name: 'comic',\r
- list_name: 'private',\r
param_id: 'none',\r
},\r
},\r
type: 'count',\r
args: {\r
item_name: 'comic_story',\r
- list_name: 'private',\r
param_id: 'none',\r
},\r
},\r
--- /dev/null
+#マニフェスト\r
+@inflectors = {\r
+ folder: 'folders',\r
+ scroll: 'scrolls',\r
+ scroll_panel: 'scroll_panels',\r
+ comic: 'comics',\r
+ comic_story: 'comic_stories',\r
+ story: 'stories',\r
+ story_sheet: 'story_sheets',\r
+ sheet: 'sheets',\r
+ sheet_panel: 'sheet_panels',\r
+ panel: 'panels',\r
+ panel_picture: 'panel_pictures',\r
+ speech_balloon: 'speech_balloons',\r
+ speech: 'speeches',\r
+ balloon: 'balloons',\r
+ ground_picture: 'ground_pictures',\r
+ ground_color: 'ground_colors',\r
+ original_picture: 'original_pictures',\r
+ picture: 'pictures',\r
+ resource_picture: 'resource_pictures',\r
+ original_picture_license_group: 'original_picture_license_groups'\r
+ original_picture_license: 'original_picture_licenses'\r
+ speech_balloon_template: 'speech_balloon_templates',\r
+ writing_format: 'writing_formats',\r
+ license_group: 'license_groups',\r
+ license: 'licenses',\r
+ author: 'authors',\r
+ artist: 'artists',\r
+ system_picture: 'system_pictures',\r
+ home: 'home',\r
+}\r
scroll_panel: {\r
type: 'leaf',\r
args: {\r
- parent_model_name: 'scroll',\r
- destination_model_name: 'panel',\r
+ parent_item_name: 'scroll',\r
+ destination_item_name: 'panel',\r
},\r
},\r
comic: {\r
comic_story: {\r
type: 'leaf',\r
args: {\r
- parent_model_name: 'comic',\r
- destination_model_name: 'story',\r
+ parent_item_name: 'comic',\r
+ destination_item_name: 'story',\r
},\r
},\r
story: {\r
story_sheet: {\r
type: 'leaf',\r
args: {\r
- parent_model_name: 'story',\r
- destination_model_name: 'sheet',\r
+ parent_item_name: 'story',\r
+ destination_item_name: 'sheet',\r
},\r
},\r
sheet: {\r
sheet_panel: {\r
type: 'element',\r
args: {\r
- parent_model_name: 'sheet',\r
+ parent_item_name: 'sheet',\r
},\r
},\r
panel: {\r
panel_picture: {\r
type: 'element',\r
args: {\r
- parent_model_name: 'panel',\r
+ parent_item_name: 'panel',\r
},\r
},\r
speech_balloon: {\r
type: 'element',\r
args: {\r
- parent_model_name: 'panel',\r
+ parent_item_name: 'panel',\r
boost: {\r
speech_balloon_template: {\r
extend_model_class_name: 'SpeechBalloon',\r
balloon: {\r
type: 'element',\r
args: {\r
- parent_model_name: 'speech_balloon',\r
+ parent_item_name: 'speech_balloon',\r
boost: {\r
speech_balloon_template: {\r
extend_model_class_name: 'Balloon',\r
speech: {\r
type: 'element',\r
args: {\r
- parent_model_name: 'speech_balloon',\r
+ parent_item_name: 'speech_balloon',\r
boost: {\r
writing_format: {\r
level: 'read',\r
ground_picture: {\r
type: 'element',\r
args: {\r
- parent_model_name: 'panel',\r
+ parent_item_name: 'panel',\r
},\r
},\r
ground_color: {\r
type: 'element',\r
args: {\r
- parent_model_name: 'panel',\r
+ parent_item_name: 'panel',\r
},\r
},\r
original_picture: {\r
license: {\r
type: 'system_resource',\r
args: {\r
- parent_model_name: 'license_group',\r
+ parent_item_name: 'license_group',\r
boost: {\r
license_group: {\r
extend_model_class_name: 'License',\r
#マニフェスト\r
@list_groups = {\r
- folder: {\r
+ folders: {\r
lists: {\r
- public: {\r
+ index: {\r
type: 'public',\r
},\r
},\r
},\r
- scroll: {\r
+ scrolls: {\r
lists: {\r
- public: {\r
+ index: {\r
type: 'public',\r
},\r
- private: {\r
- type: 'private',\r
- },\r
by_author: {\r
type: 'filter',\r
},\r
through: 'scroll_panels',\r
},\r
},\r
+ play: {\r
+ type: 'play',\r
+ },\r
},\r
},\r
- scroll_panel: {\r
+ scroll_panels: {\r
lists: {\r
- public: {\r
+ index: {\r
type: 'public',\r
},\r
- private: {\r
- type: 'private',\r
- },\r
- play: {\r
- type: 'play',\r
- args: {\r
- filter_item_name: 'scroll',\r
- filter_model_name: 'scroll_panel',\r
- filter_key: 'scroll_id',\r
- order: {\r
- type: 'method',\r
- }\r
- },\r
- },\r
by_scroll: {\r
type: 'filter',\r
},\r
},\r
},\r
},\r
- comic: {\r
+ comics: {\r
lists: {\r
- public: {\r
+ index: {\r
type: 'public',\r
},\r
- private: {\r
- type: 'private',\r
- },\r
by_author: {\r
type: 'filter',\r
},\r
through: 'comic_stories',\r
},\r
},\r
+ play: {\r
+ type: 'play',\r
+ },\r
},\r
},\r
- comic_story: {\r
+ comic_stories: {\r
lists: {\r
- public: {\r
+ index: {\r
type: 'public',\r
},\r
- private: {\r
- type: 'private',\r
- },\r
- play: {\r
- type: 'play',\r
- args: {\r
- filter_item_name: 'comic',\r
- filter_model_name: 'comic_story',\r
- filter_key: 'comic_id',\r
- order: {\r
- type: 'method',\r
- }\r
- },\r
- },\r
by_comic: {\r
type: 'filter',\r
},\r
},\r
},\r
},\r
- story: {\r
+ stories: {\r
lists: {\r
- public: {\r
+ index: {\r
type: 'public',\r
},\r
- private: {\r
- type: 'private',\r
- },\r
by_comic: {\r
type: 'through_filter',\r
args: {\r
by_author: {\r
type: 'filter',\r
},\r
+ play: {\r
+ type: 'play',\r
+ },\r
},\r
},\r
- story_sheet: {\r
+ story_sheets: {\r
lists: {\r
- public: {\r
+ index: {\r
type: 'public',\r
},\r
- private: {\r
- type: 'private',\r
- },\r
- play: {\r
- type: 'play',\r
- args: {\r
- filter_item_name: 'story',\r
- filter_model_name: 'story_sheet',\r
- filter_key: 'story_id',\r
- order: {\r
- type: 'method',\r
- }\r
- },\r
- },\r
by_story: {\r
type: 'filter',\r
},\r
},\r
},\r
},\r
- sheet: {\r
+ sheets: {\r
lists: {\r
- public: {\r
+ index: {\r
type: 'public',\r
},\r
- private: {\r
- type: 'private',\r
- },\r
by_story: {\r
type: 'through_filter',\r
args: {\r
by_author: {\r
type: 'filter',\r
},\r
+ play: {\r
+ type: 'play',\r
+ },\r
},\r
},\r
- sheet_panel: {\r
+ sheet_panels: {\r
lists: {\r
- public: {\r
+ index: {\r
type: 'public',\r
},\r
- private: {\r
- type: 'private',\r
- },\r
- play: {\r
- type: 'play',\r
- args: {\r
- filter_item_name: 'sheet',\r
- filter_model_name: 'sheet_panel',\r
- filter_key: 'sheet_id',\r
- },\r
- },\r
by_sheet: {\r
type: 'filter',\r
},\r
},\r
},\r
},\r
- panel: {\r
+ panels: {\r
lists: {\r
- public: {\r
+ index: {\r
type: 'public',\r
},\r
- private: {\r
- type: 'private',\r
- },\r
by_scroll: {\r
type: 'through_filter',\r
args: {\r
},\r
},\r
},\r
- panel_picture: {\r
+ panel_pictures: {\r
lists: {\r
- public: {\r
+ index: {\r
type: 'public',\r
},\r
- private: {\r
- type: 'private',\r
- },\r
by_panel: {\r
type: 'filter',\r
},\r
},\r
},\r
},\r
- speech_balloon: {\r
+ speech_balloons: {\r
lists: {\r
- public: {\r
+ index: {\r
type: 'public',\r
},\r
- private: {\r
- type: 'private',\r
- },\r
by_panel: {\r
type: 'filter',\r
},\r
},\r
},\r
},\r
- speech: {\r
+ speeches: {\r
lists: {\r
- public: {\r
+ index: {\r
type: 'public',\r
},\r
- private: {\r
- type: 'private',\r
- },\r
by_panel: {\r
type: 'filter',\r
},\r
},\r
},\r
},\r
- balloon: {\r
+ balloons: {\r
lists: {\r
- public: {\r
+ index: {\r
type: 'public',\r
},\r
- private: {\r
- type: 'private',\r
- },\r
by_speech_balloon: {\r
type: 'filter',\r
},\r
},\r
},\r
},\r
- ground_picture: {\r
+ ground_pictures: {\r
lists: {\r
- public: {\r
+ index: {\r
type: 'public',\r
},\r
- private: {\r
- type: 'private',\r
- },\r
by_panel: {\r
type: 'filter',\r
},\r
},\r
},\r
},\r
- ground_color: {\r
+ ground_colors: {\r
lists: {\r
- public: {\r
+ index: {\r
type: 'public',\r
},\r
- private: {\r
- type: 'private',\r
- },\r
by_panel: {\r
type: 'filter',\r
},\r
},\r
},\r
},\r
- original_picture: {\r
+ original_pictures: {\r
lists: {\r
- private: {\r
+ index: {\r
type: 'private',\r
},\r
},\r
},\r
- picture: {\r
+ pictures: {\r
lists: {\r
- public: {\r
+ index: {\r
type: 'public',\r
},\r
by_artist: {\r
},\r
},\r
},\r
- resource_picture: {\r
+ resource_pictures: {\r
lists: {\r
- public: {\r
+ index: {\r
type: 'public',\r
},\r
- private: {\r
- type: 'private',\r
- },\r
by_original_picture: {\r
type: 'filter',\r
},\r
},\r
},\r
},\r
- speech_balloon_template: {\r
+ speech_balloon_templates: {\r
lists: {\r
- public: {\r
+ index: {\r
type: 'public',\r
},\r
by_panel: {\r
},\r
},\r
},\r
- writing_format: {\r
+ writing_formats: {\r
lists: {\r
- public: {\r
+ index: {\r
type: 'public',\r
},\r
select_items: {\r
},\r
},\r
},\r
- license_group: {\r
+ license_groups: {\r
lists: {\r
- public: {\r
+ index: {\r
type: 'public',\r
},\r
by_resource_picture: {\r
},\r
},\r
},\r
- license: {\r
+ licenses: {\r
lists: {\r
- public: {\r
+ index: {\r
type: 'public',\r
},\r
by_license_group: {\r
},\r
},\r
},\r
- author: {\r
+ authors: {\r
lists: {\r
- public: {\r
+ index: {\r
type: 'public',\r
},\r
},\r
},\r
- artist: {\r
+ artists: {\r
lists: {\r
- public: {\r
+ index: {\r
type: 'public',\r
},\r
},\r
},\r
- system_picture: {\r
+ system_pictures: {\r
lists: {\r
- public: {\r
+ index: {\r
type: 'public',\r
},\r
},\r
},\r
+ home: {\r
+ lists: {\r
+ scrolls: {\r
+ type: 'private',\r
+ },\r
+ scroll_panels: {\r
+ type: 'private',\r
+ },\r
+ comics: {\r
+ type: 'private',\r
+ },\r
+ comic_stories: {\r
+ type: 'private',\r
+ },\r
+ stories: {\r
+ type: 'private',\r
+ },\r
+ story_sheets: {\r
+ type: 'private',\r
+ },\r
+ sheets: {\r
+ type: 'private',\r
+ },\r
+ sheet_panels: {\r
+ type: 'private',\r
+ },\r
+ panels: {\r
+ type: 'private',\r
+ },\r
+ panel_pictures: {\r
+ type: 'private',\r
+ },\r
+ speech_balloons: {\r
+ type: 'private',\r
+ },\r
+ speeches: {\r
+ type: 'private',\r
+ },\r
+ balloons: {\r
+ type: 'private',\r
+ },\r
+ ground_pictures: {\r
+ type: 'private',\r
+ },\r
+ ground_colors: {\r
+ type: 'private',\r
+ },\r
+ original_pictures: {\r
+ type: 'private',\r
+ },\r
+ resource_pictures: {\r
+ type: 'private',\r
+ },\r
+ },\r
+ },\r
}\r
#マニフェスト\r
@models = {\r
folder: {\r
- table_name: 'folders',\r
associations: {\r
belongs_to: {\r
},\r
},\r
},\r
scroll: {\r
- table_name: 'scrolls',\r
associations: {\r
belongs_to: {\r
author: {\r
},\r
},\r
scroll_panel: {\r
- table_name: 'scroll_panels',\r
associations: {\r
belongs_to: {\r
panel: {\r
},\r
},\r
comic: {\r
- table_name: 'comics',\r
associations: {\r
belongs_to: {\r
author: {\r
},\r
},\r
comic_story: {\r
- table_name: 'comic_stories',\r
associations: {\r
belongs_to: {\r
comic: {\r
},\r
},\r
story: {\r
- table_name: 'stories',\r
associations: {\r
belongs_to: {\r
author: {\r
},\r
},\r
story_sheet: {\r
- table_name: 'story_sheets',\r
associations: {\r
belongs_to: {\r
story: {\r
},\r
},\r
sheet: {\r
- table_name: 'sheets',\r
associations: {\r
belongs_to: {\r
author: {\r
},\r
},\r
sheet_panel: {\r
- table_name: 'sheet_panels',\r
associations: {\r
belongs_to: {\r
sheet: {\r
},\r
},\r
panel: {\r
- table_name: 'panels',\r
associations: {\r
belongs_to: {\r
author: {\r
},\r
},\r
panel_picture: {\r
- table_name: 'panel_pictures',\r
associations: {\r
belongs_to: {\r
panel: {\r
},\r
},\r
speech_balloon: {\r
- table_name: 'speech_balloons',\r
associations: {\r
belongs_to: {\r
panel: {\r
},\r
}, \r
balloon: {\r
- table_name: 'balloons',\r
associations: {\r
belongs_to: {\r
speech_balloon: {\r
},\r
},\r
speech: {\r
- table_name: 'speeches',\r
associations: {\r
belongs_to: {\r
speech_balloon: {\r
},\r
},\r
ground_picture: {\r
- table_name: 'ground_pictures',\r
associations: {\r
belongs_to: {\r
panel: {\r
},\r
},\r
ground_color: {\r
- table_name: 'ground_colors',\r
associations: {\r
belongs_to: {\r
panel: {\r
},\r
},\r
original_picture: {\r
- table_name: 'original_pictures',\r
associations: {\r
belongs_to: {\r
artist: {\r
},\r
},\r
picture: {\r
- table_name: 'pictures',\r
associations: {\r
belongs_to: {\r
license: {\r
}\r
},\r
resource_picture: {\r
- table_name: 'resource_pictures',\r
associations: {\r
belongs_to: {\r
original_picture: {\r
},\r
},\r
original_picture_license_group: {\r
- table_name: 'original_picture_license_groups',\r
associations: {\r
belongs_to: {\r
original_picture: {\r
},\r
},\r
original_picture_license: {\r
- table_name: 'original_picture_licenses',\r
associations: {\r
belongs_to: {\r
original_picture: {\r
source: {\r
type: 'filter',\r
args: {\r
- resource_list_name: 'by_license_group',\r
+ resource_action_name: 'by_license_group',\r
filter_column_name: 'license_group_id',\r
},\r
},\r
},\r
},\r
speech_balloon_template: {\r
- table_name: 'speech_balloon_templates',\r
associations: {\r
belongs_to: {\r
system_picture: {\r
},\r
},\r
writing_format: {\r
- table_name: 'writing_formats',\r
associations: {\r
belongs_to: {\r
system_picture: {\r
},\r
},\r
license_group: {\r
- table_name: 'license_groups',\r
associations: {\r
belongs_to: {\r
},\r
},\r
},\r
license: {\r
- table_name: 'licenses',\r
associations: {\r
belongs_to: {\r
license_group: {\r
},\r
},\r
author: {\r
- table_name: 'authors',\r
associations: {\r
belongs_to: {\r
},\r
},\r
},\r
artist: {\r
- table_name: 'artists',\r
associations: {\r
belongs_to: {\r
},\r
},\r
},\r
system_picture: {\r
- table_name: 'system_pictures',\r
associations: {\r
belongs_to: {\r
},\r
'speech_balloon_template',\r
],\r
has_one: [\r
- 'balloon.by_speech_balloon',\r
- 'speech.by_speech_balloon',\r
+ 'balloons.by_speech_balloon',\r
+ 'speeches.by_speech_balloon',\r
],\r
}, \r
},\r
'artist',\r
],\r
has_one: [\r
- 'resource_picture.by_original_picture',\r
],\r
}, \r
},\r
set_model
@my_list_model = Manifest.manifest.models[@my_action.item_name]
@my_list_model_class = @my_list_model.classify
- @list = Locmare::ListGroup.list @my_action.item_name, @my_action.list_name
+ @list = Locmare::ListGroup.list @my_controller.name, @my_action.name, @operators, params
end
def filer_list
set_list
- list_result = @list.open(@operators,
- {:id => params[:id], :page => params[:page], :page_size => params[:page_size]}
- )
+ list_result = @list.open(@operators)
@items = list_result.items
respond_to do |format|
format.html {
def set_play
set_list
@binder_controller = Manifest.manifest.controllers[params[:controller].to_s]
- @binder_model = Manifest.manifest.models[@binder_controller.item_name]
+ @binder_action = @my_controller.actions[params[:action].to_s]
+ @binder_model = Manifest.manifest.models[@binder_action.item_name]
@binder_model_class = @binder_model.classify
@item = @binder_model_class.show(params[:id], @operators)
end
def play_list
- @options = {:id => params[:id], :my_play => @item.own?(@operators),
- :offset => params[:offset], :count => params[:count],
- :page => params[:page], :page_size => params[:page_size]
- }
- list_result = @list.open(@operators, @options)
+ @options = params
+ @options[:my_play] = @item.own?(@operators)
+ list_result = @list.open(@operators)
@items = list_result.items
@count = list_result.count
@pager = list_result.paginate
def list_count
set_list
- j = {:count => @list.count(@operators, {:id => params[:id]})}
+ j = {:count => @list.count(@operators)}
respond_to do |format|
format.json { render json: j.to_json }
end
}
end
- def assist_items item_name, list_name
- list = Locmare::ListGroup.list item_name, list_name
- list_result = list.open(@operators, {:id => @item.id, :page => 1, :page_size => 5})
+ def assist_items controller_name, list_name
+ list = Locmare::ListGroup.list controller_name, list_name, @operators, {:id => @item.id, :page => 1, :page_size => 5}
+ list_result = list.open(@operators)
list_result.items
end
before_filter :authenticate_user, :only => [:new, :create, :edit, :update, :destroy]
before_filter :authenticate_artist, :only => [:edit, :update, :destroy]
end
-
- def self.model
- Artist
- end
def index
filer_list
before_filter :authenticate_author, :only => [:edit, :update]
end
- def self.model
- Author
- end
-
def index
filer_list
end
before_filter :authenticate_author, :only => [:new, :edit, :create, :update, :destroy]
end
- def self.model
- Balloon
- end
-
def index
filer_list
end
before_filter :authenticate_user, :only => [:new, :create, :edit, :update, :destroy]
before_filter :authenticate_author, :only => [:new, :create, :edit, :update, :destroy]
end
-
- def self.model
- ComicStory
- end
def index
filer_list
before_filter :authenticate_user, :only => [:new, :create, :edit, :update, :destroy]
before_filter :authenticate_author, :only => [:new, :create, :edit, :update, :destroy]
end
-
- def self.model
- Comic
- end
def index
filer_list
def show_html_format format
format.html {
- play_list = Locmare::ListGroup.list 'comic_story', 'play'
- @play_count = play_list.count(@operators,
+ play_list = Locmare::ListGroup.list(
+ 'comic_stories', 'by_comic', @operators,
{:id => @item.id, :my_play => @item.own?(@operators)}
)
+ @play_count = play_list.count(@operators)
}
end
end
def play
- @item = self.class.model.show(params[:id], @operators)
set_play
- @items = @list.items(@operators,
- {:id => params[:id], :my_play => @item.own?(@operators)},
- 0, -1 # no limit
+ @list = Locmare::ListGroup.list(
+ @my_controller.name,
+ @my_action.name, @operators,
+ {:id => @item.id, :offset => 0, :limit => -1}# no limit
)
- @count = @items.count
+ @items = @list.items(@operators)
+ @count = @list.count @operators
# no pager
respond_to do |format|
format.html {
if @item.own? @operators
- @new_story_items = assist_items('story', 'private')
+ @new_story_items = assist_items('home', 'stories')
end
}
format.json { render json: @items.to_json }
before_filter :authenticate_admin, :only => [:new, :create, :edit, :update, :destroy]
end
- def self.model
- Folder
- end
-
def root
set_model
@item = Folder.root
def children_html_format format
format.html {
- @filer = Locmare::Filer.new self.class.model.item_name, @item.children, nil, :none, @operators
+ @filer = Locmare::Filer.new Folder.item_name, @item.children, nil, :none, @operators
render :action => :show
}
end
before_filter :authenticate_user, :only => []
before_filter :authenticate_author, :only => []
end
-
- def self.model
- GroundColor
- end
def index
filer_list
before_filter :authenticate_author, :only => []
end
- def self.model
- GroundPicture
- end
-
def index
filer_list
end
class LicenseGroupsController < ApplicationController
before_filter :authenticate_admin, :only => [:new, :create, :edit, :update, :destroy]
- def self.model
- LicenseGroup
- end
-
def index
filer_list
end
:by_license_group, :by_system_picture, :count_by_license_group, :count_by_system_picture
]
before_filter :authenticate_admin, :only => [:new, :create, :edit, :update, :destroy]
-
- def self.model
- License
- end
def index
filer_list
before_filter :authenticate_user, :only => [:index, :new, :edit, :create, :update, :destroy]
before_filter :authenticate_artist, :only => [:index, :new, :edit, :create, :update, :destroy]
- def self.model
- OriginalPicture
- end
-
def index
filer_list
end
before_filter :authenticate_author, :only => []
end
- def self.model
- PanelPicture
- end
-
def index
filer_list
end
before_filter :authenticate_author, :only => [:new, :edit, :create, :update, :destroy, :catch]
end
- def self.model
- Panel
- end
private
def panel_list
set_list
- list_result = @list.open(@operators,
- {:id => params[:id], :page => params[:page], :page_size => params[:page_size]}
- )
+ list_result = @list.open(@operators)
@items = list_result.items
@pager = list_result.paginate
respond_to do |format|
def show_html_format format
format.html {
if @operators.author
- @new_scroll_items = assist_items('scroll', 'private')
- @fresh_scroll_items = assist_items('scroll_panel', 'private').map {|sp| sp.scroll}
+ @new_scroll_items = assist_items('home', 'scrolls')
+ @fresh_scroll_items = assist_items('home', 'scroll_panels').map {|sp| sp.scroll}
end
}
end
def update
@item = Panel.edit(params[:id], @operators)
- @item.boost
+ @item.boosts 'post'
jsn = nil
if params[:json]
jsn = JSON.parse(params[:json])
end
before_filter :authenticate_admin, :only => [:index, :by_artist, :count, :count_by_artist]
- def self.model
- Picture
- end
-
def index
filer_list
end
before_filter :authenticate_user, :only => [:new, :create, :update, :destroy]
before_filter :authenticate_artist, :only => [:new, :create, :update, :destroy]
end
-
- def self.model
- ResourcePicture
- end
def index
filer_list
before_filter :authenticate_user, :only => [:new, :create, :edit, :update, :destroy]
before_filter :authenticate_author, :only => [:new, :create, :edit, :update, :destroy]
end
-
- def self.model
- ScrollPanel
- end
def index
filer_list
before_filter :authenticate_author, :only => [:new, :create, :edit, :update, :destroy]
end
- def self.model
- Scroll
- end
-
def index
filer_list
end
def show_html_format format
format.html {
- play_list = Locmare::ListGroup.list 'scroll_panel', 'play'
- @play_count = play_list.count(@operators,
+ play_list = Locmare::ListGroup.list(
+ 'scroll_panels', 'by_scroll', @operators,
{:id => @item.id, :my_play => @item.own?(@operators)}
)
+ @play_count = play_list.count(@operators)
}
end
respond_to do |format|
format.html {
if @item.own? @operators
- @fresh_panel_items = assist_items('panel', 'public')
- @new_panel_items = assist_items('panel', 'private')
+ @fresh_panel_items = assist_items('panels', 'index')
+ @new_panel_items = assist_items('home', 'panels')
end
}
format.json { render json: @items.to_json }
before_filter :authenticate_user, :only => [:new, :create, :edit, :update, :destroy]
before_filter :authenticate_author, :only => [:new, :create, :edit, :update, :destroy]
end
-
- def self.model
- SheetPanel
- end
def index
filer_list
before_filter :authenticate_user, :only => [:new, :create, :edit, :update, :destroy]
before_filter :authenticate_author, :only => [:new, :create, :edit, :update, :destroy]
end
-
- def self.model
- Sheet
- end
def index
filer_list
def show_html_format format
format.html {
if @operators.author
- @new_panel_items = assist_items('panel', 'private')
+ @new_panel_items = assist_items('home', 'panels')
- @new_story_items = assist_items('story', 'private')
- @fresh_story_items = assist_items('story_sheet', 'private').map {|ss| ss.story}
+ @new_story_items = assist_items('home', 'stories')
+ @fresh_story_items = assist_items('home', 'story_sheets').map {|ss| ss.story}
end
}
end
def play
@item = self.class.model.show(params[:id], @operators)
set_play
- list_result = @list.open(@operators,
- {:id => params[:id]}
- )
+ list_result = @list.open(@operators, params[:id])
@items = list_result.items
respond_to do |format|
format.html {
before_filter :authenticate_user, :only => []
end
before_filter :authenticate_admin, :only => [:new, :create, :edit, :update, :destroy]
-
- def self.model
- SpeechBalloonTemplate
- end
def index
filer_list
before_filter :authenticate_author, :only => []
end
- def self.model
- SpeechBalloon
- end
-
def index
filer_list
end
before_filter :authenticate_author, :only => [:new, :edit, :create, :update, :destroy]
end
before_filter :authenticate_admin!, :only => []
-
- def self.model
- Speech
- end
def index
filer_list
before_filter :authenticate_user, :only => [:new, :create, :edit, :update, :destroy]
before_filter :authenticate_author, :only => [:new, :create, :edit, :update, :destroy]
end
-
- def self.model
- Story
- end
def index
filer_list
def show_html_format format
format.html {
- play_list = Locmare::ListGroup.list 'story_sheet', 'play'
- @play_count = play_list.count(@operators,
+ play_list = Locmare::ListGroup.list(
+ 'story_sheets', 'by_story', @operators,
{:id => @item.id, :my_play => @item.own?(@operators)}
)
+ @play_count = play_list.count(@operators)
}
end
params[:count] = nil
params[:page] ||= 1
params[:page_size] = 1
- @item = self.class.model.show(params[:id], @operators)
set_play
- play_list
- @sort_items = @list.items(@operators,
- {:id => params[:id], :my_play => @item.own?(@operators)},
- 0, -1 # no limit
+ @list = Locmare::ListGroup.list(
+ @my_controller.name,
+ @my_action.name, @operators,
+ {:id => @item.id, :offset => 0, :limit => -1}# no limit
)
+ @items = @list.items(@operators)
+ @count = @list.count @operators
respond_to do |format|
format.html {
if @item.own? @operators
- @new_sheet_items = assist_items('sheet', 'private')
+ @new_sheet_items = assist_items('home', 'sheets')
end
}
format.json { render json: @items.to_json }
before_filter :authenticate_user, :only => [:new, :create, :edit, :update, :destroy]
before_filter :authenticate_author, :only => [:new, :create, :edit, :update, :destroy]
end
-
- def self.model
- StorySheet
- end
def index
filer_list
end
before_filter :authenticate_admin!, :only => []
- def self.model
- SystemPicture
- end
-
def index
filer_list
end
end
before_filter :authenticate_admin, :only => [:new, :create, :edit, :update, :destroy]
- def self.model
- WritingFormat
- end
-
def index
filer_list
end
self.enable_list
end
- def self.enable_list
- WritingFormat.find(:all).delete_if {|wf|
- wf.enable? == false
- }
+ def self.enable_list include_available = false
+ r = WritingFormat.find(:all)
+ unless include_available
+ r.delete_if {|wf|
+ wf.enable? == false
+ }
+ end
+ r
end
def self.show_opt
<h3 id="editor"><%= t('editor') -%></h3>
<p id="notice"><%= notice %></p>
- <% @sort_items.each do |story_sheet| %>
+ <% @items.each do |story_sheet| %>
<% if story_sheet.sheet -%>
<div>
<% @items.each do |ss| %>
+++ /dev/null
-<div>
- <%= filer.model.model_name.human %>
-</div>
-<ul class="filer">
- <li id="" class="filer-head filer-head-<%= filer.model_name -%>">
- <div id="" class="filer-head-symbol">
- symbol
- </div>
- <% if filer.caption.visible? %>
- <div id="" class="filer-head-caption">
- caption
- </div>
- <% end %>
- <% if filer.summary.visible? %>
- <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>
- <% if filer.edit.visible? %>
- <div id="" class="filer-head-edit">
- edit
- </div>
- <% end %>
- </li>
- <% filer.file_items.each do |file_item| %>
- <li id="" class="filer-item filer-item-<%= filer.model_name -%>">
- <div id="" class="filer-item-symbol">
- <%= file_item.symbol self %>
- </div>
- <% if filer.caption.visible? %>
- <div id="" class="filer-item-caption">
- <%= file_item.caption self %>
- </div>
- <% end %>
- <% if filer.summary.visible? %>
- <div id="" class="filer-item-summary">
- <%= file_item.summary self %>
- </div>
- <% end %>
- <div id="" class="filer-item-icon">
- <%= file_item.icon self %>
- </div>
- <div id="" class="filer-item-date">
- <%= file_item.date self %>
- </div>
- <% if filer.edit.visible? %>
- <div id="" class="filer-item-edit">
- <%= file_item.edit self %>
- </div>
- <% end %>
- </li>
- <% end %>
-</ul>
-<div class="row_break">
-</div>
-<% if filer.paginate %>
- <%= paginate(filer.paginate) %>
-<% end %>
+++ /dev/null
-<script type="text/template" id="jfiler_template">
-<div>
- <&= filer.header &>
-</div>
-<ul class="filer">
- <li id="" class="filer-head filer-head-<&= filer.model_name() &>">
- <div id="" class="filer-head-symbol">
- symbol
- </div>
- <& if (filer.caption.visible()) { &>
- <div id="" class="filer-head-caption">
- caption
- </div>
- <& } &>
- <& if (filer.summary.visible()) { &>
- <div id="" class="filer-head-summary">
- summary
- </div>
- <& } &>
- <div id="" class="filer-head-icon">
- icon
- </div>
- <div id="" class="filer-head-date">
- date
- </div>
- <& if (filer.edit.visible()) { &>
- <div id="" class="filer-head-edit">
- edit
- </div>
- <& } &>
- </li>
- <& _.each(filer.file_items, function(file_item) { &>
- <li id="" class="filer-item filer-item-<&= filer.model_name() &>">
- <div id="" class="filer-item-symbol">
- <&= file_item.symbol() &>
- </div>
- <& if (filer.caption.visible()) { &>
- <div id="" class="filer-item-caption">
- <&= file_item.caption() &>
- </div>
- <& } &>
- <& if (filer.summary.visible()) { &>
- <div id="" class="filer-item-summary">
- <&= file_item.summary() &>
- </div>
- <& } &>
- <div id="" class="filer-item-icon">
- <&= file_item.icon() &>
- </div>
- <div id="" class="filer-item-date">
- <&= file_item.date() &>
- </div>
- <& if (filer.edit.visible()) { &>
- <div id="" class="filer-item-edit">
- <&= file_item.edit() &>
- </div>
- <& } &>
- </li>
- <& }); &>
-</ul>
-<div class="row_break">
-</div>
-<& if (filer.paginate()) { &>
- <&= filer.paginate &>
-<& } &>
-</script>
+++ /dev/null
-<%= render 'system/filer', {:filer => filer} %>
-<%= link_to tag(:img, :src => item_column.icon_file_name, :width => item_column.icon_size, :height => item_column.icon_size), polymorphic_path(item_column.item, :format => :prof) %>
+<%= link_to tag(:img, :src => item_column.icon_file_name, :width => item_column.icon_size, :height => item_column.icon_size), item_column.url %>
-<span class="r-wrap" style="display: none;" <%= raw helper.field.element.tag_attr -%>>
+<span class="r-wrap" style="display: none;" <%= raw helper.field.item.tag_attr -%>>
<button class="r-down" value="0"><</button>
<button class="r-up" value="0">></button>
<button class="r-reset" value="0">reset</button>
<%= select_tag tag.form_field_name,
- options_for_select(tag.source_by_model? ? tag.items : t_select_items(tag.items), :selected => tag.value.to_s),
+ options_for_select(tag.source_by_filter? ? tag.items : t_select_items(tag.items), :selected => tag.value.to_s),
tag.options
%>
@action_name = @args['action_name']
end
- def action_path
- a = @action_name == 'show' ? '' : @action_name + '/'
- '/' + self.filer.item_class.path_name + '/' + a
- end
-
end
class NoneLink < BaseLink
@action_name = @args['action_name']
end
- def action_path
- a = @action_name == 'show' ? '' : @action_name + '/'
- '/' + self.filer.item_class.path_name + '/' + a
- end
-
end
class NoneLink < BaseLink
@name
end
- def model_name
+ def item_name
form_name
end
end
- class ElementField < Field
- end
-
- class PartField < Field
- attr :part_name
-
- def set_default
- super
- @values['part_name'] ||= @values['model_name']
- end
-
- def init
- super
- @part_name = @values['part_name']
- end
-
- def form_field_name
- @model_name + '[' + @model_name + '_attributes][' + @column_name + ']'
- end
-
- end
-
end
end
@parent.name
end
- def model_name
+ def item_name
self.form_name
end
class ListGroup < ManifestBase::Base
include ListGroupModule
- attr :item_name, :lists
+ attr :lists
def set_default
super
- @json['item_name'] ||= @name
@json['lists'] ||= {}
end
def init
super
- @item_name = @json['item_name']
@lists = ManifestBase.load_type_name_args self, @json, 'lists', ListFactory
end
+ def controller_name
+ @name
+ end
+
end
end
ManifestBase.require_modules "local_manifest/list_group/list/",
- %w|where includes order|
+ %w|where includes|
module LocalManifest
module ListGroupModule
module ListModule
class Base < ManifestBase::TypeNameArgs
- attr :model_manifest, :model_list_manifest, :model,
- :where, :includes, :order
+ attr :where, :includes
def set_default
super
@args['where'] ||= {}
@args['includes'] ||= {}
- @args['order'] ||= {}
end
def init
super
@where = ManifestBase.load_type_args self, @args, 'where', WhereFactory
@includes = ManifestBase.load_type_args self, @args, 'includes', IncludeFactory
- @order = ManifestBase.load_type_args self, @args, 'order', OrderFactory
-
- @model_manifest = ::Manifest.manifest.models[self.item_name]
- @model_list_manifest = @model_manifest.list
- @model = ::Manifest.item_name_to_model self.item_name
end
- def has_id?
- @type =~ /filter/
+ def model_manifest
+ ::Manifest.manifest.models[self.item_name]
end
- # url format
- # true: /path/id/action
- # nil: /path/action/id
- def pre_id?
- if @name =~ /^by_/
- false
- else
- true
- end
+ def model
+ ::Manifest.item_name_to_model self.item_name
+ end
+
+ def item_name
+ self.action_manifest.item_name
+ end
+
+ def action_manifest
+ c = ::Manifest.manifest.controllers[self.controller_name]
+ c.actions[self.action_name]
end
def action_name
- ''
+ @name
end
- def item_name
- @parent.item_name
+ def controller_name
+ @parent.controller_name
end
def list_group
@filter_key = @args['filter_key']
end
- def action_name
- @name
- end
-
end
end
end
+++ /dev/null
-ManifestBase.require_modules "local_manifest/list_group/list/order/",
- %w|base method auto|
-
-module LocalManifest
- module ListGroupModule
- module ListModule
- class OrderFactory < ManifestBase::Factory
- include OrderModule
-
- def self.types
- {
- 'method' => OrderMethod, 'auto' => OrderAuto
- }
- end
-
- def self.default_type
- 'auto'
- end
-
- end
- end
- end
-end
+++ /dev/null
-module LocalManifest
- module ListGroupModule
- module ListModule
- module OrderModule
- class OrderAuto < Base
- def set_default
- super
- end
-
- def init
- super
- end
-
- def order
- 'list_order'
- end
-
- end
- end
- end
- end
-end
+++ /dev/null
-module LocalManifest
- module ListGroupModule
- module ListModule
- module OrderModule
- class Base < ManifestBase::TypeArgs
-
- def set_default
- super
- end
-
- def init
- super
- end
-
- def item_name
- @parent.item_name
- end
-
- def list_name
- @parent.name
- end
-
- def model
- @parent.model
- end
-
- end
-
- end
- end
- end
-end
+++ /dev/null
-module LocalManifest
- module ListGroupModule
- module ListModule
- module OrderModule
- class OrderMethod < Base
- attr :method_name
-
- def set_default
- super
- @args['method_name'] ||= @parent.name + '_list_order'
- end
-
- def init
- super
- @method_name = @args['method_name']
- end
-
- def order
- @method_name
- end
-
- end
-
- end
- end
- end
-end
@filter_key = @args['filter_key']
end
- def action_name
- @name
- end
-
-=begin
- def set_default
- return
- @default_page_size = @conf['default_page_size'] || 25
- @max_page_size = @conf['max_page_size'] || 100
- @params_offset = params_offset
- @params_count = params_count
- @list_list_conf = @manifest.list(@item_name).lists[list_name] || {}
- @model_name = @list_list_conf['model']
- @filter_key = @list_list_conf['filter_key']
- @model = @model_name.classify.constantize
- @table_name = @model.table_name
- if @model.content?
- @owner_model = @model.owner_model
- @owner_table_name = @owner_model.table_name if @owner_model
- end
- end
-
- def offset cnt, prm = nil
- offset = prm.to_i
- offset = cnt - 1 if offset >= cnt
- offset = cnt - offset.abs if offset < 0
- offset = 0 if offset < 0
- offset
- end
-
- def limit prm
- prm ||= @default_page_size
- count = prm.to_i
- count = @max_page_size if count > @max_page_size
- count = @default_page_size if count < 1
- count
- end
-
- def items filter_item
- c = @count || self.count(filter_item)
- o = self.offset c, @offset
- l = self.limit @count
- @model.where(self.where(filter_item)).includes(self.includes).order(self.order).offset(o).limit(l)
- end
-
- def prev_offset filter_item
- c = @count || self.count(filter_item)
- o = self.offset c, @offset
- l = self.limit @count
- if o > 0
- if o - l < 0
- 0
- else
- o - l
- end
- else
- nil
- end
- end
-
- def next_offset filter_item
- c = @count || self.count(filter_item)
- o = self.offset c, @offset
- l = self.limit @count
- if o + l > c
- nil
- else
- o + l
- end
- end
-=end
-
end
end
end
module ProfilerModule
module AssociationModule
class BelongsTo < ManifestBase::Names
- attr :model_name
+ attr :item_name
def set_default
super
def init
super
- @model_name = @name
+ @item_name = @name
end
def model
- ::Manifest::item_name_to_model @model_name
+ ::Manifest::item_name_to_model @item_name
end
def association_name
module ProfilerModule
module AssociationModule
class HasMany < ManifestBase::Names
- attr :model_name, :list_name, :table_name
+ attr :controller_name, :item_name, :action_name
def set_default
super
def init
super
if list_manifest = self.profiler.lists[@name]
- @model_name = list_manifest.model_name
- @list_name = list_manifest.list_name
+ @controller_name = list_manifest.controller_name
+ @action_name = list_manifest.action_name
else
n = @name.split '.'
if n.size > 1
- @table_name = n[0]
- @model_name = @table_name.singularize
- @list_name = n[1]
+ @controller_name = n[0]
+ @action_name = n[1]
else
ManifestBase::alert_undefined_message 'list', self.module_message
end
end
end
- def list
- Locmare::ListGroup.list @model_name, @list_name
- end
-
def model
- ::Manifest::item_name_to_model @model_name
+ item_name = Manifest.manifest.controllers[@controller_name].actions[@action_name].item_name
+ ::Manifest::item_name_to_model item_name
end
def association_name
module ProfilerModule
module AssociationModule
class HasOne < ManifestBase::Names
- attr :model_name, :list_name, :list
+ attr :controller_name, :item_name, :action_name
def set_default
super
def init
super
if list_manifest = self.profiler.lists[@name]
- @model_name = @parent.model_name
- @list_name = @parent.list_name
+ @controller_name = list_manifest.controller_name
+ @action_name = list_manifest.action_name
else
n = @name.split '.'
if n.size > 1
- @model_name = n[0]
- @list_name = n[1]
+ @controller_name = n[0]
+ @action_name = n[1]
else
ManifestBase::alert_undefined_message 'list', self.module_message
end
end
end
- def list
- Locmare::ListGroup.list @model_name, @list_name
- end
-
def model
- ::Manifest::item_name_to_model @model_name
+ item_name = Manifest.manifest.controllers[@controller_name].actions[@action_name].item_name
+ ::Manifest::item_name_to_model item_name
end
def association_name
module LocalManifest
module ProfilerModule
class List < ManifestBase::NameValues
- attr :model_name, :list_name
+ attr :controller_name, :action_name
def set_default
- ManifestBase::alert_undefined_message "model_name", self.module_message unless @json['model_name']
- ManifestBase::alert_undefined_message "list_name", self.module_message unless @json['list_name']
+ ManifestBase::alert_undefined_message "controller_name", self.module_message unless @json['controller_name']
+ ManifestBase::alert_undefined_message "action_name", self.module_message unless @json['action_name']
end
def init
- @model_name = @json['model_name']
- @list_name = @json['list_name']
+ @controller_name = @json['controller_name']
+ @action_name = @json['action_name']
end
def profiler_name
Manifest.manifest.system_resources.templates[@manifest.template_name]
end
- def model_name
+ def item_name
self.template_path_name + '_' + @manifest.item_name_for_extend_model
end
class ActionLink < BaseLink
def url
- @link_manifest.action_path + @item.id.to_s
+ controller_manifest = @item.class.my_controller
+ action_manifest = controller_manifest.actions[@link_manifest.action_name]
+ action_manifest.url({'id' => @item.id.to_s})
end
end
Manifest.manifest.magic_numbers['thumbnail_width']
end
+ def url
+ controller_manifest = @item.class.my_controller
+ action_manifest = controller_manifest.actions['show']
+ action_manifest.url({'id' => @item.id.to_s, 'format' => 'prof'})
+ end
+
end
class None < Base
class ActionLink < BaseLink
def url
- @link_manifest.action_path + @item.id.to_s
+ controller_manifest = @item.class.my_controller
+ action_manifest = controller_manifest.actions[@link_manifest.action_name]
+ action_manifest.url({'id' => @item.id.to_s})
end
end
nil
end
if boost_name and extend_model # field is extend setting AND template has a extend model
- extend_form_name = @item.boosters[boost_name].model_name
+ extend_form_name = @item.boosters[boost_name].item_name
extend_item = @item.boosters[boost_name].extend_item
@fields[field_name] = ExtendForm.new self, extend_form_name, extend_item, @mounted, @operators, field_name
else
@field_manifest.helpers.each {|helper_name, helper_manifest|
@helpers[helper_name] = HelperFactory.factory self, helper_manifest
}
- @options = {'data-model' => @field_manifest.model_name}
+ @options = {'data-model' => @field_manifest.item_name}
end
def mounted
self.form.item
end
- def model_name
- @label_manifest.model_name
+ def item_name
+ @label_manifest.item_name
end
def column_name
end
def label_name
- 'activerecord.attributes.' + self.model_name + '.' + self.column_name
+ 'activerecord.attributes.' + self.item_name + '.' + self.column_name
end
end
self.form.item
end
- def model_name
- @tag_manifest.model_name
- end
-
- def column_name
- @tag_manifest.column_name
- end
-
def template_dir
self.form.template_dir + 'tag/'
end
end
def model_manifest
- ::Manifest.manifest.models[@field.field_manifest.model_name]
+ ::Manifest.manifest.models[@field.field_manifest.item_name]
end
def model_attribute_manifest
end
def items
- if self.source_by_model?
- resource_model_name = self.model_attribute_manifest.source.resource_model_name
- resource_list_name = self.model_attribute_manifest.source.resource_list_name
+ if self.source_by_filter?
+ resource_item_name = self.model_attribute_manifest.source.resource_item_name
+ resource_action_name = self.model_attribute_manifest.source.resource_action_name
filter_column_name = self.model_attribute_manifest.source.filter_column_name
filter_id = self.form.item.attributes[filter_column_name]
- list = Locmare::ListGroup.list resource_model_name, resource_list_name
- list.items(nil, {:id => filter_id},
+ resource_controller_name = ::Manifest.manifest.models[resource_item_name].classify.tables
+ list = Locmare::ListGroup.list(
+ resource_controller_name,
+ resource_action_name,
+ self.form.operators,
+ {:id => filter_id}
+ )
+ list.items(nil,
0, -1 # no limit
).map {|i| [i.caption, i.id] }
else
end
end
- def source_by_model?
+ def source_by_filter?
case self.model_attribute_manifest.source.type
when 'filter'
true
}
end
- def self.list item_name, list_name
- list_group_manifest = LocalManifest.manifest.list_groups[item_name]
- list_manifest = list_group_manifest.lists[list_name]
- self.types[list_manifest.type].new item_name, list_name
+ def self.list controller_name, action_name, operators, options = {}
+ controller_manifest = Manifest.manifest.controllers[controller_name]
+ action_manifest = controller_manifest.actions[action_name]
+ if action_manifest.alias
+ options['order'] ||= action_manifest.order
+ options['direction'] ||= action_manifest.direction
+ alias_action = action_manifest.alias_action
+ ::Locmare::ListGroup.list alias_action.path_name, alias_action.name, operators, options
+ else
+ list_group_manifest = LocalManifest.manifest.list_groups[controller_name]
+ list_manifest = list_group_manifest.lists[action_name]
+ self.types[list_manifest.type].new controller_name, action_name, operators, options
+ end
end
end
class ListResult
attr :list, :items, :count, :paginate
- def initialize list, items, count, paginate, operators, options
+ def initialize list, items, count, paginate, operators
@list = list
@items = items
@count = count # total count
@paginate = paginate
@operators = operators
- @options = options
end
def path
- if list_manifest.has_id?
- filter_item_id = @options[:id]
- if list_manifest.pre_id?
- '/' + list_manifest.model.path_name + '/' + filter_item_id.to_s + '/' + list_manifest.action_name
- else
- '/' + list_manifest.model.path_name + '/' + list_manifest.action_name + '/' + filter_item_id.to_s
- end
- else
- '/' + list_manifest.model.path_name + '/' + list_manifest.action_name
- end
- end
-
- def list_manifest
- @list.list_manifest
+ @list.action_manifest.url @list.options
end
end
- attr :item_name, :list_name,
- :model_manifest, :model_list_manifest, :list_manifest, :model,
- :default_page_size, :max_page_size
- def initialize item_name, list_name
- @item_name = item_name
+ attr :list_group_name, :list_name, :options, :item_name,
+ :controller_manifest, :action_manifest, :list_manifest, :model,
+ :count
+ def initialize list_group_name, list_name, operators, options = {}
+ @list_group_name = list_group_name
@list_name = list_name
- self.init
- end
-
- def init
- @list_group_manifest = LocalManifest.manifest.list_groups[@item_name]
+ @operators = operators
+ @options = options
+
+ @list_group_manifest = LocalManifest.manifest.list_groups[@list_group_name]
@list_manifest = @list_group_manifest.lists[@list_name]
@where = @list_manifest.where
@includes = @list_manifest.includes
- @order = @list_manifest.order
- @model_manifest = ::Manifest.manifest.models[@item_name]
- @model_list_manifest = @model_manifest.list
+
+ @controller_name = @list_group_name
+ @action_name = @list_name
+ @controller_manifest = ::Manifest.manifest.controllers[@controller_name]
+ @action_manifest = @controller_manifest.actions[@action_name]
+ @item_name = @action_manifest.item_name
@model = ::Manifest.item_name_to_model @item_name
@table_name = @model.table_name
+ self.init
+ end
+
+ def init
+ self.set_count
+ self.set_offset
+ self.set_limit
end
def model_name
@model.model_name
end
- def model_manifest
- @model.model_manifest
+ def set_offset
+ if prm = @options['offset'] || @options[:offset]
+ @offset = prm.to_i
+ @offset = @count - 1 if @offset >= @count
+ @offset = @count - @offset.abs if @offset < 0
+ @offset = 0 if @offset < 0
+ offset
+ else
+ @offset = (self.fixed_page - 1) * self.fixed_page_size
+ end
+ @offset
+ end
+
+ def limit?
+ self.max_page_size > 0
+ end
+
+ def unlimit?
+ !limit?
end
- def page_number prm = nil
- page = prm.to_i
+ def fixed_page
+ page = self.opt_page.to_i
page = 1 if page < 1
page
end
- def page_size prm
- page_size = prm.to_i
- page_size = self.max_page_size if page_size > self.max_page_size
- page_size = self.default_page_size if page_size < 1
+ def fixed_page_size
+ page_size = self.opt_page_size || self.default_page_size
+ page_size = self.max_page_size if self.limit? and page_size > self.max_page_size
page_size
end
+ def set_limit
+ prm = self.opt_page_size || self.opt_count
+ @limit = prm.to_i
+ if self.max_page_size > 0
+ @limit = self.max_page_size if @limit > self.max_page_size
+ else # unlimited api
+ @limit = @count if @limit > @count
+ end
+ @limit = self.default_page_size if @limit < 1
+ @limit
+ end
+
+ def opt_page
+ @options['page'] || @options[:page]
+ end
+
+ def opt_page_size
+ @options['page_size'] || @options[:page_size]
+ end
+
+ def opt_count
+ @options['count'] || @options[:count]
+ end
+
def default_page_size
- @model_list_manifest.default_page_size
+ @action_manifest.default_page_size
end
def max_page_size
- @model_list_manifest.max_page_size
+ @action_manifest.max_page_size
+ end
+
+ def order
+ order = @options['order'] || @options[:order] || @action_manifest.order
+ order = 'updated_at' unless ::Manifest.manifest.models[@item_name].attributes[order]
+ @table_name + '.' + order
+ end
+
+ def direction
+ direction = @options['direction'] || @options[:direction] || @action_manifest.direction
+ if direction < 0
+ 'desc'
+ elsif direction > 0
+ 'asc'
+ else
+ ''
+ end
+ end
+
+ def filter_id
+ @options['id'] || @options[:id]
+ end
+
+ def order_by
+ self.order + ' ' + self.direction
end
def base_where_condition
@includes.includes
end
- def order
- @model.__send__ @order.order
- end
-
- def items operators, options, offset, page_size
- @model.where(self.where_condition).includes(self.include_hash).order(self.order).offset(offset).limit(page_size)
+ def items
+ @model.where(
+ self.where_condition
+ ).includes(
+ self.include_hash
+ ).order(
+ self.order_by
+ ).offset(@offset).limit(@limit)
end
- def count operators, options
- @model.where(self.where_condition).includes(self.include_hash).count
+ def set_count
+ @count = @model.where(
+ self.where_condition
+ ).includes(
+ self.include_hash
+ ).count
end
- def paginate count, page, page_size
+ def paginate count
c = count ? count.to_i : 0
- Kaminari.paginate_array(Array.new(c, nil)).page(page).per(page_size)
+ Kaminari.paginate_array(Array.new(c, nil)).page(self.fixed_page).per(self.fixed_page_size)
end
def boost_manifests
end
end
- def open operators, options
- page = self.page_number(options[:page])
- page_size = self.page_size options[:page_size]
- offset = (page -1) * page_size
- items = self.items operators, options, offset, page_size
- count = self.count operators, options
- pg = self.paginate count, page, page_size
+ def open operators
+ items = self.items
+ pg = if limit?
+ self.paginate @count
+ else
+ nil
+ end
self.boost items
- ListResult.new self, items, count, pg, operators, options
+ ListResult.new self, items, @count, pg, @operators
end
end
attr :filter_key, :filter_item_name
def init
- super
@filter_key = @list_manifest.filter_key
@filter_item_name = @list_manifest.filter_item_name
@filter_model = ::Manifest.manifest.models[@filter_item_name].classify
@filter_table_name = @filter_model.table_name
+ super
end
- def where_condition filter_item_id
+ def where_condition
w = self.base_where_condition
w += ' and ' unless w.blank?
- [w + @table_name + '.' + @filter_key + ' = ?', filter_item_id]
+ [w + @table_name + '.' + @filter_key + ' = ?', self.filter_id]
end
def include_hash
w
end
- def visible? item_id, operators
+ def visible?
r = nil
begin
- r = @filter_model.show(item_id, operators)
+ r = @filter_model.show(self.filter_id, @operators)
rescue ActiveRecord::RecordNotFound, ActiveRecord::Forbidden
r = false
end
r
end
- def items operators, options, offset, page_size
- filter_item_id = options[:id]
- if self.visible? filter_item_id, operators
- @model.where(self.where_condition(filter_item_id)).includes(self.include_hash).order(self.order).offset(offset).limit(page_size)
+ def items
+ if self.visible?
+ @model.where(
+ self.where_condition
+ ).includes(
+ self.include_hash
+ ).order(
+ self.order_by
+ ).offset(@offset).limit(@limit)
else
[]
end
end
- def count operators, options
- filter_item_id = options[:id]
- if self.visible? filter_item_id, operators
- @model.where(self.where_condition(filter_item_id)).includes(self.include_hash).count
+ def count
+ if self.visible?
+ @model.where(
+ self.where_condition
+ ).includes(
+ self.include_hash
+ ).count
else
0
end
class ForeignFilterList < FilterList
def init
- super
@filter_table_name = ::Manifest.manifest.models[@filter_item_name].classify.table_name
+ super
end
- def where_condition filter_item_id
+ def where_condition
w = self.base_where_condition
w += ' and ' unless w.blank?
- [w + @filter_table_name + '.id' + ' = ?', filter_item_id]
+ [w + @filter_table_name + '.id' + ' = ?', self.filter_id]
end
def include_hash
super
end
- def where_condition operators
+ def where_condition
owner_model = if @model.element?
@model.root_model
else
end
case owner_model.owner_type
when :author
- operator = operators.author
+ operator = @operators.author
when :artist
- operator = operators.artist
+ operator = @operators.artist
end
[owner_model.table_name + '.' + owner_model.owner_type.to_s + '_id = ?', operator.id]
end
- def items operators, options, offset, page_size
- @model.where(self.where_condition(operators)).includes(self.include_hash).order(self.order).offset(offset).limit(page_size)
+ def items
+ @model.where(
+ self.where_condition
+ ).includes(
+ self.include_hash
+ ).order(
+ self.order_by
+ ).offset(@offset).limit(@limit)
end
- def count operators, options
- filter_item_id = options[:id]
- @model.where(self.where_condition(operators)).includes(self.include_hash).count
+ def count
+ @model.where(
+ self.where_condition
+ ).includes(
+ self.include_hash
+ ).count
end
end
super
end
- def order
- @model.list_order
- end
-
end
end
super
end
- def items operators, options, offset, page_size
+ def items
# enable_list does not work when configured auto load in development.rb
# auto loader undefing MODEL at reload manifest file
@model.enable_list
attr :through
def init
- super
@through = @list_manifest.through
+ super
end
def include_hash
{@through => {@filter_item_name => {}} }
end
- def where_condition filter_item_id
+ def where_condition
w = self.base_where_condition
w += ' and ' unless w.blank?
- [w + @filter_table_name + '.id' + ' = ?', filter_item_id]
+ [w + @filter_table_name + '.id' + ' = ?', self.filter_id]
end
end
end
def model_belongs_to_manifest
- self.model_manifest.associations.belongs_to[@belongs_to_manifest.model_name]
+ self.model_manifest.associations.belongs_to[@belongs_to_manifest.item_name]
end
def profiler
end
def filer
- list_result = @has_many_manifest.list.open(self.profiler.operators, {:id => self.item.id, :page => 1, :page_size => 3})
+ list = ::Locmare::ListGroup.list(
+ @has_many_manifest.controller_name,
+ @has_many_manifest.action_name,
+ self.profiler.operators,
+ {:id => self.item.id, :page => 1, :page_size => 3}
+ )
+ list_result = list.open(self.profiler.operators)
items = list_result.items
::Locmare::Filer.new self.has_many_model.item_name, items, list_result, :more, self.profiler.operators
end
end
def filer
- list_result = @has_one_manifest.list.open(self.profiler.operators, {:id => self.item.id})
+ list = ::Locmare::ListGroup.list(
+ @has_one_manifest.controller_name,
+ @has_one_manifest.action_name,
+ {:id => self.item.id}
+ )
+ list_result = list.open(self.profiler.operators)
items = list_result.items
::Locmare::Filer.new self.has_one_model.item_name, items, nil, :none, self.profiler.operators
end
end
def extend_settings
- self.template_model_profiler.extend_settings[self.booster.model_name]
+ self.template_model_profiler.extend_settings[self.booster.item_name]
end
def template_model_profiler
module Manifest
class Controller < ManifestBase::Base
include ControllerModule
- attr :item_name, :actions
+ attr :actions
def set_default
super
- @json['item_name'] ||= ::Manifest.singularize(@name)
@json['actions'] ||= {}
end
def init
super
- @item_name = @json['item_name']
@actions = ManifestBase.load_type_name_args self, @json, 'actions', ActionFactory
end
module ControllerModule
module ActionModule
class Base < ManifestBase::TypeNameArgs
- attr :item_name
+ attr :param_id, :item_name
def set_default
super
- @args['item_name'] ||= self.parent.item_name # not parent.name. follow singularized name
+ @args['item_name'] ||= ::Manifest.manifest.singularize(@parent.name)
+ @args['param_id'] ||= 'prefix'
end
def init
super
@item_name = @args['item_name']
+ @param_id = @args['param_id']
+ end
+
+ def path_name
+ ::Manifest.manifest.pluralize(@item_name)
+ end
+
+ def encode_query params
+ q = []
+ q.push('page=' + params['page'].to_s) if params['page']
+ q.push('page_size=' + params['page_size'].to_s) if params['page_size']
+ if q.length > 0
+ '?' + q.join('&')
+ else
+ ''
+ end
+ end
+
+ def encode_url params = {}
+ controller_name = '/' + self.path_name
+ c = controller_name
+ a = if @name == 'index' or @name == 'show' or @name == 'destroy'
+ ''
+ else
+ '/' + @name
+ end
+ pf = params['format'] || params[:format]
+ # f = if params['format'] # json request? so bad. html request as get rest api
+ f = if pf == 'prof'
+ '.' + params['format'].to_s
+ else
+ ''
+ end
+ pid = params['id'] || params[:id]
+ i = if pid
+ '/' + params['id'].to_s
+ else
+ ''
+ end
+ q = self.encode_query(params)
+ case @param_id
+ when 'prefix'
+ c + i + a + f + q
+ when 'suffix'
+ c + a + i + f + q
+ else
+ c + a + f + q
+ end
+ end
+
+ def url params
+ self.encode_url(params)
end
end
module ControllerModule
module ActionModule
class ActionCount < Base
- attr :list_name
+ attr :action_name
def set_default
super
- @args['list_name'] ||= @name.gsub(/^count_/, '')
+ @args['action_name'] ||= @name.gsub(/^count_/, '')
end
def init
super
- @list_name = @args['list_name']
+ @action_name = @args['action_name']
end
end
module ControllerModule
module ActionModule
class ActionList < Base
- attr :list_name
+ attr :alias, :order, :direction, :default_page_size, :max_page_size
def set_default
super
- @args['list_name'] ||= @name
+ @args['direction'] ||= -1
+ @args['default_page_size'] ||= 25
+ @args['max_page_size'] ||= 100
end
def init
super
- @list_name = @args['list_name']
+ @alias = @args['alias']
+ @order = @args['order'] || 'updated_at'
+ @direction = @args['direction'].to_i
+ @default_page_size = @args['default_page_size']
+ @max_page_size = @args['max_page_size']
+ @counter_name = if @args['counter_name']
+ @args['counter_name']
+ else
+ if @name == 'index'
+ 'count'
+ else
+ 'count_' + @name
+ end
+ end
+ end
+
+ def alias_action
+ s = @alias.split('.')
+ c = ::Manifest.manifest.controllers[s[0]]
+ c.actions[s[1]]
+ end
+
+ def counter_url params
+ action_manifest = @parent.actions[@counter_name]
+ self.encode_url(params)
end
end
module ItemModule
class BasePeta < ManifestBase::TypeNameArgs
- attr :boost ,:parent_model_name
+ attr :boost ,:parent_item_name
def set_default
super
def init
super
- @parent_model_name = nil # init at leaf, element
+ @parent_item_name = nil # init at leaf, element
@boost = ManifestBase.load_name_values self, @args, 'boost', Boost
end
def element?
- @parent_model_name != nil
+ @parent_item_name != nil
end
def find_boost_name column_name
module Manifest
module ItemModule
class ElementPeta < BasePeta
- attr :parent_model_name
+ attr :parent_item_name
def set_default
super
- ManifestBase.alert_undefined_message 'parent_model_name', self.module_message unless @args['parent_model_name']
+ ManifestBase.alert_undefined_message 'parent_item_name', self.module_message unless @args['parent_item_name']
end
def init
super
- @parent_model_name = @args['parent_model_name']
+ @parent_item_name = @args['parent_item_name']
end
end
module Manifest
module ItemModule
class LeafPeta < BasePeta
- attr :parent_model_name, :destination_model_name
+ attr :parent_item_name, :destination_item_name
def set_default
super
- ManifestBase.alert_undefined_message 'parent_model_name', self.module_message unless @args['parent_model_name']
+ ManifestBase.alert_undefined_message 'parent_item_name', self.module_message unless @args['parent_item_name']
end
def init
super
- @parent_model_name = @args['parent_model_name']
- @destination_model_name = @args['destination_model_name']
+ @parent_item_name = @args['parent_item_name']
+ @destination_item_name = @args['destination_item_name']
end
end
class Manifest
cattr_accessor :manifest
attr :system_resources, :magic_numbers,
- :items, :controllers, :models, :module_names
+ :items, :controllers, :models, :module_names,
+ :inflectors, :singulars, :plurals
# call me before load routes.rb
# routes.rb needs engine_resources manifest in system_resources
# ex. it's adding license_groups routes
def init
# managers can't initialize before load application.rb
return unless defined? ::Pettanr
+ @inflectors = @global_json['inflectors']
+ @item_names = {}
+ @table_names = {}
+ @inflectors.each do |item_name, table_name|
+ @item_names[item_name] = table_name # monkey copy
+ @table_names[table_name] = item_name
+ end
@items = ManifestBase.load_type_name_args(self, @global_json, 'items', ItemFactory)
@controllers = Controller.load(self, @global_json, 'controllers')
@models = Model.load(self, @global_json, 'models')
end
end
+ # table_name to item_name
+ def singularize table_name
+ @table_names[table_name]
+ end
+
+ # item_name to table_name
+ def pluralize item_name
+ @item_names[item_name]
+ end
+
end
module ModuleMethods
item_name.classify.constantize
end
- def singularize name
- name.singularize
- end
-
- def pluralize name
- name.pluralize
- end
-
end
extend ModuleMethods
ManifestBase.require_modules "manifest/model/",
- %w|attribute association list|
+ %w|attribute association|
module Manifest
class Model < ManifestBase::Base
include ModelModule
- attr :attributes, :associations, :list
+ attr :attributes, :associations, :table_name
def set_default
super
+ @json['table_name'] ||= ::Manifest.manifest.pluralize(@name)
@json['attributes'] ||= {}
@json['associations'] ||= {}
- @json['list'] ||= {}
@json['attributes']['id'] = {
'type' => 'number',
'primary_key' => 1,
def init
super
+ @table_name = @json['table_name']
@attributes = ManifestBase.load_name_values self, @json, 'attributes', Attribute
@associations = ManifestBase.load_value self, @json, 'associations', Association
- @list = ManifestBase.load_value self, @json, 'list', List
end
- def model_name
+ def item_name
@name
end
::Manifest.item_name_to_model @name
end
- def table_name
- self.classify.table_name
- end
-
def valid_encode_columns
r = []
@attributes.each {|attribute_name, attribute|
false
end
- def content_model
+ def content_model?
return true if self.owner_type
false
end
r = []
::Manifest.manifest.items.each {|peta_name, peta_manifest|
next unless peta_manifest.element?
- next unless peta_manifest.parent_model_name == @name
+ next unless peta_manifest.parent_item_name == @name
r << ::Manifest.manifest.models[peta_name]
}
r
@has_one = ManifestBase.load_name_values self, @values, 'has_one', HasOne
end
- def model_name
- @parent.name
+ def item_name
+ @parent.item_name
end
def each_parent_model
@belongs_to.each do |name, belongs_to_manifest|
- next unless @parent.classify.element?
- if @parent.classify.my_peta.type == 'element'
+ pm = @parent.classify
+ next unless pm.element?
+ if pm.my_peta.type == 'element'
next unless belongs_to_manifest.model.my_peta.type == 'root'
end
- if @parent.classify.my_peta.type == 'leaf'
+ if pm.my_peta.type == 'leaf'
next unless belongs_to_manifest.model.my_peta.type == 'binder'
end
yield belongs_to_manifest.model
module ModelModule
module AssociationModule
class BelongsTo < ManifestBase::NameValues
- attr :id_column, :model_name
+ attr :id_column, :item_name
def set_default
super
- @values['model_name'] ||= @name
+ @values['item_name'] ||= @name
@values['id_column'] ||= @name + '_id'
end
def init
super
- @model_name = @values['model_name']
+ @item_name = @values['item_name']
@id_column = @values['id_column']
end
def model
- ::Manifest.item_name_to_model @model_name
+ ::Manifest.item_name_to_model @item_name
end
end
module ModelModule
module AssociationModule
class HasMany < ManifestBase::NameValues
- attr :model_name, :foreign_key, :through
+ attr :foreign_key, :through, :item_name
def set_default
super
- @values['model_name'] ||= ::Manifest.singularize @name
- @values['foreign_key'] ||= @parent.model_name + '_id'
+ @values['item_name'] ||= ::Manifest.manifest.singularize(@name)
+ @values['foreign_key'] ||= @parent.item_name + '_id'
end
def init
super
- @model_name = @values['model_name']
+ @item_name = @values['item_name']
@foreign_key = @values['foreign_key']
@through = @values['through']
end
end
def model
- ::Manifest.item_name_to_model @model_name
+ ::Manifest.item_name_to_model @item_name
end
end
module ModelModule
module AssociationModule
class HasOne < ManifestBase::NameValues
- attr :model_name, :foreign_key
+ attr :item_name, :foreign_key
def set_default
super
- @values['model_name'] ||= @name
- @values['foreign_key'] ||= @parent.model_name + '_id'
+ @values['item_name'] ||= @name
+ @values['foreign_key'] ||= @parent.item_name + '_id'
end
def init
super
- @model_name = @values['model_name']
+ @item_name = @values['item_name']
@foreign_key = @values['foreign_key']
end
end
def model
- ::Manifest.item_name_to_model @model_name
+ ::Manifest.item_name_to_model @item_name
end
end
end
end
- def model_name
- @parent.name
+ def item_name
+ @parent.item_name
end
end
super
end
- def model_name
- @parent.model_name
+ def item_name
+ @parent.item_name
end
end
module AttributeModule
module SourceModule
class ModelSource < Base
- attr :resource_model_name, :resource_list_name,
+ attr :resource_item_name, :resource_action_name,
:select_item_name, :caption_name
def set_default
super
- @args['resource_model_name'] ||= (@parent.name.gsub('_id', ''))
- @args['resource_list_name'] ||= 'select_items'
- @args['select_item_name'] ||= self.model_name + '_' + @parent.name.gsub('_id', '') + '_items'
+ @args['resource_item_name'] ||= (@parent.name.gsub('_id', ''))
+ @args['resource_action_name'] ||= 'index'
+ @args['select_item_name'] ||= self.item_name + '_' + @parent.name.gsub('_id', '') + '_items'
@args['caption_name'] ||= 'caption'
end
def init
super
- @resource_model_name = @args['resource_model_name']
- @resource_list_name = @args['resource_list_name']
+ @resource_item_name = @args['resource_item_name']
+ @resource_action_name = @args['resource_action_name']
@select_item_name = @args['select_item_name']
@caption_name = @args['caption_name']
end
+++ /dev/null
-module Manifest
- module ModelModule
- class List < ManifestBase::Values
- attr :default_page_size, :max_page_size
-
- def set_default
- super
- @values['default_page_size'] ||= 25
- @values['max_page_size'] ||= 100
- end
-
- def init
- super
- @default_page_size = @values['default_page_size']
- @max_page_size = @values['max_page_size']
- end
-
- end
-
- end
-end
source_manifest = attribute_manifest.source
next unless source_manifest
next unless source_manifest.type == 'model'
- resource_model_name = source_manifest.resource_model_name
- resource_list_name = source_manifest.resource_list_name
+ resource_item_name = source_manifest.resource_item_name
+ resource_action_name = source_manifest.resource_action_name
caption = source_manifest.caption_name
+ resource_controller_name = ::Manifest.manifest.pluralize(resource_item_name)
begin
- list = Locmare::ListGroup.list resource_model_name, resource_list_name
- r = list.open nil, {}
+ list = Locmare::ListGroup.list(
+ resource_controller_name,
+ resource_action_name,
+ nil,
+ {}
+ )
+ r = list.open nil
@select_items[source_manifest.select_item_name] =
r.items.map {|item| [item.attributes[caption], item.id]}
rescue
- puts 'skip store select_items:' + resource_model_name + '.' + resource_list_name
+ puts 'skip store select_items:' + resource_item_name + '.' + resource_action_name
end
}
}
super
return nil if self._skip_load?
# Class Methods
- ct = self.my_manifest.content_model
+ ct = self.my_manifest.content_model?
define_singleton_method("content?") do
ct
end
super
return nil if self._skip_load?
# Class Methods
- pm = Manifest.manifest.models[self.my_peta.parent_model_name].classify
+ pm = Manifest.manifest.models[self.my_peta.parent_item_name].classify
define_singleton_method("parent_model") do
pm
end
- pfk = self.my_peta.parent_model_name + '_id'
+ pfk = self.my_peta.parent_item_name + '_id'
define_singleton_method("parent_key") do
pfk
end
# Instance Methods
def root
- pm = self.__send__ self.class.parent_model.item_name
- if pm.class.element?
- pm.root
+ pi = self.__send__ self.class.parent_model.item_name
+ if pi.class.element?
+ pi.root
else
- pm
+ pi
end
end
# ClassMethods
# class_name
- # table_name
before_validation :valid_encode
end
def self.plural
- self.singular.pluralize
+ table_name = Manifest.manifest.pluralize self.item_name
+ table_name.camelize
end
def self.item_name
self.singular.underscore
end
+ # self.model_name
+ # => "PanelPicture"
+
+ # self.table_name
+ # => "panel_picture"
+
def self.item?
true
end
end
def self.path_name with_engine = false
- self.plural.underscore
+ self.table_name
end
def self.pickup_item_name
''
end
- def self.list_order
- self.table_name + '.updated_at desc'
- end
-
def self.list_opt
{}
end
r
end
+ def tag_attr column = nil, opt = {}
+ self.tag_attributes(column, opt).to_attr
+ end
+
def field_tag_attributes column_name, opt = {}
self.tag_attributes(column_name, opt).merge(
{'data-column_name' => column_name}
super
return nil if self._skip_load?
# Class Methods
- pm = Manifest.manifest.models[self.my_peta.parent_model_name].classify
+ pm = Manifest.manifest.models[self.my_peta.parent_item_name].classify
define_singleton_method("parent_model") do
pm
end
- destm = Manifest.manifest.models[self.my_peta.destination_model_name].classify
+ destm = Manifest.manifest.models[self.my_peta.destination_item_name].classify
define_singleton_method("destination_model") do
destm
end
- pfk = self.my_peta.parent_model_name + '_id'
+ pfk = self.my_peta.parent_item_name + '_id'
define_singleton_method("binder_key") do
pfk
end
- dest_key = if self.my_peta.destination_model_name
- self.my_peta.destination_model_name + '_id'
+ dest_key = if self.my_peta.destination_item_name
+ self.my_peta.destination_item_name + '_id'
else
nil
end
{\r
"list_groups": {\r
- "folder": {\r
+ "folders": {\r
"lists": {\r
- "public": {\r
+ "index": {\r
"type": "public"\r
}\r
}\r
},\r
- "scroll": {\r
+ "scrolls": {\r
"lists": {\r
- "public": {\r
+ "index": {\r
"type": "public"\r
},\r
- "private": {\r
- "type": "private"\r
- },\r
"by_author": {\r
"type": "filter"\r
},\r
"args": {\r
"through": "scroll_panels"\r
}\r
+ },\r
+ "play": {\r
+ "type": "play"\r
}\r
}\r
},\r
- "scroll_panel": {\r
+ "scroll_panels": {\r
"lists": {\r
- "public": {\r
+ "index": {\r
"type": "public"\r
},\r
- "private": {\r
- "type": "private"\r
- },\r
- "play": {\r
- "type": "play",\r
- "args": {\r
- "filter_item_name": "scroll",\r
- "filter_model_name": "scroll_panel",\r
- "filter_key": "scroll_id",\r
- "order": {\r
- "type": "method"\r
- }\r
- }\r
- },\r
"by_scroll": {\r
"type": "filter"\r
},\r
}\r
}\r
},\r
- "comic": {\r
+ "comics": {\r
"lists": {\r
- "public": {\r
+ "index": {\r
"type": "public"\r
},\r
- "private": {\r
- "type": "private"\r
- },\r
"by_author": {\r
"type": "filter"\r
},\r
"args": {\r
"through": "comic_stories"\r
}\r
+ },\r
+ "play": {\r
+ "type": "play"\r
}\r
}\r
},\r
- "comic_story": {\r
+ "comic_stories": {\r
"lists": {\r
- "public": {\r
+ "index": {\r
"type": "public"\r
},\r
- "private": {\r
- "type": "private"\r
- },\r
- "play": {\r
- "type": "play",\r
- "args": {\r
- "filter_item_name": "comic",\r
- "filter_model_name": "comic_story",\r
- "filter_key": "comic_id",\r
- "order": {\r
- "type": "method"\r
- }\r
- }\r
- },\r
"by_comic": {\r
"type": "filter"\r
},\r
}\r
}\r
},\r
- "story": {\r
+ "stories": {\r
"lists": {\r
- "public": {\r
+ "index": {\r
"type": "public"\r
},\r
- "private": {\r
- "type": "private"\r
- },\r
"by_comic": {\r
"type": "through_filter",\r
"args": {\r
},\r
"by_author": {\r
"type": "filter"\r
+ },\r
+ "play": {\r
+ "type": "play"\r
}\r
}\r
},\r
- "story_sheet": {\r
+ "story_sheets": {\r
"lists": {\r
- "public": {\r
+ "index": {\r
"type": "public"\r
},\r
- "private": {\r
- "type": "private"\r
- },\r
- "play": {\r
- "type": "play",\r
- "args": {\r
- "filter_item_name": "story",\r
- "filter_model_name": "story_sheet",\r
- "filter_key": "story_id",\r
- "order": {\r
- "type": "method"\r
- }\r
- }\r
- },\r
"by_story": {\r
"type": "filter"\r
},\r
}\r
}\r
},\r
- "sheet": {\r
+ "sheets": {\r
"lists": {\r
- "public": {\r
+ "index": {\r
"type": "public"\r
},\r
- "private": {\r
- "type": "private"\r
- },\r
"by_story": {\r
"type": "through_filter",\r
"args": {\r
},\r
"by_author": {\r
"type": "filter"\r
+ },\r
+ "play": {\r
+ "type": "play"\r
}\r
}\r
},\r
- "sheet_panel": {\r
+ "sheet_panels": {\r
"lists": {\r
- "public": {\r
+ "index": {\r
"type": "public"\r
},\r
- "private": {\r
- "type": "private"\r
- },\r
- "play": {\r
- "type": "play",\r
- "args": {\r
- "filter_item_name": "sheet",\r
- "filter_model_name": "sheet_panel",\r
- "filter_key": "sheet_id"\r
- }\r
- },\r
"by_sheet": {\r
"type": "filter"\r
},\r
}\r
}\r
},\r
- "panel": {\r
+ "panels": {\r
"lists": {\r
- "public": {\r
+ "index": {\r
"type": "public"\r
},\r
- "private": {\r
- "type": "private"\r
- },\r
"by_scroll": {\r
"type": "through_filter",\r
"args": {\r
}\r
}\r
},\r
- "panel_picture": {\r
+ "panel_pictures": {\r
"lists": {\r
- "public": {\r
+ "index": {\r
"type": "public"\r
},\r
- "private": {\r
- "type": "private"\r
- },\r
"by_panel": {\r
"type": "filter"\r
},\r
}\r
}\r
},\r
- "speech_balloon": {\r
+ "speech_balloons": {\r
"lists": {\r
- "public": {\r
+ "index": {\r
"type": "public"\r
},\r
- "private": {\r
- "type": "private"\r
- },\r
"by_panel": {\r
"type": "filter"\r
},\r
}\r
}\r
},\r
- "speech": {\r
+ "speeches": {\r
"lists": {\r
- "public": {\r
+ "index": {\r
"type": "public"\r
},\r
- "private": {\r
- "type": "private"\r
- },\r
"by_panel": {\r
"type": "filter"\r
},\r
}\r
}\r
},\r
- "balloon": {\r
+ "balloons": {\r
"lists": {\r
- "public": {\r
+ "index": {\r
"type": "public"\r
},\r
- "private": {\r
- "type": "private"\r
- },\r
"by_speech_balloon": {\r
"type": "filter"\r
},\r
}\r
}\r
},\r
- "ground_picture": {\r
+ "ground_pictures": {\r
"lists": {\r
- "public": {\r
+ "index": {\r
"type": "public"\r
},\r
- "private": {\r
- "type": "private"\r
- },\r
"by_panel": {\r
"type": "filter"\r
},\r
}\r
}\r
},\r
- "ground_color": {\r
+ "ground_colors": {\r
"lists": {\r
- "public": {\r
+ "index": {\r
"type": "public"\r
},\r
- "private": {\r
- "type": "private"\r
- },\r
"by_panel": {\r
"type": "filter"\r
},\r
}\r
}\r
},\r
- "original_picture": {\r
+ "original_pictures": {\r
"lists": {\r
- "private": {\r
+ "index": {\r
"type": "private"\r
}\r
}\r
},\r
- "picture": {\r
+ "pictures": {\r
"lists": {\r
- "public": {\r
+ "index": {\r
"type": "public"\r
},\r
"by_artist": {\r
}\r
}\r
},\r
- "resource_picture": {\r
+ "resource_pictures": {\r
"lists": {\r
- "public": {\r
+ "index": {\r
"type": "public"\r
},\r
- "private": {\r
- "type": "private"\r
- },\r
"by_original_picture": {\r
"type": "filter"\r
},\r
}\r
}\r
},\r
- "speech_balloon_template": {\r
+ "speech_balloon_templates": {\r
"lists": {\r
- "public": {\r
+ "index": {\r
"type": "public"\r
},\r
"by_panel": {\r
}\r
}\r
},\r
- "writing_format": {\r
+ "writing_formats": {\r
"lists": {\r
- "public": {\r
+ "index": {\r
"type": "public"\r
},\r
"select_items": {\r
}\r
}\r
},\r
- "license_group": {\r
+ "license_groups": {\r
"lists": {\r
- "public": {\r
+ "index": {\r
"type": "public"\r
},\r
"by_resource_picture": {\r
}\r
}\r
},\r
- "license": {\r
+ "licenses": {\r
"lists": {\r
- "public": {\r
+ "index": {\r
"type": "public"\r
},\r
"by_license_group": {\r
}\r
}\r
},\r
- "author": {\r
+ "authors": {\r
"lists": {\r
- "public": {\r
+ "index": {\r
"type": "public"\r
}\r
}\r
},\r
- "artist": {\r
+ "artists": {\r
"lists": {\r
- "public": {\r
+ "index": {\r
"type": "public"\r
}\r
}\r
},\r
- "system_picture": {\r
+ "system_pictures": {\r
"lists": {\r
- "public": {\r
+ "index": {\r
"type": "public"\r
}\r
}\r
+ },\r
+ "home": {\r
+ "lists": {\r
+ "scrolls": {\r
+ "type": "private"\r
+ },\r
+ "scroll_panels": {\r
+ "type": "private"\r
+ },\r
+ "comics": {\r
+ "type": "private"\r
+ },\r
+ "comic_stories": {\r
+ "type": "private"\r
+ },\r
+ "stories": {\r
+ "type": "private"\r
+ },\r
+ "story_sheets": {\r
+ "type": "private"\r
+ },\r
+ "sheets": {\r
+ "type": "private"\r
+ },\r
+ "sheet_panels": {\r
+ "type": "private"\r
+ },\r
+ "panels": {\r
+ "type": "private"\r
+ },\r
+ "panel_pictures": {\r
+ "type": "private"\r
+ },\r
+ "speech_balloons": {\r
+ "type": "private"\r
+ },\r
+ "speeches": {\r
+ "type": "private"\r
+ },\r
+ "balloons": {\r
+ "type": "private"\r
+ },\r
+ "ground_pictures": {\r
+ "type": "private"\r
+ },\r
+ "ground_colors": {\r
+ "type": "private"\r
+ },\r
+ "original_pictures": {\r
+ "type": "private"\r
+ },\r
+ "resource_pictures": {\r
+ "type": "private"\r
+ }\r
+ }\r
}\r
},\r
"profilers": {\r
"speech_balloon_template"\r
],\r
"has_one": [\r
- "balloon.by_speech_balloon",\r
- "speech.by_speech_balloon"\r
+ "balloons.by_speech_balloon",\r
+ "speeches.by_speech_balloon"\r
]\r
}\r
},\r
"belongs_to": [\r
"artist"\r
],\r
- "has_one": [\r
- "resource_picture.by_original_picture"\r
- ]\r
+ "has_one": []\r
}\r
},\r
"picture": {\r
{\r
+ "inflectors": {\r
+ "folder": "folders",\r
+ "scroll": "scrolls",\r
+ "scroll_panel": "scroll_panels",\r
+ "comic": "comics",\r
+ "comic_story": "comic_stories",\r
+ "story": "stories",\r
+ "story_sheet": "story_sheets",\r
+ "sheet": "sheets",\r
+ "sheet_panel": "sheet_panels",\r
+ "panel": "panels",\r
+ "panel_picture": "panel_pictures",\r
+ "speech_balloon": "speech_balloons",\r
+ "speech": "speeches",\r
+ "balloon": "balloons",\r
+ "ground_picture": "ground_pictures",\r
+ "ground_color": "ground_colors",\r
+ "original_picture": "original_pictures",\r
+ "picture": "pictures",\r
+ "resource_picture": "resource_pictures",\r
+ "original_picture_license_group": "original_picture_license_groups",\r
+ "original_picture_license": "original_picture_licenses",\r
+ "speech_balloon_template": "speech_balloon_templates",\r
+ "writing_format": "writing_formats",\r
+ "license_group": "license_groups",\r
+ "license": "licenses",\r
+ "author": "authors",\r
+ "artist": "artists",\r
+ "system_picture": "system_pictures",\r
+ "home": "home"\r
+ },\r
"items": {\r
"folder": {},\r
"scroll": {\r
"scroll_panel": {\r
"type": "leaf",\r
"args": {\r
- "parent_model_name": "scroll",\r
- "destination_model_name": "panel"\r
+ "parent_item_name": "scroll",\r
+ "destination_item_name": "panel"\r
}\r
},\r
"comic": {\r
"comic_story": {\r
"type": "leaf",\r
"args": {\r
- "parent_model_name": "comic",\r
- "destination_model_name": "story"\r
+ "parent_item_name": "comic",\r
+ "destination_item_name": "story"\r
}\r
},\r
"story": {\r
"story_sheet": {\r
"type": "leaf",\r
"args": {\r
- "parent_model_name": "story",\r
- "destination_model_name": "sheet"\r
+ "parent_item_name": "story",\r
+ "destination_item_name": "sheet"\r
}\r
},\r
"sheet": {\r
"sheet_panel": {\r
"type": "element",\r
"args": {\r
- "parent_model_name": "sheet"\r
+ "parent_item_name": "sheet"\r
}\r
},\r
"panel": {\r
"panel_picture": {\r
"type": "element",\r
"args": {\r
- "parent_model_name": "panel"\r
+ "parent_item_name": "panel"\r
}\r
},\r
"speech_balloon": {\r
"type": "element",\r
"args": {\r
- "parent_model_name": "panel",\r
+ "parent_item_name": "panel",\r
"boost": {\r
"speech_balloon_template": {\r
"extend_model_class_name": "SpeechBalloon",\r
"balloon": {\r
"type": "element",\r
"args": {\r
- "parent_model_name": "speech_balloon",\r
+ "parent_item_name": "speech_balloon",\r
"boost": {\r
"speech_balloon_template": {\r
"extend_model_class_name": "Balloon",\r
"speech": {\r
"type": "element",\r
"args": {\r
- "parent_model_name": "speech_balloon",\r
+ "parent_item_name": "speech_balloon",\r
"boost": {\r
"writing_format": {\r
"level": "read",\r
"ground_picture": {\r
"type": "element",\r
"args": {\r
- "parent_model_name": "panel"\r
+ "parent_item_name": "panel"\r
}\r
},\r
"ground_color": {\r
"type": "element",\r
"args": {\r
- "parent_model_name": "panel"\r
+ "parent_item_name": "panel"\r
}\r
},\r
"original_picture": {\r
"license": {\r
"type": "system_resource",\r
"args": {\r
- "parent_model_name": "license_group",\r
+ "parent_item_name": "license_group",\r
"boost": {\r
"license_group": {\r
"extend_model_class_name": "License",\r
},\r
"controllers": {\r
"folders": {\r
- "item_name": "folder",\r
"actions": {\r
"root": {\r
"type": "show"\r
"index": {\r
"type": "list",\r
"args": {\r
- "list_name": "public",\r
"param_id": "none"\r
}\r
},\r
"count": {\r
"type": "count",\r
"args": {\r
- "list_name": "public"\r
+ "action_name": "index"\r
}\r
},\r
"new": {\r
}\r
},\r
"scrolls": {\r
- "item_name": "scroll",\r
"actions": {\r
"index": {\r
"type": "list",\r
"args": {\r
- "list_name": "public",\r
"param_id": "none"\r
}\r
},\r
"play": {\r
"type": "list",\r
"args": {\r
- "item_name": "scroll_panel",\r
- "list_name": "play"\r
+ "alias": "scroll_panels.by_scroll",\r
+ "order": "t",\r
+ "direction": 1\r
}\r
},\r
"show": {\r
"count": {\r
"type": "count",\r
"args": {\r
- "list_name": "public"\r
+ "action_name": "index"\r
}\r
},\r
"count_by_author": {\r
"count_by_panel": {\r
"type": "count"\r
},\r
- "count_play": {\r
- "type": "count"\r
- },\r
"new": {\r
"type": "new"\r
},\r
}\r
},\r
"scroll_panels": {\r
- "item_name": "scroll_panel",\r
"actions": {\r
"index": {\r
"type": "list",\r
"args": {\r
- "list_name": "public",\r
"param_id": "none"\r
}\r
},\r
"param_id": "suffix"\r
}\r
},\r
- "play": {\r
- "type": "list",\r
- "args": {\r
- }\r
- },\r
"show": {\r
"type": "show"\r
},\r
"count": {\r
"type": "count",\r
"args": {\r
- "list_name": "public"\r
+ "action_name": "index"\r
}\r
},\r
"count_by_panel": {\r
"count_by_author": {\r
"type": "count"\r
},\r
- "count_play": {\r
- "type": "count"\r
- },\r
"new": {\r
"type": "new"\r
},\r
}\r
},\r
"comics": {\r
- "item_name": "comic",\r
"actions": {\r
"index": {\r
"type": "list",\r
"args": {\r
- "list_name": "public",\r
"param_id": "none"\r
}\r
},\r
"play": {\r
"type": "list",\r
"args": {\r
- "item_name": "comic_story",\r
- "list_name": "play"\r
+ "alias": "comic_stories.by_comic",\r
+ "order": "t",\r
+ "direction": 1\r
}\r
},\r
"show": {\r
"count": {\r
"type": "count",\r
"args": {\r
- "list_name": "public"\r
+ "action_name": "index"\r
}\r
},\r
"count_by_story": {\r
}\r
},\r
"comic_stories": {\r
- "item_name": "comic_story",\r
"actions": {\r
"index": {\r
"type": "list",\r
"args": {\r
- "list_name": "public",\r
"param_id": "none"\r
}\r
},\r
"count": {\r
"type": "count",\r
"args": {\r
- "list_name": "public"\r
+ "action_name": "index"\r
}\r
},\r
"count_by_comic": {\r
}\r
},\r
"stories": {\r
- "item_name": "story",\r
"actions": {\r
"index": {\r
"type": "list",\r
"args": {\r
- "list_name": "public",\r
"param_id": "none"\r
}\r
},\r
"play": {\r
"type": "list",\r
"args": {\r
- "item_name": "story_sheet",\r
- "list_name": "play"\r
+ "alias": "story_sheets.by_story",\r
+ "order": "t",\r
+ "direction": 1\r
}\r
},\r
"show": {\r
"count": {\r
"type": "count",\r
"args": {\r
- "list_name": "public"\r
+ "action_name": "index"\r
}\r
},\r
"count_by_comic": {\r
}\r
},\r
"story_sheets": {\r
- "item_name": "story_sheet",\r
"actions": {\r
"index": {\r
"type": "list",\r
"args": {\r
- "list_name": "public",\r
"param_id": "none"\r
}\r
},\r
"count": {\r
"type": "count",\r
"args": {\r
- "list_name": "public"\r
+ "action_name": "index"\r
}\r
},\r
"count_by_story": {\r
}\r
},\r
"sheets": {\r
- "item_name": "sheet",\r
"actions": {\r
"index": {\r
"type": "list",\r
"args": {\r
- "list_name": "public",\r
"param_id": "none"\r
}\r
},\r
"play": {\r
"type": "list",\r
"args": {\r
- "item_name": "sheet_panel",\r
- "list_name": "play"\r
+ "alias": "sheet_panels.by_sheet",\r
+ "order": "t",\r
+ "direction": 1\r
}\r
},\r
"show": {\r
"count": {\r
"type": "count",\r
"args": {\r
- "list_name": "public"\r
+ "action_name": "index"\r
}\r
},\r
"count_by_story": {\r
}\r
},\r
"sheet_panels": {\r
- "item_name": "sheet_panel",\r
"actions": {\r
"index": {\r
"type": "list",\r
"args": {\r
- "list_name": "public",\r
"param_id": "none"\r
}\r
},\r
"count": {\r
"type": "count",\r
"args": {\r
- "list_name": "public"\r
+ "action_name": "index"\r
}\r
},\r
"count_by_sheet": {\r
}\r
},\r
"panels": {\r
- "item_name": "panel",\r
"actions": {\r
"index": {\r
"type": "list",\r
"args": {\r
- "list_name": "public",\r
"param_id": "none"\r
}\r
},\r
"count": {\r
"type": "count",\r
"args": {\r
- "list_name": "public"\r
+ "action_name": "index"\r
}\r
},\r
"count_by_scroll": {\r
}\r
},\r
"panel_pictures": {\r
- "item_name": "panel_picture",\r
"actions": {\r
"index": {\r
"type": "list",\r
"args": {\r
- "list_name": "public",\r
"param_id": "none"\r
}\r
},\r
"count": {\r
"type": "count",\r
"args": {\r
- "list_name": "public"\r
+ "action_name": "index"\r
}\r
},\r
"count_by_panel": {\r
}\r
},\r
"speech_balloons": {\r
- "item_name": "speech_balloon",\r
"actions": {\r
"index": {\r
"type": "list",\r
"args": {\r
- "list_name": "public",\r
"param_id": "none"\r
}\r
},\r
"count": {\r
"type": "count",\r
"args": {\r
- "list_name": "public"\r
+ "action_name": "index"\r
}\r
},\r
"count_by_panel": {\r
}\r
},\r
"speeches": {\r
- "item_name": "speech",\r
"actions": {\r
"index": {\r
"type": "list",\r
"args": {\r
- "list_name": "public",\r
"param_id": "none"\r
}\r
},\r
"count": {\r
"type": "count",\r
"args": {\r
- "list_name": "public"\r
+ "action_name": "index"\r
}\r
},\r
"count_by_author": {\r
}\r
},\r
"balloons": {\r
- "item_name": "balloon",\r
"actions": {\r
"index": {\r
"type": "list",\r
"args": {\r
- "list_name": "public",\r
"param_id": "none"\r
}\r
},\r
"count": {\r
"type": "count",\r
"args": {\r
- "list_name": "public"\r
+ "action_name": "index"\r
}\r
},\r
"count_by_author": {\r
}\r
},\r
"ground_pictures": {\r
- "item_name": "ground_picture",\r
"actions": {\r
"index": {\r
"type": "list",\r
"args": {\r
- "list_name": "public",\r
"param_id": "none"\r
}\r
},\r
"count": {\r
"type": "count",\r
"args": {\r
- "list_name": "public"\r
+ "action_name": "index"\r
}\r
},\r
"count_by_panel": {\r
}\r
},\r
"ground_colors": {\r
- "item_name": "ground_color",\r
"actions": {\r
"index": {\r
"type": "list",\r
"args": {\r
- "list_name": "public",\r
"param_id": "none"\r
}\r
},\r
"count": {\r
"type": "count",\r
"args": {\r
- "list_name": "public"\r
+ "action_name": "index"\r
}\r
},\r
"count_by_panel": {\r
}\r
},\r
"original_pictures": {\r
- "item_name": "original_picture",\r
"actions": {\r
"index": {\r
"type": "list",\r
"args": {\r
- "list_name": "private",\r
"param_id": "none"\r
}\r
},\r
"count": {\r
"type": "count",\r
"args": {\r
- "list_name": "private"\r
+ "action_name": "index"\r
}\r
},\r
"new": {\r
}\r
},\r
"pictures": {\r
- "item_name": "picture",\r
"actions": {\r
"index": {\r
"type": "list",\r
"args": {\r
- "list_name": "public",\r
"param_id": "none"\r
}\r
},\r
"count": {\r
"type": "count",\r
"args": {\r
- "list_name": "public"\r
+ "action_name": "index"\r
}\r
},\r
"count_by_artist": {\r
}\r
},\r
"resource_pictures": {\r
- "item_name": "resource_picture",\r
"actions": {\r
"index": {\r
"type": "list",\r
"args": {\r
- "list_name": "public",\r
"param_id": "none"\r
}\r
},\r
"count": {\r
"type": "count",\r
"args": {\r
- "list_name": "public"\r
+ "action_name": "index"\r
}\r
},\r
"count_by_license_group": {\r
}\r
},\r
"speech_balloon_templates": {\r
- "item_name": "speech_balloon_template",\r
"actions": {\r
"index": {\r
"type": "list",\r
"args": {\r
- "list_name": "public",\r
"param_id": "none"\r
}\r
},\r
"count": {\r
"type": "count",\r
"args": {\r
- "list_name": "public"\r
+ "action_name": "index"\r
}\r
},\r
"count_by_panel": {\r
}\r
},\r
"writing_formats": {\r
- "item_name": "writing_format",\r
"actions": {\r
"index": {\r
"type": "list",\r
"args": {\r
- "list_name": "public",\r
"param_id": "none"\r
}\r
},\r
"count": {\r
"type": "count",\r
"args": {\r
- "list_name": "public"\r
+ "action_name": "index"\r
}\r
},\r
"count_by_system_picture": {\r
}\r
},\r
"license_groups": {\r
- "item_name": "license_group",\r
"actions": {\r
"index": {\r
"type": "list",\r
"args": {\r
- "list_name": "public",\r
"param_id": "none"\r
}\r
},\r
"count": {\r
"type": "count",\r
"args": {\r
- "list_name": "public"\r
+ "action_name": "index"\r
}\r
},\r
"new": {\r
}\r
},\r
"licenses": {\r
- "item_name": "license",\r
"actions": {\r
"index": {\r
"type": "list",\r
"args": {\r
- "list_name": "public",\r
"param_id": "none"\r
}\r
},\r
"count": {\r
"type": "count",\r
"args": {\r
- "list_name": "public"\r
+ "action_name": "index"\r
}\r
},\r
"count_by_license_group": {\r
}\r
},\r
"authors": {\r
- "item_name": "author",\r
"actions": {\r
"index": {\r
"type": "list",\r
"args": {\r
- "list_name": "public",\r
"param_id": "none"\r
}\r
},\r
"count": {\r
"type": "count",\r
"args": {\r
- "list_name": "public"\r
+ "action_name": "index"\r
}\r
},\r
"new": {\r
}\r
},\r
"artists": {\r
- "item_name": "artist",\r
"actions": {\r
"index": {\r
"type": "list",\r
"args": {\r
- "list_name": "public",\r
"param_id": "none"\r
}\r
},\r
"count": {\r
"type": "count",\r
"args": {\r
- "list_name": "public"\r
+ "action_name": "index"\r
}\r
},\r
"new": {\r
}\r
},\r
"system_pictures": {\r
- "item_name": "system_picture",\r
"actions": {\r
"index": {\r
"type": "list",\r
"args": {\r
- "list_name": "public",\r
"param_id": "none"\r
}\r
},\r
"count": {\r
"type": "count",\r
"args": {\r
- "list_name": "public"\r
+ "action_name": "index"\r
}\r
}\r
}\r
"type": "list",\r
"args": {\r
"item_name": "scroll",\r
- "list_name": "private",\r
"param_id": "none",\r
"counter_name": "scrolls_count"\r
}\r
"type": "list",\r
"args": {\r
"item_name": "scroll_panel",\r
- "list_name": "private",\r
"param_id": "none",\r
"counter_name": "scroll_panels_count"\r
}\r
"type": "list",\r
"args": {\r
"item_name": "comic",\r
- "list_name": "private",\r
"param_id": "none",\r
"counter_name": "comics_count"\r
}\r
"type": "list",\r
"args": {\r
"item_name": "comic_story",\r
- "list_name": "private",\r
"param_id": "none",\r
"counter_name": "comic_stories_count"\r
}\r
"type": "list",\r
"args": {\r
"item_name": "story",\r
- "list_name": "private",\r
"param_id": "none",\r
"counter_name": "stories_count"\r
}\r
"type": "list",\r
"args": {\r
"item_name": "story_sheet",\r
- "list_name": "private",\r
"param_id": "none",\r
"counter_name": "story_sheets_count"\r
}\r
"type": "list",\r
"args": {\r
"item_name": "sheet",\r
- "list_name": "private",\r
"param_id": "none",\r
"counter_name": "sheets_count"\r
}\r
"type": "list",\r
"args": {\r
"item_name": "sheet_panel",\r
- "list_name": "private",\r
"param_id": "none",\r
"counter_name": "sheet_panels_count"\r
}\r
"type": "list",\r
"args": {\r
"item_name": "panel",\r
- "list_name": "private",\r
"param_id": "none",\r
"counter_name": "panels_count"\r
}\r
"type": "list",\r
"args": {\r
"item_name": "panel_picture",\r
- "list_name": "private",\r
"param_id": "none",\r
"counter_name": "panel_pictures_count"\r
}\r
"type": "list",\r
"args": {\r
"item_name": "speech_balloon",\r
- "list_name": "private",\r
"param_id": "none",\r
"counter_name": "speech_balloons_count"\r
}\r
"type": "list",\r
"args": {\r
"item_name": "speech",\r
- "list_name": "private",\r
"param_id": "none",\r
"counter_name": "speeches_count"\r
}\r
"type": "list",\r
"args": {\r
"item_name": "balloon",\r
- "list_name": "private",\r
"param_id": "none",\r
"counter_name": "balloons_count"\r
}\r
"type": "list",\r
"args": {\r
"item_name": "ground_picture",\r
- "list_name": "private",\r
"param_id": "none",\r
"counter_name": "ground_pictures_count"\r
}\r
"type": "list",\r
"args": {\r
"item_name": "ground_color",\r
- "list_name": "private",\r
"param_id": "none",\r
"counter_name": "ground_colors_count"\r
}\r
"type": "list",\r
"args": {\r
"item_name": "original_picture",\r
- "list_name": "private",\r
"param_id": "none",\r
"counter_name": "count"\r
}\r
"type": "list",\r
"args": {\r
"item_name": "resource_picture",\r
- "list_name": "private",\r
"param_id": "none",\r
"counter_name": "resource_pictures_count"\r
}\r
"type": "count",\r
"args": {\r
"item_name": "scroll",\r
- "list_name": "private",\r
"param_id": "none"\r
}\r
},\r
"type": "count",\r
"args": {\r
"item_name": "scroll_panel",\r
- "list_name": "private",\r
"param_id": "none"\r
}\r
},\r
"type": "count",\r
"args": {\r
"item_name": "comic",\r
- "list_name": "private",\r
"param_id": "none"\r
}\r
},\r
"type": "count",\r
"args": {\r
"item_name": "comic_story",\r
- "list_name": "private",\r
"param_id": "none"\r
}\r
},\r
},\r
"models": {\r
"folder": {\r
- "table_name": "folders",\r
"associations": {\r
"belongs_to": {},\r
"has_many": {}\r
}\r
},\r
"scroll": {\r
- "table_name": "scrolls",\r
"associations": {\r
"belongs_to": {\r
"author": {}\r
}\r
},\r
"scroll_panel": {\r
- "table_name": "scroll_panels",\r
"associations": {\r
"belongs_to": {\r
"panel": {},\r
}\r
},\r
"comic": {\r
- "table_name": "comics",\r
"associations": {\r
"belongs_to": {\r
"author": {}\r
}\r
},\r
"comic_story": {\r
- "table_name": "comic_stories",\r
"associations": {\r
"belongs_to": {\r
"comic": {},\r
}\r
},\r
"story": {\r
- "table_name": "stories",\r
"associations": {\r
"belongs_to": {\r
"author": {}\r
}\r
},\r
"story_sheet": {\r
- "table_name": "story_sheets",\r
"associations": {\r
"belongs_to": {\r
"story": {},\r
}\r
},\r
"sheet": {\r
- "table_name": "sheets",\r
"associations": {\r
"belongs_to": {\r
"author": {}\r
}\r
},\r
"sheet_panel": {\r
- "table_name": "sheet_panels",\r
"associations": {\r
"belongs_to": {\r
"sheet": {},\r
}\r
},\r
"panel": {\r
- "table_name": "panels",\r
"associations": {\r
"belongs_to": {\r
"author": {}\r
}\r
},\r
"panel_picture": {\r
- "table_name": "panel_pictures",\r
"associations": {\r
"belongs_to": {\r
"panel": {}\r
}\r
},\r
"speech_balloon": {\r
- "table_name": "speech_balloons",\r
"associations": {\r
"belongs_to": {\r
"panel": {},\r
}\r
},\r
"balloon": {\r
- "table_name": "balloons",\r
"associations": {\r
"belongs_to": {\r
"speech_balloon": {},\r
}\r
},\r
"speech": {\r
- "table_name": "speeches",\r
"associations": {\r
"belongs_to": {\r
"speech_balloon": {},\r
}\r
},\r
"ground_picture": {\r
- "table_name": "ground_pictures",\r
"associations": {\r
"belongs_to": {\r
"panel": {}\r
}\r
},\r
"ground_color": {\r
- "table_name": "ground_colors",\r
"associations": {\r
"belongs_to": {\r
"panel": {}\r
}\r
},\r
"original_picture": {\r
- "table_name": "original_pictures",\r
"associations": {\r
"belongs_to": {\r
"artist": {}\r
}\r
},\r
"picture": {\r
- "table_name": "pictures",\r
"associations": {\r
"belongs_to": {\r
"license": {},\r
}\r
},\r
"resource_picture": {\r
- "table_name": "resource_pictures",\r
"associations": {\r
"belongs_to": {\r
"original_picture": {},\r
}\r
},\r
"original_picture_license_group": {\r
- "table_name": "original_picture_license_groups",\r
"associations": {\r
"belongs_to": {\r
"original_picture": {},\r
}\r
},\r
"original_picture_license": {\r
- "table_name": "original_picture_licenses",\r
"associations": {\r
"belongs_to": {\r
"original_picture": {},\r
"source": {\r
"type": "filter",\r
"args": {\r
- "resource_list_name": "by_license_group",\r
+ "resource_action_name": "by_license_group",\r
"filter_column_name": "license_group_id"\r
}\r
},\r
}\r
},\r
"speech_balloon_template": {\r
- "table_name": "speech_balloon_templates",\r
"associations": {\r
"belongs_to": {\r
"system_picture": {}\r
}\r
},\r
"writing_format": {\r
- "table_name": "writing_formats",\r
"associations": {\r
"belongs_to": {\r
"system_picture": {}\r
}\r
},\r
"license_group": {\r
- "table_name": "license_groups",\r
"associations": {\r
"belongs_to": {},\r
"has_many": {\r
}\r
},\r
"license": {\r
- "table_name": "licenses",\r
"associations": {\r
"belongs_to": {\r
"license_group": {},\r
}\r
},\r
"author": {\r
- "table_name": "authors",\r
"associations": {\r
"belongs_to": {},\r
"has_many": {\r
}\r
},\r
"artist": {\r
- "table_name": "artists",\r
"associations": {\r
"belongs_to": {},\r
"has_many": {\r
}\r
},\r
"system_picture": {\r
- "table_name": "system_pictures",\r
"associations": {\r
"belongs_to": {},\r
"has_many": {\r