Sha256: d132a69324db90e8551adebc6b9c9c5c6cc3e3841b5a7eba6facb8f050d9a5c8

Contents?: true

Size: 833 Bytes

Versions: 5

Compression:

Stored size: 833 Bytes

Contents

# Custom options for CustomFields
CustomFields.options = {
  :reserved_names => Mongoid.destructive_fields + %w(created_at updated_at)
}

module CustomFields

  class Field
    field :ui_enabled, :type => Boolean, :default => true

    def class_name_to_content_type
      self._parent.send :class_name_to_content_type, self.class_name
    end

    protected

    def ensure_class_name_security
      self._parent.send :ensure_class_name_security, self
    end
  end

  module Types

    module File
      class FileUploader < ::CarrierWave::Uploader::Base

        # Set correct paths
        def store_dir
          "sites/#{model.site_id}/content_#{model.class.model_name.demodulize.underscore}/#{model.id}/files"
        end

        def cache_dir
          "#{Rails.root}/tmp/uploads"
        end

      end
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
locomotive_cms-2.0.0.rc7 lib/locomotive/custom_fields.rb
locomotive_cms-2.0.0.rc6 lib/locomotive/custom_fields.rb
locomotive_cms-2.0.0.rc5 lib/locomotive/custom_fields.rb
locomotive_cms-2.0.0.rc4 lib/locomotive/custom_fields.rb
locomotive_cms-2.0.0.rc2 lib/locomotive/custom_fields.rb