Fix gravity blank bug.

This commit is contained in:
BoHung Chiu 2023-04-17 15:41:13 +08:00
parent 8ddce60cba
commit cb812c983d
2 changed files with 2 additions and 2 deletions

View File

@ -12,7 +12,7 @@ class AlbumSetting
before_save do
if defined?(OrbitHelper::SharedHash) && OrbitHelper::SharedHash
OrbitHelper::SharedHash['gallery'][:thumb_process_option] = self.thumb_process_option
OrbitHelper::SharedHash['gallery'][:resize_gravity] = self.resize_gravity
OrbitHelper::SharedHash['gallery'][:resize_gravity] = (self.resize_gravity.blank? ? 'Center' : self.resize_gravity)
end
end
end

View File

@ -92,7 +92,7 @@ Gem::Specification.new do |s|
s.license = "MIT"
s.metadata = {
"_require" => "#{File.expand_path("../app/models/album_setting", __FILE__)}",
"global_hash" => "{resize_gravity: (AlbumSetting.first.resize_gravity rescue 'Center'), thumb_process_option: (AlbumSetting.first.thumb_process_option rescue 1)}"
"global_hash" => "{resize_gravity: ([AlbumSetting.first.resize_gravity, 'Center'].select{|s| s.present?}.first rescue 'Center'), thumb_process_option: (AlbumSetting.first.thumb_process_option rescue 1)}"
}
s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.rdoc"]