Class: CamaleonCms::Plugin

Inherits:
TermTaxonomy show all
Includes:
CommonRelationships
Defined in:
app/models/camaleon_cms/plugin.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from TermTaxonomy

#children, #in_nav_menu_items, #skip_slug_validation?

Methods included from CustomFieldsRead

#add_custom_field_group, #add_custom_field_to_default_group, #get_field_groups, #get_field_object, #get_field_value, #get_field_values, #get_field_values_hash, #get_fields_grouped, #get_fields_object, #get_user_field_groups, #save_field_value, #set_field_value, #set_field_values, #update_field_value

Methods included from Metas

#delete_meta, #delete_option, #fix_save_metas_options_no_changed, #get_meta, #get_option, #options, #save_metas_options, #save_metas_options_skip, #set_meta, #set_metas, #set_option, #set_options

Methods inherited from CamaleonRecord

#cama_build_cache_key, #cama_fetch_cache, #cama_get_cache, #cama_remove_cache, #cama_set_cache

Instance Attribute Details

#errorObject

attrs:

term_group => status active (1, nil)
slug => plugin key
name => plugin name


10
11
12
# File 'app/models/camaleon_cms/plugin.rb', line 10

def error
  @error
end

Instance Method Details

#activeObject

active the plugin



21
22
23
24
# File 'app/models/camaleon_cms/plugin.rb', line 21

def active
  self.term_group = 1
  save
end

#active?Boolean

check if plugin is active

Returns:

  • (Boolean)


33
34
35
# File 'app/models/camaleon_cms/plugin.rb', line 33

def active?
  term_group.to_s == '1'
end

#inactiveObject

inactive the plugin



27
28
29
30
# File 'app/models/camaleon_cms/plugin.rb', line 27

def inactive
  self.term_group = nil
  save
end

#installed_versionObject

return gem installed version



55
56
57
58
59
60
61
62
63
64
# File 'app/models/camaleon_cms/plugin.rb', line 55

def installed_version
  ''

  # res = get_option('version_installed')
  # unless res.present? # fix for old installations
  #   res = settings['version']
  #   self.installed_version = res
  # end
  # res
end

#installed_version=(version) ⇒ Object

set a new installation version for this plugin



50
51
52
# File 'app/models/camaleon_cms/plugin.rb', line 50

def installed_version=(version)
  set_option('version_installed', version)
end

#old_version?Boolean

check if current installation version is older return boolean

Returns:

  • (Boolean)


44
45
46
47
# File 'app/models/camaleon_cms/plugin.rb', line 44

def old_version?
  # self.installed_version.to_s != self.settings["version"].to_s
  false
end

#settingsObject

return theme settings configured in config.json



38
39
40
# File 'app/models/camaleon_cms/plugin.rb', line 38

def settings
  PluginRoutes.plugin_info(slug)
end

#titleObject

return the title of this plugin



67
68
69
# File 'app/models/camaleon_cms/plugin.rb', line 67

def title
  PluginRoutes.plugin_info(slug)['title']
end