2011-05-24 19:23:05 +00:00
|
|
|
# Custom options for CustomFields
|
|
|
|
CustomFields.options = {
|
|
|
|
:reserved_aliases => Mongoid.destructive_fields + %w(created_at updated_at)
|
|
|
|
}
|
|
|
|
|
2010-06-30 13:18:17 +00:00
|
|
|
# Set correct paths
|
|
|
|
module CustomFields
|
|
|
|
module Types
|
|
|
|
module File
|
|
|
|
class FileUploader < ::CarrierWave::Uploader::Base
|
2010-07-23 20:09:54 +00:00
|
|
|
|
2010-06-30 13:18:17 +00:00
|
|
|
def store_dir
|
2010-10-10 23:16:43 +00:00
|
|
|
"sites/#{model.site_id}/contents/#{model.class.model_name.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
|
|
|
|
|
|
|
module Category
|
|
|
|
class Item
|
|
|
|
|
2011-09-14 14:37:20 +00:00
|
|
|
include Mongoid::I18n
|
|
|
|
|
|
|
|
localized_fields :name, :position
|
|
|
|
|
|
|
|
field :name
|
|
|
|
field :position, :type => Integer, :default => 0
|
|
|
|
|
2011-07-28 14:42:16 +00:00
|
|
|
def to_liquid
|
2011-08-17 20:32:39 +00:00
|
|
|
{ 'id' => self._id.to_s, 'name' => self.name }
|
2011-07-28 14:42:16 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
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
|
|
|
|