Module: Plugins::CamaleonGoogleAnalytic::MainHelper
- Included in:
- AdminController
- Defined in:
- app/helpers/plugins/camaleon_google_analytic/main_helper.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#camaleon_google_analytic_on_active(plugin) ⇒ Object
here all actions on going to active you can run sql commands like this: results = ActiveRecord::Base.connection.execute(query); plugin: plugin model.
-
#camaleon_google_analytic_on_inactive(plugin) ⇒ Object
here all actions on going to inactive plugin: plugin model.
-
#camaleon_google_analytic_on_upgrade(plugin) ⇒ Object
here all actions to upgrade for a new version plugin: plugin model.
- #google_analytic_front_before_load ⇒ Object
- #google_analytic_plugin_options(arg) ⇒ Object
Class Method Details
.included(klass) ⇒ Object
2 3 4 |
# File 'app/helpers/plugins/camaleon_google_analytic/main_helper.rb', line 2 def self.included(klass) # klass.helper_method [:my_helper_method] rescue "" # here your methods accessible from views end |
Instance Method Details
#camaleon_google_analytic_on_active(plugin) ⇒ Object
here all actions on going to active you can run sql commands like this: results = ActiveRecord::Base.connection.execute(query); plugin: plugin model
10 11 12 13 14 |
# File 'app/helpers/plugins/camaleon_google_analytic/main_helper.rb', line 10 def camaleon_google_analytic_on_active(plugin) current_site.('camaleon_google_analytic_config', {google_analytics_code: 'UA-XXXXXX-X' }) end |
#camaleon_google_analytic_on_inactive(plugin) ⇒ Object
here all actions on going to inactive plugin: plugin model
18 19 20 |
# File 'app/helpers/plugins/camaleon_google_analytic/main_helper.rb', line 18 def camaleon_google_analytic_on_inactive(plugin) current_site.camaleon_google_analytic.destroy_all end |
#camaleon_google_analytic_on_upgrade(plugin) ⇒ Object
here all actions to upgrade for a new version plugin: plugin model
24 25 |
# File 'app/helpers/plugins/camaleon_google_analytic/main_helper.rb', line 24 def camaleon_google_analytic_on_upgrade(plugin) end |
#google_analytic_front_before_load ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'app/helpers/plugins/camaleon_google_analytic/main_helper.rb', line 27 def google_analytic_front_before_load = current_site.('camaleon_google_analytic_config') if .has_key? :code camaleon_google_analytics_code = [:code] append_asset_content("<script>window.GAID='#{camaleon_google_analytics_code}';</script>") append_asset_libraries({camaleon_google_analytic: {js: [plugin_gem_asset('google_analytics')]}}) end end |
#google_analytic_plugin_options(arg) ⇒ Object
36 37 38 |
# File 'app/helpers/plugins/camaleon_google_analytic/main_helper.rb', line 36 def (arg) arg[:links] << link_to(t('plugin.camaleon_google_analytic.settings.link_name'), admin_plugins_camaleon_google_analytic_settings_path) end |