require_dependency "help_popups/application_controller" module HelpPopups class TopicsController < ApplicationController 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 def index @topics = Topic.order(:title) end def new @topic = Topic.new end def create @topic = Topic.new(params[:topic]) @topic.parent_id = -1 if (@topic.save) redirect_to topics_path else render :new end end def edit @topic = Topic.find(params[:id]) end def update @topic = Topic.find(params[:id]) if (@topic.update_attributes(params[:topic])) redirect_to topics_path else render :edit end end def destroy @topic = Topic.find(params[:id]) @topic.destroy redirect_to topics_path end end end