cleaning a little bit
This commit is contained in:
parent
e1c2687681
commit
e9c1c1d98f
3
doc/TODO
3
doc/TODO
@ -27,12 +27,15 @@ BOARD:
|
|||||||
x nav
|
x nav
|
||||||
(- link_to (new)
|
(- link_to (new)
|
||||||
- others ?) -
|
- others ?) -
|
||||||
|
- theme_assets
|
||||||
- other problems to solve:
|
- other problems to solve:
|
||||||
x If you create a new page it shall always be created in the default_language, not depending on the used language in the backend.
|
x If you create a new page it shall always be created in the default_language, not depending on the used language in the backend.
|
||||||
- set the page slug for all the site locales
|
- set the page slug for all the site locales
|
||||||
- default site locale even if the i18n feature is disabled (the disable procedure is missing btw)
|
- default site locale even if the i18n feature is disabled (the disable procedure is missing btw)
|
||||||
- redirect for the default site locale if urls like /<default_site_locale>/....
|
- redirect for the default site locale if urls like /<default_site_locale>/....
|
||||||
- inline editing
|
- inline editing
|
||||||
|
- with_scope is broken
|
||||||
|
- refactor
|
||||||
|
|
||||||
BACKLOG:
|
BACKLOG:
|
||||||
|
|
||||||
|
@ -99,12 +99,6 @@ module Mongoid
|
|||||||
protected
|
protected
|
||||||
|
|
||||||
def localized_field?(name)
|
def localized_field?(name)
|
||||||
# puts "options[:type] = #{options[:type].inspect} / #{(options[:type] == LocalizedField).inspect}"
|
|
||||||
|
|
||||||
# return true if options[:type] == LocalizedField
|
|
||||||
|
|
||||||
# puts "self.localized_fields_list = #{self.localized_fields_list.inspect} / #{meth.inspect}"
|
|
||||||
|
|
||||||
(self.localized_fields_list || []).any? do |rule|
|
(self.localized_fields_list || []).any? do |rule|
|
||||||
case rule
|
case rule
|
||||||
when String, Symbol then name.to_s == rule.to_s
|
when String, Symbol then name.to_s == rule.to_s
|
||||||
@ -121,7 +115,7 @@ module Mongoid
|
|||||||
|
|
||||||
def create_accessors(name, meth, options = {})
|
def create_accessors(name, meth, options = {})
|
||||||
if options[:type] == LocalizedField
|
if options[:type] == LocalizedField
|
||||||
if options[:use_default_if_empty] != false # nil or true
|
if options[:use_default_if_empty] != false # neither nil nor true
|
||||||
define_method(meth) do
|
define_method(meth) do
|
||||||
value = read_attribute(name)
|
value = read_attribute(name)
|
||||||
if value.is_a?(Hash)
|
if value.is_a?(Hash)
|
||||||
@ -141,14 +135,10 @@ module Mongoid
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
define_method("#{meth}=") do |value|
|
define_method("#{meth}=") do |value|
|
||||||
# debugger
|
|
||||||
# puts "@attributes[name].present? = #{@attributes[name].present?.inspect} / !@attributes[name].is_a?(Hash) #{(!@attributes[name].is_a?(Hash)).inspect}"
|
|
||||||
if !@attributes[name].nil? && !@attributes[name].is_a?(Hash)
|
if !@attributes[name].nil? && !@attributes[name].is_a?(Hash)
|
||||||
@attributes[name] = { ::I18n.default_site_locale.to_s => @attributes[name] }
|
@attributes[name] = { ::I18n.default_site_locale.to_s => @attributes[name] }
|
||||||
end
|
end
|
||||||
|
|
||||||
# puts "value = #{value.inspect} / #{meth}"
|
|
||||||
|
|
||||||
value = if value.is_a?(Hash)
|
value = if value.is_a?(Hash)
|
||||||
(@attributes[name] || {}).merge(value)
|
(@attributes[name] || {}).merge(value)
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user