#マニフェスト\r
@controllers = {\r
- scroll: {\r
+ scrolls: {\r
actions: {\r
index: {\r
type: 'list',\r
list_name: 'public_list',\r
},\r
},\r
- scroll_panels: {\r
- type: 'list',\r
- args: {\r
- list_name: 'scroll_panels',\r
- },\r
- },\r
- panels: {\r
- type: 'list',\r
- args: {\r
- list_name: 'panels',\r
- },\r
- },\r
by_author: {\r
type: 'list',\r
- args: {\r
- list_name: 'by_author',\r
- },\r
},\r
by_panel: {\r
type: 'list',\r
- args: {\r
- list_name: 'by_panel',\r
- },\r
},\r
play: {\r
type: 'list',\r
type: 'show',\r
name: 'show',\r
},\r
+ count: {\r
+ type: 'count',\r
+ args: {\r
+ list_name: 'public_list',\r
+ },\r
+ },\r
+ count_by_author: {\r
+ type: 'count',\r
+ },\r
+ count_by_panel: {\r
+ type: 'count',\r
+ },\r
},\r
},\r
- scroll_panel: {\r
+ scroll_panels: {\r
actions: {\r
index: {\r
type: 'list',\r
},\r
by_panel: {\r
type: 'list',\r
- args: {\r
- list_name: 'by_panel',\r
- },\r
},\r
by_scroll: {\r
type: 'list',\r
+ },\r
+ count: {\r
+ type: 'count',\r
args: {\r
- list_name: 'by_scroll',\r
+ list_name: 'public_list',\r
},\r
},\r
+ count_by_panel: {\r
+ type: 'count',\r
+ },\r
+ count_by_scroll: {\r
+ type: 'count',\r
+ },\r
},\r
},\r
- comic: {\r
+ comics: {\r
actions: {\r
index: {\r
type: 'list',\r
\r
},\r
},\r
- stories: {\r
- type: 'list',\r
- args: {\r
- list_name: 'stories',\r
- },\r
- },\r
by_author: {\r
type: 'list',\r
+ },\r
+ count: {\r
+ type: 'count',\r
args: {\r
- list_name: 'by_author',\r
+ list_name: 'public_list',\r
},\r
},\r
+ count_by_author: {\r
+ type: 'count',\r
+ },\r
},\r
},\r
- story: {\r
+ stories: {\r
actions: {\r
index: {\r
type: 'list',\r
\r
},\r
},\r
- story_sheets: {\r
- type: 'list',\r
- args: {\r
- list_name: 'story_sheets',\r
- },\r
- },\r
- sheets: {\r
- type: 'list',\r
- args: {\r
- list_name: 'sheets',\r
- },\r
- },\r
by_comic: {\r
type: 'list',\r
- args: {\r
- list_name: 'by_comic',\r
- },\r
},\r
by_sheet: {\r
type: 'list',\r
- args: {\r
- list_name: 'by_sheet',\r
- },\r
},\r
by_author: {\r
type: 'list',\r
- args: {\r
- list_name: 'by_author',\r
- },\r
},\r
play: {\r
type: 'list',\r
list_name: 'play',\r
},\r
},\r
+ count: {\r
+ type: 'count',\r
+ args: {\r
+ list_name: 'public_list',\r
+ },\r
+ },\r
+ by_comic: {\r
+ type: 'count',\r
+ },\r
+ by_sheet: {\r
+ type: 'count',\r
+ },\r
+ count_by_author: {\r
+ type: 'count',\r
+ },\r
},\r
},\r
- story_sheet: {\r
+ story_sheets: {\r
actions: {\r
index: {\r
type: 'list',\r
},\r
by_story: {\r
type: 'list',\r
- args: {\r
- list_name: 'by_story',\r
- },\r
},\r
by_sheet: {\r
type: 'list',\r
+ },\r
+ count: {\r
+ type: 'count',\r
args: {\r
- list_name: 'by_sheet',\r
+ list_name: 'public_list',\r
},\r
},\r
+ count_by_story: {\r
+ type: 'count',\r
+ },\r
+ count_by_sheet: {\r
+ type: 'count',\r
+ },\r
},\r
},\r
- sheet: {\r
+ sheets: {\r
actions: {\r
index: {\r
type: 'list',\r
\r
},\r
},\r
- story_sheets: {\r
+ by_story: {\r
type: 'list',\r
- args: {\r
- list_name: 'story_sheets',\r
- },\r
},\r
- stories: {\r
+ by_panel: {\r
type: 'list',\r
- args: {\r
- list_name: 'stories',\r
- },\r
},\r
- sheet_panels: {\r
+ by_author: {\r
type: 'list',\r
- args: {\r
- list_name: 'sheet_panels',\r
- },\r
},\r
- panels: {\r
+ play: {\r
type: 'list',\r
args: {\r
- list_name: 'panels',\r
+ list_name: 'play',\r
},\r
},\r
- by_story: {\r
- type: 'list',\r
+ count: {\r
+ type: 'count',\r
args: {\r
- list_name: 'by_story',\r
+ list_name: 'public_list',\r
},\r
},\r
- by_panel: {\r
- type: 'list',\r
- args: {\r
- list_name: 'by_panel',\r
- },\r
+ count_by_story: {\r
+ type: 'count',\r
},\r
- by_author: {\r
- type: 'list',\r
- args: {\r
- list_name: 'by_author',\r
- },\r
+ count_by_panel: {\r
+ type: 'count',\r
},\r
- play: {\r
- type: 'list',\r
- args: {\r
- list_name: 'play',\r
- },\r
+ count_by_author: {\r
+ type: 'count',\r
},\r
},\r
},\r
- sheet_panel: {\r
+ sheet_panels: {\r
actions: {\r
index: {\r
type: 'list',\r
},\r
by_sheet: {\r
type: 'list',\r
- args: {\r
- list_name: 'by_sheet',\r
- },\r
},\r
by_panel: {\r
type: 'list',\r
+ },\r
+ count: {\r
+ type: 'count',\r
args: {\r
- list_name: 'by_panel',\r
+ list_name: 'public_list',\r
},\r
},\r
+ count_by_sheet: {\r
+ type: 'count',\r
+ },\r
+ count_by_panel: {\r
+ type: 'count',\r
+ },\r
},\r
},\r
- panel: {\r
+ panels: {\r
actions: {\r
index: {\r
type: 'list',\r
\r
},\r
},\r
- scroll_panels: {\r
- type: 'list',\r
- args: {\r
- list_name: 'scroll_panels',\r
- },\r
- },\r
- scrolls: {\r
- type: 'list',\r
- args: {\r
- list_name: 'scrolls',\r
- },\r
- },\r
- sheet_panels: {\r
- type: 'list',\r
- args: {\r
- list_name: 'sheet_panels',\r
- },\r
- },\r
- sheets: {\r
+ by_scroll: {\r
type: 'list',\r
- args: {\r
- list_name: 'sheets',\r
- },\r
},\r
- panel_pictures: {\r
+ by_sheet: {\r
type: 'list',\r
- args: {\r
- list_name: 'panel_pictures',\r
- },\r
},\r
- speech_balloons: {\r
+ by_author: {\r
type: 'list',\r
- args: {\r
- list_name: 'speech_balloons',\r
- },\r
},\r
- ground_pictures: {\r
+ by_speech_balloon_template: {\r
type: 'list',\r
- args: {\r
- list_name: 'ground_pictures',\r
- },\r
},\r
- ground_colors: {\r
- type: 'list',\r
+ count: {\r
+ type: 'count',\r
args: {\r
- list_name: 'ground_colors',\r
+ list_name: 'public_list',\r
},\r
},\r
- by_scroll: {\r
- type: 'list',\r
- args: {\r
- list_name: 'by_scroll',\r
- },\r
+ count_by_scroll: {\r
+ type: 'count',\r
},\r
- by_sheet: {\r
- type: 'list',\r
- args: {\r
- list_name: 'by_sheet',\r
- },\r
+ count_by_sheet: {\r
+ type: 'count',\r
},\r
- by_author: {\r
- type: 'list',\r
- args: {\r
- list_name: 'by_author',\r
- },\r
+ count_by_author: {\r
+ type: 'count',\r
},\r
- by_speech_balloon_template: {\r
- type: 'list',\r
- args: {\r
- list_name: 'by_speech_balloon_template',\r
- },\r
+ count_by_speech_balloon_template: {\r
+ type: 'count',\r
},\r
},\r
},\r
- panel_picture: {\r
+ panel_pictures: {\r
actions: {\r
index: {\r
type: 'list',\r
},\r
by_panel: {\r
type: 'list',\r
- args: {\r
- list_name: 'by_panel',\r
- },\r
},\r
by_author: {\r
type: 'list',\r
+ },\r
+ count: {\r
+ type: 'count',\r
args: {\r
- list_name: 'by_author',\r
+ list_name: 'public_list',\r
},\r
},\r
+ count_by_panel: {\r
+ type: 'count',\r
+ },\r
+ count_by_author: {\r
+ type: 'count',\r
+ },\r
},\r
},\r
- speech_balloon: {\r
+ speech_balloons: {\r
actions: {\r
index: {\r
type: 'list',\r
},\r
by_panel: {\r
type: 'list',\r
- args: {\r
- list_name: 'by_panel',\r
- },\r
},\r
by_author: {\r
type: 'list',\r
+ },\r
+ count: {\r
+ type: 'count',\r
args: {\r
- list_name: 'by_author',\r
+ list_name: 'public_list',\r
},\r
},\r
+ count_by_panel: {\r
+ type: 'count',\r
+ },\r
+ count_by_author: {\r
+ type: 'count',\r
+ },\r
},\r
},\r
- speech: {\r
+ speeches: {\r
actions: {\r
index: {\r
type: 'list',\r
},\r
by_writing_format: {\r
type: 'list',\r
+ },\r
+ count: {\r
+ type: 'count',\r
args: {\r
- list_name: 'by_writing_format',\r
+ list_name: 'public_list',\r
},\r
},\r
+ count_by_writing_format: {\r
+ type: 'count',\r
+ },\r
},\r
},\r
- balloon: {\r
+ balloons: {\r
actions: {\r
index: {\r
type: 'list',\r
# list_name: 'by_system_picture',\r
# },\r
#},\r
+ count: {\r
+ type: 'count',\r
+ args: {\r
+ list_name: 'public_list',\r
+ },\r
+ },\r
},\r
},\r
- ground_picture: {\r
+ ground_pictures: {\r
actions: {\r
index: {\r
type: 'list',\r
},\r
by_panel: {\r
type: 'list',\r
- args: {\r
- list_name: 'by_panel',\r
- },\r
},\r
by_author: {\r
type: 'list',\r
+ },\r
+ count: {\r
+ type: 'count',\r
args: {\r
- list_name: 'by_author',\r
+ list_name: 'public_list',\r
},\r
},\r
+ count_by_panel: {\r
+ type: 'count',\r
+ },\r
+ count_by_author: {\r
+ type: 'count',\r
+ },\r
},\r
},\r
- ground_color: {\r
+ ground_colors: {\r
actions: {\r
index: {\r
type: 'list',\r
},\r
by_panel: {\r
type: 'list',\r
- args: {\r
- list_name: 'by_panel',\r
- },\r
},\r
by_author: {\r
type: 'list',\r
+ },\r
+ count: {\r
+ type: 'count',\r
args: {\r
- list_name: 'by_author',\r
+ list_name: 'public_list',\r
},\r
},\r
+ count_by_panel: {\r
+ type: 'count',\r
+ },\r
+ count_by_author: {\r
+ type: 'count',\r
+ },\r
},\r
},\r
- original_picture: {\r
+ original_pictures: {\r
actions: {\r
index: {\r
type: 'list',\r
\r
},\r
},\r
+ count: {\r
+ type: 'count',\r
+ args: {\r
+ list_name: 'public_list',\r
+ },\r
+ },\r
},\r
},\r
- picture: {\r
+ pictures: {\r
},\r
- resource_picture: {\r
+ resource_pictures: {\r
actions: {\r
index: {\r
type: 'list',\r
},\r
by_license: {\r
type: 'list',\r
- args: {\r
- list_name: 'by_license',\r
- },\r
},\r
by_artist: {\r
type: 'list',\r
+ },\r
+ count: {\r
+ type: 'count',\r
args: {\r
- list_name: 'by_artist',\r
+ list_name: 'public_list',\r
},\r
},\r
+ count_by_license: {\r
+ type: 'count',\r
+ },\r
+ count_by_artist: {\r
+ type: 'count',\r
+ },\r
},\r
},\r
- speech_balloon_template: {\r
+ speech_balloon_templates: {\r
actions: {\r
index: {\r
type: 'list',\r
\r
},\r
},\r
- speech_balloons: {\r
- type: 'list',\r
+ count: {\r
+ type: 'count',\r
args: {\r
- list_name: 'speech_balloons',\r
- },\r
- },\r
- panels: {\r
- type: 'list',\r
- args: {\r
- list_name: 'panels',\r
+ list_name: 'public_list',\r
},\r
},\r
},\r
},\r
- writing_format: {\r
+ writing_formats: {\r
actions: {\r
index: {\r
type: 'list',\r
\r
},\r
},\r
- speeches: {\r
- type: 'list',\r
- args: {\r
- list_name: 'speeches',\r
- },\r
- },\r
by_system_picture: {\r
type: 'list',\r
+ },\r
+ count: {\r
+ type: 'count',\r
args: {\r
- list_name: 'by_system_picture',\r
+ list_name: 'public_list',\r
},\r
},\r
+ count_by_system_picture: {\r
+ type: 'count',\r
+ },\r
},\r
},\r
- license_group: {\r
+ license_groups: {\r
actions: {\r
index: {\r
type: 'list',\r
\r
},\r
},\r
- licenses: {\r
- type: 'list',\r
+ count: {\r
+ type: 'count',\r
args: {\r
- list_name: 'licenses',\r
+ list_name: 'public_list',\r
},\r
},\r
},\r
},\r
- license: {\r
+ licenses: {\r
actions: {\r
index: {\r
type: 'list',\r
\r
},\r
},\r
- resource_pictures: {\r
- type: 'list',\r
- args: {\r
- list_name: 'resource_pictures',\r
- },\r
- },\r
by_license_group: {\r
type: 'list',\r
- args: {\r
- list_name: 'by_license_group',\r
- },\r
},\r
by_system_picture: {\r
type: 'list',\r
+ },\r
+ count: {\r
+ type: 'count',\r
args: {\r
- list_name: 'by_system_picture',\r
+ list_name: 'public_list',\r
},\r
},\r
+ count_by_license_group: {\r
+ type: 'count',\r
+ },\r
+ count_by_system_picture: {\r
+ type: 'count',\r
+ },\r
},\r
},\r
- author: {\r
+ authors: {\r
actions: {\r
index: {\r
type: 'list',\r
list_name: 'ground_colors',\r
},\r
},\r
+ count: {\r
+ type: 'count',\r
+ args: {\r
+ list_name: 'public_list',\r
+ },\r
+ },\r
},\r
},\r
- artist: {\r
+ artists: {\r
actions: {\r
index: {\r
type: 'list',\r
list_name: 'resource_pictures',\r
},\r
},\r
+ count: {\r
+ type: 'count',\r
+ args: {\r
+ list_name: 'public_list',\r
+ },\r
+ },\r
},\r
},\r
- system_picture: {\r
+ system_pictures: {\r
actions: {\r
index: {\r
type: 'list',\r
\r
},\r
},\r
+ count: {\r
+ type: 'count',\r
+ args: {\r
+ list_name: 'public_list',\r
+ },\r
+ },\r
},\r
},\r
home: {\r
actions: {\r
scrolls: {\r
- item_name: 'scroll',\r
type: 'list',\r
args: {\r
+ item_name: 'scroll',\r
list_name: 'private_list',\r
\r
},\r
},\r
scroll_panels: {\r
- item_name: 'scroll_panel',\r
type: 'list',\r
args: {\r
+ item_name: 'scroll_panel',\r
list_name: 'private_list',\r
\r
},\r
},\r
comics: {\r
- item_name: 'comic',\r
type: 'list',\r
args: {\r
+ item_name: 'comic',\r
list_name: 'private_list',\r
\r
},\r
},\r
stories: {\r
- item_name: 'story',\r
type: 'list',\r
args: {\r
+ item_name: 'story',\r
list_name: 'private_list',\r
\r
},\r
},\r
story_sheets: {\r
- item_name: 'story_sheet',\r
type: 'list',\r
args: {\r
+ item_name: 'story_sheet',\r
list_name: 'private_list',\r
\r
},\r
},\r
sheets: {\r
- item_name: 'sheet',\r
type: 'list',\r
args: {\r
+ item_name: 'sheet',\r
list_name: 'private_list',\r
\r
},\r
},\r
sheet_panels: {\r
- item_name: 'sheet_panel',\r
type: 'list',\r
args: {\r
+ item_name: 'sheet_panel',\r
list_name: 'private_list',\r
\r
},\r
},\r
panels: {\r
- item_name: 'panel',\r
type: 'list',\r
args: {\r
+ item_name: 'panel',\r
list_name: 'private_list',\r
\r
},\r
},\r
panel_pictures: {\r
- item_name: 'panel_picture',\r
type: 'list',\r
args: {\r
+ item_name: 'panel_picture',\r
list_name: 'private_list',\r
\r
},\r
},\r
speech_balloons: {\r
- item_name: 'speech_balloon',\r
type: 'list',\r
args: {\r
+ item_name: 'speech_balloon',\r
list_name: 'private_list',\r
\r
},\r
},\r
speeches: {\r
- item_name: 'speech',\r
type: 'list',\r
args: {\r
+ item_name: 'speech',\r
list_name: 'private_list',\r
\r
},\r
},\r
balloons: {\r
- item_name: 'balloon',\r
type: 'list',\r
args: {\r
+ item_name: 'balloon',\r
list_name: 'private_list',\r
\r
},\r
},\r
ground_pictures: {\r
- item_name: 'ground_picture',\r
type: 'list',\r
args: {\r
+ item_name: 'ground_picture',\r
list_name: 'private_list',\r
\r
},\r
},\r
ground_colors: {\r
- item_name: 'ground_color',\r
type: 'list',\r
args: {\r
+ item_name: 'ground_color',\r
list_name: 'private_list',\r
\r
},\r
},\r
original_pictures: {\r
- item_name: 'original_picture',\r
type: 'list',\r
args: {\r
+ item_name: 'original_picture',\r
list_name: 'private_list',\r
\r
},\r
},\r
resource_pictures: {\r
- item_name: 'resource_picture',\r
type: 'list',\r
args: {\r
+ item_name: 'resource_picture',\r
list_name: 'private_list',\r
\r
},\r
link: {\r
type: 'action',\r
args: {\r
- action_nname: 'history',\r
+ action_name: 'history',\r
},\r
},\r
},\r
Manifest.manifest.profiler_managers[self.model.item_name]
end
- def public_list
- my_controller = Manifest.manifest.controllers[self.class.model.item_name]
+ def set_list
+ my_controller = Manifest.manifest.controllers[params[:controller].to_s]
my_action = my_controller.actions[params[:action].to_s]
my_model = Manifest.manifest.models[my_action.item_name]
my_model_list = my_model.lists[my_action.list_name]
my_list = Manifest.manifest.lists[my_action.item_name]
- list = my_list[my_action.list_name]
- list_result = list.open(@operators, {:id => params})
+ @list = my_list[my_action.list_name]
+ end
+
+ def filer_list
+ set_list
+ list_result = @list.open(@operators, {:id => params[:id]})
@items = list_result.items
respond_to do |format|
format.html {
- @filer = Manifest::View::Filer.new my_action.item_name, list_result.items, list_result.paginate, @operators
+ @filer = Manifest::View::Filer.new @list.item_name, list_result.items, list_result.paginate, @operators
render @filer.template_name, :locals => {
:filer => @filer
}
end
end
- def my_list params
- controller_name = params[:controller]
- action_name = params[:action]
- controller = Manifest.manifest.controller_managers[controller_name]
- @action = controller.open(action_name, params, @operators)
- @items = @action.items
-
- respond_to do |format|
- format.html {
- @filer = @action.filer
- render :template => 'system/filer', :locals => {
- :filer => @filer
- }
- }
- format.json { render json: @items.to_json(self.class.model.list_json_opt) }
- end
- end
-
- def has_many_list
- @parent_item = self.class.model.show(params[:id], @operators)
- controller_name = self.class.model.item_name
- action_name = params[:action]
- controller = Manifest.manifest.controller_managers[controller_name]
- @action = controller.open(action_name, params, @operators)
- many_name = @action.list.association_model_name
- @items = @action.list.items @parent_item
- respond_to do |format|
- format.html {
- @filer = Manifest.manifest.filer_managers[many_name].open(many_name, @items, @operators, @action.list.paginate(@parent_item))
- render @filer.template_name, :locals => {
- :filer => @filer
- }
- }
- format.json { render json: @items.to_json(self.class.model.list_json_opt) }
- end
- end
-
- def filter_list
- controller_name = self.class.model.item_name
- action_name = params[:action]
- controller = Manifest.manifest.controller_managers[controller_name]
- @action = controller.open(action_name, params, @operators)
- @filter_item = @action.list.from_model.show(params[:id], @operators)
- item_model_name = @action.list.item_name
- @items = @action.list.items @filter_item
+ def list_count
+ set_list
+ j = {:count => @list.count(@operators, {:id => params[:id]})}
respond_to do |format|
- format.html {
- @filer = Manifest.manifest.filer_managers[item_model_name].open(item_model_name, @items, @operators, @action.list.paginate(@filter_item))
- render :template => 'system/filer', :locals => {
- :filer => @filer
- }
- }
- format.json { render json: @items.to_json(self.class.model.list_json_opt) }
+ format.json { render json: j.to_json }
end
end
end
def index
- public_list
- end
-
- def resource_pictures
- has_many_list
+ filer_list
end
def show
end
def count
- @artist = {:count => Artist.visible_count}
- respond_to do |format|
- format.json { render json: @artist.to_json }
- end
+ list_count
end
def new
before_filter :authenticate_user, :only => [:new, :create, :edit, :update]
before_filter :authenticate_author, :only => [:edit, :update]
else
- before_filter :authenticate_reader, :only => [:index, :show, :scrolls, :scroll_panels, :comics, :stories, :story_sheets, :sheets, :sheet_panels, :panels, :panel_pictures, :speech_balloons, :ground_pictures, :ground_colors]
+ before_filter :authenticate_reader, :only => [:index, :show, :count]
before_filter :authenticate_user, :only => [:new, :create, :edit, :update]
before_filter :authenticate_author, :only => [:edit, :update]
end
end
def index
- public_list
- end
-
- def scrolls
- has_many_list
- end
-
- def scroll_panels
- has_many_list
- end
-
- def comics
- has_many_list
- end
-
- def stories
- has_many_list
- end
-
- def story_sheets
- has_many_list
- end
-
- def sheets
- has_many_list
- end
-
- def sheet_panels
- has_many_list
- end
-
- def panels
- has_many_list
- end
-
- def panel_pictures
- has_many_list
- end
-
- def speech_balloons
- has_many_list
- end
-
- def ground_pictures
- has_many_list
- end
-
- def ground_colors
- has_many_list
+ filer_list
end
def show
format.json { render :json => @item.to_json(Author.show_json_opt) }
end
end
-
+
def count
- @au = {:count => Author.visible_count}
- respond_to do |format|
- format.json { render json: @au.to_json }
- end
+ list_count
end
def new
before_filter :authenticate_user, :only => []
before_filter :authenticate_author, :only => []
else
- before_filter :authenticate_reader, :only => [:index, :show, :by_speech_balloon]
+ before_filter :authenticate_reader, :only => [
+ :index, :show, :by_speech_balloon, :count, :count_by_speech_balloon
+ ]
before_filter :authenticate_user, :only => []
before_filter :authenticate_author, :only => []
end
end
def index
- public_list
+ filer_list
end
def by_speech_balloon
- has_one_list
+ filer_list
end
def show
end
end
- def list
- @balloons = Balloon.all
-
- respond_to do |format|
- format.html { render layout: 'system' }
- format.json { render json: @balloons }
- end
+ def count
+ list_count
end
-
- def browse
- @balloon = Balloon.find(params[:id])
-
- respond_to do |format|
- format.html { render layout: 'system' }
- format.json { render json: @balloon }
- end
+
+ def count_by_speech_balloon
+ list_count
end
-
+
end
before_filter :authenticate_user, :only => [:new, :create, :edit, :update, :destroy]
before_filter :authenticate_author, :only => [:new, :create, :edit, :update, :destroy]
else
- before_filter :authenticate_reader, :only => [:top, :index, :show, :stories, :by_author]
+ before_filter :authenticate_reader, :only => [:index, :show, :by_author, :count, :count_by_author]
before_filter :authenticate_user, :only => [:new, :create, :edit, :update, :destroy]
before_filter :authenticate_author, :only => [:new, :create, :edit, :update, :destroy]
end
end
def index
- public_list
- end
-
- def stories
- has_many_list
+ filer_list
end
def by_author
- filter_list
+ filer_list
end
def show
end
def count
- @comic = {:count => Comic.visible_count}
- respond_to do |format|
- format.json { render json: @comic.to_json }
- end
+ list_count
+ end
+
+ def count_by_author
+ list_count
end
def new
before_filter :authenticate_user, :only => [:new, :edit, :create, :update, :destroy]
before_filter :authenticate_author, :only => [:new, :edit, :create, :update, :destroy]
else
- before_filter :authenticate_reader, :only => [:index, :show, :by_panel, :by_author]
+ before_filter :authenticate_reader, :only => [
+ :index, :show, :by_panel, :by_author, :count, :count_by_panel, :count_by_author
+ ]
before_filter :authenticate_user, :only => [:new, :edit, :create, :update, :destroy]
before_filter :authenticate_author, :only => [:new, :edit, :create, :update, :destroy]
end
end
def index
- public_list
+ filer_list
end
def by_panel
- filter_list
+ filer_list
end
def by_author
- filter_list
+ filer_list
end
def show
end
end
+ def count
+ list_count
+ end
+
+ def count_by_panel
+ list_count
+ end
+
+ def count_by_author
+ list_count
+ end
+
def new
raise Pettanr::NotWork unless @operators.author.working_panel
@panel = Panel.edit(@operators.author.working_panel, @operators)
before_filter :authenticate_user, :only => [:new, :edit, :create, :update, :destroy]
before_filter :authenticate_author, :only => [:new, :edit, :create, :update, :destroy]
else
- before_filter :authenticate_reader, :only => [:index, :show, :by_panel, :by_author]
+ before_filter :authenticate_reader, :only => [
+ :index, :show, :by_panel, :by_author, :count, :count_by_panel, :count_by_author
+ ]
before_filter :authenticate_user, :only => [:new, :edit, :create, :update, :destroy]
before_filter :authenticate_author, :only => [:new, :edit, :create, :update, :destroy]
end
end
def index
- public_list
+ filer_list
end
def by_panel
- filter_list
+ filer_list
end
def by_author
- filter_list
+ filer_list
end
def show
end
end
+ def count
+ list_count
+ end
+
+ def count_by_panel
+ list_count
+ end
+
+ def count_by_author
+ list_count
+ end
+
def new
raise Pettanr::NotWork unless @operators.author.working_panel
@picture = Picture.show params[:picture_id], @operators
:index, :show, :profile, :configure, :create_token, :delete_token,
:scrolls, :scroll_panels, :comics, :stories, :story_sheets, :sheets, :sheet_panels, :panels, :resource_pictures, :panel_pictures, :speech_balloons, :ground_pictures, :ground_colors
]
- before_filter :authenticate_author, :only => [:scrolls, :scroll_panels, :comics, :stories, :story_sheets, :sheets, :sheet_panels, :panels, :panel_pictures, :speech_balloons, :ground_pictures, :ground_colors]
+ before_filter :authenticate_author, :only => [
+ :scrolls, :scroll_panels, :comics, :stories, :story_sheets, :sheets, :sheet_panels, :panels, :panel_pictures, :speech_balloons, :ground_pictures, :ground_colors
+ ]
before_filter :authenticate_artist, :only => [:resource_pictures]
def index
end
def scrolls
- my_list params
+ filer_list
end
def scroll_panels
- my_list params
+ filer_list
end
def comics
- my_list params
+ filer_list
end
def stories
- my_list params
+ filer_list
end
def story_sheets
- my_list params
+ filer_list
end
def sheets
- my_list params
+ filer_list
end
def sheet_panels
- my_list params
+ filer_list
end
def panels
- my_list params
+ filer_list
end
def panel_pictures
- my_list params
+ filer_list
end
def speech_balloons
- my_list params
+ filer_list
end
def ground_pictures
- my_list params
+ filer_list
end
def ground_colors
- my_list params
+ filer_list
end
def resource_pictures
- my_list params
+ filer_list
end
end
class LicenseGroupsController < ApplicationController
- before_filter :authenticate_admin!, :only => [:list, :browse]
+ before_filter :authenticate_admin!, :only => []
def self.model
LicenseGroup
end
def index
- public_list
- end
-
- def licenses
- has_many_list
+ filer_list
end
def show
format.json { render json: @item.to_json(LicenseGroup.show_json_opt) }
end
end
-
- def list
- @license_groups = LicenseGroup.all
-
- respond_to do |format|
- format.html { render layout: 'system' }
- end
- end
-
- def browse
- @license_group = LicenseGroup.find(params[:id])
-
- respond_to do |format|
- format.html { render layout: 'system' }
- end
+
+ def count
+ list_count
end
+
end
class LicensesController < ApplicationController
- before_filter :authenticate_resource_reader, :only => [:resource_pictures, :by_license_group, :by_system_picture]
+ before_filter :authenticate_resource_reader, :only => [
+ :by_license_group, :by_system_picture, :count_by_license_group, :count_by_system_picture
+ ]
def self.model
License
end
def index
- public_list
- end
-
- def resource_pictures
- has_many_list
+ filer_list
end
def by_license_group
- filter_list
+ filer_list
end
def by_system_picture
- filter_list
+ filer_list
end
def show
end
end
+ def count
+ list_count
+ end
+
+ def count_by_license_group
+ list_count
+ end
+
+ def count_by_system_picture
+ list_count
+ end
+
end
#原画
class OriginalPicturesController < ApplicationController
- before_filter :authenticate_reader, :only => [:show, :history]
+ before_filter :authenticate_reader, :only => [:show, :history, :count]
before_filter :authenticate_user, :only => [:index, :new, :edit, :create, :update, :destroy]
before_filter :authenticate_artist, :only => [:index, :new, :edit, :create, :update, :destroy]
end
def index
- public_list
+ filer_list
end
def show
end
end
+ def count
+ list_count
+ end
+
def new
@original_picture = OriginalPicture.new
@original_picture.supply_default
before_filter :authenticate_user, :only => [:new, :edit, :create, :update, :destroy]
before_filter :authenticate_author, :only => [:new, :edit, :create, :update, :destroy]
else
- before_filter :authenticate_reader, :only => [:index, :show, :by_panel, :by_author]
+ before_filter :authenticate_reader, :only => [
+ :index, :show, :by_panel, :by_author, :count, :count_by_panel, :count_by_author
+ ]
before_filter :authenticate_user, :only => [:new, :edit, :create, :update, :destroy]
before_filter :authenticate_author, :only => [:new, :edit, :create, :update, :destroy]
end
end
def index
- public_list
+ filer_list
end
def by_panel
- filter_list
+ filer_list
end
def by_author
- filter_list
+ filer_list
end
def show
end
end
+ def count
+ list_count
+ end
+
+ def count_by_panel
+ list_count
+ end
+
+ def count_by_author
+ list_count
+ end
+
def new
raise Pettanr::NotWork unless @operators.author.working_panel
@picture = Picture.show params[:picture_id], @operators
before_filter :authenticate_user, :only => [:new, :edit, :create, :update, :destroy, :catch]
before_filter :authenticate_author, :only => [:new, :edit, :create, :update, :destroy, :catch]
else
- before_filter :authenticate_reader, :only => [:index, :show, :scroll_panels, :scrolls, :sheet_panels, :sheets, :panel_pictures, :speech_balloons, :ground_pictures, :ground_colors, :by_scroll, :by_sheet, :by_author]
+ before_filter :authenticate_reader, :only => [
+ :index, :show, :by_scroll, :by_sheet, :by_author, :count, :count_by_scroll, :count_by_sheet, :count_by_author
+ ]
before_filter :authenticate_user, :only => [:new, :edit, :create, :update, :destroy, :catch]
before_filter :authenticate_author, :only => [:new, :edit, :create, :update, :destroy, :catch]
end
end
def index
- public_list
- end
-
- def scroll_panels
- has_many_list
- end
-
- def scrolls
- has_many_list
- end
-
- def sheet_panels
- has_many_list
- end
-
- def sheets
- has_many_list
- end
-
- def panel_pictures
- has_many_list
- end
-
- def speech_balloons
- has_many_list
- end
-
- def ground_pictures
- has_many_list
- end
-
- def ground_colors
- has_many_list
+ filer_list
end
def by_scroll
- filter_list
+ filer_list
end
def by_sheet
- filter_list
+ filer_list
end
def by_author
- filter_list
+ filer_list
end
-
def show
@item = Panel.show(params[:id], @operators)
end
def count
- @panel = {:count => Panel.visible_count}
- respond_to do |format|
- format.json { render json: @panel.to_json }
- end
+ list_count
+ end
+
+ def count_by_scroll
+ list_count
+ end
+
+ def count_by_sheet
+ list_count
+ end
+
+ def count_by_author
+ list_count
end
def new
before_filter :authenticate_user, :only => [:new, :create, :update, :destroy]
before_filter :authenticate_artist, :only => [:new, :create, :update, :destroy]
else
- before_filter :authenticate_resource_reader, :only => [:index, :show, :credit, :by_license, :by_artist]
+ before_filter :authenticate_resource_reader, :only => [
+ :index, :show, :credit, :by_license, :by_artist, :count, :count_by_license, :count_by_artist
+ ]
before_filter :authenticate_user, :only => [:new, :create, :update, :destroy]
before_filter :authenticate_artist, :only => [:new, :create, :update, :destroy]
end
end
def index
- public_list
+ filer_list
end
def by_license
- filter_list
+ filer_list
end
def by_artist
- filter_list
+ filer_list
end
def show
end
end
+ def count
+ list_count
+ end
+
+ def count_by_license
+ list_count
+ end
+
+ def count_by_artist
+ list_count
+ end
+
def new
@original_picture = OriginalPicture.edit params[:original_picture_id], @operators
@imager = PettanImager.load @original_picture.restore
before_filter :authenticate_user, :only => [:new, :create, :edit, :update, :destroy]
before_filter :authenticate_author, :only => [:new, :create, :edit, :update, :destroy]
else
- before_filter :authenticate_reader, :only => [:index, :show, :by_panel, :by_scroll]
+ before_filter :authenticate_reader, :only => [
+ :index, :show, :by_panel, :by_scroll, :count, :count_by_panel, :count_by_scroll
+ ]
before_filter :authenticate_user, :only => [:new, :create, :edit, :update, :destroy]
before_filter :authenticate_author, :only => [:new, :create, :edit, :update, :destroy]
end
end
def index
- public_list
+ filer_list
end
def by_panel
- filter_list
+ filer_list
end
def by_scroll
- filter_list
+ filer_list
end
def show
end
end
+ def count
+ list_count
+ end
+
+ def count_by_panel
+ list_count
+ end
+
+ def count_by_scroll
+ list_count
+ end
+
def new
@scroll_panel = ScrollPanel.new
@scroll_panel.supply_default
end
def index
- public_list
+ filer_list
end
def by_author
- filter_list
+ filer_list
end
def by_panel
- filter_list
+ filer_list
end
def show
end
def count
- @scroll = {:count => Scroll.visible_count}
- respond_to do |format|
- format.json { render json: @scroll.to_json }
- end
- end
-
- def scroll_panels_count
- has_many_list
- end
-
- def panels_count
- has_many_list
+ list_count
end
def count_by_author
- filter_list
+ list_count
end
def count_by_panel
- filter_list
+ list_count
end
def new
before_filter :authenticate_user, :only => [:new, :create, :edit, :update, :destroy]
before_filter :authenticate_author, :only => [:new, :create, :edit, :update, :destroy]
else
- before_filter :authenticate_reader, :only => [:index, :show, :by_sheet, :by_panel]
+ before_filter :authenticate_reader, :only => [
+ :index, :show, :by_sheet, :by_panel, :count, :count_by_sheet, :count_by_panel
+ ]
before_filter :authenticate_user, :only => [:new, :create, :edit, :update, :destroy]
before_filter :authenticate_author, :only => [:new, :create, :edit, :update, :destroy]
end
end
def index
- public_list
+ filer_list
end
def by_sheet
- filter_list
+ filer_list
end
def by_panel
- filter_list
+ filer_list
end
def show
end
end
+ def count
+ list_count
+ end
+
+ def count_by_sheet
+ list_count
+ end
+
+ def count_by_panel
+ list_count
+ end
+
def new
@sheet_panel = SheetPanel.new
@sheet_panel.supply_default
before_filter :authenticate_user, :only => [:new, :create, :edit, :update, :destroy]
before_filter :authenticate_author, :only => [:new, :create, :edit, :update, :destroy]
else
- before_filter :authenticate_reader, :only => [:index, :show, :play, :story_sheets, :stories, :sheet_panels, :panels, :by_story, :by_panel, :by_author]
+ before_filter :authenticate_reader, :only => [
+ :index, :show, :play, :by_story, :by_panel, :by_author, :count, :count_by_story, :count_by_panel, :count_by_author
+ ]
before_filter :authenticate_user, :only => [:new, :create, :edit, :update, :destroy]
before_filter :authenticate_author, :only => [:new, :create, :edit, :update, :destroy]
end
end
def index
- public_list
- end
-
- def story_sheets
- has_many_list
- end
-
- def stories
- has_many_list
- end
-
- def sheet_panels
- has_many_list
- end
-
- def panels
- has_many_list
+ filer_list
end
def by_story
- filter_list
+ filer_list
end
def by_panel
- filter_list
+ filer_list
end
def by_author
- filter_list
+ filer_list
end
def show
end
def count
- @sheet = {:count => Sheet.visible_count}
- respond_to do |format|
- format.json { render json: @sheet.to_json }
- end
+ list_count
+ end
+
+ def count_by_story
+ list_count
+ end
+
+ def count_by_panel
+ list_count
+ end
+
+ def count_by_author
+ list_count
end
def new
if Manifest.manifest.magic_numbers['run_mode'] == 0
before_filter :authenticate_user, :only => []
else
- before_filter :authenticate_reader, :only => [:index, :show, :speech_balloons, :panels, :by_system_picture]
+ before_filter :authenticate_reader, :only => [
+ :index, :show, :by_system_picture, :count, :count_by_system_picture
+ ]
before_filter :authenticate_user, :only => []
end
- before_filter :authenticate_admin!, :only => [:list, :browse, :destroy]
+ before_filter :authenticate_admin!, :only => [:destroy]
def self.model
SpeechBalloonTemplate
end
def index
- public_list
- end
-
- def speech_balloons
- has_many_list
- end
-
- def panels
- has_many_list
+ filer_list
end
def by_system_picture
- filter_list
+ filer_list
end
def show
}
end
end
-
- def list
- @speech_balloon_templates = SpeechBalloonTemplate.all
-
- respond_to do |format|
- format.html { render layout: 'system' }
- format.json { render json: @speech_balloon_templates }
- end
+
+ def count
+ list_count
end
-
- def browse
- @speech_balloon_template = SpeechBalloonTemplate.find(params[:id])
-
- respond_to do |format|
- format.html { render layout: 'system' }
- format.json { render json: @speech_balloon_template }
- end
+
+ def count_by_system_picture
+ list_count
end
-
+
def destroy
@speech_balloon_template = SpeechBalloonTemplate.find(params[:id])
@speech_balloon_template.destroy
before_filter :authenticate_user, :only => [:new, :edit, :create, :update, :destroy]
before_filter :authenticate_author, :only => [:new, :edit, :create, :update, :destroy]
else
- before_filter :authenticate_reader, :only => [:index, :show, :by_panel, :by_author]
+ before_filter :authenticate_reader, :only => [
+ :index, :show, :by_panel, :by_author, :count, :count_by_panel, :count_by_author
+ ]
before_filter :authenticate_user, :only => [:new, :edit, :create, :update, :destroy]
before_filter :authenticate_author, :only => [:new, :edit, :create, :update, :destroy]
end
end
def index
- public_list
+ filer_list
end
def by_panel
- filter_list
+ filer_list
end
def by_author
- filter_list
+ filer_list
end
def show
end
end
+ def count
+ list_count
+ end
+
+ def count_by_panel
+ list_count
+ end
+
+ def count_by_author
+ list_count
+ end
+
def new
raise Pettanr::NotWork unless @operators.author.working_panel
@speech_balloon_template = SpeechBalloonTemplate.show params[:speech_balloon_template_id], @operators
before_filter :authenticate_user, :only => []
before_filter :authenticate_author, :only => []
else
- before_filter :authenticate_reader, :only => [:index, :show, :by_speech_balloon, :by_writing_format]
+ before_filter :authenticate_reader, :only => [
+ :index, :show, :by_speech_balloon, :by_writing_format, :count, :count_by_speech_balloon, :count_by_writing_format
+ ]
before_filter :authenticate_user, :only => []
before_filter :authenticate_author, :only => []
end
- before_filter :authenticate_admin!, :only => [:list, :browse]
+ before_filter :authenticate_admin!, :only => []
def self.model
Speech
end
def index
- public_list
+ filer_list
end
def by_speech_balloon
- filter_list
+ filer_list
end
def by_writing_format
- filter_list
+ filer_list
end
def show
end
end
- def list
- @speeches = Speech.all
-
- respond_to do |format|
- format.html { render layout: 'system' }
- format.json { render json: @speeches }
- end
+ def count
+ list_count
end
-
- def browse
- @speech = Speech.find(params[:id])
-
- respond_to do |format|
- format.html { render layout: 'system' }
- format.json { render json: @speech }
- end
+
+ def count_by_speech_balloon
+ list_count
end
-
+
+ def count_by_writing_format
+ list_count
+ end
+
end
before_filter :authenticate_user, :only => [:new, :create, :edit, :update, :destroy]
before_filter :authenticate_author, :only => [:new, :create, :edit, :update, :destroy]
else
- before_filter :authenticate_reader, :only => [:index, :show, :play, :story_sheets, :sheets, :by_comic, :by_sheet, :by_author]
+ before_filter :authenticate_reader, :only => [
+ :index, :show, :play, :by_comic, :by_sheet, :by_author, :count, :count_by_comic, :count_by_sheet, :count_by_author
+ ]
before_filter :authenticate_user, :only => [:new, :create, :edit, :update, :destroy]
before_filter :authenticate_author, :only => [:new, :create, :edit, :update, :destroy]
end
end
def index
- public_list
- end
-
- def story_sheets
- has_many_list
- end
-
- def sheets
- has_many_list
+ filer_list
end
def by_comic
- filter_list
+ filer_list
end
def by_sheet
- filter_list
+ filer_list
end
def by_author
- filter_list
+ filer_list
end
def show
end
end
+ def count
+ list_count
+ end
+
+ def count_by_comic
+ list_count
+ end
+
+ def count_by_sheet
+ list_count
+ end
+
+ def count_by_author
+ list_count
+ end
+
def new
@story = Story.new
@story.supply_default
before_filter :authenticate_user, :only => [:new, :create, :edit, :update, :destroy]
before_filter :authenticate_author, :only => [:new, :create, :edit, :update, :destroy]
else
- before_filter :authenticate_reader, :only => [:index, :show, :by_story, :by_sheet]
+ before_filter :authenticate_reader, :only => [
+ :index, :show, :by_story, :by_sheet, :count, :count_by_story, :count_by_sheet
+ ]
before_filter :authenticate_user, :only => [:new, :create, :edit, :update, :destroy]
before_filter :authenticate_author, :only => [:new, :create, :edit, :update, :destroy]
end
end
def index
- public_list
+ filer_list
end
def by_story
- filter_list
+ filer_list
end
def by_sheet
- filter_list
+ filer_list
end
def show
end
end
+ def count
+ list_count
+ end
+
+ def count_by_story
+ list_count
+ end
+
+ def count_by_sheet
+ list_count
+ end
+
def new
@story_sheet = StorySheet.new
@story_sheet.supply_default
end
end
- def browse
- end
-
def auth_token
end
before_filter :authenticate_user, :only => []
before_filter :authenticate_author, :only => []
else
- before_filter :authenticate_resource_reader, :only => [:index, :show, :speech_balloon_templates, :licenses]
+ before_filter :authenticate_resource_reader, :only => [:index, :show, :count]
before_filter :authenticate_user, :only => []
before_filter :authenticate_author, :only => []
end
- before_filter :authenticate_admin!, :only => [:list, :browse, :new, :create]
+ before_filter :authenticate_admin!, :only => []
def self.model
SystemPicture
end
def index
- public_list
- end
-
- def speech_balloon_templates
- has_many_list
- end
-
- def licenses
- has_many_list
+ filer_list
end
def show
format.json { render json: @item.to_json(SystemPicture.show_json_opt)}
end
end
-
- def list
- @system_pictures = SystemPicture.all
-
- respond_to do |format|
- format.html { render layout: 'system' }
- format.json { render json: @system_pictures }
- end
- end
-
- def browse
- @system_picture = SystemPicture.find(params[:id])
-
- respond_to do |format|
- format.html { render layout: 'system' }
- format.json { render json: @system_picture}
- end
+
+ def count
+ list_count
end
-
+
end
if Manifest.manifest.magic_numbers['run_mode'] == 0
before_filter :authenticate_user, :only => []
else
- before_filter :authenticate_reader, :only => [:index, :show]
+ before_filter :authenticate_reader, :only => [:index, :show, :count]
before_filter :authenticate_user, :only => []
end
- before_filter :authenticate_admin!, :only => [:list, :browse, :destroy]
+ before_filter :authenticate_admin!, :only => [:destroy]
def self.model
WritingFormat
end
def index
- public_list
+ filer_list
end
def show
end
end
+ def count
+ list_count
+ end
+
end
end
def set_default
- @controller_manifest['item_name'] ||= @controller_name
+ @controller_manifest['item_name'] ||= ::Manifest.singularize(@controller_name)
@controller_manifest['actions'] ||= {}
end
require_dependency "manifest/controller/action/base"
require_dependency "manifest/controller/action/list"
require_dependency "manifest/controller/action/show"
+require_dependency "manifest/controller/action/count"
module Manifest
module ControllerModule
class ActionFactory
include ActionModule
@@types = {
- 'list' => ActionList, 'show' => ActionShow
+ 'list' => ActionList, 'show' => ActionShow, 'count' => ActionCount
}
def self.factory controller, action_name, my_manifest
my_manifest['type'] ||= 'list'
def set_default
super
+ @action_manifest['args']['list_name'] ||= @action_name
end
def init
super
- raise "undefined list_name for controllers > #{self.controller_name} > actions > #{@action_name}\n" unless @args['list_name']
@list_name = @args['list_name']
end
attr :method_name
def set_default
super
- raise "undefined method_name for filers > #{self.caption.filer.filer_name} > caption > default > face\n" unless @face_manifest['args']['method_name']
+ @face_manifest['args']['method_name'] ||= 'caption'
end
def init
@model.where(self.where).includes(self.includes).order(self.order).offset(offset).limit(page_size)
end
+ def count operators, options
+ @model.where(self.where).includes(self.includes)
+ end
+
def paginate items, offset, page_size
c = items ? items.count : 0
Kaminari.paginate_array(Array.new(c, nil)).page(offset).per(page_size)
def init
super
+ @filter_key = @model_list_manifest.filter_key
end
- def where filter_item
+ def where filter_item_id
w = @model.list_where
w += ' and ' unless w.blank?
- [w + @table_name + '.' + @filter_key + ' = ?', filter_item.id]
+ [w + @table_name + '.' + @filter_key + ' = ?', filter_item_id]
end
def includes
end
def items options, offset, page_size
- filter_item = options[:filter_item]
- @model.where(self.where(filter_item)).includes(self.includes).order(self.order).offset(offset).limit(page_size)
+ filter_item_id = options[:id]
+ @model.where(self.where(filter_item_)).includes(self.includes).order(self.order).offset(offset).limit(page_size)
+ end
+
+ def count operators, options
+ filter_item_id = options[:id]
+ @model.where(self.where(filter_item_id)).includes(self.includes).count
end
def self._add_action item_name, action_name, list_name, list_conf
end
def tag_opt
- @item.__send__ self.method_name
+ if @item.methods(true).include?(self.method_name.to_sym)
+ @item.__send__ self.method_name
+ else
+ {:src => '/images/error.png', :width => Manifest.manifest.magic_numbers['thumbnail_width'], :height => Manifest.manifest.magic_numbers['thumbnail_height']}
+ end
end
end
+require_dependency "manifest/local/view/filer/body/file_header/base"
require_dependency "manifest/local/view/filer/body/file_header/show"
require_dependency "manifest/local/view/filer/body/file_header/none"
module Manifest
module FilerModule
module BodyModule
module FileHeaderModule
- class None
- attr :file_header, :column_name
- def initialize file_header, column_name
- @file_header = file_header
- @column_name = column_name
- end
-
- def filer
- @file_header.filer
- end
-
- def manifest
- self.filer.manifest
- end
-
- def item_name
- self.filer.item_name
- end
-
- def model
- self.filer.model
- end
-
- def items
- self.filer.items
- end
-
- def template_dir
- self.filer.template_dir + 'header_column/'
- end
-
+ class None < Base
def template_file_name
"none"
end
-
- def template_name
- self.template_dir + self.template_file_name
- end
-
end
end
end
module FilerModule
module BodyModule
module FileHeaderModule
- class Show
- attr :file_header, :column_name
- def initialize file_header, column_name
- @file_header = file_header
- @column_name = column_name
- end
-
- def filer
- @file_header.filer
- end
-
- def manifest
- self.filer.manifest
- end
-
- def item_name
- self.filer.item_name
- end
-
- def model
- self.filer.model
- end
-
- def items
- self.filer.items
- end
-
- def template_dir
- self.filer.template_dir + 'header_column/'
- end
-
+ class Show < Base
def template_file_name
"show"
end
-
- def template_name
- self.template_dir + self.template_file_name
- end
-
end
end
end
item_name.classify.constantize
end
+ def singularize name
+ name.singularize
+ end
+
end
extend ModuleMethods
def init
@type = @list_manifest['type']
@args = @list_manifest['args']
- @default_page_size = @list_manifest['args']['default_page_size']
- @max_page_size = @list_manifest['args']['max_page_size']
+ @default_page_size = @args['default_page_size']
+ @max_page_size = @args['max_page_size']
end
def model_name
module ModelModule
module ListModule
class FilterList < Base
+ attr :filter_key
def set_default
super
+ @list_manifest['args']['filter_item_name'] ||= @list_name.gsub(/^by_/, '')
+ @list_manifest['args']['filter_key'] ||= @list_manifest['args']['filter_item_name'] + '_id'
end
def init
super
- return
- end
-
- def where filter_item
- w = @model.list_where
- w += ' and ' unless w.blank?
- [w + @table_name + '.' + @filter_key + ' = ?', filter_item.id]
- end
-
- def includes
- return @includes if @includes
- w = @owner_model ? {@owner_model.item_name => {}} : {}
- w.merge({@from => {} })
- end
-
- def items filter_item
- @model.where(self.where(filter_item)).includes(self.includes).order(self.order).offset(@offset).limit(@page_size)
- end
-
- def paginate filter_item
- Kaminari.paginate_array(Array.new(@model.where(self.where(filter_item)).includes(self.includes).count, nil)).page(@offset).per(@page_size)
+ @filter_key = @args['filter_key']
end
def self._add_action item_name, action_name, list_name, list_conf
{\r
"controllers": {\r
- "scroll": {\r
+ "scrolls": {\r
"actions": {\r
"index": {\r
"type": "list",\r
"list_name": "public_list"\r
}\r
},\r
- "scroll_panels": {\r
- "type": "list",\r
- "args": {\r
- "list_name": "scroll_panels"\r
- }\r
- },\r
- "panels": {\r
- "type": "list",\r
- "args": {\r
- "list_name": "panels"\r
- }\r
- },\r
"by_author": {\r
- "type": "list",\r
- "args": {\r
- "list_name": "by_author"\r
- }\r
+ "type": "list"\r
},\r
"by_panel": {\r
- "type": "list",\r
- "args": {\r
- "list_name": "by_panel"\r
- }\r
+ "type": "list"\r
},\r
"play": {\r
"type": "list",\r
"show": {\r
"type": "show",\r
"name": "show"\r
+ },\r
+ "count": {\r
+ "type": "count",\r
+ "args": {\r
+ "list_name": "public_list"\r
+ }\r
+ },\r
+ "count_by_author": {\r
+ "type": "count"\r
+ },\r
+ "count_by_panel": {\r
+ "type": "count"\r
}\r
}\r
},\r
- "scroll_panel": {\r
+ "scroll_panels": {\r
"actions": {\r
"index": {\r
"type": "list",\r
}\r
},\r
"by_panel": {\r
- "type": "list",\r
- "args": {\r
- "list_name": "by_panel"\r
- }\r
+ "type": "list"\r
},\r
"by_scroll": {\r
- "type": "list",\r
+ "type": "list"\r
+ },\r
+ "count": {\r
+ "type": "count",\r
"args": {\r
- "list_name": "by_scroll"\r
+ "list_name": "public_list"\r
}\r
+ },\r
+ "count_by_panel": {\r
+ "type": "count"\r
+ },\r
+ "count_by_scroll": {\r
+ "type": "count"\r
}\r
}\r
},\r
- "comic": {\r
+ "comics": {\r
"actions": {\r
"index": {\r
"type": "list",\r
"list_name": "public_list"\r
}\r
},\r
- "stories": {\r
- "type": "list",\r
- "args": {\r
- "list_name": "stories"\r
- }\r
- },\r
"by_author": {\r
- "type": "list",\r
+ "type": "list"\r
+ },\r
+ "count": {\r
+ "type": "count",\r
"args": {\r
- "list_name": "by_author"\r
+ "list_name": "public_list"\r
}\r
+ },\r
+ "count_by_author": {\r
+ "type": "count"\r
}\r
}\r
},\r
- "story": {\r
+ "stories": {\r
"actions": {\r
"index": {\r
"type": "list",\r
"list_name": "public_list"\r
}\r
},\r
- "story_sheets": {\r
- "type": "list",\r
- "args": {\r
- "list_name": "story_sheets"\r
- }\r
- },\r
- "sheets": {\r
- "type": "list",\r
- "args": {\r
- "list_name": "sheets"\r
- }\r
- },\r
"by_comic": {\r
- "type": "list",\r
- "args": {\r
- "list_name": "by_comic"\r
- }\r
+ "type": "count"\r
},\r
"by_sheet": {\r
- "type": "list",\r
- "args": {\r
- "list_name": "by_sheet"\r
- }\r
+ "type": "count"\r
},\r
"by_author": {\r
- "type": "list",\r
- "args": {\r
- "list_name": "by_author"\r
- }\r
+ "type": "list"\r
},\r
"play": {\r
"type": "list",\r
"args": {\r
"list_name": "play"\r
}\r
+ },\r
+ "count": {\r
+ "type": "count",\r
+ "args": {\r
+ "list_name": "public_list"\r
+ }\r
+ },\r
+ "count_by_author": {\r
+ "type": "count"\r
}\r
}\r
},\r
- "story_sheet": {\r
+ "story_sheets": {\r
"actions": {\r
"index": {\r
"type": "list",\r
}\r
},\r
"by_story": {\r
- "type": "list",\r
- "args": {\r
- "list_name": "by_story"\r
- }\r
+ "type": "list"\r
},\r
"by_sheet": {\r
- "type": "list",\r
+ "type": "list"\r
+ },\r
+ "count": {\r
+ "type": "count",\r
"args": {\r
- "list_name": "by_sheet"\r
+ "list_name": "public_list"\r
}\r
+ },\r
+ "count_by_story": {\r
+ "type": "count"\r
+ },\r
+ "count_by_sheet": {\r
+ "type": "count"\r
}\r
}\r
},\r
- "sheet": {\r
+ "sheets": {\r
"actions": {\r
"index": {\r
"type": "list",\r
"list_name": "public_list"\r
}\r
},\r
- "story_sheets": {\r
- "type": "list",\r
- "args": {\r
- "list_name": "story_sheets"\r
- }\r
+ "by_story": {\r
+ "type": "list"\r
},\r
- "stories": {\r
- "type": "list",\r
- "args": {\r
- "list_name": "stories"\r
- }\r
+ "by_panel": {\r
+ "type": "list"\r
},\r
- "sheet_panels": {\r
- "type": "list",\r
- "args": {\r
- "list_name": "sheet_panels"\r
- }\r
+ "by_author": {\r
+ "type": "list"\r
},\r
- "panels": {\r
+ "play": {\r
"type": "list",\r
"args": {\r
- "list_name": "panels"\r
+ "list_name": "play"\r
}\r
},\r
- "by_story": {\r
- "type": "list",\r
+ "count": {\r
+ "type": "count",\r
"args": {\r
- "list_name": "by_story"\r
+ "list_name": "public_list"\r
}\r
},\r
- "by_panel": {\r
- "type": "list",\r
- "args": {\r
- "list_name": "by_panel"\r
- }\r
+ "count_by_story": {\r
+ "type": "count"\r
},\r
- "by_author": {\r
- "type": "list",\r
- "args": {\r
- "list_name": "by_author"\r
- }\r
+ "count_by_panel": {\r
+ "type": "count"\r
},\r
- "play": {\r
- "type": "list",\r
- "args": {\r
- "list_name": "play"\r
- }\r
+ "count_by_author": {\r
+ "type": "count"\r
}\r
}\r
},\r
- "sheet_panel": {\r
+ "sheet_panels": {\r
"actions": {\r
"index": {\r
"type": "list",\r
}\r
},\r
"by_sheet": {\r
- "type": "list",\r
- "args": {\r
- "list_name": "by_sheet"\r
- }\r
+ "type": "list"\r
},\r
"by_panel": {\r
- "type": "list",\r
+ "type": "list"\r
+ },\r
+ "count": {\r
+ "type": "count",\r
"args": {\r
- "list_name": "by_panel"\r
+ "list_name": "public_list"\r
}\r
+ },\r
+ "count_by_sheet": {\r
+ "type": "count"\r
+ },\r
+ "count_by_panel": {\r
+ "type": "count"\r
}\r
}\r
},\r
- "panel": {\r
+ "panels": {\r
"actions": {\r
"index": {\r
"type": "list",\r
"list_name": "public_list"\r
}\r
},\r
- "scroll_panels": {\r
- "type": "list",\r
- "args": {\r
- "list_name": "scroll_panels"\r
- }\r
- },\r
- "scrolls": {\r
- "type": "list",\r
- "args": {\r
- "list_name": "scrolls"\r
- }\r
- },\r
- "sheet_panels": {\r
- "type": "list",\r
- "args": {\r
- "list_name": "sheet_panels"\r
- }\r
- },\r
- "sheets": {\r
- "type": "list",\r
- "args": {\r
- "list_name": "sheets"\r
- }\r
+ "by_scroll": {\r
+ "type": "list"\r
},\r
- "panel_pictures": {\r
- "type": "list",\r
- "args": {\r
- "list_name": "panel_pictures"\r
- }\r
+ "by_sheet": {\r
+ "type": "list"\r
},\r
- "speech_balloons": {\r
- "type": "list",\r
- "args": {\r
- "list_name": "speech_balloons"\r
- }\r
+ "by_author": {\r
+ "type": "list"\r
},\r
- "ground_pictures": {\r
- "type": "list",\r
- "args": {\r
- "list_name": "ground_pictures"\r
- }\r
+ "by_speech_balloon_template": {\r
+ "type": "list"\r
},\r
- "ground_colors": {\r
- "type": "list",\r
+ "count": {\r
+ "type": "count",\r
"args": {\r
- "list_name": "ground_colors"\r
+ "list_name": "public_list"\r
}\r
},\r
- "by_scroll": {\r
- "type": "list",\r
- "args": {\r
- "list_name": "by_scroll"\r
- }\r
+ "count_by_scroll": {\r
+ "type": "count"\r
},\r
- "by_sheet": {\r
- "type": "list",\r
- "args": {\r
- "list_name": "by_sheet"\r
- }\r
+ "count_by_sheet": {\r
+ "type": "count"\r
},\r
- "by_author": {\r
- "type": "list",\r
- "args": {\r
- "list_name": "by_author"\r
- }\r
+ "count_by_author": {\r
+ "type": "count"\r
},\r
- "by_speech_balloon_template": {\r
- "type": "list",\r
- "args": {\r
- "list_name": "by_speech_balloon_template"\r
- }\r
+ "count_by_speech_balloon_template": {\r
+ "type": "count"\r
}\r
}\r
},\r
- "panel_picture": {\r
+ "panel_pictures": {\r
"actions": {\r
"index": {\r
"type": "list",\r
}\r
},\r
"by_panel": {\r
- "type": "list",\r
- "args": {\r
- "list_name": "by_panel"\r
- }\r
+ "type": "list"\r
},\r
"by_author": {\r
- "type": "list",\r
+ "type": "list"\r
+ },\r
+ "count": {\r
+ "type": "count",\r
"args": {\r
- "list_name": "by_author"\r
+ "list_name": "public_list"\r
}\r
+ },\r
+ "count_by_panel": {\r
+ "type": "count"\r
+ },\r
+ "count_by_author": {\r
+ "type": "count"\r
}\r
}\r
},\r
- "speech_balloon": {\r
+ "speech_balloons": {\r
"actions": {\r
"index": {\r
"type": "list",\r
}\r
},\r
"by_panel": {\r
- "type": "list",\r
- "args": {\r
- "list_name": "by_panel"\r
- }\r
+ "type": "list"\r
},\r
"by_author": {\r
- "type": "list",\r
+ "type": "list"\r
+ },\r
+ "count": {\r
+ "type": "count",\r
"args": {\r
- "list_name": "by_author"\r
+ "list_name": "public_list"\r
}\r
+ },\r
+ "count_by_panel": {\r
+ "type": "count"\r
+ },\r
+ "count_by_author": {\r
+ "type": "count"\r
}\r
}\r
},\r
- "speech": {\r
+ "speeches": {\r
"actions": {\r
"index": {\r
"type": "list",\r
}\r
},\r
"by_writing_format": {\r
- "type": "list",\r
+ "type": "list"\r
+ },\r
+ "count": {\r
+ "type": "count",\r
"args": {\r
- "list_name": "by_writing_format"\r
+ "list_name": "public_list"\r
}\r
+ },\r
+ "count_by_writing_format": {\r
+ "type": "count"\r
}\r
}\r
},\r
- "balloon": {\r
+ "balloons": {\r
"actions": {\r
"index": {\r
"type": "list",\r
"args": {\r
"list_name": "public_list"\r
}\r
+ },\r
+ "count": {\r
+ "type": "count",\r
+ "args": {\r
+ "list_name": "public_list"\r
+ }\r
}\r
}\r
},\r
- "ground_picture": {\r
+ "ground_pictures": {\r
"actions": {\r
"index": {\r
"type": "list",\r
}\r
},\r
"by_panel": {\r
- "type": "list",\r
- "args": {\r
- "list_name": "by_panel"\r
- }\r
+ "type": "list"\r
},\r
"by_author": {\r
- "type": "list",\r
+ "type": "list"\r
+ },\r
+ "count": {\r
+ "type": "count",\r
"args": {\r
- "list_name": "by_author"\r
+ "list_name": "public_list"\r
}\r
+ },\r
+ "count_by_panel": {\r
+ "type": "count"\r
+ },\r
+ "count_by_author": {\r
+ "type": "count"\r
}\r
}\r
},\r
- "ground_color": {\r
+ "ground_colors": {\r
"actions": {\r
"index": {\r
"type": "list",\r
}\r
},\r
"by_panel": {\r
- "type": "list",\r
- "args": {\r
- "list_name": "by_panel"\r
- }\r
+ "type": "list"\r
},\r
"by_author": {\r
- "type": "list",\r
+ "type": "list"\r
+ },\r
+ "count": {\r
+ "type": "count",\r
"args": {\r
- "list_name": "by_author"\r
+ "list_name": "public_list"\r
}\r
+ },\r
+ "count_by_panel": {\r
+ "type": "count"\r
+ },\r
+ "count_by_author": {\r
+ "type": "count"\r
}\r
}\r
},\r
- "original_picture": {\r
+ "original_pictures": {\r
"actions": {\r
"index": {\r
"type": "list",\r
"args": {\r
"list_name": "private_list"\r
}\r
+ },\r
+ "count": {\r
+ "type": "count",\r
+ "args": {\r
+ "list_name": "public_list"\r
+ }\r
}\r
}\r
},\r
- "picture": {},\r
- "resource_picture": {\r
+ "pictures": {},\r
+ "resource_pictures": {\r
"actions": {\r
"index": {\r
"type": "list",\r
}\r
},\r
"by_license": {\r
- "type": "list",\r
- "args": {\r
- "list_name": "by_license"\r
- }\r
+ "type": "list"\r
},\r
"by_artist": {\r
- "type": "list",\r
+ "type": "list"\r
+ },\r
+ "count": {\r
+ "type": "count",\r
"args": {\r
- "list_name": "by_artist"\r
+ "list_name": "public_list"\r
}\r
+ },\r
+ "count_by_license": {\r
+ "type": "count"\r
+ },\r
+ "count_by_artist": {\r
+ "type": "count"\r
}\r
}\r
},\r
- "speech_balloon_template": {\r
+ "speech_balloon_templates": {\r
"actions": {\r
"index": {\r
"type": "list",\r
"list_name": "public_list"\r
}\r
},\r
- "speech_balloons": {\r
- "type": "list",\r
+ "count": {\r
+ "type": "count",\r
"args": {\r
- "list_name": "speech_balloons"\r
- }\r
- },\r
- "panels": {\r
- "type": "list",\r
- "args": {\r
- "list_name": "panels"\r
+ "list_name": "public_list"\r
}\r
}\r
}\r
},\r
- "writing_format": {\r
+ "writing_formats": {\r
"actions": {\r
"index": {\r
"type": "list",\r
"list_name": "public_list"\r
}\r
},\r
- "speeches": {\r
- "type": "list",\r
- "args": {\r
- "list_name": "speeches"\r
- }\r
- },\r
"by_system_picture": {\r
- "type": "list",\r
+ "type": "list"\r
+ },\r
+ "count": {\r
+ "type": "count",\r
"args": {\r
- "list_name": "by_system_picture"\r
+ "list_name": "public_list"\r
}\r
+ },\r
+ "count_by_system_picture": {\r
+ "type": "count"\r
}\r
}\r
},\r
- "license_group": {\r
+ "license_groups": {\r
"actions": {\r
"index": {\r
"type": "list",\r
"list_name": "public_list"\r
}\r
},\r
- "licenses": {\r
- "type": "list",\r
+ "count": {\r
+ "type": "count",\r
"args": {\r
- "list_name": "licenses"\r
+ "list_name": "public_list"\r
}\r
}\r
}\r
},\r
- "license": {\r
+ "licenses": {\r
"actions": {\r
"index": {\r
"type": "list",\r
"list_name": "public_list"\r
}\r
},\r
- "resource_pictures": {\r
- "type": "list",\r
- "args": {\r
- "list_name": "resource_pictures"\r
- }\r
- },\r
"by_license_group": {\r
- "type": "list",\r
- "args": {\r
- "list_name": "by_license_group"\r
- }\r
+ "type": "list"\r
},\r
"by_system_picture": {\r
- "type": "list",\r
+ "type": "list"\r
+ },\r
+ "count": {\r
+ "type": "count",\r
"args": {\r
- "list_name": "by_system_picture"\r
+ "list_name": "public_list"\r
}\r
+ },\r
+ "count_by_license_group": {\r
+ "type": "count"\r
+ },\r
+ "count_by_system_picture": {\r
+ "type": "count"\r
}\r
}\r
},\r
- "author": {\r
+ "authors": {\r
"actions": {\r
"index": {\r
"type": "list",\r
"args": {\r
"list_name": "ground_colors"\r
}\r
+ },\r
+ "count": {\r
+ "type": "count",\r
+ "args": {\r
+ "list_name": "public_list"\r
+ }\r
}\r
}\r
},\r
- "artist": {\r
+ "artists": {\r
"actions": {\r
"index": {\r
"type": "list",\r
"args": {\r
"list_name": "resource_pictures"\r
}\r
+ },\r
+ "count": {\r
+ "type": "count",\r
+ "args": {\r
+ "list_name": "public_list"\r
+ }\r
}\r
}\r
},\r
- "system_picture": {\r
+ "system_pictures": {\r
"actions": {\r
"index": {\r
"type": "list",\r
"args": {\r
"list_name": "public_list"\r
}\r
+ },\r
+ "count": {\r
+ "type": "count",\r
+ "args": {\r
+ "list_name": "public_list"\r
+ }\r
}\r
}\r
},\r
"home": {\r
"actions": {\r
"scrolls": {\r
- "item_name": "scroll",\r
"type": "list",\r
"args": {\r
+ "item_name": "scroll",\r
"list_name": "private_list"\r
}\r
},\r
"scroll_panels": {\r
- "item_name": "scroll_panel",\r
"type": "list",\r
"args": {\r
+ "item_name": "scroll_panel",\r
"list_name": "private_list"\r
}\r
},\r
"comics": {\r
- "item_name": "comic",\r
"type": "list",\r
"args": {\r
+ "item_name": "comic",\r
"list_name": "private_list"\r
}\r
},\r
"stories": {\r
- "item_name": "story",\r
"type": "list",\r
"args": {\r
+ "item_name": "story",\r
"list_name": "private_list"\r
}\r
},\r
"story_sheets": {\r
- "item_name": "story_sheet",\r
"type": "list",\r
"args": {\r
+ "item_name": "story_sheet",\r
"list_name": "private_list"\r
}\r
},\r
"sheets": {\r
- "item_name": "sheet",\r
"type": "list",\r
"args": {\r
+ "item_name": "sheet",\r
"list_name": "private_list"\r
}\r
},\r
"sheet_panels": {\r
- "item_name": "sheet_panel",\r
"type": "list",\r
"args": {\r
+ "item_name": "sheet_panel",\r
"list_name": "private_list"\r
}\r
},\r
"panels": {\r
- "item_name": "panel",\r
"type": "list",\r
"args": {\r
+ "item_name": "panel",\r
"list_name": "private_list"\r
}\r
},\r
"panel_pictures": {\r
- "item_name": "panel_picture",\r
"type": "list",\r
"args": {\r
+ "item_name": "panel_picture",\r
"list_name": "private_list"\r
}\r
},\r
"speech_balloons": {\r
- "item_name": "speech_balloon",\r
"type": "list",\r
"args": {\r
+ "item_name": "speech_balloon",\r
"list_name": "private_list"\r
}\r
},\r
"speeches": {\r
- "item_name": "speech",\r
"type": "list",\r
"args": {\r
+ "item_name": "speech",\r
"list_name": "private_list"\r
}\r
},\r
"balloons": {\r
- "item_name": "balloon",\r
"type": "list",\r
"args": {\r
+ "item_name": "balloon",\r
"list_name": "private_list"\r
}\r
},\r
"ground_pictures": {\r
- "item_name": "ground_picture",\r
"type": "list",\r
"args": {\r
+ "item_name": "ground_picture",\r
"list_name": "private_list"\r
}\r
},\r
"ground_colors": {\r
- "item_name": "ground_color",\r
"type": "list",\r
"args": {\r
+ "item_name": "ground_color",\r
"list_name": "private_list"\r
}\r
},\r
"original_pictures": {\r
- "item_name": "original_picture",\r
"type": "list",\r
"args": {\r
+ "item_name": "original_picture",\r
"list_name": "private_list"\r
}\r
},\r
"resource_pictures": {\r
- "item_name": "resource_picture",\r
"type": "list",\r
"args": {\r
+ "item_name": "resource_picture",\r
"list_name": "private_list"\r
}\r
}\r
"link": {\r
"type": "action",\r
"args": {\r
- "action_nname": "history"\r
+ "action_name": "history"\r
}\r
}\r
}\r