Class: HelpPopups::TopicsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- HelpPopups::TopicsController
- Defined in:
- app/controllers/help_popups/topics_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #login ⇒ Object
- #new ⇒ Object
- #update ⇒ Object
Methods inherited from ApplicationController
Instance Method Details
#create ⇒ Object
25 26 27 28 29 30 31 32 33 34 |
# File 'app/controllers/help_popups/topics_controller.rb', line 25 def create @topic = Topic.new(params[:topic]) @topic.parent_id = -1 if (@topic.save) redirect_to topics_path else render :new end end |
#destroy ⇒ Object
50 51 52 53 54 |
# File 'app/controllers/help_popups/topics_controller.rb', line 50 def destroy @topic = Topic.find(params[:id]) @topic.destroy redirect_to topics_path end |
#edit ⇒ Object
36 37 38 |
# File 'app/controllers/help_popups/topics_controller.rb', line 36 def edit @topic = Topic.find(params[:id]) end |
#index ⇒ Object
17 18 19 |
# File 'app/controllers/help_popups/topics_controller.rb', line 17 def index @topics = Topic.order(:title) end |
#login ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 |
# File 'app/controllers/help_popups/topics_controller.rb', line 5 def login if !(params[:help_popups_password].nil?) if (params[:help_popups_password] == Rails.configuration.help_popups_password) session[:help_popups_clearance] = 1 else flash[:error] = "Invalid Password!" end end redirect_to topics_path end |
#new ⇒ Object
21 22 23 |
# File 'app/controllers/help_popups/topics_controller.rb', line 21 def new @topic = Topic.new end |
#update ⇒ Object
40 41 42 43 44 45 46 47 48 |
# File 'app/controllers/help_popups/topics_controller.rb', line 40 def update @topic = Topic.find(params[:id]) if (@topic.update_attributes(params[:topic])) redirect_to topics_path else render :edit end end |