filemanager and some update for file uploader . added file uploader to kernel

This commit is contained in:
harrybomrah authored and saurabhbhatia committed 2013-09-11 14:03:06 +08:00
1 parent 3328a41b55
commit f920a4f6ba
28 files changed
+586 -88

No files matched your search

+12 -1
View File
@@ -5,13 +5,16 @@ class Asset
include OrbitTag::Taggable
mount_uploader :data, FileAssetUploader
before_save :update_asset_attributes
field :filename
field :description, localize: true
field :title, localize: true
field :content_type
field :file_size
validates :title, :at_least_one => true
validates :description, :at_least_one => true
validates_presence_of :data
@@ -21,6 +24,14 @@ class Asset
before_save :clean_tags
protected
def update_asset_attributes
if data.present? && data_changed?
self.content_type = data.file.content_type
self.file_size = data.file.size
end
end
def clean_tags
self.tagged_ids.delete('')
-7
View File
@@ -1,7 +0,0 @@
class Ckeditor::Asset
include Ckeditor::Orm::Mongoid::AssetBase
delegate :url, :current_path, :size, :content_type, :filename, :to => :data
validates_presence_of :data
end
-7
View File
@@ -1,7 +0,0 @@
class Ckeditor::AttachmentFile < Ckeditor::Asset
mount_uploader :data, CkeditorAttachmentFileUploader, :mount_on => :data_file_name
def url_thumb
@url_thumb ||= Ckeditor::Utils.filethumb(filename)
end
end
-7
View File
@@ -1,7 +0,0 @@
class Ckeditor::Picture < Ckeditor::Asset
mount_uploader :data, CkeditorPictureUploader, :mount_on => :data_file_name
def url_content
url(:content)
end
end
+1
View File
@@ -32,6 +32,7 @@ class User
has_one :desktop, :autosave => true, :dependent => :destroy
has_one :facebook, :autosave => true, :dependent => :destroy
has_many :other_accounts, :autosave => true, :dependent => :destroy
has_many :assets, as: :assetable
# has_many :journals, :autosave => true, :dependent => :destroy
# has_many :papers, :autosave => true, :dependent => :destroy
has_and_belongs_to_many :sub_role_tags