model_name: 'scroll',\r
actions: {\r
index: {\r
+ type: 'list',\r
list: {\r
- list_name: 'public',\r
+ list_name: 'public_list',\r
+ \r
+ },\r
+ },\r
+ show: {\r
+ type: 'show',\r
+ name: 'show',\r
+ },\r
+ },\r
+ },\r
+ home: {\r
+ actions: {\r
+ scrolls: {\r
+ item_name: 'scroll',\r
+ type: 'list',\r
+ list: {\r
+ list_name: 'public_list',\r
\r
},\r
},\r
}, \r
},\r
},\r
+ filters: {\r
+ by_author: {\r
+ type: 'filter',\r
+ key: 'author_id',\r
+ },\r
+ },\r
+ through_filters: {\r
+ by_panel: {\r
+ through: 'scroll_panels',\r
+ key: 'panel_id',\r
+ },\r
+ },\r
attributes: {\r
id: {\r
type: 'number',\r
},\r
lists: {\r
scroll: {\r
- default_page_size: 20, \r
- public_list: {\r
- type: 'public',\r
- },\r
- private_list: {\r
- type: 'private',\r
- },\r
- scroll_panels: {\r
- type: 'has_many',\r
- association_name: 'scroll_panels',\r
- },\r
- panels: {\r
- type: 'has_many',\r
- association_name: 'panels',\r
- },\r
- by_panel: {\r
- type: 'filter',\r
- filter_key: 'scroll_id',\r
- list: {\r
- method: 'filtered_list',\r
+ default_page_size: 25, \r
+ max_page_size: 100, \r
+ lists: {\r
+ public_list: {\r
+ type: 'public',\r
+ },\r
+ private_list: {\r
+ type: 'private',\r
+ },\r
+ scroll_panels: {\r
+ type: 'has_many',\r
+ association_name: 'scroll_panels',\r
+ },\r
+ panels: {\r
+ type: 'has_many',\r
+ association_name: 'panels',\r
+ },\r
+ by_panel: {\r
+ type: 'throughfilter',\r
+ filter_key: 'panel_id',\r
+ list: {\r
+ method: 'filtered_list',\r
+ },\r
},\r
},\r
},\r
scroll_panel: {\r
+ default_page_size: 20, \r
+ lists: {\r
+ public_list: {\r
+ type: 'public',\r
+ },\r
+ private_list: {\r
+ type: 'private',\r
+ },\r
+ by_scroll: {\r
+ type: 'filter',\r
+ filter_key: 'scroll_id',\r
+ list: {\r
+ method: 'filtered_list',\r
+ },\r
+ },\r
+ by_panel: {\r
+ type: 'filter',\r
+ filter_key: 'panel_id',\r
+ list: {\r
+ method: 'filtered_list',\r
+ },\r
+ },\r
+ },\r
},\r
comic: {\r
+ default_page_size: 20, \r
+ lists: {\r
+ public_list: {\r
+ type: 'public',\r
+ },\r
+ private_list: {\r
+ type: 'private',\r
+ },\r
+ stories: {\r
+ type: 'has_many',\r
+ association_name: 'stories',\r
+ },\r
+ },\r
},\r
story: {\r
+ default_page_size: 20, \r
+ lists: {\r
+ public_list: {\r
+ type: 'public',\r
+ },\r
+ private_list: {\r
+ type: 'private',\r
+ },\r
+ story_sheets: {\r
+ type: 'has_many',\r
+ association_name: 'story_sheets',\r
+ },\r
+ sheets: {\r
+ type: 'has_many',\r
+ association_name: 'sheets',\r
+ },\r
+ by_comic: {\r
+ type: 'filter',\r
+ filter_key: 'comic_id',\r
+ list: {\r
+ method: 'filtered_list',\r
+ },\r
+ },\r
+ },\r
},\r
story_sheet: {\r
+ default_page_size: 20, \r
+ lists: {\r
+ public_list: {\r
+ type: 'public',\r
+ },\r
+ private_list: {\r
+ type: 'private',\r
+ },\r
+ by_story: {\r
+ type: 'filter',\r
+ filter_key: 'story_id',\r
+ list: {\r
+ method: 'filtered_list',\r
+ },\r
+ },\r
+ by_sheet: {\r
+ type: 'filter',\r
+ filter_key: 'sheet_id',\r
+ list: {\r
+ method: 'filtered_list',\r
+ },\r
+ },\r
+ },\r
},\r
sheet: {\r
+ default_page_size: 20, \r
+ lists: {\r
+ public_list: {\r
+ type: 'public',\r
+ },\r
+ private_list: {\r
+ type: 'private',\r
+ },\r
+ story_sheets: {\r
+ type: 'has_many',\r
+ association_name: 'story_sheets',\r
+ },\r
+ sheet_panels: {\r
+ type: 'has_many',\r
+ association_name: 'sheet_panels',\r
+ },\r
+ },\r
},\r
sheet_panel: {\r
+ default_page_size: 20, \r
+ lists: {\r
+ public_list: {\r
+ type: 'public',\r
+ },\r
+ private_list: {\r
+ type: 'private',\r
+ },\r
+ by_sheet: {\r
+ type: 'filter',\r
+ filter_key: 'sheet_id',\r
+ list: {\r
+ method: 'filtered_list',\r
+ },\r
+ },\r
+ by_panel: {\r
+ type: 'filter',\r
+ filter_key: 'panel_id',\r
+ list: {\r
+ method: 'filtered_list',\r
+ },\r
+ },\r
+ },\r
},\r
panel: {\r
},\r
system_picture: {\r
},\r
},\r
- licenses: {\r
- pettanr_creative_commons_v30_licenses: 'PettanrCreativeCommonsV30Licenses',\r
- pettanr_pettan_commons_v01_licenses: 'PettanrPettanCommonsV01Licenses',\r
- pettanr_pettan_protected_v01_licenses: 'PettanrPettanProtectedV01Licenses',\r
- pettanr_pettan_public_v01_licenses: 'PettanrPettanPublicV01Licenses',\r
- pettanr_public_domain_v01_licenses: 'PettanrPublicDomainV01Licenses',\r
- pettanr_unknown_v01_licenses: 'PettanrUnknownV01Licenses',\r
- },\r
- elements: {\r
- PanelPicture: 'panel_pictures',\r
- SpeechBalloon: 'speech_balloons',\r
- GroundPicture: 'ground_pictures',\r
- GroundColor: 'ground_colors',\r
- },\r
- speech_balloon_templates: {\r
- CircleSpeechBalloon: 'circle_speech_balloon',\r
- PlainSpeechBalloon: 'plain_speech_balloon',\r
- SquareSpeechBalloon: 'square_speech_balloon',\r
- # TestSpeechBalloon: 'test_speech_balloon',\r
- },\r
- writing_formats: {\r
- SimpleFormat: 'pettanr_simple_format',\r
- },\r
- profile: {\r
- "users": {\r
- "caption": "ペンギン王国",\r
- "url": "http://localhost:3001/", \r
- "description": "ペンギン王国はペンギン素材を豊富に用意したペンギンマニアのサイトです。",\r
+ system_resources: {\r
+ licenses: {\r
+ pettanr_creative_commons_v30_licenses: 'PettanrCreativeCommonsV30Licenses',\r
+ pettanr_pettan_commons_v01_licenses: 'PettanrPettanCommonsV01Licenses',\r
+ pettanr_pettan_protected_v01_licenses: 'PettanrPettanProtectedV01Licenses',\r
+ pettanr_pettan_public_v01_licenses: 'PettanrPettanPublicV01Licenses',\r
+ pettanr_public_domain_v01_licenses: 'PettanrPublicDomainV01Licenses',\r
+ pettanr_unknown_v01_licenses: 'PettanrUnknownV01Licenses',\r
},\r
- "admins": {\r
- "caption": "site name for admin",\r
- "url": "http://your.site.url/admins/", \r
- "description": "admin register",\r
+ elements: {\r
+ PanelPicture: 'panel_pictures',\r
+ SpeechBalloon: 'speech_balloons',\r
+ GroundPicture: 'ground_pictures',\r
+ GroundColor: 'ground_colors',\r
+ },\r
+ speech_balloon_templates: {\r
+ CircleSpeechBalloon: 'circle_speech_balloon',\r
+ PlainSpeechBalloon: 'plain_speech_balloon',\r
+ SquareSpeechBalloon: 'square_speech_balloon',\r
+ # TestSpeechBalloon: 'test_speech_balloon',\r
+ },\r
+ writing_formats: {\r
+ SimpleFormat: 'pettanr_simple_format',\r
},\r
- "demand_users": {\r
- "caption": "provider name",\r
- "url": "http://your.site.url/demanders/", \r
- "description": "provider description",\r
- }\r
},\r
magic_numbers: {\r
run_mode: 1, \r
thumbnail_width: 64, \r
thumbnail_height: 64, \r
+ profile: {\r
+ users: {\r
+ caption: "ペンギン王国",\r
+ url: "http://localhost:3001/", \r
+ description: "ペンギン王国はペンギン素材を豊富に用意したペンギンマニアのサイトです。",\r
+ },\r
+ admins: {\r
+ caption: "site name for admin",\r
+ url: "http://your.site.url/admins/", \r
+ description: "admin register",\r
+ },\r
+ demand_users: {\r
+ caption: "provider name",\r
+ url: "http://your.site.url/demanders/", \r
+ description: "provider description",\r
+ },\r
+ },\r
+ provider_sources: [\r
+ 'http://sourceforge.jp/projects/pettanr/wiki/ProviderSource/attach/provider_source.json'\r
+ ], \r
+ },\r
+ select_items: {\r
provider_status_status_items: [\r
['select_items.provider_status.status.waiting', 0], \r
['select_items.provider_status.status.receiving', 1], \r
- ]\r
+ ],\r
demander_status_status_items: [\r
['select_items.demander_status.status.waiting', 0], \r
['select_items.demander_status.status.rejected', 1], \r
['select_items.demander_status.status.requesting', 2], \r
['select_items.demander_status.status.approved', 3], \r
- ]\r
+ ],\r
scroll_visible_items: [\r
['select_items.scroll.visible.private', 0], \r
['select_items.scroll.visible.public', 1], \r
- ]\r
+ ],\r
comic_visible_items: [\r
['select_items.comic.visible.private', 0], \r
['select_items.comic.visible.public', 1], \r
- ]\r
+ ],\r
story_visible_items: [\r
['select_items.story.visible.private', 0], \r
['select_items.story.visible.public', 1], \r
- ]\r
+ ],\r
sheet_visible_items: [\r
['select_items.sheet.visible.private', 0], \r
['select_items.sheet.visible.public', 1], \r
- ]\r
+ ],\r
panel_visible_items: [\r
['select_items.panel.visible.private', 0], \r
['select_items.panel.visible.public', 1], \r
- ]\r
+ ],\r
ground_picture_repeat_items: [\r
['select_items.ground_pictures.repeat.repeat', 0], \r
['select_items.ground_pictures.repeat.repeat-x', 1], \r
['select_items.ground_pictures.repeat.repeat-y', 2], \r
['select_items.ground_pictures.repeat.no-repeat', 3], \r
- ]\r
+ ],\r
ground_color_orientation_items: [\r
['select_items.ground_color.orientation.horizontal', 0], \r
['select_items.ground_color.orientation.vertical', 1], \r
- ]\r
+ ],\r
speech_font_size_items: [\r
['select_items.speeches.font_size.ultra_small', 0.2], \r
['select_items.speeches.font_size.very_small', 0.4], \r
['select_items.speeches.font_size.large', 2.0], \r
['select_items.speeches.font_size.very_large', 3.5], \r
['select_items.speeches.font_size.ultra_large', 5.0], \r
- ]\r
+ ],\r
speech_text_align_items: [\r
['select_items.speeches.text_align.none', 0], \r
['select_items.speeches.text_align.left', 1], \r
['select_items.speeches.text_align.right', 2], \r
['select_items.speeches.text_align.center', 3], \r
- ]\r
- provider_sources: [\r
- 'http://sourceforge.jp/projects/pettanr/wiki/ProviderSource/attach/provider_source.json'\r
- ]\r
+ ],\r
},\r
locals: {\r
profilers: {\r
scroll: {\r
+ lists: {\r
+ 'scroll_panels.by_scroll': {\r
+ model_name: 'scroll_panel',\r
+ list_name: 'by_scroll',\r
+ }, \r
+ }, \r
columns: [\r
'id', \r
'title', \r
'author',\r
],\r
has_many: [\r
- 'scroll_panels', \r
- 'panels'\r
+ 'scroll_panels.by_scroll', \r
+ 'panels.by_scroll'\r
],\r
}, \r
},\r
before_filter :authenticate_admin!, :only => [:list, :browse]
@@model = Comic
- @@controller = Pettanr::ControllerManager.new @@model.item_name, Pettanr.manifest
- @@list_manager = Pettanr::Application::manifest.list_managers[@@model.item_name]
- @@filer_manager = Pettanr::Application::manifest.filer_managers[@@model.item_name]
+ @@controller = Pettanr::Application::manifest.controller_managers[@@model.item_name]
@@profiler_manager = Pettanr::Application::manifest.profiler_managers[@@model.item_name]
def index
- @c = @@controller.open(params[:action])
- @list = @@list_manager.open(@page, @page_size, @operators)
- @items = @c.items
+ @action = @@controller.open(params, @operators)
+ @items = @action.items
respond_to do |format|
format.html {
- @filer = @@filer_manager.open(@items, @operators, @list.paginate)
+ @filer = @action.filer
render :template => 'system/filer', :locals => {
:filer => @filer
}
end
def scrolls
- @page = Author.page params[:page]
- @page_size = Author.scroll_page_size params[:page_size]
- @scrolls = Scroll.mylist(@author, @page, @page_size)
+ model = Scroll
+ controller = Pettanr::Application::manifest.controller_managers[model.item_name]
+ action_name = 'private'
+ @action = controller.open(action_name, params, @operators)
+ @items = @action.items
respond_to do |format|
format.html {
- @paginate = Scroll.mylist_paginate(@author, @page, @page_size)
+ @filer = @action.filer
render :template => 'system/filer', :locals => {
- :items => @scrolls, :model => Scroll,
- :roles => [@user, @admin], :pager => @paginate
+ :filer => @filer
}
}
- format.json { render json: @scrolls.to_json(Scroll.list_json_opt) }
+ format.json { render json: @items.to_json(Scroll.list_json_opt) }
end
end
before_filter :authenticate_admin!, :only => [:list, :browse]
@@model = Scroll
+ @@controller = Pettanr::Application::manifest.controller_managers[@@model.item_name]
+ @@profiler_manager = Pettanr::Application::manifest.profiler_managers[@@model.item_name]
+
def index
- set_filer
-
+ action_name = params[:action]
+ @action = @@controller.open(action_name, params, @operators)
+ @items = @action.items
respond_to do |format|
- format_filer format
+ format.html {
+ @filer = @action.filer
+ render :template => 'system/filer', :locals => {
+ :filer => @filer
+ }
+ }
format.json { render json: @items.to_json(@@model.list_json_opt) }
format.atom
format.rss
end
}
format.json { render json: @item.to_json(Scroll.show_json_opt) }
- format_prof format
+ format.prof {
+ @profiler = @@profiler_manager.open(@item, @operators)
+ render :template => 'system/prof', :locals => {
+ :profiler => @profiler
+ }
+ }
format.atom
format.rss
end
@scroll = Scroll.new
@scroll.supply_default
@scroll.attributes = params[:scroll]
- @scroll.overwrite @author
+ @scroll.overwrite @operators
respond_to do |format|
if @scroll.save
module ApplicationHelper
+ def manifest
+ Pettanr::Application.manifest
+ end
+
def full_url filename
request.protocol + request.host_with_port + filename
end
end
def self.each_element_class_names
- Pettanr::Application.elements.each do |k, n|
+ Pettanr::Application.manifest.system_resources.elements.each do |k, n|
yield k
end
end
before_validation :valid_encode
+ cattr_reader :singular, :plural
+ @@singular = 'Scroll'
+ @@plural = 'Scrolls'
+ def self.item_name
+ self.singular.underscore
+ end
+
+ def item_name
+ self.class.item_name
+ end
+
+ def self.path_name with_engine = false
+ self.plural.underscore
+ end
+
+ def path_name
+ self.class.path_name
+ end
+
def valid_encode
['title', 'description'].each do |a|
next if attributes[a] == nil
self.visible = 0 if self.visible.blank?
end
- def overwrite au
- return false unless au
- self.author_id = au.id
+ def overwrite operators
+ return false unless operators.author
+ self.author_id = operators.author.id
end
def own? roles
self.author_id == au.id
end
- def visible? roles
+ def visible? operators
if MagicNumber['run_mode'] == 0
- return false unless guest_role_check(roles)
+ return false unless operators.guest?
else
- return false unless reader_role_check(roles)
+ return false unless operators.resource_reader?
end
- return true if self.own?(roles)
self.visible > 0
end
page_size
end
+ def self.list_order
+ 'scrolls.updated_at desc'
+ end
+
def self.list_where
'scrolls.visible > 0'
end
{:include => {:scroll_panels => {:include => {:panel => {}}}, :author => {}}}
end
- def self.show sid, roles
+ def self.show sid, operators
opt = {}
opt.merge!(Scroll.show_opt)
res = Scroll.find(sid, opt)
- raise ActiveRecord::Forbidden unless res.visible?(roles)
+ raise ActiveRecord::Forbidden unless res.visible?(operators)
res
end
def self.enable_list
SpeechBalloonTemplate.list.delete_if {|sbt|
- Pettanr::Application.speech_balloons[sbt.classname] == nil
+ Pettanr::Application.manifest.system_resources.speech_balloon_templates[sbt.classname] == nil
}
end
end
def engine_name
- Pettanr::Application.speech_balloons[self.classname]
+ Pettanr::Application.manifest.system_resources.speech_balloon_templates[self.classname]
end
def engine_module_name
end
def engine_name
- Pettanr::Application.writing_formats[self.classname]
+ Pettanr::Application.manifest.system_resources.writing_formats[self.classname]
end
def enable?
- Pettanr::Application.writing_formats.include? self.classname
+ Pettanr::Application.manifest.system_resources.writing_formats.include? self.classname
end
def engine_module_name
<% else %>\r
<%= t("#{params[:controller]}.#{params[:action]}.title") %>\r
<% end %>\r
- - <%= h(MagicNumber['profile']['users']['caption']) %>\r
+ - <%= h(manifest.magic_numbers['profile']['users']['caption']) %>\r
</title>\r
<%= stylesheet_link_tag "application" %>\r
<%= javascript_include_tag "application" %>\r
<table class="no-border">\r
<tr>\r
<td width="50%">\r
- <h3><%= link_to MagicNumber['profile']['users']['caption'], main_app.root_path %></h3>\r
+ <h3><%= link_to manifest.magic_numbers['profile']['users']['caption'], main_app.root_path %></h3>\r
</td>\r
<td width="30%">\r
<% if user_signed_in? %>\r
<% else %>\r
<%= t("#{params[:controller]}.#{params[:action]}.title") %>\r
<% end %>\r
- - <%= h(MagicNumber['profile']['users']['caption']) %>\r
+ - <%= h(manifest.magic_numbers['profile']['users']['caption']) %>\r
</title>\r
<%= stylesheet_link_tag "application" %>\r
<%= javascript_include_tag "application" %>\r
</div>
<div class="field">
<%= f.label :author_id %><br />
- <%= h @author.name %>
+ <%= h @operators.author.name %>
</div>
<div class="row_break">
</div>
-<% model_name = model.to_s.underscore %>
-<% path_name = model.to_s.tableize %>
-<% filer_configurations = configurations['filers'][model.to_s.underscore] || {} %>
-<% symbol = filer_configurations['symbol'] || {} %>
-<% symbol_type = symbol['type'] || 'src' %>
-<% caption = filer_configurations['caption'] || {} %>
-<% caption_type = caption['type'] || 'column' %>
-<% summary = filer_configurations['summary'] || {} %>
-<% summary_type = summary['type'] || 'none' %>
-<% edit = filer_configurations['edit'] || {} %>
-<% edit_type = edit['type'] || 'default' %>
<div>
- <%= model.model_name.human %>
+ <%= filer.model.model_name.human %>
</div>
<ul class="filer">
- <li id="" class="filer-head filer-head-<%= model.to_s.underscore -%>">
+ <li id="" class="filer-head filer-head-<%= filer.model_name -%>">
<div id="" class="filer-head-symbol">
symbol
</div>
- <% unless caption_type == 'none' %>
+ <% if filer.caption.visible? %>
<div id="" class="filer-head-caption">
caption
</div>
<% end %>
- <% unless summary_type == 'none' %>
+ <% if filer.summary.visible? %>
<div id="" class="filer-head-summary">
summary
</div>
<div id="" class="filer-head-date">
date
</div>
- <% unless edit_type == 'none' %>
+ <% if filer.edit.visible? %>
<div id="" class="filer-head-edit">
edit
</div>
<% end %>
</li>
- <% items.each do |item| %>
- <li id="" class="filer-item filer-item-<%= model.to_s.underscore -%>">
+ <% filer.file_items.each do |file_item| %>
+ <li id="" class="filer-item filer-item-<%= filer.model_name -%>">
<div id="" class="filer-item-symbol">
- <%= filer.symbol item, self %>
- </div>
- <div id="" class="filer-item-caption">
- <%= filer.caption item, self %>
- </div>
- <div id="" class="filer-item-summary">
- <%= filer.summary item, self %>
+ <%= 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">
- <%= filer.icon item, self %>
+ <%= file_item.icon self %>
</div>
<div id="" class="filer-item-date">
- <%= filer.date item, self %>
- </div>
- <div id="" class="filer-item-edit">
- <%= filer.edit item, self %>
+ <%= 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 pager %>
- <%= paginate(pager) %>
+<% if filer.paginate %>
+ <%= paginate(filer.paginate) %>
<% end %>
-<%= render 'system/filer', {:items => items, :model => model, :roles => roles, :pager => pager} %>
+<%= render 'system/filer', {:filer => filer} %>
-<% item_name = item.class.to_s.underscore %>\r
-<% profile = configurations['profiles'][item_name] || {} %>\r
-<% model_conf = configurations['models'][item_name] || {} %>\r
-<% model_attributes = model_conf['attributes'] || {} %>\r
-<% model_associations = model_conf['associations'] || {} %>\r
-<% profile_associations = profile['associations'] || {} %>\r
-<%= render 'system/filer.html', :items => [item], :model => item.class, :roles => roles, :pager => nil %>\r
-<% profile['fields'].each do |field_name| %>\r
- <% field_conf = model_attributes[field_name] || {} %>\r
+<%= render 'system/filer.html', :filer => profiler.header_filer %>\r
+<% profiler.each_column do |column| %>\r
<div>\r
- <%= item.class.human_attribute_name(field_name) %>\r
- <% case field_conf['type'] %>\r
- <% when 'datetime' %>\r
- <% if item.attributes[field_name] %>\r
- <%= l item.attributes[field_name] %>\r
- <% else %>\r
- <%= item.attributes[field_name] %>\r
- <% end %>\r
- <% else %>\r
- <%= item.attributes[field_name] %>\r
- <% end %>\r
- <% if field_conf['source'] %>\r
- <% case field_conf['source']['type'] %>\r
- <% when 'magic_number' %>\r
- (<%= t_selected_item(field_conf['source']['key'], item.attributes[field_name]) %>)\r
- <% when 'model' %>\r
- <% else %>\r
- <% end %>\r
- <% end %>\r
+ <%= column.label self %>\r
+ <%= column.disp_value self %>\r
+ <%= column.note self %>\r
</div>\r
<% end %>\r
<div>\r
<div>\r
<%= 'belongs_to' %>\r
</div>\r
-<% (profile_associations['belongs_to'] || []).each do |association_model_name| %>\r
- <% belongs_to_conf = model_associations['belongs_to'][association_model_name] %>\r
- <% parent_model = association_model_name.classify.constantize %>\r
- <% id_column = belongs_to_conf['id_column'] %>\r
- <% parent = nil %>\r
- <% begin %>\r
- <% parent = parent_model.show(item.attributes[id_column], roles) %>\r
- <% rescue ActiveRecord::RecordNotFound %>\r
- <% end %>\r
- <% if parent %>\r
- <%= render 'system/filer.html', :items => [parent], :model => parent.class, :roles => roles, :pager => nil %>\r
- <% end %>\r
+<% profiler.each_belongs_to do |parent_filer| %>\r
+ <%= render 'system/filer.html', :filer => parent_filer %>\r
<% end %>\r
<div>\r
<%= 'has_many' %>\r
</div>\r
-<% (profile_associations['has_many'] || []).each do |association_model_name| %>\r
- <% has_many_conf = model_associations['has_many'][association_model_name] %>\r
- <% child_model = association_model_name.classify.constantize %>\r
- <% foreign_key = has_many_conf['foreign_key'] %>\r
- <% children = child_model.__send__(has_many_conf['list_method'], item.attributes['id'], roles, 1, 3) %>\r
- <%= render 'system/filer.html', :items => children, :model => child_model, :roles => roles, :pager => nil %>\r
+<% profiler.each_belongs_to do |has_many_filer| %>\r
+ <%= render 'system/filer.html', :filer => has_many_filer %>\r
<% end %>\r
<div>\r
<%= 'has_one' %>\r
</div>\r
-<% (profile_associations['has_one'] || []).each do |association_model_name| %>\r
- <% has_one_conf = model_associations['has_one'][association_model_name] %>\r
- <% child_model = association_model_name.classify.constantize %>\r
- <% foreign_key = has_one_conf['foreign_key'] %>\r
- <% children = child_model.__send__(has_one_conf['list_method'], item.attributes['id'], roles, 1, 3) %>\r
- <%= render 'system/filer.html', :items => children, :model => child_model, :roles => roles, :pager => nil %>\r
+<% profiler.each_has_one do |has_one_filer| %>\r
+ <%= render 'system/filer.html', :filer => has_one_filer %>\r
<% end %>\r
config.assets.version = '1.0'
config.autoload_paths += %W(#{config.root}/lib/validators)
+=begin
def self.licenses=(ary)
@@licenses = ary
def self.elements
@@elements || {}
end
+=end
def self.manifest=(arg)
@@manifest = Pettanr::Manifest.new arg
end
+=begin
Pettanr::Application.licenses = YAML.load(open(Rails.root + 'config/license.yml').read)
Pettanr::Application.speech_balloons = YAML.load(open(Rails.root + 'config/speech_balloon.yml').read)
Pettanr::Application.writing_formats = YAML.load(open(Rails.root + 'config/writing_format.yml').read)
Pettanr::Application.elements = YAML.load(open(Rails.root + 'config/element.yml').read)
-MagicNumber = YAML.load(open(Rails.root + 'config/magic_number.yml').read)
+=end
+Pettanr::Application.manifest = JSON.parse(open(Rails.root + 'public/manifest.json').read)
+MagicNumber = Pettanr::Application.manifest.magic_numbers
+MagicNumber.merge! Pettanr::Application.manifest.select_items
MagicNumber['test_layout'] = if File.exist? Rails.root + 'config/test_layout'
'test'
else
false
end
-MagicNumber['profile'] = JSON.parse(open(Rails.root + 'config/profile.json').read).first[1] #strip profile body
-Pettanr::Application.manifest = JSON.parse(open(Rails.root + 'public/manifest.json').read)
y = YAML.load(open(Rails.root + 'config/picture_io.yml').read)
require y[Rails.env]["adapter"]
devise_for :admins
devise_for :demand_users
- Pettanr::Application.licenses.each do |name, klass|
+ Pettanr::Application.manifest.system_resources.licenses.each do |name, klass|
mount Module.const_get(klass)::Engine => "/#{name}"
end
- Pettanr::Application.speech_balloons.each do |klass , name|
+ Pettanr::Application.manifest.system_resources.speech_balloon_templates.each do |klass , name|
mount Module.const_get(klass)::Engine => "/#{name}"
end
require "manifest/manifest"
+require "manifest/controller"
require "manifest/model"
require "manifest/list"
require "manifest/profiler"
module Pettanr
class ControllerManager
- class Controller
- def initialize item_name, conf, manifest
+ class ActionList
+ def initialize action_name, item_name, operators, list, conf, manifest
+ @action_name = action_name
@item_name = item_name
+ @operators = operators
+ @list = list
@conf = conf
@manifest = manifest
-
- @model_name = @conf['odel_name']
end
- def items
- @model.private_list @operators, @page, @page_size
+ def items
+ @items ||= @list.items
+ end
+
+ def filer
+ @filer ||= @manifest.filer_managers[@item_name].open(@item_name, @items, @operators, @list.paginate)
end
- def paginate
- @model.list_paginate(@page, @page_size)
+ end
+
+ class ActionShow
+ def initialize action_name, item_name, conf, manifest
+ @action_name = action_name
+ @item_name = item_name
+ @conf = conf
+ @manifest = manifest
+
end
end
- def initialize item_name, manifest
- @item_name = item_namel
- @manifest = manifest
- @controller_manifest = manifest.controllers(@item_name)
+ attr :controller_manifest, :item_name, :manifest, :controller_conf,
+ :actions
+ @@types = {'list' => ActionList, 'show' => ActionShow}
+ def initialize controller_manifest
+ @controller_manifest = controller_manifest
+ @item_name = @controller_manifest.item_name
+ @manifest = @controller_manifest.manifest
@controller_conf = @controller_manifest.conf
@actions = {}
- @list_conf.each {|action_name, conf|
+ @controller_manifest.actions.each {|action_name, conf|
type = conf['type']
- @actions[action_name] = Action.new(action_name, conf, @manifest)
+ @actions[action_name] = @@types[type]
}
end
- def open action_name
- Controller.new(@actions[action_name], @controller_manifest, @manifest)
+ def open action_name, params, operators
+ name = if @controller_conf['item_name']
+ @controller_conf['item_name']
+ else
+ @item_name
+ end
+ list_name = @controller_manifest.list_name action_name
+ @list = @manifest.list_managers[name].open(list_name, params[:page], params[:page_size], operators)
+ @actions[action_name].new action_name, name, operators, @list, @controller_conf, @manifest
end
end
'no.png'
end
+ def visible?
+ self.link_method_name != :link_none
+ end
+
def render view, item, operators
link = self.__send__(@link_method_name, view, item, operators)
tag = self.__send__(@tag_method_name, view, item, operators)
unless tag.blank?
- link_to_unless link.blank?, tag, link
+ view.link_to_unless link.blank?, tag, link
end
end
end
def tag_column view, item, operators
- item.attributes[caption['name']]
+ item.attributes[@caption_conf['name']]
end
def tag_method view, item, operators
- item.__send__(caption['name']).to_s
+ item.__send__(@caption_conf['name']).to_s
end
def tag_else view, item, operators
'no caption'
end
+ def visible?
+ self.link_method_name != :link_none
+ end
+
def render view, item, operators
- unless caption_type == 'none'
- link = self.__send__(@link_method_name, view, item, operators)
- tag = self.__send__(@tag_method_name, view, item, operators)
- tag = 'no caption' if tag.blank?
- unless tag.blank?
- link_to_unless link.blank?, tag, link
- end
+ link = self.__send__(@link_method_name, view, item, operators)
+ tag = self.__send__(@tag_method_name, view, item, operators)
+ tag = 'no caption' if tag.blank?
+ unless tag.blank?
+ view.link_to_unless link.blank?, tag, link
end
end
view.render item.path_name + '/' + @summary_conf['name'], :item => item
end
+ def visible?
+ self.type_method != :type_none
+ end
+
def render view, item, operators
- self.__send__(@type_method, view, item)
+ self.__send__(@type_method, view, item, operators)
end
end
@icon_conf = icon_conf || {}
end
+ def visible?
+ true
+ end
+
def render view, item, operators
view.link_to view.icon_tag(item.class.to_s, :object => item, :size => 64),
view.polymorphic_path(item, :format => :prof)
@date_conf = date_conf || {}
end
+ def visible?
+ true
+ end
+
def render view, item, operators
view.distance_of_time_in_words_to_now item.updated_at
end
''
end
+ def visible?
+ self.type_method != :type_none
+ end
+
def render view, item, operators
self.__send__(@type_method, view, item, operators)
end
end
- attr :items, :file_items, :operators
- def initialize items, operators, symbol, caption, summary, icon, date, edit, manifest
+ attr :items, :file_items, :operators, :paginate, :symbol, :caption, :summary, :icon, :date, :edit
+ def initialize item_name, items, operators, paginate, symbol, caption, summary, icon, date, edit, manifest
+ @item_name = item_name
@items = items
+ @operators = operators
+ @paginate = paginate
+ @symbol = symbol
+ @caption = caption
+ @summary = summary
+ @icon = icon
+ @date = date
+ @edit = edit
@manifest = manifest
@file_items = @items.map {|item|
FileItem.new item, operators, symbol, caption, summary, icon, date, edit, manifest
}
end
+
+ def model_name
+ @item_name
+ end
+
+ def model
+ model_name.classify.constantize
+ end
+
end
+ attr :filer_manifest, :item_name, :manifest, :filer_conf,
+ :symbol, :caption, :summary, :icon, :date, :edit
def initialize filer_manifest
@filer_manifest = filer_manifest
@item_name = @filer_manifest.item_name
@edit = Edit.new @filer_manifest.edit
end
- def open items, operators
- Filer.new items, operators, @symbol, @caption, @summary, @icon, @date, @edit, @manifest
+ def open item_name, items, operators, paginate
+ Filer.new item_name, items, operators, paginate, @symbol, @caption, @summary, @icon, @date, @edit, @manifest
end
end
@item_name = item_name
@conf = conf
@manifest = manifest
- @page = self.page_number(page || @conf['default_page_size'])
+ @default_page_size = @conf['default_page_size'] || 25
+ @max_page_size = @conf['max_page_size'] || 100
+ @page = self.page_number(page)
@page_size = self.page_size page_size
@operators = operators
@offset = (@page -1) * @page_size
end
- def self.page_number prm = nil
+ def page_number prm = nil
page = prm.to_i
page = 1 if page < 1
page
end
- def self.page_size prm
+ 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
+ page_size = @max_page_size if page_size > @max_page_size
+ page_size = @default_page_size if page_size < 1
page_size
end
@foreign_key = @association_conf['foreign_key']
end
- def where
- [@model.list_where + 'comics.author_id = ?', me.id]
+ def where parent_item
+ w = @model.list_where
+ w += ' and ' unless w.blank?
+ [w + @association_model_name + '.' + @foreign_key + ' = ?', parent_item.id]
end
- def items item
- method_name = 'list_by_' + item.item_name
- @association_model.__send__ @method_name, item.id, @operators, @page, @page_size
+ def items parent_item
+ @model.where(self.where(parent_item)).includes(@model.list_opt).order(@model.list_order).offset(@offset).limit(@page_size)
end
def paginate
@manifest = @list_manifest.manifest
@list_conf = @list_manifest.conf
@lists = {}
- @list_conf.each {|list_name, conf|
+ @list_manifest.lists.each {|list_name, conf|
type = conf['type']
@lists[list_name] = @@types[type]
}
module Pettanr
class Manifest
class Controller
- attr :conf, :attributes, :associations
+ attr :item_name, :conf, :manifest, :model_name, :actions
def initialize item_name, conf, manifest
@item_name = item_name
@conf = conf || {}
@manifest = manifest
@model_name = @conf['model_name']
+ @actions = @conf['actions'] || {}
end
- def actions
- @model_manifest['actions'] || {}
+ def list_name action_name
+ a = @actions[action_name] || {}
+ l = a['list'] || {}
+ l['list_name']
end
end
class Model
- attr :item_name, :conf, :manifest, :attributes, :associations
+ attr :item_name, :conf, :manifest, :attributes, :associations, :belongs_to, :has_many, :has_one
def initialize item_name, conf, manifest
@item_name = item_name
@conf = conf || {}
@manifest = manifest
- end
-
- def attributes
- @model_manifest['attributes'] || {}
- end
-
- def associations
- @conf['name'] || {}
+
+ @attributes = @conf['attributes']
+ @associations = @conf['associations'] || {}
+ @belongs_to = @associations['belongs_to'] || {}
+ @has_many = @associations['has_many'] || {}
+ @has_one = @associations['has_one'] || {}
end
end
class List
- attr :item_name, :conf, :manifest, :default_page_size
+ attr :item_name, :conf, :manifest, :default_page_size, :lists
def initialize item_name, conf, manifest
@item_name = item_name
@conf = conf || {}
@manifest = manifest
@default_page_size = @conf['default_page_size'] || 20
+ @lists = @conf['lists'] || {}
end
end
- class License
- attr :conf
- def initialize manifest
- @manifest = manifest
- @conf = @manifest['licenses'] || {}
- end
- end
-
- class Element
- attr :conf
- def initialize manifest
- @manifest = manifest
- @conf = @manifest['elements'] || {}
- end
- end
-
- class SpeechBalloonTemplate
- attr :conf
- def initialize manifest
- @manifest = manifest
- @conf = @manifest['speech_balloon_templates'] || {}
- end
- end
-
- class WritingFormat
- attr :conf
- def initialize manifest
- @manifest = manifest
- @conf = @manifest['writing_formats'] || {}
- end
- end
-
- class Profile
- attr :conf
- def initialize manifest
- @manifest = manifest
- @conf = @manifest['profile'] || {}
+ class SystemResources
+ attr :conf, :licenses, :elements, :speech_balloon_templates, :writing_formats
+ def initialize system_resource_conf
+ @conf = system_resource_conf || {}
+ @licenses = @conf['licenses'] || {}
+ @elements = @conf['elements'] || {}
+ @speech_balloon_templates = @conf['speech_balloon_templates'] || {}
+ @writing_formats = @conf['writing_formats'] || {}
end
+
end
class Profiler
- attr :item_name, :conf, :manifest, :columns, :belongs_to, :has_many, :has_one
+ attr :item_name, :conf, :manifest, :columns, :lists, :belongs_to, :has_many, :has_one
def initialize item_name, conf, manifest
@item_name = item_name
@conf = conf || {}
@manifest = manifest
@columns = @conf['columns'] || {}
+ @lists = @conf['lists'] || {}
@associations_conf = @conf['associations'] || {}
@belongs_to = @associations_conf['belongs_to'] || []
@has_many = @associations_conf['has_many'] || []
end
- attr :licenses, :elements, :speech_balloon_templates, :writing_formats, :profile,
- :model_managers, :list_managers, :profiler_managers, :filer_managers, :form_managers
+ attr :system_resources, :magic_numbers, :select_items,
+ :controller_managers, :model_managers, :list_managers, :profiler_managers, :filer_managers, :form_managers
def initialize manifest
@manifest = manifest || {}
+ @system_resources = SystemResources.new(@manifest['system_resources'])
+ @magic_numbers = @manifest['magic_numbers']
+ @select_items = @manifest['select_items']
@controllers = {}
@models = {}
@lists = {}
- @licenses = License.new(manifest)
- @elements = Element.new(manifest)
- @speech_balloon_templates = SpeechBalloonTemplate.new(manifest)
- @writing_formats = WritingFormat.new(manifest)
- @profile = Profile.new(manifest)
@profilers = {}
@filers = {}
@forms = {}
+ @controller_managers = {}
@model_managers = {}
@list_managers = {}
@profiler_managers = {}
@filer_managers = {}
@form_managers = {}
(@manifest['controllers'] || {}).each {|item_name, controller_conf|
- @controllers[item_name] = Controller.new(item_name, controller_conf, manifest)
+ @controllers[item_name] = Controller.new(item_name, controller_conf, self)
+ @controller_managers[item_name] = Pettanr::ControllerManager.new @controllers[item_name]
}
(@manifest['models'] || {}).each {|item_name, model_conf|
- @models[item_name] = Model.new(item_name, model_conf, manifest)
+ @models[item_name] = Model.new(item_name, model_conf, self)
@model_managers[item_name] = Pettanr::ModelManager.new @models[item_name]
}
(@manifest['lists'] || {}).each {|item_name, list_conf|
- @lists[item_name] = List.new(item_name, list_conf, manifest)
+ @lists[item_name] = List.new(item_name, list_conf, self)
@list_managers[item_name] = Pettanr::ListManager.new @lists[item_name]
}
@locals = @manifest['locals'] || {}
(@locals['profilers'] || {}).each {|item_name, profiler_conf|
- @profilers[item_name] = Profiler.new item_name, profiler_conf, manifest
+ @profilers[item_name] = Profiler.new item_name, profiler_conf, self
@profiler_managers[item_name] = Pettanr::ProfilerManager.new @profilers[item_name]
}
(@locals['filers'] || {}).each {|item_name, filer_conf|
- @filers[item_name] = Filer.new item_name, filer_conf, manifest
+ @filers[item_name] = Filer.new item_name, filer_conf, self
@filer_managers[item_name] = Pettanr::FilerManager.new @filers[item_name]
}
(@locals['forms'] || {}).each {|item_name, form_conf|
- @forms[item_name] = Form.new item_name, form_conf, manifest
+ @forms[item_name] = Form.new item_name, form_conf, self
@form_managers[item_name] = Pettanr::FormManager.new @forms[item_name]
}
end
module Pettanr
-
class ProfilerManager
- class Ccolumn
- def initialize item, attribute_name, attribute_conf
- @attribute_conf = attribute_conf || {}
- end
-
- def label
- label = item.class.human_attribute_name(field_name)
- end
-
- def value
- case field_conf['type']
- when 'datetime'
- if item.attributes[field_name]
- l item.attributes[field_name]
+ class Profiler
+ class Column
+ def initialize item_name, column_name, item, operators, manifest
+ @item_name = item_name
+ @column_name = column_name
+ @item = item
+ @operators = operators
+ @manifest = manifest
+
+ @model = @item_name.classify.constantize
+ @model_attributes = @manifest.model(@item_name).attributes
+ @column_conf = @model_attributes[@column_name]
+ end
+
+ def label view
+ @model.human_attribute_name(@column_name)
+ end
+
+ def date?
+ case @column_conf['type']
+ when 'datetime'
+ if self.value
+ true
+ else
+ false
+ end
else
- item.attributes[field_name]
+ false
end
- else
- item.attributes[field_name]
end
- end
-
- def note
- if field_conf['source']
- case field_conf['source']['type']
- when 'magic_number'
- t_selected_item(field_conf['source']['key'], item.attributes[field_name])
- when 'model'
+
+ def value
+ @item.attributes[@column_name]
+ end
+
+ def disp_value view
+ if self.date?
+ view.l self.value
else
+ self.value
end
end
- end
-
- end
-
- class BelongsTo
- def initialize belongs_to_conf
- @belongs_to_conf = belongs_to_conf || {}
- end
-
- def each item, operators
- belongs_to_conf.each do |association_model_name|
- model_belongs_to_conf = model_associations['belongs_to'][association_model_name]
- parent_model = association_model_name.classify.constantize
- id_column = model_belongs_to_conf['id_column']
- parent = nil
- begin
- parent = parent_model.show(item.attributes[id_column], roles)
- rescue ActiveRecord::RecordNotFound
+
+ def note?
+ if @column_conf['source']
+ case @column_conf['source']['type']
+ when 'magic_number'
+ true
+ when 'model'
+ false
+ else
+ false
+ end
+ else
+ false
end
- if parent
- yield parent
+ end
+
+ def note view
+ if self.note?
+ '(' + view.t_selected_item(@column_conf['source']['key'], self.value) + ')'
+ else
end
end
+
end
- end
-
- class HasMany
- def initialize has_many_conf
- @has_many_conf = has_many_conf || {}
+
+ def initialize item_name, item, operators, conf, manifest
+ @item_name = item_name
+ @item = item
+ @operators = operators
+ @conf = conf
+ @manifest = manifest
+
+ @lists = @manifest.profiler(@item_name).lists
+ @belongs_to_conf = @manifest.profiler(@item_name).belongs_to
+ @has_many_conf = @manifest.profiler(@item_name).has_many
+ @has_one_conf = @manifest.profiler(@item_name).has_one
end
- def each item, operators
- @has_many_conf.each do |association_model_name|
- model_has_many_conf = model_associations['has_many'][association_model_name]
- child_model = association_model_name.classify.constantize
- foreign_key = model_has_many_conf['foreign_key']
- children = child_model.__send__(model_has_many_conf['list_method'], item.attributes['id'], operators, 1, 3)
- yield children, child_model
- end
+ def modelize str
+ str.classify.constantize
end
- end
-
- class HasOne
- def initialize has_one_conf
- @has_one_conf = has_one_conf || {}
+ def header_filer
+ @manifest.filer_managers[@item_name].open @item_name, [@item], @operators, nil
end
- def each item, operators
- @has_one_conf.each do |association_model_name|
- model_has_one_conf = model_associations['has_one'][association_model_name]
- child_model = association_model_name.classify.constantize
- foreign_key = model_has_one_conf['foreign_key']
- children = child_model.__send__(model_has_one_conf['list_method'], item.attributes['id'], operators, 1, 3)
- yield children, child_model
+ def each_column
+ @conf['columns'].each do |column_name|
+ column = Column.new @item_name, column_name, @item, @operators, @manifest
+ yield column
end
end
- end
-
- class Profiler
- def initialize item
- @attribute_conf = attribute_conf || {}
+ def parent_item parent_model, model_belongs_to_conf
+ r = nil
+ id_column = model_belongs_to_conf['id_column']
+ begin
+ r = parent_model.show(@item.attributes[id_column], @operators)
+ rescue ActiveRecord::RecordNotFound
+ end
+ r
+ end
+
+ def each_belongs_to
+ @belongs_to_conf.each do |association_model_name|
+ model_belongs_to_conf = @manifest.model(@item_name).belongs_to[association_model_name]
+ parent_model = self.modelize association_model_name
+ parent = self.parent_item parent_model, model_belongs_to_conf
+ if parent
+ parent_filer = @manifest.filer_managers[@item_name].open @item_name, [@item], @operators, nil
+ yield parent_filer
+ end
+ end
end
- def header
- ender 'system/filer.html', :items => [item], :model => item.class, :roles => roles, :pager => nil
+ def each_has_many
+ @has_many_conf.each do |profiler_list_name|
+ model_name = @lists['model_name']
+ list_name = @lists['list_name']
+ list = @manifest.list_managers[model_name].open(list_name, 1, 3, @operators)
+ items = list.items
+ has_many_filer = @manifest.filer_managers[model_name].open model_name, items, @operators, nil
+ yield has_many_filer
+ end
end
- def each_column
- profiler_conf['fields'].each do |field_name|
- yield label, value, note
+ def each_has_one
+ @has_one_conf.each do |profiler_list_name|
+ list = @manifest.list_managers[@item_name].open(profiler_list_name, 1, 1, @operators)
+ items = list.items
+ has_one_filer = @manifest.filer_managers[@item_name].open @item_name, items, @operators, nil
+ yield has_one_filer
end
end
@item_name = @profiler_manifest.item_name
@manifest = profiler_manifest.manifest
@profiler_conf = @profiler_manifest.conf
- @associations_conf = @profiler_conf['associations'] || {}
- @belongs_to = BelongsTo.new @profiler_manifest.belongs_to
- @bhas_many = HasMany.new @profiler_manifest.has_many
- @has_one = HasOne.new @profiler_manifest.has_one
end
- def open
- Profiler.new item
- end
-
- def render view, operators
- @belongs_to.each(item, operators) do |parent|
- render 'system/filer.html', :items => [parent], :model => parent.class, :operators => operators, :pager => nil
- end
- @has_many.each(item, operators) do |items, child_model|
- #child_model.filer.list operators, , 1, 3, items
- render 'system/filer.html', :items => items, :model => child_model, :operators => operators, :pager => nil
- end
- @has_one.each(item, operators) do |items, child_model|
- render 'system/filer.html', :items => items, :model => child_model, :operators => operators, :pager => nil
- end
+ def open item, operators
+ Profiler.new @item_name, item, operators, @profiler_conf, @manifest
end
end
{\r
"controllers": {\r
"scroll": {\r
- "item_name": "scroll",\r
- "index": {\r
- "list": {\r
- "list_name": "public"\r
+ "model_name": "scroll",\r
+ "actions": {\r
+ "index": {\r
+ "type": "list",\r
+ "list": {\r
+ "list_name": "public_list"\r
+ }\r
+ },\r
+ "show": {\r
+ "type": "show",\r
+ "name": "show"\r
+ }\r
+ }\r
+ },\r
+ "home": {\r
+ "actions": {\r
+ "scrolls": {\r
+ "item_name": "scroll",\r
+ "type": "list",\r
+ "list": {\r
+ "list_name": "public_list"\r
+ }\r
}\r
}\r
}\r
}\r
}\r
},\r
+ "filters": {\r
+ "by_author": {\r
+ "type": "filter",\r
+ "key": "author_id"\r
+ }\r
+ },\r
+ "through_filters": {\r
+ "by_panel": {\r
+ "through": "scroll_panels",\r
+ "key": "panel_id"\r
+ }\r
+ },\r
"attributes": {\r
"id": {\r
"type": "number",\r
},\r
"lists": {\r
"scroll": {\r
- "public_list": {\r
- "type": "public"\r
- },\r
- "private_list": {\r
- "type": "private"\r
- },\r
- "scroll_panels": {\r
- "type": "has_many",\r
- "association_name": "scroll_panels"\r
- },\r
- "panels": {\r
- "type": "has_many",\r
- "association_name": "panels"\r
- },\r
- "by_panel": {\r
- "type": "filter",\r
- "filter_key": "scroll_id",\r
- "list": {\r
- "method": "filtered_list"\r
+ "default_page_size": 25,\r
+ "max_page_size": 100,\r
+ "lists": {\r
+ "public_list": {\r
+ "type": "public"\r
+ },\r
+ "private_list": {\r
+ "type": "private"\r
+ },\r
+ "scroll_panels": {\r
+ "type": "has_many",\r
+ "association_name": "scroll_panels"\r
+ },\r
+ "panels": {\r
+ "type": "has_many",\r
+ "association_name": "panels"\r
+ },\r
+ "by_panel": {\r
+ "type": "throughfilter",\r
+ "filter_key": "panel_id",\r
+ "list": {\r
+ "method": "filtered_list"\r
+ }\r
+ }\r
+ }\r
+ },\r
+ "scroll_panel": {\r
+ "default_page_size": 20,\r
+ "lists": {\r
+ "public_list": {\r
+ "type": "public"\r
+ },\r
+ "private_list": {\r
+ "type": "private"\r
+ },\r
+ "by_scroll": {\r
+ "type": "filter",\r
+ "filter_key": "scroll_id",\r
+ "list": {\r
+ "method": "filtered_list"\r
+ }\r
+ },\r
+ "by_panel": {\r
+ "type": "filter",\r
+ "filter_key": "panel_id",\r
+ "list": {\r
+ "method": "filtered_list"\r
+ }\r
+ }\r
+ }\r
+ },\r
+ "comic": {\r
+ "default_page_size": 20,\r
+ "lists": {\r
+ "public_list": {\r
+ "type": "public"\r
+ },\r
+ "private_list": {\r
+ "type": "private"\r
+ },\r
+ "stories": {\r
+ "type": "has_many",\r
+ "association_name": "stories"\r
+ }\r
+ }\r
+ },\r
+ "story": {\r
+ "default_page_size": 20,\r
+ "lists": {\r
+ "public_list": {\r
+ "type": "public"\r
+ },\r
+ "private_list": {\r
+ "type": "private"\r
+ },\r
+ "story_sheets": {\r
+ "type": "has_many",\r
+ "association_name": "story_sheets"\r
+ },\r
+ "sheets": {\r
+ "type": "has_many",\r
+ "association_name": "sheets"\r
+ },\r
+ "by_comic": {\r
+ "type": "filter",\r
+ "filter_key": "comic_id",\r
+ "list": {\r
+ "method": "filtered_list"\r
+ }\r
+ }\r
+ }\r
+ },\r
+ "story_sheet": {\r
+ "default_page_size": 20,\r
+ "lists": {\r
+ "public_list": {\r
+ "type": "public"\r
+ },\r
+ "private_list": {\r
+ "type": "private"\r
+ },\r
+ "by_story": {\r
+ "type": "filter",\r
+ "filter_key": "story_id",\r
+ "list": {\r
+ "method": "filtered_list"\r
+ }\r
+ },\r
+ "by_sheet": {\r
+ "type": "filter",\r
+ "filter_key": "sheet_id",\r
+ "list": {\r
+ "method": "filtered_list"\r
+ }\r
+ }\r
+ }\r
+ },\r
+ "sheet": {\r
+ "default_page_size": 20,\r
+ "lists": {\r
+ "public_list": {\r
+ "type": "public"\r
+ },\r
+ "private_list": {\r
+ "type": "private"\r
+ },\r
+ "story_sheets": {\r
+ "type": "has_many",\r
+ "association_name": "story_sheets"\r
+ },\r
+ "sheet_panels": {\r
+ "type": "has_many",\r
+ "association_name": "sheet_panels"\r
+ }\r
+ }\r
+ },\r
+ "sheet_panel": {\r
+ "default_page_size": 20,\r
+ "lists": {\r
+ "public_list": {\r
+ "type": "public"\r
+ },\r
+ "private_list": {\r
+ "type": "private"\r
+ },\r
+ "by_sheet": {\r
+ "type": "filter",\r
+ "filter_key": "sheet_id",\r
+ "list": {\r
+ "method": "filtered_list"\r
+ }\r
+ },\r
+ "by_panel": {\r
+ "type": "filter",\r
+ "filter_key": "panel_id",\r
+ "list": {\r
+ "method": "filtered_list"\r
+ }\r
}\r
}\r
},\r
- "scroll_panel": {},\r
- "comic": {},\r
- "story": {},\r
- "story_sheet": {},\r
- "sheet": {},\r
- "sheet_panel": {},\r
"panel": {},\r
"panel_picture": {},\r
"speech_balloon": {},\r
"artist": {},\r
"system_picture": {}\r
},\r
- "licenses": {\r
- "pettanr_creative_commons_v30_licenses": "PettanrCreativeCommonsV30Licenses",\r
- "pettanr_pettan_commons_v01_licenses": "PettanrPettanCommonsV01Licenses",\r
- "pettanr_pettan_protected_v01_licenses": "PettanrPettanProtectedV01Licenses",\r
- "pettanr_pettan_public_v01_licenses": "PettanrPettanPublicV01Licenses",\r
- "pettanr_public_domain_v01_licenses": "PettanrPublicDomainV01Licenses",\r
- "pettanr_unknown_v01_licenses": "PettanrUnknownV01Licenses"\r
- },\r
- "elements": {\r
- "PanelPicture": "panel_pictures",\r
- "SpeechBalloon": "speech_balloons",\r
- "GroundPicture": "ground_pictures",\r
- "GroundColor": "ground_colors"\r
- },\r
- "speech_balloon_templates": {\r
- "CircleSpeechBalloon": "circle_speech_balloon",\r
- "PlainSpeechBalloon": "plain_speech_balloon",\r
- "SquareSpeechBalloon": "square_speech_balloon"\r
- },\r
- "writing_formats": {\r
- "SimpleFormat": "pettanr_simple_format"\r
- },\r
- "profile": {\r
- "users": {\r
- "caption": "\83y\83\93\83M\83\93\89¤\8d\91",\r
- "url": "http://localhost:3001/",\r
- "description": "\83y\83\93\83M\83\93\89¤\8d\91\82Í\83y\83\93\83M\83\93\91f\8dÞ\82ð\96L\95x\82É\97p\88Ó\82µ\82½\83y\83\93\83M\83\93\83}\83j\83A\82Ì\83T\83C\83g\82Å\82·\81B"\r
+ "system_resources": {\r
+ "licenses": {\r
+ "pettanr_creative_commons_v30_licenses": "PettanrCreativeCommonsV30Licenses",\r
+ "pettanr_pettan_commons_v01_licenses": "PettanrPettanCommonsV01Licenses",\r
+ "pettanr_pettan_protected_v01_licenses": "PettanrPettanProtectedV01Licenses",\r
+ "pettanr_pettan_public_v01_licenses": "PettanrPettanPublicV01Licenses",\r
+ "pettanr_public_domain_v01_licenses": "PettanrPublicDomainV01Licenses",\r
+ "pettanr_unknown_v01_licenses": "PettanrUnknownV01Licenses"\r
},\r
- "admins": {\r
- "caption": "site name for admin",\r
- "url": "http://your.site.url/admins/",\r
- "description": "admin register"\r
+ "elements": {\r
+ "PanelPicture": "panel_pictures",\r
+ "SpeechBalloon": "speech_balloons",\r
+ "GroundPicture": "ground_pictures",\r
+ "GroundColor": "ground_colors"\r
},\r
- "demand_users": {\r
- "caption": "provider name",\r
- "url": "http://your.site.url/demanders/",\r
- "description": "provider description"\r
+ "speech_balloon_templates": {\r
+ "CircleSpeechBalloon": "circle_speech_balloon",\r
+ "PlainSpeechBalloon": "plain_speech_balloon",\r
+ "SquareSpeechBalloon": "square_speech_balloon"\r
+ },\r
+ "writing_formats": {\r
+ "SimpleFormat": "pettanr_simple_format"\r
}\r
},\r
"magic_numbers": {\r
"run_mode": 1,\r
"thumbnail_width": 64,\r
"thumbnail_height": 64,\r
+ "profile": {\r
+ "users": {\r
+ "caption": "ペンギン王国",\r
+ "url": "http://localhost:3001/",\r
+ "description": "ペンギン王国はペンギン素材を豊富に用意したペンギンマニアのサイトです。"\r
+ },\r
+ "admins": {\r
+ "caption": "site name for admin",\r
+ "url": "http://your.site.url/admins/",\r
+ "description": "admin register"\r
+ },\r
+ "demand_users": {\r
+ "caption": "provider name",\r
+ "url": "http://your.site.url/demanders/",\r
+ "description": "provider description"\r
+ }\r
+ },\r
+ "provider_sources": [\r
+ "http://sourceforge.jp/projects/pettanr/wiki/ProviderSource/attach/provider_source.json"\r
+ ]\r
+ },\r
+ "select_items": {\r
"provider_status_status_items": [\r
[\r
"select_items.provider_status.status.waiting",\r
"select_items.speeches.text_align.center",\r
3\r
]\r
- ],\r
- "provider_sources": [\r
- "http://sourceforge.jp/projects/pettanr/wiki/ProviderSource/attach/provider_source.json"\r
]\r
},\r
"locals": {\r
"profilers": {\r
"scroll": {\r
+ "lists": {\r
+ "scroll_panels.by_scroll": {\r
+ "model_name": "scroll_panel",\r
+ "list_name": "by_scroll"\r
+ }\r
+ },\r
"columns": [\r
"id",\r
"title",\r
"author"\r
],\r
"has_many": [\r
- "scroll_panels",\r
- "panels"\r
+ "scroll_panels.by_scroll",\r
+ "panels.by_scroll"\r
]\r
}\r
},\r