OSDN Git Service

rails upgrade to 4 for js
authoryasushiito <yas@pen-chan.jp>
Fri, 3 Jul 2015 10:25:46 +0000 (19:25 +0900)
committeryasushiito <yas@pen-chan.jp>
Fri, 3 Jul 2015 10:25:46 +0000 (19:25 +0900)
51 files changed:
app/assets/javascripts/admin.js
app/assets/javascripts/controllers.js.coffee
app/assets/javascripts/work/controllers.js.coffee.erb
app/controllers/application_controller.rb
app/controllers/comics_controller.rb
app/controllers/home_controller.rb
app/controllers/licenses_controller.rb
app/controllers/original_pictures_controller.rb
app/controllers/panels_controller.rb
app/controllers/resource_pictures_controller.rb
app/controllers/scrolls_controller.rb
app/controllers/sheets_controller.rb
app/controllers/stories_controller.rb
app/models/artist.rb
app/models/author.rb
app/models/balloon.rb
app/models/comic.rb
app/models/comic_story.rb
app/models/folder.rb
app/models/ground_color.rb
app/models/ground_picture.rb
app/models/license.rb
app/models/license_group.rb
app/models/original_picture.rb
app/models/panel.rb
app/models/panel_picture.rb
app/models/picture.rb
app/models/resource_picture.rb
app/models/resource_picture_picture.rb
app/models/scroll.rb
app/models/scroll_panel.rb
app/models/sheet.rb
app/models/sheet_panel.rb
app/models/speech.rb
app/models/speech_balloon.rb
app/models/speech_balloon_template.rb
app/models/story.rb
app/models/story_sheet.rb
app/models/system_picture.rb
app/models/writing_format.rb
app/views/layouts/application.html.erb
app/views/layouts/system.html.erb
app/views/stories/play.html.erb
app/views/templates/r/filer/_filer.html.erb
db/migrate/20150702232018_add_t_on_license_groups.rb [new file with mode: 0644]
lib/locmare/list_group/lib/page_status.rb
lib/locmare/list_group/list/base.rb
lib/manifest/controller/action/base.rb
lib/manifest/controller/action/list.rb
lib/peta/item.rb
public/manifest.json

index c5cb978..3e643e8 100644 (file)
@@ -4,5 +4,6 @@
 // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
 // the compiled file.
 //
+//= require jquery
 //= require_directory ./work
 //= require system
index 3912215..f97f77b 100644 (file)
@@ -47,11 +47,7 @@ class Pettanr.AppController
   \r
   set_play: (render_func) ->\r
     @set_list()\r
-    @binder_action = @my_action.original\r
-    @binder_controller = @binder_action.controller()\r
-    @binder_model = Manifest.manifest().models[@binder_action.item_name]\r
-    @binder_model_class = @binder_model.classify()\r
-    retriever = new Pettanr.Cache.Retriever(@binder_model_class, @params['id'])\r
+    retriever = new Pettanr.Cache.Retriever(@my_model_class, @params['id'])\r
     @listenTo(retriever, 'retrieve', render_func)\r
     retriever.retrieve()\r
   \r
index 6057f46..3024b42 100644 (file)
@@ -51,7 +51,7 @@
       play: {\r
         type: 'list',\r
         args: {\r
-          alias: 'scroll_panels.by_scroll',\r
+          return_item_name: 'scroll_panel',\r
           order: 't',\r
           direction: 1\r
         },\r
       play: {\r
         type: 'list',\r
         args: {\r
-          alias: 'comic_stories.by_comic',\r
+          return_item_name: 'comic_story',\r
           max_page_size: -1,\r
           order: 't',\r
           direction: 1\r
       play: {\r
         type: 'list',\r
         args: {\r
-          alias: 'story_sheets.by_story',\r
+          return_item_name: 'story_sheet',\r
           max_page_size: -1,\r
           order: 't',\r
           direction: 1\r
       play: {\r
         type: 'list',\r
         args: {\r
-          alias: 'sheet_panels.by_sheet',\r
+          return_item_name: 'sheet_panel',\r
           order: 't',\r
           direction: 1\r
         },\r
       scrolls: {\r
         type: 'list',\r
         args: {\r
-          alias: 'scrolls.index',\r
+          item_name: 'scroll',\r
         },\r
       },\r
       scroll_panels: {\r
         type: 'list',\r
         args: {\r
-          alias: 'scroll_panels.index',\r
+          item_name: 'scroll_panel',\r
         },\r
       },\r
       comics: {\r
         type: 'list',\r
         args: {\r
-          alias: 'comics.index',\r
+          item_name: 'comic',\r
         },\r
       },\r
       comic_stories: {\r
         type: 'list',\r
         args: {\r
-          alias: 'comic_stories.index',\r
+          item_name: 'comic_story',\r
         },\r
       },\r
       stories: {\r
         type: 'list',\r
         args: {\r
-          alias: 'stories.index',\r
+           item_name: 'story',\r
         },\r
       },\r
       story_sheets: {\r
         type: 'list',\r
         args: {\r
-          alias: 'story_sheets.index',\r
+          item_name: 'story_sheet',\r
         },\r
       },\r
       sheets: {\r
         type: 'list',\r
         args: {\r
-          alias: 'sheets.index',\r
+          item_name: 'sheet',\r
         },\r
       },\r
       sheet_panels: {\r
         type: 'list',\r
         args: {\r
-          alias: 'sheet_panels.index',\r
+          item_name: 'sheet_panel',\r
         },\r
       },\r
       panels: {\r
         type: 'list',\r
         args: {\r
-          alias: 'panels.index',\r
+          item_name: 'panel',\r
         },\r
       },\r
       panel_pictures: {\r
         type: 'list',\r
         args: {\r
-          alias: 'panel_pictures.index',\r
+          item_name: 'panel_picture',\r
         },\r
       },\r
       speech_balloons: {\r
         type: 'list',\r
         args: {\r
-          alias: 'speech_balloons.index',\r
+          item_name: 'speech_balloon',\r
         },\r
       },\r
       speeches: {\r
         type: 'list',\r
         args: {\r
-          alias: 'speeches.index',\r
+          item_name: 'speech',\r
         },\r
       },\r
       balloons: {\r
         type: 'list',\r
         args: {\r
-          alias: 'balloons.index',\r
+          item_name: 'balloon',\r
         },\r
       },\r
       ground_pictures: {\r
         type: 'list',\r
         args: {\r
-          alias: 'ground_pictures.index',\r
+          item_name: 'ground_picture',\r
         },\r
       },\r
       ground_colors: {\r
         type: 'list',\r
         args: {\r
-          alias: 'ground_colors.index',\r
+          item_name: 'ground_color',\r
         },\r
       },\r
       original_pictures: {\r
         type: 'list',\r
         args: {\r
-          alias: 'original_pictures.index',\r
+          item_name: 'original_picture',\r
         },\r
       },\r
       resource_pictures: {\r
         type: 'list',\r
         args: {\r
-          alias: 'resource_pictures.index',\r
+          item_name: 'resource_picture',\r
         },\r
       },\r
     },\r
index 2b3138f..0c17b70 100644 (file)
@@ -110,24 +110,26 @@ class ApplicationController < ActionController::Base
     @my_model_class = @my_model.classify
   end
   
-  def set_list
+  def set_list options = {}
     set_model
-    @my_list_model = Manifest.manifest.models[@my_action.item_name]
-    @my_list_model_class = @my_list_model.classify
-    @list = Locmare::ListGroup.list @my_action.controller.name, @my_action.action_name, @operators, params
+    # params merge to options
+    options[:page] ||= params[:page]
+    options[:page_size] ||= params[:page_size]
+    options[:order] ||= params[:order]
+    options[:direction] ||= params[:direction]
+    @finder = @my_action.find options
   end
   
-  def filer_list
-    set_list
-    @items = @list.items 
+  def filer_list options = {}
+    set_list options
     respond_to do |format|
       format.html {
-        @filer = Locmare::Filer.new @list.item_name, @items, @list.page_status, @operators
+        @filer = Locmare::Filer.new @my_action.return_item_name, @finder, @finder, @operators
         render @filer.template_name, :locals => {
           :filer => @filer
         }
       }
-      list_json_format @list, format
+      list_json_format @finder, format
       format.atom 
       format.rss
     end
@@ -136,31 +138,37 @@ class ApplicationController < ActionController::Base
   def list_json_format list, format
     format.json {
       res = {
-        :page_status => list.page_status.to_hash,
+        :page_status => {
+          :type => :default, :total => @finder.total_count, :total_page => @finder.total_pages, 
+          :page => @finder.page, :page_size => @finder.limit_value, 
+          :item_name => @my_action.return_item_name
+        },
         # rails3.2 has problem
         # y method defined as private
         # attribute y conflict at PanelPicture, balloon ..etc
         # use i.attributes[name]
-        :list => list.items.map{|i| i.attributes}
-        # :list => @items.to_json
+        :list => list.map{|i| i.attributes}
+        # :list => @finder.to_json
       }
       render json:  res.to_json
     }
   end
   
   def set_play
-    set_list
-    @binder_action = @my_action.original
-    @binder_controller = @binder_action.controller
-    @binder_model = Manifest.manifest.models[@binder_action.item_name]
-    @binder_model_class = @binder_model.classify
-    @item = @binder_model_class.show(params[:id], @operators)
+    set_model
+    @item = @my_model_class.show(params[:id], @operators)
+    options = if @item.own?(@operators)
+      {finder: :find_private_play, param: [params[:id], @operators]}
+    else
+      {finder: :find_play, param: params[:id]}
+    end
+    set_list options
   end
   
   def play_list
-    @items = @list.items #.map {|sp| sp.root }
-    @count = @list.total
-    @pager = @list.page_status.pager
+    @items = @finder #.map {|sp| sp.root }
+    @count = @finder.total_count
+    @pager = @finder
   end
   
   def set_show
@@ -430,9 +438,13 @@ class ApplicationController < ActionController::Base
     }
   end
   
-  def assist_items controller_name, action_name
-    list = Locmare::ListGroup.list controller_name, action_name, @operators, {:id => @item.id, :page => 1, :page_size => 5}
-    list.items
+  def assist_items controller_name, action_name, options = {}
+    controller = Manifest.manifest.controllers[controller_name]
+    action = controller.actions[action_name]
+    options[:page] = 1
+    options[:page_size] = 5
+    finder = action.find options
+    finder
   end
   
   def set_image(file)
index 6acc8c9..c74bfa0 100644 (file)
@@ -44,16 +44,15 @@ class ComicsController < ApplicationController
   
   def play
     set_play
-    @list.options.merge!({'page_size' => -1})    # no limit no pager
-    @list.reset
+    @finder.per(-1)    # no limit no pager
     play_list
     respond_to do |format|
       format.html {
         if @item.own? @operators
-          @new_story_items = assist_items('home', 'stories')
+          @new_story_items = assist_items('home', 'stories', finder: :find_private, param: @operators)
         end
       }
-      list_json_format @list, format
+      list_json_format @finder, format
     end
   end
   
index 6280b67..7a9c6cd 100644 (file)
@@ -60,67 +60,67 @@ class HomeController < ApplicationController
   end
   
   def scrolls
-    filer_list
+    filer_list finder: :find_private, param: @operators
   end
   
   def scroll_panels
-    filer_list
+    filer_list finder: :find_private, param: @operators
   end
   
   def comics
-    filer_list
+    filer_list finder: :find_private, param: @operators
   end
   
   def comic_stories
-    filer_list
+    filer_list finder: :find_private, param: @operators
   end
   
   def stories
-    filer_list
+    filer_list finder: :find_private, param: @operators
   end
   
   def story_sheets
-    filer_list
+    filer_list finder: :find_private, param: @operators
   end
   
   def sheets
-    filer_list
+    filer_list finder: :find_private, param: @operators
   end
   
   def sheet_panels
-    filer_list
+    filer_list finder: :find_private, param: @operators
   end
   
   def panels
-    filer_list
+    filer_list finder: :find_private, param: @operators
   end
   
   def panel_pictures
-    filer_list
+    filer_list finder: :find_private, param: @operators
   end
   
   def speech_balloons
-    filer_list
+    filer_list finder: :find_private, param: @operators
   end
   
   def balloons
-    filer_list
+    filer_list finder: :find_private, param: @operators
   end
   
   def speeches
-    filer_list
+    filer_list finder: :find_private, param: @operators
   end
   
   def ground_pictures
-    filer_list
+    filer_list finder: :find_private, param: @operators
   end
   
   def ground_colors
-    filer_list
+    filer_list finder: :find_private, param: @operators
   end
   
   def resource_pictures
-    filer_list
+    filer_list finder: :find_private, param: @operators
   end
   
 end
index bb7e49a..659e2f7 100644 (file)
@@ -9,7 +9,7 @@ class LicensesController < ApplicationController
   end
   
   def by_license_group
-    filer_list
+    filer_list param: params[:id]
   end
   
   def by_system_picture
index 5e70e36..67604b1 100644 (file)
@@ -5,7 +5,7 @@ class OriginalPicturesController < ApplicationController
   before_action :authenticate_artist, :only => [:index, :new, :edit, :create, :update, :destroy]
   
   def index
-    filer_list
+    filer_list param: @operators
   end
 
   def show_html_format format
index 805a4da..7da6273 100644 (file)
@@ -13,11 +13,11 @@ class PanelsController < ApplicationController
   private
   def panel_list
     set_list
-    @items = @list.items 
-    @pager = @list.page_status.pager
+    @items = @finder
+    @pager = @finder
     respond_to do |format|
       format.html 
-      list_json_format @list, format
+      list_json_format @finder, format
       format.atom 
       format.rss
     end
@@ -114,9 +114,9 @@ class PanelsController < ApplicationController
       jsn = JSON.parse_no_except(params[:json])
     end
     @prm = if params[:panel] == nil or params[:panel].empty?
-       jsn
+      jsn
     else
-       params[:panel]
+      @item.permit_params(params)
     end
     @item.class.fold_extend_settings @prm
     #@item.refresh
@@ -138,7 +138,11 @@ class PanelsController < ApplicationController
     if params[:json]
       jsn = JSON.parse(params[:json])
     end
-    @prm = params[:panel] || jsn
+    @prm = if params[:panel] == nil or params[:panel].empty?
+      jsn
+    else
+      @item.permit_params(params)
+    end
     @item.class.fold_extend_settings @prm
     # @item.refresh
     respond_to do |format|
index 60972c4..549e779 100644 (file)
@@ -72,12 +72,12 @@ class ResourcePicturesController < ApplicationController
     if params[:json]
       jsn = JSON.parse_no_except(params[:json])
     end
+    @item = @original_picture.resource_picture || ResourcePicture.new
     @prm = if params[:resource_picture] == nil or params[:resource_picture].empty?
       jsn
     else
-      @item.permit_params(:resource_picture)
+      @item.permit_params(params)
     end
-    @item = @original_picture.resource_picture || ResourcePicture.new
     @item.attributes = @prm
     @item.overwrite @original_picture
     @item.boosts 'post'
index bed3e55..ec7d580 100644 (file)
@@ -47,10 +47,10 @@ class ScrollsController < ApplicationController
       format.html {
         if @item.own? @operators
           @fresh_panel_items = assist_items('panels', 'index')
-          @new_panel_items = assist_items('home', 'panels')
+          @new_panel_items = assist_items('home', 'panels', finder: :find_private, param: @operators)
         end
       }
-      list_json_format @list, format
+      list_json_format @finder, format
     end
   end
   
index c2173aa..be06e7d 100644 (file)
@@ -48,16 +48,15 @@ class SheetsController < ApplicationController
   
   def play
     set_play
-    @list.options.merge!({'page_size' => -1})    # no limit no pager
-    @list.reset
+    @finder.per(-1)    # no limit no pager
     play_list
     respond_to do |format|
       format.html {
-        if @operators.author
-          @new_panel_items = assist_items('home', 'panels')
+        if @item.own? @operators
+          @new_panel_items = assist_items('home', 'panels', finder: :find_private, param: @operators)
         end
       }
-      list_json_format @list, format
+      list_json_format @finder, format
     end
   end
   
index 6466664..7c26f7c 100644 (file)
@@ -46,17 +46,16 @@ class StoriesController < ApplicationController
   
   def play
     set_play
-    @list.options.merge!({'per_page' => 1})    # show one sheet
-    @list.reset
+    @finder.per( 1)   # show one sheet
     play_list
     respond_to do |format|
       format.html {
-        @pager = @list.page_status.pager
+        @pager = @finder
         if @item.own? @operators
-          @new_sheet_items = assist_items('home', 'sheets')
+          @new_sheet_items = assist_items('home', 'sheets', finder: :find_private, param: @operators)
         end
       }
-      list_json_format @list, format
+      list_json_format @finder, format
     end
   end
   
index 77dbf1f..6c97a5e 100644 (file)
@@ -9,6 +9,10 @@ class Artist < Peta::Owner
   validates :user_id, :numericality => true, :existence => {:both => false}
   validates :provider_id, :numericality => {:allow_nil => true}
   
+  scope :find_index, -> do
+    self
+  end
+  
   def supply_default
     self.name = 'no name' if self.name.blank?
     self.user_id = nil
index 594e36c..c598a8a 100644 (file)
@@ -9,6 +9,10 @@ class Author < Peta::Owner
   validates :name, :presence => true, :length => {:maximum => 30}
   validates :user_id, :numericality => true, :existence => {:both => false}
   
+  scope :find_index, -> do
+    self
+  end
+  
   def supply_default
     self.name = 'no name' if self.name.blank?
     self.user_id = nil
index f4287fe..bf3d7f4 100644 (file)
@@ -16,6 +16,42 @@ class Balloon < Peta::Element
 #  validates :caption, :presence => true
   validates :speech_balloon_template_settings, :boost => {:boost_name => :speech_balloon_template}
 
+  scope :with_panel, -> do
+    includes(speech_balloon: :panel)
+  end
+  
+  scope :with_speech_balloon_template, -> do
+    includes(:speech_balloon_template)
+  end
+  
+  scope :find_index, -> do
+    with_panel.where(Panel.arel_table[:publish].gt 0).references(:panel)
+  end
+  
+  scope :find_private, -> (operators) do 
+    with_panel.where(Panel.arel_table[:author_id].eq operators.author.id).references(:panel)
+  end
+  
+  scope :find_by_panel, -> (panel_id) do 
+    find_index.where(panel_id: panel_id).references(:panel)
+  end
+  
+  scope :find_by_speech_balloon, -> (speech_balloon_id) do 
+    find_index.where(speech_balloon_id: speech_balloon_id).references(:panel)
+  end
+  
+  scope :find_by_speech_balloon_template, -> (speech_balloon_template_id) do 
+    find_index.where(speech_balloon_template_id: speech_balloon_template_id).references(:panel)
+  end
+  
+  scope :find_by_system_picture, -> (system_picture_id) do 
+    find_index.where(system_picture_id: system_picture_id).references(:panel)
+  end
+  
+  scope :find_by_author, -> (author_id) do 
+    find_index.where(Panel.arel_table[:author_id].eq author_id).references(:panel)
+  end
+  
   def y
     self.attributes['y']
   end
index ed15468..269f07b 100644 (file)
@@ -8,6 +8,36 @@ class Comic < Peta::Binder
   validates :visible, :presence => true, :numericality => true, :inclusion => {:in => 0..1}
   validates :author_id, :presence => true, :numericality => true, :existence => {:both => false}
   
+  scope :find_index, -> do
+    where(arel_table[:visible].gt 0)
+  end
+  
+  scope :find_private, -> (operators) do 
+    where(author_id: operators.author.id)
+  end
+  
+  scope :find_by_author, -> (author_id) do 
+    find_index.where(author_id: author_id)
+  end
+  
+  scope :with_stories, -> do
+    includes(comic_stories: :story)
+  end
+  
+  scope :find_by_story, -> (story_id) do 
+    with_stories.find_index.where(Story.arel_table[:id].eq story_id).references(:story)
+  end
+  
+  # scope of find_play
+  def self.find_play(id)
+    ComicStory.find_play(id)
+  end
+  
+  # scope of find_private_play
+  def self.find_private_play(id, operators)
+    ComicStory.find_private_play(id, operators)
+  end
+  
   def supply_default
     self.visible = 0 if self.visible.blank?
     self.author_id = nil
index 12213ba..7f773d8 100644 (file)
@@ -8,6 +8,42 @@ class ComicStory < Peta::Leaf
   validates :story_id, :presence => true, :numericality => true, :existence => {:both => false}
   validates :t, :presence => true, :numericality => {:greater_than_or_equal_to => 0}
   
+  scope :with_comic, -> do
+    includes(:comic)
+  end
+  
+  scope :find_index, -> do
+    with_comic.where(Comic.arel_table[:visible].gt 0).references(:comic)
+  end
+  
+  scope :find_private, -> (operators) do 
+    with_comic.where(Comic.arel_table[:author_id].eq operators.author.id).references(:comic)
+  end
+  
+  scope :by_comic, -> (comic_id) do 
+    where(comic_id: comic_id)
+  end
+  
+  scope :find_by_comic, -> (comic_id) do 
+    find_index.by_comic(comic_id)
+  end
+  
+  scope :find_by_story, -> (story_id) do 
+    find_index.where(story_id: story_id).references(:comic)
+  end
+  
+  scope :find_by_author, -> (author_id) do 
+    find_index.where(Comic.arel_table[:author_id].eq author_id).references(:comic)
+  end
+  
+  scope :find_play, -> (comic_id) do 
+    find_by_comic(comic_id)
+  end
+  
+  scope :find_private_play, -> (comic_id, operators) do 
+   find_private(operators).by_comic(comic_id)
+  end
+  
   def supply_default
     self.comic_id = nil
     self.story_id = nil
index e66fbb2..14548a7 100644 (file)
@@ -7,6 +7,10 @@ class Folder < Peta::SystemResource
   validates :category_id, :presence => true, :numericality => true
   validates :t, :presence => true, :numericality => true
   
+  scope :find_index, -> do
+    self
+  end
+  
   #remove last dir name
   def dir
     r = name.split('/')
index 588196e..a4c9a66 100644 (file)
@@ -11,6 +11,26 @@ class GroundColor < Peta::Element
   validates :z, :presence => true, :numericality => {:greater_than => 0}
   validates :t, :presence => true, :numericality => {:greater_than_or_equal_to => 0}
   
+  scope :with_panel, -> do
+    includes(:panel)
+  end
+  
+  scope :find_index, -> do
+    with_panel.where(Panel.arel_table[:publish].gt 0).references(:panel)
+  end
+  
+  scope :find_private, -> (operators) do 
+    with_panel.where(Panel.arel_table[:author_id].eq operators.author.id).references(:panel)
+  end
+  
+  scope :find_by_panel, -> (panel_id) do 
+    find_index.where(panel_id: panel_id).references(:panel)
+  end
+  
+  scope :find_by_author, -> (author_id) do 
+    find_index.where(Panel.arel_table[:author_id].eq author_id).references(:panel)
+  end
+  
   def self.by_author_list_includes
     {
       :panel => {
index ab5a244..bd1d16d 100644 (file)
@@ -11,6 +11,26 @@ class GroundPicture < Peta::Element
   validates :z, :presence => true, :numericality => {:greater_than => 0}
   validates :t, :presence => true, :numericality => {:greater_than_or_equal_to => 0}
   
+  scope :with_panel, -> do
+    includes(:panel)
+  end
+  
+  scope :find_index, -> do
+    with_panel.where(Panel.arel_table[:publish].gt 0).references(:panel)
+  end
+  
+  scope :find_private, -> (operators) do 
+    with_panel.where(Panel.arel_table[:author_id].eq operators.author.id).references(:panel)
+  end
+  
+  scope :find_by_panel, -> (panel_id) do 
+    find_index.where(panel_id: panel_id).references(:panel)
+  end
+  
+  scope :find_by_author, -> (author_id) do 
+    find_index.where(Panel.arel_table[:author_id].eq author_id).references(:panel)
+  end
+  
   @@repeat_texts = ['repeat', 'repeat-x', 'repeat-y', 'no-repeat']
   
   def self.pickup_item_name
index 0ebfe56..f0ebd78 100644 (file)
@@ -14,6 +14,18 @@ class License < Peta::SystemResource
   validates :license_group_settings, :boost => {:boost_name => :license_group}
   validates :credit_picture_settings, :boost => {:boost_name => :credit_picture}
   
+  scope :find_index, -> do
+    self.all
+  end
+  
+  scope :find_by_license_group, -> (license_group_id) do 
+    where(license_group_id: license_group_id)
+  end
+  
+  scope :find_by_system_picture, -> (system_picture_id) do 
+    where(system_picture_id: system_picture_id)
+  end
+  
   def overwrite 
   end
   
index 61c6179..9578164 100644 (file)
@@ -9,6 +9,10 @@ class LicenseGroup < Peta::Template
   validates :caption, :presence => true, :length => {:maximum => 30}
   validates :url, :presence => true, :length => {:maximum => 200}, :url => {:message => I18n.t('errors.messages.url')}
   
+  scope :find_index, -> do
+    self.all
+  end
+  
   def supply_default
   end
   
index 883b1df..5380713 100644 (file)
@@ -13,6 +13,10 @@ class OriginalPicture < Peta::Content
   validates :artist_id, :presence => true, :numericality => true, :existence => {:both => false}
   validates :md5, :presence => true, :length => {:minimum => 32, :maximum => 32}
   
+  scope :find_index, -> (operators) do 
+    where(artist_id: operators.artist.id)
+  end
+  
   def supply_default
     self.artist_id = nil
   end
index f6fc3c7..daa7bf7 100644 (file)
@@ -19,6 +19,42 @@ class Panel < Peta::Root
   validates :author_id, :presence => true, :numericality => true, :existence => {:both => false}
   validates :publish, :presence => true, :numericality => true
   
+  scope :find_index, -> do
+    where(arel_table[:publish].gt 0)
+  end
+  
+  scope :find_private, -> (operators) do 
+    where(author_id: operators.author.id)
+  end
+  
+  scope :find_by_author, -> (author_id) do 
+    find_index.where(author_id: author_id)
+  end
+  
+  scope :with_scrolls, -> do
+    includes(scroll_panels: :scroll)
+  end
+  
+  scope :find_by_scroll, -> (scroll_id) do 
+    with_scrolls.find_index.where(Scroll.arel_table[:id].eq scroll_id).references(:scroll)
+  end
+  
+  scope :with_sheets, -> do
+    includes(sheet_panels: :sheet)
+  end
+  
+  scope :find_by_sheet, -> (sheet_id) do 
+    with_sheets.find_index.where(Sheet.arel_table[:id].eq sheet_id).references(:sheet)
+  end
+  
+  scope :with_speech_balloons, -> do
+    includes(:speech_balloons)
+  end
+  
+  scope :find_by_speech_balloon_template, -> (speech_balloon_template_id) do 
+    with_speech_balloons.find_index.where(SpeechBalloon.arel_table[:speech_balloon_template_id].eq speech_balloon_template_id).references(:speech_balloon)
+  end
+  
   def supply_default
     self.border = 2
     self.publish = 0
index 80cf323..3713764 100644 (file)
@@ -13,6 +13,26 @@ class PanelPicture < Peta::Element
   validates :z, :presence => true, :numericality => {:greater_than => 0}
   validates :t, :presence => true, :numericality => {:greater_than_or_equal_to => 0}
   
+  scope :with_panel, -> do
+    includes(:panel)
+  end
+  
+  scope :find_index, -> do
+    with_panel.where(Panel.arel_table[:publish].gt 0).references(:panel)
+  end
+  
+  scope :find_private, -> (operators) do 
+    with_panel.where(Panel.arel_table[:author_id].eq operators.author.id).references(:panel)
+  end
+  
+  scope :find_by_panel, -> (panel_id) do 
+    find_index.where(panel_id: panel_id).references(:panel)
+  end
+  
+  scope :find_by_author, -> (author_id) do 
+    find_index.where(Panel.arel_table[:author_id].eq author_id).references(:panel)
+  end
+  
   def self.pickup_item_name
     Picture.item_name
   end
index ec914f3..e987d93 100644 (file)
@@ -20,6 +20,14 @@ class Picture < Peta::Content
   validates :artist_id, :presence => true, :numericality => true, :existence => {:both => false}
   validates :license_group_module_name, :presence => true, :length => {:maximum => 50}
   
+  scope :find_index, -> do
+    self
+  end
+  
+  scope :find_by_artist, -> (artist_id) do 
+    find_index.where(artist_id: artist_id)
+  end
+  
   def supply_default
   end
   
index 3488ab0..521a071 100644 (file)
@@ -24,6 +24,30 @@ class ResourcePicture < Peta::Content
   validates :license_group_settings, :boost => {:boost_name => :license_group}
   validates :credit_picture_settings, :boost => {:boost_name => :credit_picture}
   
+  scope :find_index, -> do
+    self.all
+  end
+  
+  scope :find_private, -> (operators) do 
+    where(artist_id: operators.artist.id)
+  end
+  
+  scope :find_by_original_picture, -> (original_picture_id) do 
+    find_index.where(original_picture_id: original_picture_id)
+  end
+  
+  scope :find_by_license_group, -> (license_group_id) do 
+    find_index.where(license_group_id: license_group_id)
+  end
+  
+  scope :find_by_license, -> (license_id) do 
+    find_index.where(license_id: license_id)
+  end
+  
+  scope :find_by_artist, -> (artist_id) do 
+    find_index.where(artist_id: artist_id)
+  end
+  
   def self.pickup_item_name
     Picture.item_name
   end
index 3be419a..7a24ec9 100644 (file)
@@ -4,6 +4,22 @@ class ResourcePicturePicture < Peta::Item
   belongs_to :resource_picture
   belongs_to :picture
   
+  scope :find_index, -> do
+    self
+  end
+  
+  scope :find_by_original_picture, -> (original_picture_id) do 
+    find_index.where(original_picture_id: original_picture_id)
+  end
+  
+  scope :find_by_resource_picture, -> (resource_picture_id) do 
+    find_index.where(resource_picture_id: resource_picture_id)
+  end
+  
+  scope :find_by_picture, -> (picture_id) do 
+    find_index.where(picture_id: picture_id)
+  end
+  
   def symbol_option
     self.picture.tmb_opt_img_tag
   end
index b748414..3a50002 100644 (file)
@@ -29,12 +29,14 @@ class Scroll < Peta::Binder
     with_panels.find_index.where(Panel.arel_table[:id].eq panel_id).references(:panel)
   end
   
-  scope :find_play, -> (id) do 
-    with_panels.find_index.where(id: id).references(:scroll_panels)
+  # scope of find_play
+  def self.find_play(id)
+    ScrollPanel.find_play(id)
   end
   
-  scope :find_private_play, -> (id, operators) do 
-    with_panels.find_private(operators).where(self.arel_table[:id].eq id).references(:scroll_panels)
+  # scope of find_private_play
+  def self.find_private_play(id, operators)
+    ScrollPanel.find_private_play(id, operators)
   end
   
   def supply_default
index 913cf57..dbc4de2 100644 (file)
@@ -20,8 +20,12 @@ class ScrollPanel < Peta::Leaf
     with_scroll.where(Scroll.arel_table[:author_id].eq operators.author.id).references(:scroll)
   end
   
+  scope :by_scroll, -> (scroll_id) do 
+    where(scroll_id: scroll_id)
+  end
+  
   scope :find_by_scroll, -> (scroll_id) do 
-    find_index.where(scroll_id: scroll_id).references(:scroll)
+    find_index.by_scroll(scroll_id).references(:scroll)
   end
   
   scope :find_by_panel, -> (panel_id) do 
@@ -32,6 +36,14 @@ class ScrollPanel < Peta::Leaf
     find_index.where(Scroll.arel_table[:author_id].eq author_id).references(:scroll)
   end
   
+  scope :find_play, -> (scroll_id) do 
+    find_by_scroll(scroll_id)
+  end
+  
+  scope :find_private_play, -> (scroll_id, operators) do 
+    find_private(operators).by_scroll(scroll_id)
+  end
+  
   def supply_default
     self.scroll_id = nil
     self.panel_id = nil
index dd4d5eb..6d5360e 100644 (file)
@@ -10,6 +10,44 @@ class Sheet < Peta::Root
   validates :visible, :presence => true, :numericality => true, :inclusion => {:in => 0..1}
   accepts_nested_attributes_for :sheet_panels, :allow_destroy => true
   
+  scope :find_index, -> do
+    where(arel_table[:visible].gt 0)
+  end
+  
+  scope :find_private, -> (operators) do 
+    where(author_id: operators.author.id)
+  end
+  
+  scope :find_by_author, -> (author_id) do 
+    find_index.where(author_id: author_id)
+  end
+  
+  scope :with_panels, -> do
+    includes(sheet_panels: :panel)
+  end
+  
+  scope :find_by_panel, -> (panel_id) do 
+    with_panels.find_index.where(Panel.arel_table[:id].eq panel_id).references(:panel)
+  end
+  
+  scope :with_stories, -> do
+    includes(story_sheets: :story)
+  end
+  
+  scope :find_by_story, -> (story_id) do 
+    with_stories.find_index.where(Story.arel_table[:id].eq story_id).references(:story)
+  end
+  
+  # scope of find_play
+  def self.find_play(id)
+    SheetPanel.find_play(id)
+  end
+  
+  # scope of find_private_play
+  def self.find_private_play(id, operators)
+    SheetPanel.find_private_play(id, operators)
+  end
+  
   def supply_default
     self.visible = 0 if self.visible.blank?
     self.author_id = nil
index fa0c1b6..4cc2654 100644 (file)
@@ -12,6 +12,42 @@ class SheetPanel < Peta::Element
   validates :z, :presence => true, :numericality => {:greater_than => 0}
   validates :t, :presence => true, :numericality => {:greater_than_or_equal_to => 0}
   
+  scope :with_sheet, -> do
+    includes(:sheet)
+  end
+  
+  scope :find_index, -> do
+    with_sheet.where(Sheet.arel_table[:visible].gt 0).references(:sheet)
+  end
+  
+  scope :find_private, -> (operators) do 
+    with_sheet.where(Sheet.arel_table[:author_id].eq operators.author.id).references(:sheet)
+  end
+  
+  scope :by_sheet, -> (sheet_id) do 
+    where(sheet_id: sheet_id)
+  end
+  
+  scope :find_by_sheet, -> (sheet_id) do 
+    find_index.by_sheet(sheet_id).references(:sheet)
+  end
+  
+  scope :find_by_panel, -> (panel_id) do 
+    find_index.where(panel_id: panel_id).references(:sheet)
+  end
+  
+  scope :find_by_author, -> (author_id) do 
+    find_index.where(Sheet.arel_table[:author_id].eq author_id).references(:sheet)
+  end
+  
+  scope :find_play, -> (sheet_id) do 
+    find_by_sheet(sheet_id)
+  end
+  
+  scope :find_private_play, -> (sheet_id, operators) do 
+    find_private(operators).by_sheet(sheet_id)
+  end
+  
   def y
     self.attributes['y']
   end
index 24cb701..263f6cf 100644 (file)
@@ -20,6 +20,42 @@ class Speech < Peta::Element
   validates :speech_balloon_template_settings, :boost => {:boost_name => :speech_balloon_template}
   #validates :writing_format_settings
   
+  scope :with_panel, -> do
+    includes(speech_balloon: :panel)
+  end
+  
+  scope :with_speech_balloon_template, -> do
+    includes(:speech_balloon_template)
+  end
+  
+  scope :find_index, -> do
+    with_panel.where(Panel.arel_table[:publish].gt 0).references(:panel)
+  end
+  
+  scope :find_private, -> (operators) do 
+    with_panel.where(Panel.arel_table[:author_id].eq operators.author.id).references(:panel)
+  end
+  
+  scope :find_by_panel, -> (panel_id) do 
+    find_index.where(panel_id: panel_id).references(:panel)
+  end
+  
+  scope :find_by_speech_balloon, -> (speech_balloon_id) do 
+    find_index.where(speech_balloon_id: speech_balloon_id).references(:panel)
+  end
+  
+  scope :find_by_speech_balloon_template, -> (speech_balloon_template_id) do 
+    find_index.where(speech_balloon_template_id: speech_balloon_template_id).references(:panel)
+  end
+  
+  scope :find_by_writing_format, -> (writing_format_id) do 
+    find_index.where(writing_format_id: writing_format_id).references(:panel)
+  end
+  
+  scope :find_by_author, -> (author_id) do 
+    find_index.where(Panel.arel_table[:author_id].eq author_id).references(:panel)
+  end
+  
   @@text_align_texts = ['left', 'left', 'right', 'center']
   
   def y
index 5f7c63d..367af4a 100644 (file)
@@ -15,6 +15,34 @@ class SpeechBalloon < Peta::Element
   validates :t, :presence => true, :numericality => {:greater_than_or_equal_to => 0}
   validates :speech_balloon_template_settings, :boost => {:boost_name => :speech_balloon_template}
   
+  scope :with_panel, -> do
+    includes(:panel)
+  end
+  
+  scope :with_speech_balloon_template, -> do
+    includes(:speech_balloon_template)
+  end
+  
+  scope :find_index, -> do
+    with_panel.where(Panel.arel_table[:publish].gt 0).references(:panel)
+  end
+  
+  scope :find_private, -> (operators) do 
+    with_panel.where(Panel.arel_table[:author_id].eq operators.author.id).references(:panel)
+  end
+  
+  scope :find_by_panel, -> (panel_id) do 
+    find_index.where(panel_id: panel_id).references(:panel)
+  end
+  
+  scope :find_by_speech_balloon_template, -> (speech_balloon_template_id) do 
+    find_index.where(speech_balloon_template_id: speech_balloon_template_id).references(:panel)
+  end
+  
+  scope :find_by_author, -> (author_id) do 
+    find_index.where(Panel.arel_table[:author_id].eq author_id).references(:panel)
+  end
+  
   def self.by_author_list_includes
     {
       :panel => {
index 5217f5d..4660b97 100644 (file)
@@ -11,6 +11,26 @@ class SpeechBalloonTemplate < Peta::Template
   validates :system_picture_id, :presence => true, :numericality => true, :existence => {:both => false}
   validates :settings, :presence => true
   
+  scope :find_index, -> do
+    self
+  end
+  
+  scope :find_by_original_picture, -> (original_picture_id) do 
+    find_index.where(original_picture_id: original_picture_id)
+  end
+  
+  scope :with_panels, -> do
+    includes(speech_balloons: panel)
+  end
+  
+  scope :find_by_panel, -> (panel_id) do 
+    with_panels.where(Panel.arel_table[:id].eq panel_id).references(:panel)
+  end
+  
+  scope :find_by_system_picture, -> (system_picture_id) do 
+    find_index.where(system_picture_id: system_picture_id)
+  end
+  
   def supply_default
   end
   
index 7c3354d..cd02e7f 100644 (file)
@@ -9,6 +9,44 @@ class Story < Peta::Binder
   validates :visible, :presence => true, :numericality => true, :inclusion => {:in => 0..1}
   validates :author_id, :presence => true, :numericality => true, :existence => {:both => false}
   
+  scope :find_index, -> do
+    where(arel_table[:visible].gt 0)
+  end
+  
+  scope :find_private, -> (operators) do 
+    where(author_id: operators.author.id)
+  end
+  
+  scope :find_by_author, -> (author_id) do 
+    find_index.where(author_id: author_id)
+  end
+  
+  scope :with_comics, -> do
+    includes(comic_stories: :comic)
+  end
+  
+  scope :find_by_comic, -> (comic_id) do 
+    with_comics.find_index.where(Comic.arel_table[:id].eq comic_id).references(:comic)
+  end
+  
+  scope :with_sheets, -> do
+    includes(story_sheets: :sheet)
+  end
+  
+  scope :find_by_sheet, -> (sheet_id) do 
+    with_sheets.find_index.where(Sheet.arel_table[:id].eq sheet_id).references(:sheet)
+  end
+  
+  # scope of find_play
+  def self.find_play(id)
+    StorySheet.find_play(id)
+  end
+  
+  # scope of find_private_play
+  def self.find_private_play(id, operators)
+    StorySheet.find_private_play(id, operators)
+  end
+  
   def supply_default
     self.visible = 0 if self.visible.blank?
     self.author_id = nil
index 0d09dcb..f4aff82 100644 (file)
@@ -7,6 +7,42 @@ class StorySheet < Peta::Leaf
   validates :sheet_id, :presence => true, :numericality => true, :existence => {:both => false}
   validates :t, :presence => true, :numericality => {:greater_than_or_equal_to => 0}
   
+  scope :with_story, -> do
+    includes(:story)
+  end
+  
+  scope :find_index, -> do
+    with_story.where(Story.arel_table[:visible].gt 0).references(:story)
+  end
+  
+  scope :find_private, -> (operators) do 
+    with_story.where(Story.arel_table[:author_id].eq operators.author.id).references(:story)
+  end
+  
+  scope :by_story, -> (story_id) do 
+    where(story_id: story_id)
+  end
+  
+  scope :find_by_story, -> (story_id) do 
+    find_index.by_story(story_id)
+  end
+  
+  scope :find_by_sheet, -> (sheet_id) do 
+    find_index.where(sheet_id: sheet_id).references(:story)
+  end
+  
+  scope :find_by_author, -> (author_id) do 
+    find_index.where(Story.arel_table[:author_id].eq author_id).references(:story)
+  end
+  
+  scope :find_play, -> (story_id) do 
+    find_by_story(story_id)
+  end
+  
+  scope :find_private_play, -> (story_id, operators) do 
+    find_private(operators).by_story(story_id)
+  end
+  
   def supply_default
     self.story_id = nil
     self.sheet_id = nil
index 8b25d19..fae8c10 100644 (file)
@@ -13,6 +13,10 @@ class SystemPicture < Peta::SystemResource
   
   before_destroy :destroy_with_file
   
+  scope :find_index, -> do
+    self
+  end
+  
   def destroy_with_file
     PictureIO.system_picture_io.delete self.filename
   end
index 850d735..ebcde00 100644 (file)
@@ -10,6 +10,14 @@ class WritingFormat < Peta::Template
   validates :system_picture_id, :presence => true, :numericality => true, :existence => {:both => false}
   validates :settings, :presence => true
   
+  scope :find_index, -> do
+    self
+  end
+  
+  scope :find_by_system_picture, -> (system_picture_id) do 
+    find_index.where(system_picture_id: system_picture_id)
+  end
+  
   def supply_default
   end
   
index 91801bc..4e5eb40 100644 (file)
@@ -10,7 +10,7 @@
     - <%= h(manifest.magic_numbers['profile']['users']['caption']) %>\r
   </title>\r
   <%= stylesheet_link_tag "test" %>\r
-  <%= javascript_include_tag "application" %>\r
+  <%= javascript_include_tag "admin" %>\r
   <%= csrf_meta_tags %>\r
 </head>\r
 <body>\r
index ce898c3..315bcd7 100644 (file)
@@ -1,9 +1,9 @@
 <!DOCTYPE html>
 <html>
 <head>
-  <title><%= h(Manifest.manifest.magic_numbers['profile']['admins']['caption']) %></title>
+  <title><%= Manifest.manifest.magic_numbers['profile']['admins']['caption'] %></title>
   <%= stylesheet_link_tag "application" %>
-  <%= javascript_include_tag "application" %>
+  <%# javascript_include_tag "application" %>
   <%= javascript_include_tag "admin" %>
   <%= raw panel_editor_javascript_include_tags %>
   <%= csrf_meta_tags %>
index 2ba7b81..da08533 100644 (file)
@@ -13,7 +13,7 @@
 <% if @items.empty? -%>
   <h2><%= t('stories.play.empty') %></h2>
 <% else %>
-  <%= render @pager.template_name, :pager => @pager %>
+  <%= paginate @pager %>
   <% @items.each do |story_sheet| %>
     <% if story_sheet.sheet and story_sheet.sheet.visible?(@operators) -%>
       <%= render 'sheets/standard', :sheet => story_sheet.sheet, :operators => @operators %>
@@ -21,7 +21,7 @@
       sheet is hidden or deleted
     <% end %>
   <% end %>
-  <%= render @pager.template_name, :pager => @pager %>
+  <%= paginate @pager %>
 <% end %>
 
 <% if @item.own? @operators -%>
index 50d9e8d..86e8f35 100644 (file)
@@ -1,8 +1,7 @@
 <div class="filer">
   <%= render filer.header.template_name, :header => filer.header %>
   <%= render filer.body.template_name, :body => filer.body %>
-  <% if filer.page_status and filer.page_status.pageable? %>
-    <% pager = filer.page_status.pager %>
-    <%= render pager.template_name, :pager => pager %>
+  <% if filer.page_status  %>
+    <%= paginate filer.page_status %>
   <% end %>
 </div>
diff --git a/db/migrate/20150702232018_add_t_on_license_groups.rb b/db/migrate/20150702232018_add_t_on_license_groups.rb
new file mode 100644 (file)
index 0000000..7ef9979
--- /dev/null
@@ -0,0 +1,5 @@
+class AddTOnLicenseGroups < ActiveRecord::Migration
+  def change
+    add_column :license_groups, :t, :integer, :null => false, :default => 0
+  end
+end
index 4999935..d19add1 100644 (file)
@@ -15,7 +15,7 @@ module Locmare
           def to_hash
             {
               :type => :default, :total => @total, :total_page => self.total_page, 
-              :page => self.page, :page_size => self.limit
+              :page => self.page, :page_size => self.limit, :item_name => @list.item_name
             }
           end
           
index 75e8d90..88fee26 100644 (file)
@@ -91,17 +91,6 @@ module Locmare
       def arel
         r = @model
         return @model.__send__('find_' + @action_name)
-        
-        r.includes(
-          self.include_hash
-        )
-        @wheres.each do |key|
-          n = key + '_list_where'
-          r = r.where(@model.respond_to?(n) ? @model.__send__(n, self) : self.__send__(n))
-        end
-        r.references(
-          self.include_hash
-        )
       end
       
       def items
index 2dc905b..720cb2b 100644 (file)
@@ -32,6 +32,14 @@ module Manifest
           @parent
         end
         
+        def has_param
+          @param_id != 'none'
+        end
+        
+        def has_alias_action
+          @alias.any?
+        end
+        
         def alias_action
           s = @alias.split('.')
           c = ::Manifest.manifest.controllers[s[0]]
index c6779b6..dec4beb 100644 (file)
@@ -2,7 +2,7 @@ module Manifest
   module ControllerModule
     module ActionModule
       class ActionList < Base
-        attr :order, :direction, :default_page_size, :max_page_size
+        attr :order, :direction, :default_page_size, :max_page_size, :return_item_name
         
         def set_default
           super
@@ -17,12 +17,64 @@ module Manifest
           @direction = @args['direction'].to_i
           @default_page_size = @args['default_page_size']
           @max_page_size = @args['max_page_size']
+          @return_item_name = @args['return_item_name'] || @item_name
         end
         
         def a_arg_names
           super + ['order', 'direction', 'default_page_size', 'max_page_size']
         end
         
+        def find options = {}
+          self.finder(options).order(
+            self.order_sql(options[:order], options[:direction])
+          ).page(options[:page]).per(options[:page_size])
+        end
+        
+        def finder options = {}
+          finder_name = options[:finder] || 'find_' + @name
+          finder = if args = options[:param]
+            args = [args] unless options[:param].is_a?(Array)  # param to array
+            self.finder_model.__send__(finder_name, *args)
+          else
+            self.finder_model.__send__(finder_name)
+          end
+        end
+        
+        def finder_model
+          Manifest.manifest.models[@item_name].classify
+        end
+        
+        def return_model
+          Manifest.manifest.models[@return_item_name].classify
+        end
+        
+        def order_sql order, direction
+          order ||= self.order
+          direction ||= (self.direction < 0 ? :desc : :asc)
+          self.return_model.arel_table[order].__send__(direction)
+        end
+        
+        def page page
+          page.to_i
+          page = 1 if page < 1
+          page
+        end
+        
+        def page_size page_size
+          page_size ||= self.default_page_size
+          page_size = -1 if page_size < 0
+          page_size = self.max_page_size if page_size > self.max_page_size
+          page_size
+        end
+        
+        def limited?
+          self.max_page_size > 0
+        end
+        
+        def unlimited?
+          !self.limited?
+        end
+        
       end
       
     end
index b23dd20..5e50ed5 100644 (file)
@@ -256,8 +256,19 @@ module Peta
     end
     
     def permit_params params
+      attrs = self.class.permit_attributes
+      params.require(self.item_name.to_sym).permit(attrs)
+    end
+    
+    def self.permit_attributes
       attrs = self.my_manifest.attributes.keys
-      params.require(self.item_name).permit(attrs)
+      self.child_models.each do |element_model|
+        name = self.my_manifest.associations.child_element_name(element_model) + '_attributes'
+        child_attrs = {}
+        child_attrs[name] = element_model.permit_attributes
+        attrs.push child_attrs
+      end
+      attrs
     end
     
     def editize?
index 7a4932a..53bdb3f 100644 (file)
         "play": {\r
           "type": "list",\r
           "args": {\r
-            "alias": "scroll_panels.by_scroll",\r
+            "return_item_name": "scroll_panel",\r
             "order": "t",\r
             "direction": 1\r
           }\r
         "play": {\r
           "type": "list",\r
           "args": {\r
-            "alias": "comic_stories.by_comic",\r
+            "return_item_name": "comic_story",\r
             "max_page_size": -1,\r
             "order": "t",\r
             "direction": 1\r
         "play": {\r
           "type": "list",\r
           "args": {\r
-            "alias": "story_sheets.by_story",\r
+            "return_item_name": "story_sheet",\r
             "max_page_size": -1,\r
             "order": "t",\r
             "direction": 1\r
         "play": {\r
           "type": "list",\r
           "args": {\r
-            "alias": "sheet_panels.by_sheet",\r
+            "return_item_name": "sheet_panel",\r
             "order": "t",\r
             "direction": 1\r
           }\r
           "type": "show"\r
         },\r
         "history": {\r
-          "type": "show"\r
+          "type": "list",\r
+          "args": {}\r
         },\r
         "new": {\r
           "type": "new"\r
         "scrolls": {\r
           "type": "list",\r
           "args": {\r
-            "alias": "scrolls.index"\r
+            "item_name": "scroll"\r
           }\r
         },\r
         "scroll_panels": {\r
           "type": "list",\r
           "args": {\r
-            "alias": "scroll_panels.index"\r
+            "item_name": "scroll_panel"\r
           }\r
         },\r
         "comics": {\r
           "type": "list",\r
           "args": {\r
-            "alias": "comics.index"\r
+            "item_name": "comic"\r
           }\r
         },\r
         "comic_stories": {\r
           "type": "list",\r
           "args": {\r
-            "alias": "comic_stories.index"\r
+            "item_name": "comic_story"\r
           }\r
         },\r
         "stories": {\r
           "type": "list",\r
           "args": {\r
-            "alias": "stories.index"\r
+            "item_name": "story"\r
           }\r
         },\r
         "story_sheets": {\r
           "type": "list",\r
           "args": {\r
-            "alias": "story_sheets.index"\r
+            "item_name": "story_sheet"\r
           }\r
         },\r
         "sheets": {\r
           "type": "list",\r
           "args": {\r
-            "alias": "sheets.index"\r
+            "item_name": "sheet"\r
           }\r
         },\r
         "sheet_panels": {\r
           "type": "list",\r
           "args": {\r
-            "alias": "sheet_panels.index"\r
+            "item_name": "sheet_panel"\r
           }\r
         },\r
         "panels": {\r
           "type": "list",\r
           "args": {\r
-            "alias": "panels.index"\r
+            "item_name": "panel"\r
           }\r
         },\r
         "panel_pictures": {\r
           "type": "list",\r
           "args": {\r
-            "alias": "panel_pictures.index"\r
+            "item_name": "panel_picture"\r
           }\r
         },\r
         "speech_balloons": {\r
           "type": "list",\r
           "args": {\r
-            "alias": "speech_balloons.index"\r
+            "item_name": "speech_balloon"\r
           }\r
         },\r
         "speeches": {\r
           "type": "list",\r
           "args": {\r
-            "alias": "speeches.index"\r
+            "item_name": "speech"\r
           }\r
         },\r
         "balloons": {\r
           "type": "list",\r
           "args": {\r
-            "alias": "balloons.index"\r
+            "item_name": "balloon"\r
           }\r
         },\r
         "ground_pictures": {\r
           "type": "list",\r
           "args": {\r
-            "alias": "ground_pictures.index"\r
+            "item_name": "ground_picture"\r
           }\r
         },\r
         "ground_colors": {\r
           "type": "list",\r
           "args": {\r
-            "alias": "ground_colors.index"\r
+            "item_name": "ground_color"\r
           }\r
         },\r
         "original_pictures": {\r
           "type": "list",\r
           "args": {\r
-            "alias": "original_pictures.index"\r
+            "item_name": "original_picture"\r
           }\r
         },\r
         "resource_pictures": {\r
           "type": "list",\r
           "args": {\r
-            "alias": "resource_pictures.index"\r
+            "item_name": "resource_picture"\r
           }\r
         }\r
       }\r