Module: Plugins::CamaleonPostClone::MainHelper

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



2
3
4
# File 'app/helpers/plugins/camaleon_post_clone/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_post_clone_edit_post(args) ⇒ Object



34
35
36
37
# File 'app/helpers/plugins/camaleon_post_clone/main_helper.rb', line 34

def camaleon_post_clone_edit_post(args)
  args[:extra_settings] <<
      "<div class=''><label class='control-label'>#{t('camaleon_cms.admin.post.clone_content')}: </label> <a href='#{admin_plugins_camaleon_post_clone_clone_path(id: args[:post].id)}'><i class='fa fa-copy'></i> #{t('camaleon_cms.admin.post.clone')}</a> </div>"
end

#camaleon_post_clone_new_post(args) ⇒ Object



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

def camaleon_post_clone_new_post(args)

end

#camaleon_post_clone_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
15
16
17
# File 'app/helpers/plugins/camaleon_post_clone/main_helper.rb', line 10

def camaleon_post_clone_on_active(plugin)
  options = [{"title"=>"Enable?", "value"=>"1", "default"=>"1"}]
  group = plugin.add_custom_field_group({name: "#{t('plugin.post_clone.post_clone_configuration')}", slug: "plugin_clone_custom_settings", description: ""})
  group.add_manual_field({"name"=>"#{t('plugin.post_clone.clone_custom_fields')}", "slug"=>"plugin_clone_custom_fields", "description"=>"#{t('plugin.post_clone.clone_custom_field_values')}"},
                         {field_key: "checkboxes", multiple: false, required: false, multiple_options: options})
  group.add_manual_field({"name"=>"#{t('plugin.post_clone.saved_pending')}", "slug"=>"plugin_clone_save_as_pending", "description"=>"#{t('plugin.post_clone.want_save_pending')}"},
                         {field_key: "checkboxes", multiple: false, required: false, multiple_options: [{"title"=>"#{t('plugin.post_clone.enable')}", "value"=>"1", "default"=>"0"}]})
end

#camaleon_post_clone_on_inactive(plugin) ⇒ Object

here all actions on going to inactive plugin: plugin model



21
22
23
# File 'app/helpers/plugins/camaleon_post_clone/main_helper.rb', line 21

def camaleon_post_clone_on_inactive(plugin)
  plugin.get_field_groups().destroy_all
end

#camaleon_post_clone_on_upgrade(plugin) ⇒ Object

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



27
28
# File 'app/helpers/plugins/camaleon_post_clone/main_helper.rb', line 27

def camaleon_post_clone_on_upgrade(plugin)
end

#camaleon_post_clone_plugin_options(arg) ⇒ Object



39
40
41
# File 'app/helpers/plugins/camaleon_post_clone/main_helper.rb', line 39

def camaleon_post_clone_plugin_options(arg)
  arg[:links] << link_to(t('plugin.post_clone.settings'), admin_plugins_camaleon_post_clone_settings_path)
end