2011-05-24 19:23:05 +00:00
|
|
|
# Custom options for CustomFields
|
|
|
|
CustomFields.options = {
|
2011-12-22 23:45:32 +00:00
|
|
|
:reserved_names => Mongoid.destructive_fields + %w(created_at updated_at)
|
2011-05-24 19:23:05 +00:00
|
|
|
}
|
|
|
|
|
2010-06-30 13:18:17 +00:00
|
|
|
module CustomFields
|
2012-02-01 01:01:42 +00:00
|
|
|
|
|
|
|
class Field
|
|
|
|
field :ui_enabled, :type => Boolean, :default => true
|
|
|
|
|
2012-02-02 15:53:26 +00:00
|
|
|
def class_name_to_content_type
|
|
|
|
self._parent.send :class_name_to_content_type, self.class_name
|
|
|
|
end
|
|
|
|
|
2012-02-01 01:01:42 +00:00
|
|
|
protected
|
|
|
|
|
|
|
|
def ensure_class_name_security
|
|
|
|
self._parent.send :ensure_class_name_security, self
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2010-06-30 13:18:17 +00:00
|
|
|
module Types
|
2012-02-01 01:01:42 +00:00
|
|
|
|
2010-06-30 13:18:17 +00:00
|
|
|
module File
|
|
|
|
class FileUploader < ::CarrierWave::Uploader::Base
|
2010-07-23 20:09:54 +00:00
|
|
|
|
2012-02-01 01:01:42 +00:00
|
|
|
# Set correct paths
|
2010-06-30 13:18:17 +00:00
|
|
|
def store_dir
|
2012-03-01 23:31:45 +00:00
|
|
|
"sites/#{model.site_id}/content_#{model.class.model_name.demodulize.underscore}/#{model.id}/files"
|
2010-06-30 13:18:17 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def cache_dir
|
|
|
|
"#{Rails.root}/tmp/uploads"
|
|
|
|
end
|
2010-07-23 20:09:54 +00:00
|
|
|
|
|
|
|
end
|
2010-06-30 13:18:17 +00:00
|
|
|
end
|
2011-07-28 14:42:16 +00:00
|
|
|
|
2010-06-30 13:18:17 +00:00
|
|
|
end
|
2010-07-23 20:09:54 +00:00
|
|
|
end
|
2011-03-17 16:41:25 +00:00
|
|
|
|