Sha256: 9ae784aabc6ef6b044ce4d3ecd1724739549ea2a2eee4e04a447fa67d0064b99

Contents?: true

Size: 1.25 KB

Versions: 6

Compression:

Stored size: 1.25 KB

Contents

class Admin::BlacklistController < Admin::BaseController
  def list
    index
    render :action => 'index'
  end

  def index
    @blacklist_patterns = BlacklistPattern.find :all
  end

  def show
    @blacklist_pattern = BlacklistPattern.find(params[:id])
  end

  def new
    @blacklist_pattern = BlacklistPattern.new

    if params[:blacklist_pattern].has_key?('type')
      @blacklist_pattern = case params[:blacklist_pattern][:type]
        when "StringPattern": StringPattern.new
        when "RegexPattern": RegexPattern.new
      end
    end rescue nil

    @blacklist_pattern.attributes = params[:blacklist_pattern]

    if request.post? and @blacklist_pattern.save
      flash[:notice] = 'BlacklistPattern was successfully created.'
      redirect_to :action => 'list'
    end
  end

  def edit
    @blacklist_pattern = BlacklistPattern.find(params[:id])
    @blacklist_pattern.attributes = params[:blacklist_pattern]
    if request.post? and @blacklist_pattern.save
      flash[:notice] = 'BlacklistPattern was successfully updated.'
      redirect_to :action => 'list'
    end
  end

  def destroy
    @blacklist_pattern = BlacklistPattern.find(params[:id])
    if request.post?
      @blacklist_pattern.destroy
      redirect_to :action => 'list'
    end
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
typo-5.0.3.98.1 app/controllers/admin/blacklist_controller.rb
typo-5.0.3.98 app/controllers/admin/blacklist_controller.rb
typo-5.1.2 app/controllers/admin/blacklist_controller.rb
typo-5.1.1 app/controllers/admin/blacklist_controller.rb
typo-5.1.3 app/controllers/admin/blacklist_controller.rb
typo-5.1 app/controllers/admin/blacklist_controller.rb