Sha256: 6ef33f1848beb51b79b5bc8d65fe58d5999535b9fe582b2d5760921a415cac82

Contents?: true

Size: 1.35 KB

Versions: 1

Compression:

Stored size: 1.35 KB

Contents

module Cms9
  module ApplicationHelper

    def cms9_field(field, options={})
      if field.present?
        case field.post_field.field_type
          when 'text', 'number', 'select_single', 'date', 'time', 'date_time'
            return field.value.blank? ? '' : cms9_text_tag(field)
          when 'text_area'
            return field.value.blank? ? '' : cms9_text_area_tag(field)
          when 'select_multiple'
            return field.value.blank? ? '' : cms9_multiple_choice(field)
          when 'image'
            return field.blank? ? '' : cms9_image_tag(field, options)
          else
            return '<unsupported type>'
        end
      end
    end   
   
    def cms9_text_tag(model)
      return model.to_s 
    end 

    def cms9_text_area_tag(model)      
        return raw(model.to_s)
    end 

    def cms9_multiple_choice(model)     
      @m = model.value.to_s.split("\' ")[0]
      return  "#{@m}" 
    end 

    def cms9_image_tag(model, options={})
      return image_tag(model.image.url, options)
    end 

    def cms9_number_tag(model)
      return model.to_s 
    end 

    def cms9_select_single_tag(model)
      return model.to_s 
    end 

    def cms9_date_tag(model)
      return model.to_s 
    end

    def cms9_time_tag(model)
      return model.to_s 
    end

    def cms9_date_time_tag(model)
      return model.to_s 
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cms9-0.2.0 app/helpers/cms9/application_helper.rb