Sha256: 41608b5d60be70c3a58aa50759ee2e68c8d9357c63d73a9261c98210842b9611
Contents?: true
Size: 841 Bytes
Versions: 11
Compression:
Stored size: 841 Bytes
Contents
class RailsInfo::Data::ObjectPresenter < ::RailsInfo::Presenter def initialize(subject, options = {}) super(subject, options) options.assert_valid_keys(:object) @object = options[:object] end def row content = content_tag :td, class: 'first' do check_box_tag "data[]", "#{object[:class].name};#{object['id']}", false, id: "#{object[:class].name.tableize}-#{object['id']}" end object[:class].columns.each do |column| value = object[column.name] if ['string', 'text'].include?(column.type.to_s) text = value.present? && value.length > 20 ? "#{value[0,20]}..." : value value = content_tag :span, text, title: value end content += content_tag :td, value end content end private def object @object end end
Version data entries
11 entries across 11 versions & 1 rubygems