Module: Plugins::CamaleonMandrill::MainHelper

Defined in:
app/helpers/plugins/camaleon_mandrill/main_helper.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



6
7
8
# File 'app/helpers/plugins/camaleon_mandrill/main_helper.rb', line 6

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

Instance Method Details

#camaleon_mandrill_email_late(plugin) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'app/helpers/plugins/camaleon_mandrill/main_helper.rb', line 37

def camaleon_mandrill_email_late(plugin)
  mandrill_data_config = current_site.get_meta('mandrill_config')
  plugin[:mail_data][:from] = mandrill_data_config[:default_from]
  plugin[:mail_data][:delivery_method] = :smtp
  plugin[:mail_data][:delivery_method_options] = {
    user_name: mandrill_data_config[:smtp_username],
    password: mandrill_data_config[:smtp_password],
    address: 'smtp.mandrillapp.com',
    port: '587',
    domain: (current_site.the_url.to_s.parse_domain rescue 'localhost'),
    authentication: 'plain',
    enable_starttls_auto: true
  }
end

#camaleon_mandrill_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



14
15
16
17
18
19
20
21
# File 'app/helpers/plugins/camaleon_mandrill/main_helper.rb', line 14

def camaleon_mandrill_on_active(plugin)
  current_site.set_meta('mandrill_config',
                        {
                          smtp_username: '',
                          smtp_password: '',
                          default_from: '[email protected]'
                        })
end

#camaleon_mandrill_on_destroy(plugin) ⇒ Object



3
4
# File 'app/helpers/plugins/camaleon_mandrill/main_helper.rb', line 3

def camaleon_mandrill_on_destroy(plugin)
end

#camaleon_mandrill_on_inactive(plugin) ⇒ Object

here all actions on going to inactive plugin: plugin model



25
26
# File 'app/helpers/plugins/camaleon_mandrill/main_helper.rb', line 25

def camaleon_mandrill_on_inactive(plugin)
end

#camaleon_mandrill_on_upgrade(plugin) ⇒ Object

here all actions to upgrade for a new version plugin: plugin model



30
31
# File 'app/helpers/plugins/camaleon_mandrill/main_helper.rb', line 30

def camaleon_mandrill_on_upgrade(plugin)
end

#camaleon_mandrill_plugin_options(arg) ⇒ Object



33
34
35
# File 'app/helpers/plugins/camaleon_mandrill/main_helper.rb', line 33

def camaleon_mandrill_plugin_options(arg)
  arg[:links] << link_to(t('plugin.mandrill.settings.link_name'), admin_plugins_camaleon_mandrill_settings_path)
end