• R/O
  • HTTP
  • SSH
  • HTTPS

pettanr: コミット

サーバ側、Railsシステム本体


コミットメタ情報

リビジョン3690e63e2aa9371aa117ea009a8f8639912cc873 (tree)
日時2013-06-30 16:59:45
作者yasushiito <yas@pen-...>
コミッターyasushiito

ログメッセージ

fix sb engine

変更サマリ

差分

--- a/.gitignore
+++ b/.gitignore
@@ -19,3 +19,6 @@ db/migrate/*_pettan_protected_v??_licenses_attributes.rb
1919 db/migrate/*_pettan_public_v??_licenses_attributes.rb
2020 db/migrate/*_public_domain_v??_licenses_attributes.rb
2121 db/migrate/*_unknown_v??_licenses_attributes.rb
22+db/migrate/*_speech_balloon_speech_balloons.rb
23+db/migrate/*_speech_balloon_balloons.rb
24+db/migrate/*_speech_balloon_speeches.rb
--- a/Gemfile
+++ b/Gemfile
@@ -13,6 +13,9 @@ gem 'pettanr_pettan_protected_v01_licenses'
1313 gem 'pettanr_pettan_public_v01_licenses'
1414 gem 'pettanr_public_domain_v01_licenses'
1515 gem 'pettanr_unknown_v01_licenses'
16+gem 'circle_speech_balloon'
17+gem 'plain_speech_balloon'
18+gem 'square_speech_balloon'
1619
1720 # Bundle edge Rails instead:
1821 # gem 'rails', :git => 'git://github.com/rails/rails.git'
--- a/app/controllers/speech_balloons_controller.rb
+++ b/app/controllers/speech_balloons_controller.rb
@@ -60,8 +60,13 @@ class SpeechBalloonsController < ApplicationController
6060 @speech = @speech_balloon.build_speech
6161 @balloon.extend @speech_balloon_template.engine_balloon_module
6262 @speech.extend @speech_balloon_template.engine_speech_module
63- @balloon.supply_default @speech_balloon_template.parsed_settings
64- @speech.supply_default @speech_balloon_template.parsed_settings
63+ @balloon.new_speech_balloon = @speech_balloon
64+ @speech.new_speech_balloon = @speech_balloon
65+ @balloon.supply_default
66+ @speech.supply_default
67+ @speech_balloon_extend = @speech_balloon.extend_speech_balloon
68+ @balloon_extend = @balloon.extend_balloon
69+ @speech_extend = @speech.extend_speech
6570
6671 respond_to do |format|
6772 format.html {
@@ -90,33 +95,68 @@ class SpeechBalloonsController < ApplicationController
9095 end
9196
9297 def create
93- @panel = Panel.edit(@author.working_panel, @author)
94- if params[:speech_balloon][:settings] and params[:speech_balloon][:settings].is_a?(Hash)
95- params[:speech_balloon][:settings] = params[:speech_balloon][:settings].to_json
98+ speech_balloon_settings = params[:speech_balloon][:settings]
99+ if speech_balloon_settings.blank?
100+ speech_balloon_settings = {}
101+ else
102+ if speech_balloon_settings.is_a?(Hash)
103+ params[:speech_balloon][:settings] = speech_balloon_settings.to_json
104+ else
105+ speech_balloon_settings = {}
106+ end
96107 end
97- if params[:speech_balloon][:balloon_attributes][:settings] and params[:speech_balloon][:balloon_attributes][:settings].is_a?(Hash)
98- params[:speech_balloon][:balloon_attributes][:settings] = params[:speech_balloon][:balloon_attributes][:settings].to_json
108+ balloon_settings = params[:speech_balloon][:balloon_attributes][:settings]
109+ if balloon_settings.blank?
110+ balloon_settings = {}
111+ else
112+ if balloon_settings.is_a?(Hash)
113+ params[:speech_balloon][:balloon_attributes][:settings] = balloon_settings.to_json
114+ else
115+ balloon_settings = {}
116+ end
99117 end
100- if params[:speech_balloon][:speech_attributes][:settings] and params[:speech_balloon][:speech_attributes][:settings].is_a?(Hash)
101- params[:speech_balloon][:speech_attributes][:settings] = params[:speech_balloon][:speech_attributes][:settings].to_json
118+ speech_settings = params[:speech_balloon][:speech_attributes][:settings]
119+ if speech_settings.blank?
120+ speech_settings = {}
121+ else
122+ if speech_settings.is_a?(Hash)
123+ params[:speech_balloon][:speech_attributes][:settings] = speech_settings.to_json
124+ else
125+ speech_settings = {}
126+ end
102127 end
128+ @panel = Panel.edit(@author.working_panel, @author)
103129 @speech_balloon = SpeechBalloon.new
104130 @speech_balloon.attributes = params[:speech_balloon]
105131
106132 @speech_balloon_template = @speech_balloon.speech_balloon_template
107133 @balloon = @speech_balloon.balloon
108134 @speech = @speech_balloon.speech
135+
109136 @speech_balloon.extend @speech_balloon_template.engine_speech_balloon_module
110137 @balloon.extend @speech_balloon_template.engine_balloon_module
111138 @speech.extend @speech_balloon_template.engine_speech_module
139+
140+ @balloon.new_speech_balloon = @speech_balloon
141+ @speech.new_speech_balloon = @speech_balloon
142+
143+ @speech_balloon.extend_speech_balloon = speech_balloon_settings
144+ @balloon.extend_balloon = balloon_settings
145+ @speech.extend_speech = speech_settings
146+
112147 @speech_balloon_extend = @speech_balloon.extend_speech_balloon
113148 @balloon_extend = @balloon.extend_balloon
114149 @speech_extend = @speech.extend_speech
115150
151+ params[:speech_balloon][:balloon_attributes][:system_picture_id] = @balloon.select_system_picture
152+
116153 @speech_balloon.overwrite @panel.id
117154
118155 respond_to do |format|
119- if @speech_balloon.valid? or @speech_balloon.extend_speech_balloon.valid? or @balloon.extend_balloon.valid? or @speech.extend_speech.valid? or @speech_balloon_extend.valid?
156+ sbv = @speech_balloon_extend.valid?
157+ bv = @balloon_extend.valid?
158+ sv = @speech_extend.valid?
159+ if @speech_balloon.valid? and @speech_balloon_extend.valid? and @balloon_extend.valid? and @speech_extend.valid? and sbv and bv and sv
120160 if @speech_balloon.store @author, params[:speech_balloon]
121161 flash[:notice] = I18n.t('flash.notice.created', :model => Panel.model_name.human)
122162 format.html { redirect_to @panel }
@@ -189,7 +229,7 @@ class SpeechBalloonsController < ApplicationController
189229 @balloon_extend = @balloon.extend_balloon
190230 @speech_extend = @speech.extend_speech
191231
192- @balloon.select_system_picture
232+ params[:speech_balloon][:balloon_attributes][:system_picture_id] = @balloon.select_system_picture
193233
194234 @panel = Panel.edit(@speech_balloon.panel.id, @author)
195235 @speech_balloon.overwrite @panel.id
--- a/app/models/balloon.rb
+++ b/app/models/balloon.rb
@@ -44,6 +44,10 @@ class Balloon < ActiveRecord::Base
4444 self.system_picture_id = 1
4545 end
4646
47+ def get_speech_balloon
48+ self.speech_balloon
49+ end
50+
4751 def tag_id c = nil
4852 'panel' + tag_panel_id + tag_element_type + tag_element_id + tag_element_part_type + tag_element_part_id + c.to_s
4953 end
@@ -53,11 +57,11 @@ self.system_picture_id = 1
5357 end
5458
5559 def tag_panel_id
56- self.speech_balloon.panel.new_record? ? '0' : self.speech_balloon.panel.id.to_s
60+ self.get_speech_balloon.panel.new_record? ? '0' : self.get_speech_balloon.panel.id.to_s
5761 end
5862
5963 def tag_element_id
60- self.speech_balloon.new_record? ? '0' : self.speech_balloon.id.to_s
64+ self.get_speech_balloon.new_record? ? '0' : self.get_speech_balloon.id.to_s
6165 end
6266
6367 def tag_element_type
--- a/app/models/speech.rb
+++ b/app/models/speech.rb
@@ -34,6 +34,10 @@ class Speech < ActiveRecord::Base
3434 self.speech_balloon.panel.visible? roles
3535 end
3636
37+ def get_speech_balloon
38+ self.speech_balloon
39+ end
40+
3741 def tag_id c = nil
3842 'panel' + tag_panel_id + tag_element_type + tag_element_id + tag_element_part_type + tag_element_part_id + c.to_s
3943 end
@@ -43,11 +47,11 @@ class Speech < ActiveRecord::Base
4347 end
4448
4549 def tag_panel_id
46- self.speech_balloon.panel.new_record? ? '0' : self.speech_balloon.panel.id.to_s
50+ self.get_speech_balloon.panel.new_record? ? '0' : self.get_speech_balloon.panel.id.to_s
4751 end
4852
4953 def tag_element_id
50- self.speech_balloon.new_record? ? '0' : self.speech_balloon.id.to_s
54+ self.get_speech_balloon.new_record? ? '0' : self.get_speech_balloon.id.to_s
5155 end
5256
5357 def tag_element_type
--- a/config/speech_balloon.yml
+++ b/config/speech_balloon.yml
@@ -1,2 +1,4 @@
1-# Square: pettanr_square_v01_sbt
1+ CircleSpeechBalloon: circle_speech_balloon
2+ PlainSpeechBalloon: plain_speech_balloon
3+ SquareSpeechBalloon: square_speech_balloon
24 # TestSpeechBalloon: test_speech_balloon
旧リポジトリブラウザで表示