Class: Plum::Cp::TaxonomiesController

Inherits:
BaseController show all
Defined in:
app/controllers/plum/cp/taxonomies_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



19
20
21
22
23
24
25
26
27
# File 'app/controllers/plum/cp/taxonomies_controller.rb', line 19

def create
  @taxonomy = current_site.taxonomies.build(taxonomy_params)

  if @taxonomy.save
    redirect_to "#{cp_prefix}/taxonomies/#{@taxonomy.id}", notice: "Taxonomy created"
  else
    render :new, status: :unprocessable_entity
  end
end

#destroyObject



40
41
42
43
# File 'app/controllers/plum/cp/taxonomies_controller.rb', line 40

def destroy
  @taxonomy.destroy
  redirect_to "#{cp_prefix}/taxonomies", notice: "Taxonomy deleted"
end

#editObject



29
30
# File 'app/controllers/plum/cp/taxonomies_controller.rb', line 29

def edit
end

#indexObject



7
8
9
# File 'app/controllers/plum/cp/taxonomies_controller.rb', line 7

def index
  @taxonomies = current_site.taxonomies.order(:name)
end

#newObject



15
16
17
# File 'app/controllers/plum/cp/taxonomies_controller.rb', line 15

def new
  @taxonomy = current_site.taxonomies.build
end

#showObject



11
12
13
# File 'app/controllers/plum/cp/taxonomies_controller.rb', line 11

def show
  @terms = @taxonomy.terms.ordered
end

#updateObject



32
33
34
35
36
37
38
# File 'app/controllers/plum/cp/taxonomies_controller.rb', line 32

def update
  if @taxonomy.update(taxonomy_params)
    redirect_to "#{cp_prefix}/taxonomies/#{@taxonomy.id}", notice: "Taxonomy updated"
  else
    render :edit, status: :unprocessable_entity
  end
end