Sha256: c8b044eb23a2d6bb016baa288a5cddcfbe65f8414794ae076c54feb847bab128

Contents?: true

Size: 1.51 KB

Versions: 20

Compression:

Stored size: 1.51 KB

Contents

class IformatsController < ApplicationController
  before_filter :check_is_admin
  before_filter :find_iformat, :except => [:index, :new, :create]
  before_filter :visitor_node
  layout :admin_layout

  def show
  end

  def edit
    respond_to do |format|
      format.html
      format.js { render :partial => 'form' }
    end
  end

  def index
    @iformat_pages, @iformats = nil, nil
    @iformats = Iformat.list
    @iformat  = Iformat.new
    respond_to do |format|
      format.html
    end
  end

  def create
    @iformat = Iformat.create(params[:iformat])
  end

  def update
    @iformat.update_attributes(params[:iformat])

    respond_to do |format|
      format.html do
        if @iformat.errors.empty?
          redirect_to :action => 'show'
        else
          render :action => 'edit'
        end
      end
      format.js { render :action => 'show' }
    end
  end

  def destroy
    @iformat.destroy

    respond_to do |format|
      format.html do
        if @iformat.errors.empty?
          redirect_to :action => 'index'
        else
          render :action => 'edit'
        end
      end
      format.js   do
        render(:partial => 'form') unless @iformat.errors.empty?
      end
      format.xml  { head :ok }
    end
  end

  protected
    def find_iformat
      if imf_id = params[:id]
        if imf_id =~ /[a-zA-Z]/
          # default format
          @iformat = Iformat.new_from_default(imf_id)
        else
          @iformat = secure!(Iformat) { Iformat.find(params[:id]) }
        end
      end
    end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
zena-1.2.8 app/controllers/iformats_controller.rb
zena-1.2.7 app/controllers/iformats_controller.rb
zena-1.2.6 app/controllers/iformats_controller.rb
zena-1.2.5 app/controllers/iformats_controller.rb
zena-1.2.4 app/controllers/iformats_controller.rb
zena-1.2.3 app/controllers/iformats_controller.rb
zena-1.2.2 app/controllers/iformats_controller.rb
zena-1.2.1 app/controllers/iformats_controller.rb
zena-1.2.0 app/controllers/iformats_controller.rb
zena-1.1.3 app/controllers/iformats_controller.rb
zena-1.1.2 app/controllers/iformats_controller.rb
zena-1.1.1 app/controllers/iformats_controller.rb
zena-1.1.0 app/controllers/iformats_controller.rb
zena-1.0.0 app/controllers/iformats_controller.rb
zena-1.0.0.rc3 app/controllers/iformats_controller.rb
zena-1.0.0.rc2 app/controllers/iformats_controller.rb
zena-1.0.0.rc1 app/controllers/iformats_controller.rb
zena-1.0.0.beta3 app/controllers/iformats_controller.rb
zena-1.0.0.beta2 app/controllers/iformats_controller.rb
zena-1.0.0.beta1 app/controllers/iformats_controller.rb