Merge branch 'development' of github.com:Rulingcom/orbit into development
Conflicts: app/controllers/default_widget_controller.rb lib/tasks/migrate.rake
This commit is contained in:
commit
9fec7beb47
319 files changed
+3012
-4094
No files matched your search
@@ -3,24 +3,24 @@ module DefaultWidgetHelper
|
||||
I18n.t("#{@page_part.module_app.key}.default_widget.#{field}")
|
||||
end
|
||||
|
||||
def link_to_field(row_data,field,switch)
|
||||
def link_to_field(row_data,field, switch, options=nil)
|
||||
method_ary = @page_part.module_app.widget_fields_link_method
|
||||
field = field.to_sym
|
||||
if(method_ary.has_key?(field) and (switch == "true"))
|
||||
url = case method_ary[field][:args]
|
||||
when nil # no args
|
||||
get_data_link(method_ary[field][:method])
|
||||
get_data_link(method_ary[field]["method"], options)
|
||||
when :self # passing self
|
||||
get_data_link(method_ary[field][:method],row_data.id)
|
||||
get_data_link(method_ary[field]['method'], options,row_data.id)
|
||||
else
|
||||
ary = method_ary[field][:args].clone
|
||||
object_hash = ary.each do |key,val|
|
||||
ary[key]= type_trans_or_to_s(row_data.send(val[0]).send(val[1]))
|
||||
end
|
||||
get_data_link(method_ary[field][:method],object_hash)
|
||||
get_data_link(method_ary[field]['method'], options,object_hash)
|
||||
end
|
||||
|
||||
link_to row_data.send(field),url
|
||||
|
||||
link_to row_data.send(field), url
|
||||
else
|
||||
type_trans_or_to_s(row_data.send(field) )
|
||||
end
|
||||
@@ -45,13 +45,17 @@ module DefaultWidgetHelper
|
||||
end
|
||||
end
|
||||
|
||||
def get_data_link(method_entry,object = nil)
|
||||
def get_data_link(method_entry, options=nil, object = nil)
|
||||
case object
|
||||
when nil
|
||||
eval method_entry
|
||||
when NilClass
|
||||
eval eval("#{method_entry}(#{options})")
|
||||
when BSON::ObjectId
|
||||
object = "'#{object.to_s}'"
|
||||
eval("#{method_entry}(#{object}, #{options})")
|
||||
when Hash
|
||||
eval("#{method_entry}(#{object.merge options})")
|
||||
else
|
||||
object = "'#{object.to_s}'" if object.class == BSON::ObjectId
|
||||
eval("#{method_entry}(#{object})" )
|
||||
''
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in new issue
Block a user