Module: Plugins::CamaleonImageOptimizer::MainHelper

Included in:
AdminController
Defined in:
app/helpers/plugins/camaleon_image_optimizer/main_helper.rb

Overview

This modules public methods are called via hooks defined in config/camaleon_plugin.json

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



7
8
9
# File 'app/helpers/plugins/camaleon_image_optimizer/main_helper.rb', line 7

def self.included(klass)
  # klass.helper_method [:my_helper_method] rescue "" # methods accessible from views
end

Instance Method Details

#cama_optimize_image(settings) ⇒ Object



26
27
28
29
30
# File 'app/helpers/plugins/camaleon_image_optimizer/main_helper.rb', line 26

def cama_optimize_image(settings)
  image_optim = ImageOptim.new camaleon_image_optimizer_settings
  image_optim.optimize_image! settings[:uploaded_io].path
  settings[:uploaded_io] = File.open settings[:uploaded_io].path
end

#camaleon_image_optimizer_on_active(plugin) ⇒ Object



11
12
13
# File 'app/helpers/plugins/camaleon_image_optimizer/main_helper.rb', line 11

def camaleon_image_optimizer_on_active(plugin)
  camaleon_image_optimizer_options plugin
end

#camaleon_image_optimizer_on_inactive(plugin) ⇒ Object



15
16
# File 'app/helpers/plugins/camaleon_image_optimizer/main_helper.rb', line 15

def camaleon_image_optimizer_on_inactive(plugin)
end

#camaleon_image_optimizer_on_plugin_options(args) ⇒ Object



22
23
24
# File 'app/helpers/plugins/camaleon_image_optimizer/main_helper.rb', line 22

def camaleon_image_optimizer_on_plugin_options(args)
  args[:links] << link_to("Settings", admin_plugins_camaleon_image_optimizer_settings_path)
end

#camaleon_image_optimizer_on_upgrade(plugin) ⇒ Object



18
19
20
# File 'app/helpers/plugins/camaleon_image_optimizer/main_helper.rb', line 18

def camaleon_image_optimizer_on_upgrade(plugin)
  camaleon_image_optimizer_options plugin
end