Sha256: a28582aa5b087a4d2153d9e7b882541ecd8ab8e88085978eed2f284db6c2fdad

Contents?: true

Size: 1.13 KB

Versions: 10

Compression:

Stored size: 1.13 KB

Contents

module Admin
  class ContentTypesController < BaseController
  
    sections 'contents'
      
    def new
      @content_type = current_site.content_types.build
    end
  
    def edit
      @content_type = current_site.content_types.find(params[:id])
    end
  
    def create
      @content_type = current_site.content_types.build(params[:content_type])

      if @content_type.save
        flash_success!
        redirect_to edit_admin_content_type_url(@content_type)
      else
        flash_error!
        render :action => 'new'
      end
    end
  
    def update
      @content_type = current_site.content_types.find(params[:id])
      
      if @content_type.update_attributes(params[:content_type])
        flash_success!
        redirect_to edit_admin_content_type_url(@content_type)
      else
        flash_error!
        render :action => "edit"
      end
    end
    
    def destroy
      @content_type = current_site.content_types.find(params[:id])

      begin
        @content_type.destroy
        flash_success!
      rescue Exception => e
        flash[:error] = e.to_s
      end

      redirect_to admin_pages_url
    end
      
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
locomotive_cms-0.0.2.9 app/controllers/admin/content_types_controller.rb
locomotive_cms-0.0.2.8 app/controllers/admin/content_types_controller.rb
locomotive_cms-0.0.2.7 app/controllers/admin/content_types_controller.rb
locomotive_cms-0.0.2.6 app/controllers/admin/content_types_controller.rb
locomotive_cms-0.0.2.5 app/controllers/admin/content_types_controller.rb
locomotive_cms-0.0.2.4 app/controllers/admin/content_types_controller.rb
locomotive_cms-0.0.2.3 app/controllers/admin/content_types_controller.rb
locomotive_cms-0.0.2.2 app/controllers/admin/content_types_controller.rb
locomotive_cms-0.0.2.1 app/controllers/admin/content_types_controller.rb
locomotive_cms-0.0.2 app/controllers/admin/content_types_controller.rb