Module: XmtFroala

Defined in:
lib/xmt_froala.rb,
lib/xmt_froala/engine.rb,
lib/xmt_froala/helper.rb,
lib/xmt_froala/version.rb,
lib/xmt_froala/simple_form.rb,
app/controllers/xmt_froala/application_controller.rb,
lib/generators/xmt_froala/install/install_generator.rb,
lib/generators/xmt_froala/migration/migration_generator.rb

Defined Under Namespace

Modules: Builder, Helper, SimpleForm Classes: ApplicationController, Asset, AssetUploader, AssetsController, Engine, File, FileUploader, Flash, FlashUploader, Image, ImageUploader, InstallGenerator, Media, MediaUploader, MigrationGenerator

Constant Summary collapse

VERSION =
'0.3.1'
@@upload_dir =
'uploads'
@@upload_image_ext =
%w[gif jpg jpeg png bmp]
@@upload_flash_ext =
%w[swf flv]
@@upload_media_ext =
%w[f4v flv mp3 mp4 ogg webm]
@@upload_file_ext =
%w[doc docx xls xlsx ppt htm html txt zip rar gz bz2]

Class Method Summary collapse

Class Method Details

.assetsObject



36
37
38
39
40
41
42
43
44
# File 'lib/xmt_froala.rb', line 36

def self.assets
  Dir[root_path.join('vendor/assets/javascripts/xmt_froala/**', '*.js')].inject([]) do |assets, path|
    assets << Pathname.new(path).relative_path_from(root_path.join('vendor/assets/javascripts')).to_s
  end

  Dir[root_path.join('vendor/assets/stylesheets/xmt_froala/**', '*.css')].inject([]) do |assets, path|
    assets << Pathname.new(path).relative_path_from(root_path.join('vendor/assets/stylesheets')).to_s
  end
end

.base_pathObject



28
29
30
# File 'lib/xmt_froala.rb', line 28

def self.base_path
  self.asset_url_prefix ? "#{self.asset_url_prefix}/xmt_froala/" : '/assets/xmt_froala/'
end

.resize_to_limitObject



53
54
55
56
57
58
59
# File 'lib/xmt_froala.rb', line 53

def self.resize_to_limit
  if !image_resize_to_limit.nil? && image_resize_to_limit.is_a?(Array)
    [image_resize_to_limit[0], image_resize_to_limit[1]]
  else
    [800, 800]
  end
end

.root_pathObject



32
33
34
# File 'lib/xmt_froala.rb', line 32

def self.root_path
  @root_path ||= Pathname.new(File.dirname(File.expand_path('../', __FILE__)))
end

.setup {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:

  • _self (XmtFroala)

    the object that the method was called on



61
62
63
# File 'lib/xmt_froala.rb', line 61

def self.setup
  yield self
end

.upload_store_dirObject



46
47
48
49
50
51
# File 'lib/xmt_froala.rb', line 46

def self.upload_store_dir
  dirs = upload_dir.gsub(/^\/+/,'').gsub(/\/+$/,'').split('/')
  dirs.each { |dir| dir.gsub!(/\W/, '') }
  dirs.delete('')
  dirs.join('/')
end