Remove i18n_variable for announcement

This commit is contained in:
Christophe Vilayphiou committed 2012-07-27 19:12:58 +08:00
1 parent d589a1b522
commit e2ebd48b22
33 files changed
+163 -160

No files matched your search

+7 -17
View File
@@ -39,11 +39,10 @@ class OrbitBackendController< ApplicationController
options = [options] if !options.class.eql?(Array)
options.each do |option|
if object_class.fields.include?(option)
case object_class.fields[option].type.to_s
when 'BigDecimal', 'Boolean', 'Date', 'DateTime', 'Float', 'Integer', 'String', 'Symbol', 'Time'
(objects = objects.order_by(option, params[:direction])) rescue nil
when 'Object'
objects = get_objects_from_referenced_objects(object_class.fields[option].options[:class_name].constantize, objects, option)
if object_class.fields[option].type.to_s.eql?('Object') && !object_class.relations[option].nil?
objects = get_objects_from_referenced_objects(object_class.fields[option].options[:class_name].constantize, objects, option)
else
(objects = objects.order_by(option, params[:direction])) rescue nil
end
elsif object_class.relations.include?(option)
case object_class.relations[option].macro
@@ -92,20 +91,11 @@ class OrbitBackendController< ApplicationController
end
def get_string_value_from_object(object)
s = object[I18n.locale] rescue nil
s = object.i18n_variable unless s rescue nil
s = object.name_translations[I18n.locale.to_s] unless s rescue nil
s = object.title_translations[I18n.locale.to_s] unless s rescue nil
s = object.name unless s rescue nil
s = object.title unless s rescue nil
if s
case s.class.to_s
when "String"
s.downcase rescue ''
when "I18nVariable"
s[I18n.locale].downcase rescue ''
else
nil
end
end
s.downcase rescue ''
end
def get_objects_from_referenced_objects(object_class, objects, option)