Class: Asset

Inherits:
Object
  • Object
show all
Defined in:
lib/generators/mcms_pages/templates/asset.rb

Overview

@File Name : lib/asset_manager.rb

@Company Name              : Mindfire Solutions Private Limited
@Creator Name              : Vikram Kumar Mishra
@Date Created              : 2012-06-09
@Date Modified             :
@Last Modification Details :
@Purpose                   : To include controller action specific JS and CSS.

Class Method Summary collapse

Class Method Details

.get_cssObject

Returns = Array.

Parameters:

  • =

    none

Returns:

  • Array



87
88
89
90
91
92
# File 'lib/generators/mcms_pages/templates/asset.rb', line 87

def self.get_css

  # return class array
  return @@css_includes

end

.get_librariesObject

Returns = Array.

Parameters:

  • =

    none

Returns:

  • Array



78
79
80
81
82
83
# File 'lib/generators/mcms_pages/templates/asset.rb', line 78

def self.get_libraries

  # return class array
  return @@js_includes

end

.include_css(file) ⇒ Object

To include individual CSS file

Parameters:

  • =

    mixed

Returns:

  • none



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/generators/mcms_pages/templates/asset.rb', line 18

def self.include_css file

  # if param is of type Array
  if file.class == Array

    # loop through the param and include all files one by one
    file.each do |f|

      #calling include_css_file_individual to include css file
      include_css_file_individual f

    end # end each loop

  else

    #calling include_css_file_individual to include css file
    include_css_file_individual file

  end # end if

end

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

To include JS files

Returns:

  • none



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/generators/mcms_pages/templates/asset.rb', line 53

def self.include_js_library library, type = :local

  #if param is of type array
  if library.class == Array

    # loop through the param and include all JS files one by one
    library.each do |l|

      #calling include_js_library_individual to include js file
      include_js_library_individual l, type

    end # end each loop

  else

     #calling include_js_library_individual to include js file
    include_js_library_individual library, type

  end # end if

end

.include_local_library(library) ⇒ Object

TO include all JS file

Parameters:

  • =

    mixed

Returns:

  • none



43
44
45
46
47
48
# File 'lib/generators/mcms_pages/templates/asset.rb', line 43

def self.include_local_library library

  #calling include_js_library to include specific JS files
  include_js_library library, :local

end