Class: CamaleonCms::Admin::PluginsController

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

Overview

Camaleon CMS is a content management system

Copyright (C) 2015 by Owen Peredo Diaz
Email: [email protected]
This program is free software: you can redistribute it and/or modify   it under the terms of the GNU Affero General Public License as  published by the Free Software Foundation, either version 3 of the  License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,  but WITHOUT ANY WARRANTY; without even the implied warranty of  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the  GNU Affero General Public License (GPLv3) for more details.

Instance Method Summary collapse

Instance Method Details

#destroyObject


39
40
41
42
43
44
45
46
47
# File 'app/controllers/camaleon_cms/admin/plugins_controller.rb', line 39

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


12
13
14
# File 'app/controllers/camaleon_cms/admin/plugins_controller.rb', line 12

def index
  PluginRoutes.reload
end

#toggleObject


16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'app/controllers/camaleon_cms/admin/plugins_controller.rb', line 16

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


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

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