Class: Plum::Cp::ContentTypesController
- Inherits:
-
BaseController
- Object
- ApplicationController
- ApplicationController
- BaseController
- Plum::Cp::ContentTypesController
- Defined in:
- app/controllers/plum/cp/content_types_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'app/controllers/plum/cp/content_types_controller.rb', line 19 def create @content_type = current_site.content_types.build(content_type_params) if @content_type.save redirect_to cp_content_type_path(@content_type), notice: "Content type created" else render :new, status: :unprocessable_entity end end |
#destroy ⇒ Object
39 40 41 42 |
# File 'app/controllers/plum/cp/content_types_controller.rb', line 39 def destroy @content_type.destroy redirect_to cp_content_types_path, notice: "Content type deleted" end |
#edit ⇒ Object
28 29 |
# File 'app/controllers/plum/cp/content_types_controller.rb', line 28 def edit end |
#index ⇒ Object
7 8 9 |
# File 'app/controllers/plum/cp/content_types_controller.rb', line 7 def index @content_types = ContentType.for_site(current_site) end |
#new ⇒ Object
15 16 17 |
# File 'app/controllers/plum/cp/content_types_controller.rb', line 15 def new @content_type = current_site.content_types.build end |
#show ⇒ Object
11 12 13 |
# File 'app/controllers/plum/cp/content_types_controller.rb', line 11 def show @entries = @content_type.entries.order(updated_at: :desc) end |
#update ⇒ Object
31 32 33 34 35 36 37 |
# File 'app/controllers/plum/cp/content_types_controller.rb', line 31 def update if @content_type.update(content_type_params) redirect_to cp_content_type_path(@content_type), notice: "Content type updated" else render :edit, status: :unprocessable_entity end end |