Class: CamaleonCms::Admin::PluginsController

Inherits:
CamaleonCms::AdminController
  • Object
show all
Defined in:
app/controllers/camaleon_cms/admin/plugins_controller.rb

Instance Method Summary collapse

Instance Method Details

#destroyObject


31
32
33
34
35
36
37
38
39
# File 'app/controllers/camaleon_cms/admin/plugins_controller.rb', line 31

def destroy
  plugin = plugin_destroy(params[:id])
  if plugin.error
    flash[:notice] = "Plugin \"#{plugin.title}\" #{t('camaleon_cms.admin.message.was_removed')}"
  else
    flash[:error] = "Plugin \"#{plugin.title}\" #{t('camaleon_cms.admin.message.can_not_be_removed')}"
  end
  redirect_to action: :index
end

#indexObject


4
5
6
# File 'app/controllers/camaleon_cms/admin/plugins_controller.rb', line 4

def index
  PluginRoutes.reload
end

#toggleObject


8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/controllers/camaleon_cms/admin/plugins_controller.rb', line 8

def toggle
  status = params[:status].to_bool
  if status == true # to inactivate
    plugin = plugin_uninstall(params[:id])
    flash[:notice] = "Plugin \"#{plugin.title}\" #{t('camaleon_cms.admin.message.was_inactivated')}"
  end

  unless status # to activate
    plugin = plugin_install(params[:id])
    flash[:notice] = "Plugin \"#{plugin.title}\" #{t('camaleon_cms.admin.message.was_activated')}"
  end
  PluginRoutes.reload
  redirect_to action: :index
end

#upgradeObject

permit to upgrade a plugin for a new version


24
25
26
27
28
29
# File 'app/controllers/camaleon_cms/admin/plugins_controller.rb', line 24

def upgrade
  plugin = plugin_upgrade(params[:plugin_id])
  flash[:notice] = "Plugin \"#{plugin.title}\" #{t('camaleon_cms.admin.message.was_upgraded')}"
  PluginRoutes.reload
  redirect_to action: :index
end