Sha256: 1f34f2b2212ce974ead35da87912691eec47bcd4e209461e76afa3c7222483b2

Contents?: true

Size: 1.12 KB

Versions: 6

Compression:

Stored size: 1.12 KB

Contents

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
help_popups-1.0.5 app/controllers/help_popups/topics_controller.rb
help_popups-1.0.4 app/controllers/help_popups/topics_controller.rb
help_popups-1.0.3 app/controllers/help_popups/topics_controller.rb
help_popups-1.0.2 app/controllers/help_popups/topics_controller.rb
help_popups-1.0.1 app/controllers/help_popups/topics_controller.rb
help_popups-1.0.0 app/controllers/help_popups/topics_controller.rb