Sha256: 04e4af1202d1c1133ba42b6e71e0137ba8d0764a2a97ab78ffe4dd3e9dde30e2

Contents?: true

Size: 536 Bytes

Versions: 53

Compression:

Stored size: 536 Bytes

Contents

module Para
  module AttributeField
    class Redactor < AttributeField::Base
      include ActionView::Helpers::SanitizeHelper
      include ActionView::Helpers::TextHelper

      register :redactor, self

      def initialize(model, options = {})
        options.reverse_merge!(type: 'text', field_type: 'redactor')
        super(model, options)
      end

      def value_for(instance)
        (value = instance.send(name)) && truncate(
          sanitize(value, tags: []),
          length: 50
        )
      end
    end
  end
end

Version data entries

53 entries across 53 versions & 1 rubygems

Version Path
para-0.11.4 lib/para/attribute_field/redactor.rb
para-0.11.3 lib/para/attribute_field/redactor.rb
para-0.11.2 lib/para/attribute_field/redactor.rb
para-0.11.1 lib/para/attribute_field/redactor.rb
para-0.11.0 lib/para/attribute_field/redactor.rb
para-0.10.0 lib/para/attribute_field/redactor.rb
para-0.9.4 lib/para/attribute_field/redactor.rb
para-0.9.3.3 lib/para/attribute_field/redactor.rb
para-0.9.3.2 lib/para/attribute_field/redactor.rb
para-0.9.3.1 lib/para/attribute_field/redactor.rb
para-0.9.2 lib/para/attribute_field/redactor.rb
para-0.9.0 lib/para/attribute_field/redactor.rb
para-0.8.15 lib/para/attribute_field/redactor.rb
para-0.8.14 lib/para/attribute_field/redactor.rb
para-0.8.13 lib/para/attribute_field/redactor.rb
para-0.8.12 lib/para/attribute_field/redactor.rb
para-0.8.11 lib/para/attribute_field/redactor.rb
para-0.8.10 lib/para/attribute_field/redactor.rb
para-0.8.9 lib/para/attribute_field/redactor.rb
para-0.8.8 lib/para/attribute_field/redactor.rb