Sha256: bf09ceceafa3e8bb5a7aa59a5f11b363de5a9f50e75adadbbabd7a084ae79eec

Contents?: true

Size: 451 Bytes

Versions: 5

Compression:

Stored size: 451 Bytes

Contents

module Brightcontent
  module BaseHelper
    def render_list_field(item, field)
      render_if_exists("list_field_#{field}", item: item) || item.send(field).truncate(50)
    end

    def render_form_field(form, field)
      render_if_exists("form_field_#{field}", form: form, item: form.object) || form.input(field.to_sym)
    end

    def render_if_exists(*args)
      render *args
    rescue ActionView::MissingTemplate
      nil
    end
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
brightcontent-core-2.0.0.alpha5 app/helpers/brightcontent/base_helper.rb
brightcontent-2.0.0.alpha3 core/app/helpers/brightcontent/base_helper.rb
brightcontent-core-2.0.0.alpha3 app/helpers/brightcontent/base_helper.rb
brightcontent-2.0.0.alpha2 core/app/helpers/brightcontent/base_helper.rb
brightcontent-core-2.0.0.alpha2 app/helpers/brightcontent/base_helper.rb