Class: AssetManager

Inherits:
Object
  • Object
show all
Defined in:
lib/generators/mcms_blog/templates/asset_manager.rb

Overview

@Name: Asset manager class @Use: Dynamically adding javascript and css files through the methods for page basis @Created date: 08-06-2012 @Modified Date: 12-06-2012

@Company:  Mindfire Solutions

Class Method Summary collapse

Class Method Details

.get_cssObject

get_css method return css_includes array gloabal varibale



62
63
64
# File 'lib/generators/mcms_blog/templates/asset_manager.rb', line 62

def self.get_css
  return @@css_includes
end

.get_librariesObject

get_libraries method return all javscripts included array



55
56
57
# File 'lib/generators/mcms_blog/templates/asset_manager.rb', line 55

def self.get_libraries
  return @@js_includes
end

.include_contrib_library(library) ⇒ Object

include_contrib_library includes the javascripts in contrib folder those are the mandatory libraries



28
29
30
# File 'lib/generators/mcms_blog/templates/asset_manager.rb', line 28

def self.include_contrib_library library
  include_js_library library, :contrib
end

.include_css(file) ⇒ Object

include_css checking the file type if array then loop to include neither simple includes



15
16
17
18
19
20
21
22
23
24
# File 'lib/generators/mcms_blog/templates/asset_manager.rb', line 15

def self.include_css file
  if file.class == Array
   
    file.each do |f|
      include_css_file_individual f
    end
  else
    include_css_file_individual file
  end
end

.include_js_library(library, type = :local) ⇒ Object

include_js_library method includes the javascripts those are localy added



41
42
43
44
45
46
47
48
49
50
# File 'lib/generators/mcms_blog/templates/asset_manager.rb', line 41

def self.include_js_library library, type = :local
  Rails.logger.debug library.inspect
  if library.class == Array
    library.each do |l|
      include_js_library_individual l, type
    end
  else
    include_js_library_individual library, type
  end
end

.include_local_library(library) ⇒ Object

include_local_library method includes the javascripts those are localy added



35
36
37
# File 'lib/generators/mcms_blog/templates/asset_manager.rb', line 35

def self.include_local_library library
  include_js_library library, :local
end