Sha256: 5feb0153bc96a33e05078d0ae92093d3281dd403e777ac8fef0fb026e172c903

Contents?: true

Size: 901 Bytes

Versions: 6

Compression:

Stored size: 901 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).to_b
    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

6 entries across 6 versions & 1 rubygems

Version Path
bhf-0.4.2.2 app/helpers/bhf/entries_helper.rb
bhf-0.4.2.1 app/helpers/bhf/entries_helper.rb
bhf-0.4.2 app/helpers/bhf/entries_helper.rb
bhf-0.4.1 app/helpers/bhf/entries_helper.rb
bhf-0.4.0 app/helpers/bhf/entries_helper.rb
bhf-0.3.11 app/helpers/bhf/entries_helper.rb