Sha256: bbcd7395c5dc83a7054a50fd72b7fba7cae1ce89ef10f14273b1dd210e383d0b
Contents?: true
Size: 1.57 KB
Versions: 13
Compression:
Stored size: 1.57 KB
Contents
class IformatsController < ApplicationController before_filter :check_is_admin before_filter :find_iformat, :except => [:index, :new, :create] before_filter :find_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 def find_node @node = visitor.contact end end
Version data entries
13 entries across 13 versions & 1 rubygems