Class: Plum::Cp::EntriesController
- Inherits:
-
BaseController
- Object
- ApplicationController
- ApplicationController
- BaseController
- Plum::Cp::EntriesController
- Defined in:
- app/controllers/plum/cp/entries_controller.rb
Constant Summary collapse
- ALLOWED_RICH_TEXT_TAGS =
%w[ a action-text-attachment blockquote br code em figcaption figure h1 h2 h3 hr img li ol p pre s strong table tbody td th thead tr ul ].freeze
- ALLOWED_RICH_TEXT_ATTRIBUTES =
%w[ alt caption content-type filename filesize height href presentation rel sgid src target title url width ].freeze
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 |
# File 'app/controllers/plum/cp/entries_controller.rb', line 26 def create @entry = @content_type.entries.build(entry_params) @entry.site = current_site @entry. = current_user if current_user.is_a?(Plum::User) if save_entry(@entry) redirect_to edit_cp_content_type_entry_path(@content_type, @entry), notice: "Entry created" else render :new, status: :unprocessable_entity end end |
#destroy ⇒ Object
51 52 53 54 |
# File 'app/controllers/plum/cp/entries_controller.rb', line 51 def destroy @entry.destroy redirect_to cp_content_type_entries_path(@content_type), notice: "Entry deleted" end |
#edit ⇒ Object
38 39 |
# File 'app/controllers/plum/cp/entries_controller.rb', line 38 def edit end |
#index ⇒ Object
18 19 20 |
# File 'app/controllers/plum/cp/entries_controller.rb', line 18 def index @entries = @content_type.entries.order(updated_at: :desc) end |
#new ⇒ Object
22 23 24 |
# File 'app/controllers/plum/cp/entries_controller.rb', line 22 def new @entry = @content_type.entries.build(status: :draft, site: current_site) end |
#update ⇒ Object
41 42 43 44 45 46 47 48 49 |
# File 'app/controllers/plum/cp/entries_controller.rb', line 41 def update @entry.assign_attributes(entry_params) if save_entry(@entry) redirect_to edit_cp_content_type_entry_path(@content_type, @entry), notice: "Entry updated" else render :edit, status: :unprocessable_entity end end |