Class: Admin::TopicController

Inherits:
AdminController
  • Object
show all
Defined in:
app/controllers/admin/topic_controller.rb

Instance Method Summary collapse

Instance Method Details

#destroy ⇒ Object



32
33
34
35
36
# File 'app/controllers/admin/topic_controller.rb', line 32

def destroy
  Topic.destroy(params[:id])
  flash[:notice] = "Topic Deleted"
  redirect_to "/admin/forums"
end

#edit ⇒ Object



9
10
# File 'app/controllers/admin/topic_controller.rb', line 9

def edit
end

#make ⇒ Object



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

def make
  v = params[:value]=='true' ? 1 : 0
  if params[:attr]=="visible"
    @topic.update_attributes(:is_visible=>v)
  end
  if params[:attr]=="open"
    @topic.update_attributes(:is_open=>v)
  end

  redirect_to "/admin/forums/topic/#{@topic.id}"
end

#show ⇒ Object



6
7
# File 'app/controllers/admin/topic_controller.rb', line 6

def show
end

#update ⇒ Object



24
25
26
27
28
29
30
# File 'app/controllers/admin/topic_controller.rb', line 24

def update
  if @topic.update_attributes(params[:topic])
    redirect_to "/admin/forums/topic/#{@topic.id}"
  else
    render "edit"
  end
end