Class: Plum::Cp::TermsController
- Inherits:
-
BaseController
- Object
- ApplicationController
- ApplicationController
- BaseController
- Plum::Cp::TermsController
- Defined in:
- app/controllers/plum/cp/terms_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/controllers/plum/cp/terms_controller.rb', line 12 def create @term = @taxonomy.terms.build(term_params) @term.site = current_site @term.position = @taxonomy.terms.maximum(:position).to_i + 1 if @term.save redirect_to "#{cp_prefix}/taxonomies/#{@taxonomy.id}", notice: "Term created" else render :new, status: :unprocessable_entity end end |
#destroy ⇒ Object
35 36 37 38 |
# File 'app/controllers/plum/cp/terms_controller.rb', line 35 def destroy @term.destroy redirect_to "#{cp_prefix}/taxonomies/#{@taxonomy.id}", notice: "Term deleted" end |
#edit ⇒ Object
24 25 |
# File 'app/controllers/plum/cp/terms_controller.rb', line 24 def edit end |
#new ⇒ Object
8 9 10 |
# File 'app/controllers/plum/cp/terms_controller.rb', line 8 def new @term = @taxonomy.terms.build(site: current_site) end |
#update ⇒ Object
27 28 29 30 31 32 33 |
# File 'app/controllers/plum/cp/terms_controller.rb', line 27 def update if @term.update(term_params) redirect_to "#{cp_prefix}/taxonomies/#{@taxonomy.id}", notice: "Term updated" else render :edit, status: :unprocessable_entity end end |