Class: Spotlight::PagesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- Spotlight::PagesController
- Includes:
- Blacklight::Base, Blacklight::Catalog::SearchContext
- Defined in:
- app/controllers/spotlight/pages_controller.rb
Direct Known Subclasses
AboutPagesController, FeaturePagesController, HomePagesController
Instance Method Summary collapse
-
#create ⇒ Object
POST /exhibits/1/pages.
-
#destroy ⇒ Object
DELETE /pages/1.
-
#edit ⇒ Object
GET /pages/1/edit.
-
#index ⇒ Object
GET /exhibits/1/pages.
-
#new ⇒ Object
GET /exhibits/1/pages/new.
-
#show ⇒ Object
GET /pages/1.
-
#update ⇒ Object
PATCH/PUT /pages/1.
- #update_all ⇒ Object
Methods inherited from ApplicationController
Instance Method Details
#create ⇒ Object
POST /exhibits/1/pages
36 37 38 39 40 41 42 43 44 45 |
# File 'app/controllers/spotlight/pages_controller.rb', line 36 def create @page.attributes = page_params @page.last_edited_by = @page.created_by = current_user if @page.save redirect_to [@page.exhibit, page_collection_name], notice: 'Page was successfully created.' else render action: 'new' end end |
#destroy ⇒ Object
DELETE /pages/1
57 58 59 60 |
# File 'app/controllers/spotlight/pages_controller.rb', line 57 def destroy @page.destroy redirect_to [@page.exhibit, @page], notice: 'Page was successfully destroyed.' end |
#edit ⇒ Object
GET /pages/1/edit
32 33 |
# File 'app/controllers/spotlight/pages_controller.rb', line 32 def edit end |
#index ⇒ Object
GET /exhibits/1/pages
18 19 20 21 |
# File 'app/controllers/spotlight/pages_controller.rb', line 18 def index # set up a model the inline "add a new page" form @page = CanCan::ControllerResource.new(self).send(:build_resource) end |
#new ⇒ Object
GET /exhibits/1/pages/new
28 29 |
# File 'app/controllers/spotlight/pages_controller.rb', line 28 def new end |
#show ⇒ Object
GET /pages/1
24 25 |
# File 'app/controllers/spotlight/pages_controller.rb', line 24 def show end |
#update ⇒ Object
PATCH/PUT /pages/1
48 49 50 51 52 53 54 |
# File 'app/controllers/spotlight/pages_controller.rb', line 48 def update if @page.update(page_params.merge(last_edited_by: current_user)) redirect_to [@page.exhibit, page_collection_name], notice: 'Page was successfully updated.' else render action: 'edit' end end |
#update_all ⇒ Object
62 63 64 65 66 67 68 69 |
# File 'app/controllers/spotlight/pages_controller.rb', line 62 def update_all notice = if @exhibit.update update_all_page_params "#{human_name} were successfully updated." else "There was an error updating the requested pages." end redirect_to :back, notice: notice end |