Class: Admin::PagesController
- Inherits:
-
ResourceController
- Object
- ResourceController
- Admin::PagesController
- Includes:
- NodeHelper, PagesHelper, UrlHelper
- Defined in:
- app/controllers/admin/pages_controller.rb
Defined Under Namespace
Classes: PreviewStop
Instance Method Summary collapse
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #restore ⇒ Object
- #save_table_position ⇒ Object
- #search ⇒ Object
Instance Method Details
#edit ⇒ Object
51 52 53 54 55 56 57 58 |
# 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
29 30 31 32 33 |
# File 'app/controllers/admin/pages_controller.rb', line 29 def index set_site_and_homepage @q = initialize_search response_for :plural end |
#new ⇒ Object
43 44 45 46 47 48 49 |
# File 'app/controllers/admin/pages_controller.rb', line 43 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 |
#restore ⇒ Object
60 61 62 63 64 |
# File 'app/controllers/admin/pages_controller.rb', line 60 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
66 67 68 69 70 |
# File 'app/controllers/admin/pages_controller.rb', line 66 def save_table_position new_position = params[:new_position] Page.save_order(new_position) head :ok end |
#search ⇒ Object
35 36 37 38 39 40 41 |
# File 'app/controllers/admin/pages_controller.rb', line 35 def search @site_id = params[:site_id] || Page.current_site.id @q = initialize_search @pages = fetch_search_results if search_query_present? render end |