Sha256: d0462623fbb08091ad2271823753daedff66a3319b2a8f9660b72c58076fab12

Contents?: true

Size: 867 Bytes

Versions: 51

Compression:

Stored size: 867 Bytes

Contents

module Bhf
  module EntriesHelper
    
    def node(f, field, &block)
      render partial: 'bhf/helper/node', locals: {f: f, field: field, input: with_output_buffer(&block)}
    end

    def reflection_node(f, field, &block)
      return if field.form_type == :static && f.object.new_record? && f.object.send(field.reflection.name).blank?
      render partial: 'bhf/helper/reflection_node', locals: {
        f: f, field: field, input: with_output_buffer(&block)
      }
    end

    def is_image?(file)
      ! file.match(/\.png|\.jpg|\.jpeg|\.gif|\.svg/i).nil?
    end

    def reflection_title(f, field)
      title = f.object.class.human_attribute_name(field.reflection.name)
      if field.link
        title = t("bhf.platforms.#{field.link}.title", count: f.object.send(field.reflection.name).to_a.count, default: title)
      end
      title
    end
  end
end

Version data entries

51 entries across 51 versions & 1 rubygems

Version Path
bhf-0.6.6 app/helpers/bhf/entries_helper.rb
bhf-0.6.5 app/helpers/bhf/entries_helper.rb
bhf-0.6.4 app/helpers/bhf/entries_helper.rb
bhf-0.6.3 app/helpers/bhf/entries_helper.rb
bhf-0.6.2 app/helpers/bhf/entries_helper.rb
bhf-0.6.1 app/helpers/bhf/entries_helper.rb
bhf-0.6.0 app/helpers/bhf/entries_helper.rb
bhf-0.5.13 app/helpers/bhf/entries_helper.rb
bhf-0.5.12 app/helpers/bhf/entries_helper.rb
bhf-0.5.11 app/helpers/bhf/entries_helper.rb
bhf-0.5.10 app/helpers/bhf/entries_helper.rb
bhf-0.5.9 app/helpers/bhf/entries_helper.rb
bhf-0.5.8 app/helpers/bhf/entries_helper.rb
bhf-0.5.7 app/helpers/bhf/entries_helper.rb
bhf-0.5.6 app/helpers/bhf/entries_helper.rb
bhf-0.5.5 app/helpers/bhf/entries_helper.rb
bhf-0.5.4 app/helpers/bhf/entries_helper.rb
bhf-0.5.3 app/helpers/bhf/entries_helper.rb
bhf-0.5.2 app/helpers/bhf/entries_helper.rb
bhf-0.5.1 app/helpers/bhf/entries_helper.rb