OSDN Git Service

fix
authoryasushiito <yas@pen-chan.jp>
Sat, 17 May 2014 02:14:20 +0000 (11:14 +0900)
committeryasushiito <yas@pen-chan.jp>
Sat, 17 May 2014 02:14:20 +0000 (11:14 +0900)
18 files changed:
app/assets/javascripts/manifest/work/controllers.js.coffee.erb
app/controllers/panels_controller.rb
app/controllers/scroll_panels_controller.rb
app/controllers/sheet_panels_controller.rb
app/controllers/story_sheets_controller.rb
app/models/license.rb
app/models/panel.rb
app/models/panel_picture.rb
config/locales/pettanr.ja.yml
config/routes.rb
lib/locmare/list_group/list/base.rb
lib/peta/item.rb
lib/peta/leaf.rb
lib/validators/resize_validator.rb [deleted file]
lib/validators/reverse_validator.rb
lib/validators/sync_vh_validator.rb
public/manifest.json
script/panel_import.rb

index 026c832..1c9abaf 100644 (file)
@@ -87,6 +87,9 @@
       by_scroll: {\r
         type: 'list',\r
       },\r
+      by_author: {\r
+        type: 'list',\r
+      },\r
       show: {\r
         type: 'show',\r
       },\r
       count_by_scroll: {\r
         type: 'count',\r
       },\r
+      count_by_author: {\r
+        type: 'count',\r
+      },\r
       new: {\r
         type: 'new',\r
       },\r
       by_sheet: {\r
         type: 'list',\r
       },\r
+      by_author: {\r
+        type: 'list',\r
+      },\r
       show: {\r
         type: 'show',\r
       },\r
       count_by_sheet: {\r
         type: 'count',\r
       },\r
+      count_by_author: {\r
+        type: 'count',\r
+      },\r
       new: {\r
         type: 'new',\r
       },\r
       by_panel: {\r
         type: 'list',\r
       },\r
+      by_author: {\r
+        type: 'list',\r
+      },\r
       show: {\r
         type: 'show',\r
       },\r
       count_by_panel: {\r
         type: 'count',\r
       },\r
+      count_by_author: {\r
+        type: 'count',\r
+      },\r
       new: {\r
         type: 'new',\r
       },\r
index 6804020..5c08447 100644 (file)
@@ -108,7 +108,7 @@ class PanelsController < ApplicationController
     if params[:json]
       jsn = JSON.parse_no_except(params[:json])
     end
-    @prm = if params[:panel].empty?
+    @prm = if params[:panel] == nil or params[:panel].empty?
        jsn
     else
        params[:panel]
index df8c011..fd47963 100644 (file)
@@ -4,7 +4,7 @@ class ScrollPanelsController < ApplicationController
     before_filter :authenticate_author, :only => [:new, :create, :edit, :update, :destroy]
   else
     before_filter :authenticate_reader, :only => [
-      :index, :show, :by_panel, :by_scroll, :count, :count_by_panel, :count_by_scroll
+      :index, :show, :by_panel, :by_scroll, :by_author, :count, :count_by_panel, :count_by_scroll, :count_by_author
     ]
     before_filter :authenticate_user, :only => [:new, :create, :edit, :update, :destroy]
     before_filter :authenticate_author, :only => [:new, :create, :edit, :update, :destroy]
@@ -26,6 +26,10 @@ class ScrollPanelsController < ApplicationController
     filer_list
   end
   
+  def by_author
+    filer_list
+  end
+  
   def show
     set_show
     respond_to do |format|
@@ -46,6 +50,10 @@ class ScrollPanelsController < ApplicationController
     list_count
   end
   
+  def count_by_author
+    list_count
+  end
+  
   def new
     form_new
   end
index 66e876b..c2f1c78 100644 (file)
@@ -4,7 +4,7 @@ class SheetPanelsController < ApplicationController
     before_filter :authenticate_author, :only => [:new, :create, :edit, :update, :destroy]
   else
     before_filter :authenticate_reader, :only => [
-      :index, :show, :by_sheet, :by_panel, :count, :count_by_sheet, :count_by_panel
+      :index, :show, :by_sheet, :by_panel, :by_author, :count, :count_by_sheet, :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]
@@ -26,6 +26,10 @@ class SheetPanelsController < ApplicationController
     filer_list
   end
   
+  def by_author
+    filer_list
+  end
+  
   def show
     set_show
     respond_to do |format|
@@ -46,6 +50,10 @@ class SheetPanelsController < ApplicationController
     list_count
   end
   
+  def count_by_author
+    list_count
+  end
+  
   def new
     form_new
   end
index 9b56617..0708389 100644 (file)
@@ -4,7 +4,7 @@ class StorySheetsController < ApplicationController
     before_filter :authenticate_author, :only => [:new, :create, :edit, :update, :destroy]
   else
     before_filter :authenticate_reader, :only => [
-      :index, :show, :by_story, :by_sheet, :count, :count_by_story, :count_by_sheet
+      :index, :show, :by_story, :by_sheet, :by_author, :count, :count_by_story, :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]
@@ -26,6 +26,10 @@ class StorySheetsController < ApplicationController
     filer_list
   end
   
+  def by_author
+    filer_list
+  end
+  
   def show
     set_show
     respond_to do |format|
@@ -46,6 +50,10 @@ class StorySheetsController < ApplicationController
     list_count
   end
   
+  def count_by_author
+    list_count
+  end
+  
   def new
     form_new
   end
index abb7c2c..3a70d4d 100644 (file)
@@ -12,12 +12,6 @@ class License < Peta::SystemResource
   validates :url, :presence => true, :length => {:maximum => 200}, :uniqueness => {:scope => :name}, :url => {:message => I18n.t('errors.messages.url')} #{:allow_blank => true}
   validates :system_picture_id, :presence => true, :numericality => true, :existence => {:both => false}
   
-  def supply_default
-  end
-  
-  def overwrite
-  end
-  
   def caption_with_group
     self.license_group.caption + '/' + self.caption
   end
@@ -30,14 +24,6 @@ class License < Peta::SystemResource
     'licenses.name'
   end
   
-  def self.list_opt
-    {:license_group => {}}
-  end
-  
-  def self.list_json_opt
-    {:include => {:license_group => {}}}
-  end
-  
   def self.show_opt
     {:include => {:license_group => {}}}
   end
@@ -74,6 +60,21 @@ class License < Peta::SystemResource
     res
   end
   
+=begin
+  def supply_default
+  end
+  
+  def overwrite
+  end
+  
+  def self.list_opt
+    {:license_group => {}}
+  end
+  
+  def self.list_json_opt
+    {:include => {:license_group => {}}}
+  end
+  
   def credit_pictures_attr
     return @credit_pictures_attr if @credit_pictures_attr
     begin
@@ -83,6 +84,7 @@ class License < Peta::SystemResource
     @credit_pictures_attr = {} unless @credit_pictures_attr
     @credit_pictures_attr
   end
+=end
   
   def self.export(dt = nil)
     opt = {}
index ad3ba44..bbdf9ed 100644 (file)
@@ -162,14 +162,12 @@ class Panel < Peta::Root
   
   def self.collect_element_value elements, name
     elements.map {|e|
-      e.map {|o|
-        if o['_destroy'] or o[:_destroy]
-          nil
-        else
-          o[name]
-        end
-      }.compact
-    }.flatten
+      if e['_destroy'] or e[:_destroy]
+        nil
+      else
+        e[name]
+      end
+    }
   end
   
   def self.validate_serial ary, offset = 0
@@ -199,7 +197,6 @@ class Panel < Peta::Root
   end
   def validate_child
 #    r1 = Panel.validate_elements_id validate_id_list
-      return true
     Panel.validate_elements_serial validate_serial_list
   end
   
index d4c9e1e..b75b417 100644 (file)
@@ -8,8 +8,8 @@ class PanelPicture < Peta::Element
   validates :link, :length => {:maximum => 200}, :url => {:allow_blank => true, :message => I18n.t('errors.messages.url')}
   validates :x, :presence => true, :numericality => true
   validates :y, :presence => true, :numericality => true
-  validates :width, :presence => true, :numericality => true, :not_zero => true#, :reverse => true, :resize => true, :sync_vh => true
-  validates :height, :presence => true, :numericality => true, :not_zero => true#, :reverse => true, :resize => true, :sync_vh => true
+  validates :width, :presence => true, :numericality => true, :not_zero => true, :reverse => true, :sync_vh => true
+  validates :height, :presence => true, :numericality => true, :not_zero => true, :reverse => true, :sync_vh => true
   validates :z, :presence => true, :numericality => {:greater_than => 0}
   validates :t, :presence => true, :numericality => {:greater_than_or_equal_to => 0}
   
@@ -71,7 +71,7 @@ class PanelPicture < Peta::Element
   end
   
   def filename
-    self.flip + self.picture.filename
+    self.picture.filename + '?subdir=' + self.flip
   end
   
   def url
index 3e36d4c..92befec 100644 (file)
@@ -741,6 +741,8 @@ ja:
       title: コマのスクコマ一覧
     by_scroll:
       title: スクロールのスクコマ一覧
+    by_author:
+      title: 作家のスクコマ一覧
     show:
       title: スクコマ詳細
     new:
@@ -823,6 +825,8 @@ ja:
       title: ストーリーのスト紙一覧
     by_sheet:
       title: 用紙のスト紙一覧
+    by_author:
+      title: 作家のスト紙一覧
     show:
       title: スト紙詳細
     new:
@@ -884,6 +888,8 @@ ja:
       title: 用紙の紙コマ一覧
     by_panel:
       title: コマの紙コマ一覧
+    by_author:
+      title: 作家の紙コマ一覧
     show:
       title: 紙コマ詳細
     new:
index 6d9c7f7..6299c42 100644 (file)
@@ -67,8 +67,10 @@ Pettanr::Application.routes.draw do
     member do
       get :by_panel
       get :by_scroll
+      get :by_author
       get :count_by_panel
       get :count_by_scroll
+      get :count_by_author
       get :edit
       put :update
       delete :destroy
@@ -135,8 +137,10 @@ Pettanr::Application.routes.draw do
     member do
       get :by_story
       get :by_sheet
+      get :by_author
       get :count_by_story
       get :count_by_sheet
+      get :count_by_author
       get :edit
       put :update
       delete :destroy
@@ -185,8 +189,10 @@ Pettanr::Application.routes.draw do
     member do
       get :by_sheet
       get :by_panel
+      get :by_author
       get :count_by_sheet
       get :count_by_panel
+      get :count_by_author
       get :edit
       put :update
       delete :destroy
@@ -423,6 +429,7 @@ Pettanr::Application.routes.draw do
     collection do
       get :index
       get :show
+      get :count
       get :search
     end
     member do
index bd3fb58..61ed328 100644 (file)
@@ -16,12 +16,12 @@ module Locmare
           if list_manifest.has_id?
             filter_item_id = @options[:id]
             if list_manifest.pre_id?
-              list_manifest.model.path_name + '/' + filter_item_id.to_s + '/' + list_manifest.action_name
+              '/' + list_manifest.model.path_name + '/' + filter_item_id.to_s + '/' + list_manifest.action_name
             else
-              list_manifest.model.path_name + '/' + list_manifest.action_name + '/' + filter_item_id.to_s
+              '/' + list_manifest.model.path_name + '/' + list_manifest.action_name + '/' + filter_item_id.to_s
             end
           else
-            list_manifest.model.path_name + '/' + list_manifest.action_name
+            '/' + list_manifest.model.path_name + '/' + list_manifest.action_name
           end
         end
         
index 938437d..e379a1c 100644 (file)
@@ -120,7 +120,7 @@ module Peta
       opt.merge!(self.show_opt)
       item = self.find(item_id, opt)
       item.boosts 'read'
-      raise ActiveRecord::Forbidden unless item.visible?(operators)
+      raise ActiveRecord::Forbidden if item.visible?(operators) == false
       item
     end
     
index ae16445..7f4a5b3 100644 (file)
@@ -31,8 +31,9 @@ module Peta
       self.root.own? operators
     end
     
+    # super return if my item
     def visible? operators
-      return false unless super
+      return false if super == false
       self.root.visible? operators
     end
     
diff --git a/lib/validators/resize_validator.rb b/lib/validators/resize_validator.rb
deleted file mode 100644 (file)
index 87f9704..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-class ResizeValidator < ActiveModel::EachValidator\r
-  def validate_each(record, attribute, value)\r
-    if record.picture and record.picture.flag_resize < 0\r
-      record.errors[attribute] << (options[:message] || I18n.t('activerecord.errors.messages.resize')) unless value == record.picture[attribute]\r
-    end\r
-  end\r
-end\r
-\r
index 4965fc8..d65a5ba 100644 (file)
@@ -1,6 +1,7 @@
 class ReverseValidator < ActiveModel::EachValidator\r
   def validate_each(record, attribute, value)\r
-    if record.picture and record.picture.flag_reverse < 0\r
+    record.picture.boosts 'post'\r
+    if record.picture and record.picture.license_extend.reverse < 0\r
       record.errors[attribute] << (options[:message] || I18n.t('activerecord.errors.messages.reverse')) if value < 0\r
     end\r
   end\r
index 92c3a07..c2b6a50 100644 (file)
@@ -1,6 +1,7 @@
 class SyncVhValidator < ActiveModel::EachValidator\r
   def validate_each(record, attribute, value)\r
-    if record.picture and record.picture.flag_sync_vh < 0\r
+    record.picture.boosts 'post'\r
+    if record.picture and record.picture.license_extend.sync_vh < 0\r
       record.errors[attribute] << (options[:message] || I18n.t('activerecord.errors.messages.sync_vh')) unless sync?(record)\r
     end\r
   end\r
index 5b25712..2d94439 100644 (file)
         "by_scroll": {\r
           "type": "list"\r
         },\r
+        "by_author": {\r
+          "type": "list"\r
+        },\r
         "show": {\r
           "type": "show"\r
         },\r
         "count_by_scroll": {\r
           "type": "count"\r
         },\r
+        "count_by_author": {\r
+          "type": "count"\r
+        },\r
         "new": {\r
           "type": "new"\r
         },\r
         "by_sheet": {\r
           "type": "list"\r
         },\r
+        "by_author": {\r
+          "type": "list"\r
+        },\r
         "show": {\r
           "type": "show"\r
         },\r
         "count_by_sheet": {\r
           "type": "count"\r
         },\r
+        "count_by_author": {\r
+          "type": "count"\r
+        },\r
         "new": {\r
           "type": "new"\r
         },\r
         "by_panel": {\r
           "type": "list"\r
         },\r
+        "by_author": {\r
+          "type": "list"\r
+        },\r
         "show": {\r
           "type": "show"\r
         },\r
         "count_by_panel": {\r
           "type": "count"\r
         },\r
+        "count_by_author": {\r
+          "type": "count"\r
+        },\r
         "new": {\r
           "type": "new"\r
         },\r
index a070a82..da532bf 100644 (file)
@@ -202,8 +202,8 @@ class Importer
           speech['speech_balloon_template_id'] = dsb['id']\r
           speech["speech_balloon_template_classname"] = dsb["classname"]\r
           speech['writing_format_id'] = dwf['id']\r
-          speech["writing_format_classname"] = 'Pettanr' + dwf["classname"]\r
-      #    speech["writing_format_classname"] = dwf["classname"]\r
+    #      speech["writing_format_classname"] = 'Pettanr' + dwf["classname"]\r
+          speech["writing_format_classname"] = dwf["classname"]\r
           \r
           e['balloon_attributes'] = balloon\r
           e['speech_attributes'] = speech\r