Class: SimpleForum::Admin::CategoriesController

Inherits:
BaseController show all
Defined in:
app/controllers/simple_forum/admin/categories_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'app/controllers/simple_forum/admin/categories_controller.rb', line 26

def create
  success = resource.save

  respond_with([:admin, resource]) do |format|
    format.html do
      if success
        redirect_to [:admin, resource]
      else
        render :new
      end
    end
  end
end

#destroyObject



54
55
56
57
58
# File 'app/controllers/simple_forum/admin/categories_controller.rb', line 54

def destroy
  resource.destroy

  respond_with([:admin, resource])
end

#editObject



16
17
18
19
# File 'app/controllers/simple_forum/admin/categories_controller.rb', line 16

def edit

  respond_with([:admin, resource])
end

#indexObject



5
6
7
8
9
# File 'app/controllers/simple_forum/admin/categories_controller.rb', line 5

def index
  @categories = SimpleForum::Category.default_order.all

  respond_with(@categories)
end

#newObject



21
22
23
24
# File 'app/controllers/simple_forum/admin/categories_controller.rb', line 21

def new

  respond_with([:admin, resource])
end

#showObject



11
12
13
14
# File 'app/controllers/simple_forum/admin/categories_controller.rb', line 11

def show

  respond_with([:admin, resource])
end

#updateObject



40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'app/controllers/simple_forum/admin/categories_controller.rb', line 40

def update
  success = resource.update_attributes(params[:category])

  respond_with([:admin, resource]) do |format|
    format.html do
      if success
        redirect_to [:admin, resource]
      else
        render :edit
      end
    end
  end
end