Class: CamaleonCms::AdminController

Inherits:
CamaleonController show all
Includes:
CamaleonCms::Admin::ApplicationHelper
Defined in:
app/controllers/camaleon_cms/admin_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

Methods inherited from CamaleonController

#captcha, #render_error

Methods included from EmailHelper

#send_email, #send_user_confirm_email

Methods included from UploaderHelper

#cama_crop_image, #cama_file_path_to_url, #cama_media_find_folder, #cama_resize_and_crop, #cama_uploader_add_folder, #cama_uploader_check_name, #cama_uploader_destroy_file, #cama_uploader_destroy_folder, #cama_uploader_init_connection, #cama_uploader_parse_file, #cama_url_to_file_path, #upload_file, #uploader_verify_name

Methods included from CaptchaHelper

#cama_captcha_build, #cama_captcha_increment_attack, #cama_captcha_reset_attack, #cama_captcha_tag, #cama_captcha_tags_if_under_attack, #cama_captcha_total_attacks, #cama_captcha_under_attack?, #cama_captcha_verified?, #captcha_verify_if_under_attack

Methods included from ContentHelper

#cama_content_after_draw, #cama_content_append, #cama_content_before_draw, #cama_content_init, #cama_content_prepend

Methods included from HooksHelper

#hook_run, #hook_skip, #hooks_run

Methods included from ThemeHelper

#self_theme_key, #theme_asset_file_path, #theme_asset_path, #theme_asset_url, #theme_init, #theme_layout, #theme_view

Methods included from PluginsHelper

#current_plugin, #plugin_asset_path, #plugin_asset_url, #plugin_destroy, #plugin_install, #plugin_layout, #plugin_load_helpers, #plugin_uninstall, #plugin_upgrade, #plugin_view, #plugins_initialize, #self_plugin_key

Methods included from ShortCodeHelper

#cama_strip_shortcodes, #do_shortcode, #render_shortcode, #shortcode_add, #shortcode_change_template, #shortcode_delete, #shortcodes_init

Methods included from UserRolesHelper

#cama_get_roles_values

Methods included from HtmlHelper

#append_asset_content, #append_pre_asset_content, #cama_assets_library_register, #cama_draw_custom_assets, #cama_draw_pre_asset_contents, #cama_get_options_html_from_items, #cama_html_helpers_init, #cama_html_tooltip, #cama_load_custom_assets, #cama_load_libraries

Methods included from SiteHelper

#cama_get_list_layouts_files, #cama_get_list_template_files, #cama_site_check_existence, #current_locale, #current_site, #current_theme, #site_after_install, #site_console_switch, #site_install_theme, #site_load_custom_models, #site_uninstall_theme

Methods included from SessionHelper

#cama_authenticate, #cama_current_role, #cama_current_user, #cama_get_session_id, #cama_logout_user, #cama_on_heroku?, #cama_register_user, #cama_sign_in?, #login_user, #login_user_with_password, #session_back_to_parent, #session_switch_user

Methods included from CamaleonHelper

#cama_cache_fetch, #cama_draw_timer, #cama_edit_link, #cama_is_admin_request?, #cama_requestAction, #cama_sitemap_cats_generator, #ct, #sendmail

Instance Method Details

#ajaxObject

ajax requests for admin panel you need to send a param mode to control the action to to do


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

def ajax
  case params[:mode]
    when "save_intro"
      current_site.set_option("save_intro", true);
    when "save_intro_post"
      current_site.set_option("save_intro_post", true);
  end
  render inline: ""
end

#dashboardObject

render admin dashboard


42
43
44
# File 'app/controllers/camaleon_cms/admin_controller.rb', line 42

def dashboard
  index
end

#indexObject

render admin dashboard


25
26
27
# File 'app/controllers/camaleon_cms/admin_controller.rb', line 25

def index
  render "dashboard"
end

#searchObject

render search results receive params receive params: define de type of the results type (content|category|tag) => default content if this is receive a param, then will render only results view


50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'app/controllers/camaleon_cms/admin_controller.rb', line 50

def search
  add_breadcrumb I18n.t("camaleon_cms.admin.button.search")
  params[:kind] = "content" unless params[:kind].present?
  case params[:kind]
    when "category"
      @items = current_site.full_categories.where("#{CamaleonCms::Category.table_name}.name LIKE ?", "%#{params[:q]}%")
    when "tag"
      @items = current_site..where("#{CamaleonCms::PostTag.table_name}.name LIKE ?", "%#{params[:q]}%")
    else
      @items = current_site.posts.where("#{CamaleonCms::Post.table_name}.title LIKE ?", "%#{params[:q]}%")
  end
  @items = @items.paginate(:page => params[:page], :per_page => current_site.admin_per_page)
end