Class: CamaleonCms::Plugin

Inherits:
TermTaxonomy
  • Object
show all
Defined in:
app/models/camaleon_cms/plugin.rb

Overview

Camaleon CMS is a content management system

Copyright (C) 2015 by Owen Peredo Diaz
Email: [email protected]
This program is free software: you can redistribute it and/or modify   it under the terms of the GNU Affero General Public License as  published by the Free Software Foundation, either version 3 of the  License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,  but WITHOUT ANY WARRANTY; without even the implied warranty of  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the  GNU Affero General Public License (GPLv3) for more details.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from TermTaxonomy

#children, #in_nav_menu_items, #set_options_from_form, #skip_slug_validation?

Methods included from CustomFieldsRead

#add_custom_field_group, #add_custom_field_to_default_group, #get_field!, #get_field_groups, #get_field_object, #get_field_value, #get_field_values, #get_field_values_hash, #get_fields_object, #get_user_field_groups, #save_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_multiple_options, #set_option

Instance Attribute Details

#errorObject

Returns the value of attribute error


19
20
21
# File 'app/models/camaleon_cms/plugin.rb', line 19

def error
  @error
end

Instance Method Details

#activeObject

active the plugin


23
24
25
26
# File 'app/models/camaleon_cms/plugin.rb', line 23

def active
  self.term_group = 1
  self.save
end

#active?Boolean

check if plugin is active

Returns:

  • (Boolean)

35
36
37
# File 'app/models/camaleon_cms/plugin.rb', line 35

def active?
  self.term_group.to_s == "1"
end

#inactiveObject

inactive the plugin


29
30
31
32
# File 'app/models/camaleon_cms/plugin.rb', line 29

def inactive
  self.term_group = nil
  self.save
end

#installed_versionObject

return gem installed version


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

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

#installed_version=(version) ⇒ Object

set a new installation version for this plugin


52
53
54
# File 'app/models/camaleon_cms/plugin.rb', line 52

def installed_version=(version)
  self.set_option("version_installed", version)
end

#old_version?Boolean

check if current installation version is older return boolean

Returns:

  • (Boolean)

46
47
48
49
# File 'app/models/camaleon_cms/plugin.rb', line 46

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

#settingsObject

return theme settings configured in config.json


40
41
42
# File 'app/models/camaleon_cms/plugin.rb', line 40

def settings
  PluginRoutes.plugin_info(self.slug)
end

#titleObject

return the title of this plugin


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

def title
  PluginRoutes.plugin_info(self.slug)["title"]
end