Class: TinyMCE::Rails::Engine
- Inherits:
-
Rails::Engine
- Object
- Rails::Engine
- TinyMCE::Rails::Engine
- Defined in:
- lib/tinymce/rails/engine.rb
Class Method Summary collapse
- .asset_host ⇒ Object
- .base ⇒ Object
- .config_path ⇒ Object
- .default_base ⇒ Object
- .normalize_host(host) ⇒ Object
- .relative_url_root ⇒ Object
Class Method Details
.asset_host ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/tinymce/rails/engine.rb', line 48 def self.asset_host host = Rails.application.config.action_controller.asset_host if host.respond_to?(:call) # Callable asset hosts cannot be supported during # precompilation as there is no request object nil elsif host =~ /%d/ # Load all TinyMCE assets from the first asset host normalize_host(host % 0) else normalize_host(host) end end |
.base ⇒ Object
27 28 29 |
# File 'lib/tinymce/rails/engine.rb', line 27 def self.base config.tinymce.base || default_base end |
.config_path ⇒ Object
72 73 74 |
# File 'lib/tinymce/rails/engine.rb', line 72 def self.config_path Rails.application.config.tinymce.config_path || ::Rails.root.join("config/tinymce.yml") end |
.default_base ⇒ Object
31 32 33 34 35 |
# File 'lib/tinymce/rails/engine.rb', line 31 def self.default_base File.join(asset_host || "", relative_url_root || "", Rails.application.config.assets.prefix || "/", "tinymce") end |
.normalize_host(host) ⇒ Object
63 64 65 66 67 68 69 70 |
# File 'lib/tinymce/rails/engine.rb', line 63 def self.normalize_host(host) if host =~ /^https?:\/\// || host =~ /^\/\// host else # Use a protocol-relative URL if not otherwise specified "//#{host}" end end |
.relative_url_root ⇒ Object
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/tinymce/rails/engine.rb', line 37 def self.relative_url_root config = Rails.application.config if config.respond_to?(:relative_url_root) config.relative_url_root else # Fallback for Rails 3.1 config.action_controller.relative_url_root end end |