Class: Admin::PagesController
- Inherits:
-
ResourceController
- Object
- ActionController::Base
- ApplicationController
- ResourceController
- Admin::PagesController
- Includes:
- PagesHelper, UrlHelper
- Defined in:
- app/controllers/admin/pages_controller.rb
Defined Under Namespace
Classes: PreviewStop
Instance Attribute Summary
Attributes inherited from ApplicationController
#cache, #pagination_parameters, #trusty_config
Instance Method Summary collapse
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #preview ⇒ Object
- #restore ⇒ Object
- #save_table_position ⇒ Object
- #search ⇒ Object
Methods included from UrlHelper
#build_url, #default_route?, #extract_base_url, #format_path, #generate_page_url, #lookup_page_path
Methods included from PagesHelper
#class_of_page, #clean_page_description, #filter, #meta_errors?, #parent_page_options, #revert_confirmation_message
Methods included from ReferencesHelper
#_display_name, #class_of_page, #filter, #filter_reference, #tag_reference
Methods included from NodeHelper
#expanded, #expanded_rows, #expander, #homepage, #icon, #node_title, #page_type, #prepare_page, #render_node, #render_nodes, #render_search_node, #show_all?, #spinner
Methods inherited from ResourceController
#destroy, model_class, paginate_models, #paginated?, #pagination_parameters, #will_paginate_options
Methods included from TrustyCms::ResourceResponses
Methods inherited from ApplicationController
#after_sign_in_path_for, #initialize, #template_name
Methods included from LoginSystem
Constructor Details
This class inherits a constructor from ApplicationController
Instance Method Details
#edit ⇒ Object
51 52 53 54 55 56 57 58 59 |
# File 'app/controllers/admin/pages_controller.rb', line 51 def edit verify_site_id load_assets @page_url = generate_page_url(request.url, @page) @page_path = format_path(@page.path) @versions = format_versions(@page.versions) = response_for :edit end |
#index ⇒ Object
28 29 30 31 32 |
# File 'app/controllers/admin/pages_controller.rb', line 28 def index set_site_and_homepage @q = initialize_search response_for :plural end |
#new ⇒ Object
42 43 44 45 46 47 48 49 |
# File 'app/controllers/admin/pages_controller.rb', line 42 def new assets = Asset.order('created_at DESC') @term = assets.ransack(params[:search] || '') @page = self.model = model_class.new_with_defaults(trusty_config) = assign_page_attributes response_for :new end |
#preview ⇒ Object
67 68 69 70 71 |
# File 'app/controllers/admin/pages_controller.rb', line 67 def preview render_preview rescue PreviewStop => e render text: e. unless @performed_render end |
#restore ⇒ Object
61 62 63 64 65 |
# File 'app/controllers/admin/pages_controller.rb', line 61 def restore index = params[:version_index].to_i restore_page_version(@page, index) redirect_to edit_admin_page_path(@page) end |
#save_table_position ⇒ Object
73 74 75 76 77 |
# File 'app/controllers/admin/pages_controller.rb', line 73 def save_table_position new_position = params[:new_position] Page.save_order(new_position) head :ok end |
#search ⇒ Object
34 35 36 37 38 39 40 |
# File 'app/controllers/admin/pages_controller.rb', line 34 def search @site_id = params[:site_id] || Page.current_site.id @q = initialize_search @pages = fetch_search_results if search_query_present? render end |