Module: LatoView::Interface::Assets

Included in:
LatoView::Interface
Defined in:
lib/lato_view/interface/assets.rb

Overview

This module contain functions for assest management.

Instance Method Summary collapse

Instance Method Details

#view_getApplicationsAssetsItemsObject

This function return an array of url of assets from the main application.



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/lato_view/interface/assets.rb', line 51

def view_getApplicationsAssetsItems
  return VIEW_APPASSETS if defined? VIEW_APPASSETS
  # inizializzo la lista delle voci della navbar
  assets = []
  directory = core_getCacheDirectory
  if File.exist? "#{directory}/view.yml"
    # accedo al view.yml
    config = YAML.load(
      File.read(File.expand_path("#{directory}/view.yml", __FILE__))
    )
    # estraggo i dati dallo yaml
    data = getConfigAssets(config)
    # aggiungo i dati nella risposta
    data.each do |single_asset|
      assets.push(single_asset)
    end
  end
  # ritorno il risultato
  return assets
end

#view_getLatoAssetsItemsObject

This function return an array of url of assets from lato gems.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/lato_view/interface/assets.rb', line 6

def view_getLatoAssetsItems
  return VIEW_LATOASSETS if defined? VIEW_LATOASSETS
  # inizializzo la lista degli assets
  assets = []
  # identifico la lista di gemme del progetto Lato usate dalla
  # applicazione
  gems = core_getLatoGems
  # per ogni gemma estraggo i dati necessari a riempire la navbar
  gems.each do |name|
    module_name = name.camelize
    module_root = module_name.constantize::Engine.root
    next unless File.exist? "#{module_root}/config/config.yml"
    # accedo al config.yml
    config = YAML.load(
      File.read(File.expand_path("#{module_root}/config/config.yml",
                                 __FILE__))
    )
    # estraggo i dati dallo yaml
    data = getConfigAssets(config)
    # aggiungo i dati nella risposta
    data.each do |single_asset|
      assets.push(single_asset)
    end
  end
  # ritorno il risultato
  return assets
end

#view_getLatoGMapsKeyObject

This function return an array of url of assets from lato gems.



35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/lato_view/interface/assets.rb', line 35

def view_getLatoGMapsKey
  return VIEW_LATOGMAPSKEY if defined? VIEW_LATOGMAPSKEY
  key = ''
  directory = core_getCacheDirectory
  if File.exist? "#{directory}/view.yml"
    # accedo al view.yml
    config = YAML.load(
      File.read(File.expand_path("#{directory}/view.yml", __FILE__))
    )
    key = (config && config['google_maps_key'] ? config['google_maps_key'] : nil)
  end
  # ritorno il risultato
  return key
end