Class: CamaleonCms::Admin::Settings::SitesController
- Inherits:
-
CamaleonCms::Admin::SettingsController
- Object
- CamaleonCms::Admin::SettingsController
- CamaleonCms::Admin::Settings::SitesController
- Defined in:
- app/controllers/camaleon_cms/admin/settings/sites_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
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'app/controllers/camaleon_cms/admin/settings/sites_controller.rb', line 51 def create site_data = params[:site] @site = CamaleonCms::Site.new(site_data) if @site.save (@site) site_after_install(@site, @site.get_theme_slug) flash[:notice] = t('camaleon_cms.admin.sites.message.created') redirect_to action: :index else new end end |
#destroy ⇒ Object
64 65 66 67 |
# File 'app/controllers/camaleon_cms/admin/settings/sites_controller.rb', line 64 def destroy flash[:notice] = t('camaleon_cms.admin.sites.message.deleted') if @site.destroy redirect_to action: :index end |
#edit ⇒ Object
25 26 27 28 |
# File 'app/controllers/camaleon_cms/admin/settings/sites_controller.rb', line 25 def edit I18n.t("camaleon_cms.admin.button.edit") render 'form' end |
#index ⇒ Object
14 15 16 17 18 19 20 |
# File 'app/controllers/camaleon_cms/admin/settings/sites_controller.rb', line 14 def index @sites = CamaleonCms::Site.all.order(:term_group) @sites = @sites.paginate(:page => params[:page], :per_page => current_site.admin_per_page) r = { sites: @sites, render: "index" } hooks_run("list_site", r) render r[:render] end |
#new ⇒ Object
45 46 47 48 49 |
# File 'app/controllers/camaleon_cms/admin/settings/sites_controller.rb', line 45 def new I18n.t("camaleon_cms.admin.button.new") @site ||= CamaleonCms::Site.new.decorate render 'form' end |
#show ⇒ Object
22 23 |
# File 'app/controllers/camaleon_cms/admin/settings/sites_controller.rb', line 22 def show end |
#update ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'app/controllers/camaleon_cms/admin/settings/sites_controller.rb', line 30 def update tmp = @site.slug if @site.update(params[:site]) (@site) flash[:notice] = t('camaleon_cms.admin.sites.message.updated') if @site.id == Cama::Site.main_site.id && tmp != @site.slug redirect_to @site.the_admin_url else redirect_to action: :index end else edit end end |