Module: Themes::ThemeClass::MainHelper
- Defined in:
- lib/generators/camaleon_cms/theme_template/main_helper.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#themeKey_on_install_theme(theme) ⇒ Object
callback called after theme installed.
-
#themeKey_on_uninstall_theme(theme) ⇒ Object
callback executed after theme uninstalled.
- #themeKey_settings(theme) ⇒ Object
Class Method Details
.included(klass) ⇒ Object
4 5 6 |
# File 'lib/generators/camaleon_cms/theme_template/main_helper.rb', line 4 def self.included(klass) # klass.helper_method [:my_helper_method] rescue "" # here your methods accessible from views end |
Instance Method Details
#themeKey_on_install_theme(theme) ⇒ Object
callback called after theme installed
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/generators/camaleon_cms/theme_template/main_helper.rb', line 13 def themeKey_on_install_theme(theme) # # Sample Custom Field # unless theme.get_field_groups.where(slug: "fields").any? # group = theme.add_field_group({name: "Main Settings", slug: "fields", description: ""}) # group.add_field({"name"=>"Background color", "slug"=>"bg_color"},{field_key: "colorpicker"}) # group.add_field({"name"=>"Links color", "slug"=>"links_color"},{field_key: "colorpicker"}) # group.add_field({"name"=>"Background image", "slug"=>"bg"},{field_key: "image"}) # end # # Sample Meta Value # theme.set_meta("installed_at", Time.current.to_s) # save a custom value end |
#themeKey_on_uninstall_theme(theme) ⇒ Object
callback executed after theme uninstalled
27 |
# File 'lib/generators/camaleon_cms/theme_template/main_helper.rb', line 27 def themeKey_on_uninstall_theme(theme); end |
#themeKey_settings(theme) ⇒ Object
8 9 10 |
# File 'lib/generators/camaleon_cms/theme_template/main_helper.rb', line 8 def themeKey_settings(theme) # callback to save custom values of fields added in my_theme/views/admin/settings.html.erb end |