Module: LatoView::Interface::Themes

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

Overview

This module contain functions used to manage themes.

Instance Method Summary collapse

Instance Method Details

#view_getCurrentTemplateNameObject

This function return the name of the current theme used for the application.



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

def view_getCurrentTemplateName
  return VIEW_CURRENTTEMPLATENAME if defined? VIEW_CURRENTTEMPLATENAME
  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__))
    )
    # verifico esistenza dati
    if !config || !config['template']
      return false
    end
    # verifico che il template sia valido
    unless VIEW_TEMPLATES.include? config['template']
      raise 'Template value is not correct on view.yml config file' and return false
    end
    # ritorno nome template
    return config['template']
  else
    return false
  end
end