Class: Admin::PagesController
- Inherits:
-
ResourceController
- Object
- ResourceController
- Admin::PagesController
- Includes:
- PagesHelper
- Defined in:
- app/controllers/admin/pages_controller.rb
Defined Under Namespace
Classes: PreviewStop
Instance Method Summary collapse
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #preview ⇒ Object
- #restore ⇒ Object
- #save_table_position ⇒ Object
- #search ⇒ Object
Instance Method Details
#edit ⇒ Object
48 49 50 51 52 53 54 |
# File 'app/controllers/admin/pages_controller.rb', line 48 def edit assets = Asset.order('created_at DESC') @term = assets.ransack(params[:search] || '') @term.result(distinct: true) @versions = format_versions(@page.versions) response_for :edit end |
#index ⇒ Object
26 27 28 29 30 |
# File 'app/controllers/admin/pages_controller.rb', line 26 def index set_site_and_homepage @q = initialize_search response_for :plural end |
#new ⇒ Object
40 41 42 43 44 45 46 |
# File 'app/controllers/admin/pages_controller.rb', line 40 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
62 63 64 65 66 |
# File 'app/controllers/admin/pages_controller.rb', line 62 def preview render_preview rescue PreviewStop => e render text: e. unless @performed_render end |
#restore ⇒ Object
56 57 58 59 60 |
# File 'app/controllers/admin/pages_controller.rb', line 56 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
68 69 70 71 72 |
# File 'app/controllers/admin/pages_controller.rb', line 68 def save_table_position new_position = params[:new_position] Page.save_order(new_position) head :ok end |
#search ⇒ Object
32 33 34 35 36 37 38 |
# File 'app/controllers/admin/pages_controller.rb', line 32 def search @site_id = params[:site_id] || Page.current_site.id @q = initialize_search @pages = fetch_search_results if search_title_present? render end |