orbit-basic/app/helpers/default_widgets_helper.rb

14 lines
538 B
Ruby
Raw Normal View History

module DefaultWidgetsHelper
def get_row_data(row_data,field)
field_is_link = (field[0][1]== 'false' ? false : true )
field_setting = {:class=>field[0][1],:method=>field[0][0]}
if field_is_link
field_link = field[0][1].to_s + '_path'
binding.pry
link = link_to(row_data.send(field_setting[:method]),field_link.send(row_data))
content_tag(:span,link,:class=>field_setting[:class])
else
content_tag(:span,row_data.send(field_setting[:method]),:class=>field_setting[:class])
end
end
end