Sha256: 9a0dba0ee4938d28565bfc94bfa7d1b9258d61caf760d0ae572db5478f391021
Contents?: true
Size: 1.14 KB
Versions: 10
Compression:
Stored size: 1.14 KB
Contents
module Themes::PluginClass::MainHelper def self.included(klass) # klass.helper_method [:my_helper_method] rescue "" # here your methods accessible from views end def pluginKey_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 pluginKey_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 pluginKey_on_uninstall_theme(theme) end end
Version data entries
10 entries across 10 versions & 1 rubygems