Sha256: bb42272fc84fd6f0e4af50b4526bb9f667df89fe215d62b10e74763b15c66830
Contents?: true
Size: 1.06 KB
Versions: 11
Compression:
Stored size: 1.06 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 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"=>"Backgroun image", "slug"=>"bg"},{field_key: "image"}) end theme.set_meta("installed_at", Time.now.to_s) # save a custom value end def themeKey_on_uninstall_theme(theme) theme.destroy end end
Version data entries
11 entries across 11 versions & 1 rubygems