Sha256: 774409c1ac96949ed7835fb85105107851d4499a12489fe12702a35f86726ee4

Contents?: true

Size: 1.14 KB

Versions: 17

Compression:

Stored size: 1.14 KB

Contents

module Themes::ThemeClass::MainHelper
  def self.included(klass)
    # klass.helper_method [:my_helper_method] rescue "" # here your methods accessible from views
  end

  def themeKey_settings(theme)
    # here your code on save settings for current site, by default params[:theme_fields] is auto saved into theme
    # Also, you can save your extra values added in admin/settings.html.erb
    # sample: theme.set_meta("my_key", params[:my_value])
  end

  # callback called after theme installed
  def themeKey_on_install_theme(theme)
    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
    theme.set_meta("installed_at", Time.current.to_s) # save a custom value
  end

  # callback executed after theme uninstalled
  def themeKey_on_uninstall_theme(theme)
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
camaleon_cms-2.1.0 lib/generators/camaleon_cms/theme_template/app/apps/themes/my_theme/main_helper.rb
camaleon_cms-2.0.4.1 lib/generators/camaleon_cms/theme_template/app/apps/themes/my_theme/main_helper.rb
camaleon_cms-2.0.4 lib/generators/camaleon_cms/theme_template/app/apps/themes/my_theme/main_helper.rb
camaleon_cms-2.0.3 lib/generators/camaleon_cms/theme_template/app/apps/themes/my_theme/main_helper.rb
camaleon_cms-2.0.2 lib/generators/camaleon_cms/theme_template/app/apps/themes/my_theme/main_helper.rb
camaleon_cms-2.0.1 lib/generators/camaleon_cms/theme_template/app/apps/themes/my_theme/main_helper.rb
camaleon_cms-1.1.0 lib/generators/ctheme_template/app/apps/themes/my_theme/main_helper.rb
camaleon_cms-1.0.9 lib/generators/ctheme_template/app/apps/themes/my_theme/main_helper.rb
camaleon_cms-1.0.8 lib/generators/ctheme_template/app/apps/themes/my_theme/main_helper.rb
camaleon_cms-1.0.7 lib/generators/ctheme_template/app/apps/themes/my_theme/main_helper.rb
camaleon_cms-1.0.6 lib/generators/ctheme_template/app/apps/themes/my_theme/main_helper.rb
camaleon_cms-1.0.5 lib/generators/ctheme_template/app/apps/themes/my_theme/main_helper.rb
camaleon_cms-1.0.4 lib/generators/ctheme_template/app/apps/themes/my_theme/main_helper.rb
camaleon_cms-1.0.3 lib/generators/ctheme_template/app/apps/themes/my_theme/main_helper.rb
camaleon_cms-1.0.2 lib/generators/ctheme_template/app/apps/themes/my_theme/main_helper.rb
camaleon_cms-1.0.1 lib/generators/ctheme_template/app/apps/themes/my_theme/main_helper.rb
camaleon_cms-1.0 lib/generators/ctheme_template/app/apps/themes/my_theme/main_helper.rb