OSDN Git Service

test sb extend data
authoryasushiito <yas@pen-chan.jp>
Wed, 23 Apr 2014 02:53:49 +0000 (11:53 +0900)
committeryasushiito <yas@pen-chan.jp>
Wed, 23 Apr 2014 02:53:49 +0000 (11:53 +0900)
app/assets/javascripts/manifest/work/items.js.coffee.erb
app/controllers/balloons_controller.rb
app/controllers/pictures_controller.rb
app/controllers/speech_balloons_controller.rb
app/controllers/speeches_controller.rb
app/models/balloon.rb
app/models/speech.rb
app/models/speech_balloon.rb
lib/locmare/booster.rb
lib/validators/boost_validator.rb
public/manifest.json

index 39ebab3..52a77b3 100644 (file)
@@ -65,6 +65,7 @@
       parent_model_name: 'speech_balloon',\r
       boost: {\r
         speech_balloon_template: {\r
       parent_model_name: 'speech_balloon',\r
       boost: {\r
         speech_balloon_template: {\r
+          extend_item_name: 'balloon',\r
         },\r
       },\r
     },\r
         },\r
       },\r
     },\r
@@ -77,6 +78,7 @@
         writing_format: {\r
         },\r
         speech_balloon_template: {\r
         writing_format: {\r
         },\r
         speech_balloon_template: {\r
+          extend_item_name: 'speech',\r
         },\r
       },\r
     },\r
         },\r
       },\r
     },\r
index d7d4936..d4f94ae 100644 (file)
@@ -25,6 +25,7 @@ class BalloonsController < ApplicationController
   
   def show_html_format format
     format.html {
   
   def show_html_format format
     format.html {
+      @item.boosts 'post'
       @balloon = @item
     }
   end
       @balloon = @item
     }
   end
index 9e1bae8..b4c6d8e 100644 (file)
@@ -7,6 +7,15 @@ class PicturesController < ApplicationController
     before_filter :authenticate_resource_reader, :only => [:show, :credit, :search]
     before_filter :authenticate_author, :only => []
   end
     before_filter :authenticate_resource_reader, :only => [:show, :credit, :search]
     before_filter :authenticate_author, :only => []
   end
+  before_filter :authenticate_admin, :only => [:index]
+  
+  def self.model
+    Picture
+  end
+  
+  def index
+    filer_list
+  end
   
   def show_html_format format
     format.html {
   
   def show_html_format format
     format.html {
index a1551f2..4198bec 100644 (file)
@@ -28,6 +28,7 @@ class SpeechBalloonsController < ApplicationController
   
   def show_html_format format
     format.html {
   
   def show_html_format format
     format.html {
+      @item.boosts 'post'
       @speech_balloon = @item
     }
   end
       @speech_balloon = @item
     }
   end
index db947ad..2ee6880 100644 (file)
@@ -29,6 +29,7 @@ class SpeechesController < ApplicationController
   
   def show_html_format format
     format.html {
   
   def show_html_format format
     format.html {
+      @item.boosts 'post'
       @speech = @item
     }
   end
       @speech = @item
     }
   end
index f3f9460..c79616d 100644 (file)
@@ -14,7 +14,7 @@ class Balloon < Peta::Element
   validates :height, :presence => true, :numericality => true, :natural_number => true
   validates :r, :presence => true, :numericality => true
 #  validates :caption, :presence => true
   validates :height, :presence => true, :numericality => true, :natural_number => true
   validates :r, :presence => true, :numericality => true
 #  validates :caption, :presence => true
-  validates :speech_balloon_template_settings, :boost => {:resource_name => :speech_balloon_template}
+  validates :speech_balloon_template_settings, :boost => {:boost_name => :speech_balloon_template}
 
   def url
     '/system_pictures/' + self.system_picture.filename
 
   def url
     '/system_pictures/' + self.system_picture.filename
index 076c80d..24fc43b 100644 (file)
@@ -17,7 +17,7 @@ class Speech < Peta::Element
   validates :width, :presence => true, :numericality => true, :natural_number => true
   validates :height, :presence => true, :numericality => true, :natural_number => true
   validates :quotes, :length => {:maximum => 15}, :quotes_even => true
   validates :width, :presence => true, :numericality => true, :natural_number => true
   validates :height, :presence => true, :numericality => true, :natural_number => true
   validates :quotes, :length => {:maximum => 15}, :quotes_even => true
-  validates :speech_balloon_template_settings, :boost => {:resource_name => :speech_balloon_template}
+  validates :speech_balloon_template_settings, :boost => {:boost_name => :speech_balloon_template}
   #validates :writing_format_settings
   
   @@text_align_texts = ['left', 'left', 'right', 'center']
   #validates :writing_format_settings
   
   @@text_align_texts = ['left', 'left', 'right', 'center']
index d5a4148..88073cd 100644 (file)
@@ -13,7 +13,7 @@ class SpeechBalloon < Peta::Element
   validates :speech_balloon_template_classname, :presence => true, :length => {:maximum => 50}
   validates :z, :presence => true, :numericality => {:greater_than => 0}
   validates :t, :presence => true, :numericality => {:greater_than_or_equal_to => 0}
   validates :speech_balloon_template_classname, :presence => true, :length => {:maximum => 50}
   validates :z, :presence => true, :numericality => {:greater_than => 0}
   validates :t, :presence => true, :numericality => {:greater_than_or_equal_to => 0}
-  validates :speech_balloon_template_settings, :boost => {:resource_name => :speech_balloon_template}
+  validates :speech_balloon_template_settings, :boost => {:boost_name => :speech_balloon_template}
   
   def self.by_author_list_includes
     {
   
   def self.by_author_list_includes
     {
index a8201d4..0f4dee5 100644 (file)
@@ -97,6 +97,10 @@ module Locmare
       end
     end
     
       end
     end
     
+    def update_settings new_settings
+      @item.__send__ @manifest.setter_method_name, new_settings
+    end
+    
   end
 end
 
   end
 end
 
index 63ad5af..530e282 100644 (file)
@@ -1,6 +1,6 @@
 class BoostValidator < ActiveModel::EachValidator\r
   def validate_each(record, attribute, value)\r
 class BoostValidator < ActiveModel::EachValidator\r
   def validate_each(record, attribute, value)\r
-    rec = record.boosters[options[:resource_name].to_s].extend_item\r
+    rec = record.boosters[options[:boost_name].to_s].extend_item\r
     msg = options[:message] || I18n.t('activerecord.errors.messages.extend_settings')\r
     record.errors[attribute] << msg unless rec.valid?\r
   end\r
     msg = options[:message] || I18n.t('activerecord.errors.messages.extend_settings')\r
     record.errors[attribute] << msg unless rec.valid?\r
   end\r
index fb4b3ed..1f17621 100644 (file)
@@ -58,7 +58,9 @@
       "args": {\r
         "parent_model_name": "speech_balloon",\r
         "boost": {\r
       "args": {\r
         "parent_model_name": "speech_balloon",\r
         "boost": {\r
-          "speech_balloon_template": {}\r
+          "speech_balloon_template": {\r
+            "extend_item_name": "balloon"\r
+          }\r
         }\r
       }\r
     },\r
         }\r
       }\r
     },\r
@@ -68,7 +70,9 @@
         "parent_model_name": "speech_balloon",\r
         "boost": {\r
           "writing_format": {},\r
         "parent_model_name": "speech_balloon",\r
         "boost": {\r
           "writing_format": {},\r
-          "speech_balloon_template": {}\r
+          "speech_balloon_template": {\r
+            "extend_item_name": "speech"\r
+          }\r
         }\r
       }\r
     },\r
         }\r
       }\r
     },\r