Class: Admin::ForumsController

Inherits:
AdminController
  • Object
show all
Includes:
Formol::Controllers::Nested::HasParentCategory
Defined in:
app/controllers/formol/admin/forums_controller.rb

Instance Method Summary collapse

Methods included from Formol::Controllers::Nested::HasParentCategory

#category

Instance Method Details

#createObject



14
15
16
17
18
19
20
21
22
# File 'app/controllers/formol/admin/forums_controller.rb', line 14

def create
  if forum.save
    respond_with(forum, :status => :created, :location => admin_categories_path)
  else
    respond_with(forum, :status => :unprocessable_entity) do |format|
      format.html { render :new }
    end
  end
end

#destroyObject



38
39
40
41
42
# File 'app/controllers/formol/admin/forums_controller.rb', line 38

def destroy
  forum.destroy
  
  respond_with(forum, :location => admin_categories_path)
end

#editObject



24
25
26
# File 'app/controllers/formol/admin/forums_controller.rb', line 24

def edit
  forum
end

#newObject



8
9
10
11
12
# File 'app/controllers/formol/admin/forums_controller.rb', line 8

def new
  forum
  
  respond_with(forum)
end

#reorganizeObject



44
45
46
47
48
# File 'app/controllers/formol/admin/forums_controller.rb', line 44

def reorganize
  Formol::Forum.reorganize(params[:forums], params[:category_id])
  
  render :nothing => true, :status => :ok
end

#updateObject



28
29
30
31
32
33
34
35
36
# File 'app/controllers/formol/admin/forums_controller.rb', line 28

def update
  if forum.update_attributes(params[:forum])
    respond_with(forum, :location => admin_categories_path)
  else
    respond_with(forum) do |format|
      format.html { render :edit }
    end
  end
end