Sha256: 604a6b632d86c6020978c0eae8b7e579b2206c11f540725d88cc473c62ea05da

Contents?: true

Size: 1.29 KB

Versions: 33

Compression:

Stored size: 1.29 KB

Contents

class Admin::BlogCategoriesController < ApplicationController
  before_filter :authenticate_user! if Object.const_defined?('Devise')
  before_filter :find_blog_category, :only => [:destroy, :edit, :update, :show]

  def index
    @blog_categories = BlogCategory.roots
  end

  def show
  end

  def new
    @blog_category = BlogCategory.new :parent_id => params[:parent_id]
  end

  def create
    @blog_category = BlogCategory.new params[:blog_category]
    if @blog_category.save
      flash[:notice] = 'Successfully created the blog_category.'
      redirect_to @blog_category.root? ? admin_blog_category_path(@blog_category) : admin_blog_category_path(@blog_category.parent)
    else
      render :action => 'new'
    end
  end

  def edit
  end

  def update
    if @blog_category.update_attributes params[:blog_category]
      flash[:notice] = 'Successfully updated the blog_category.'
      redirect_to admin_blog_categories_path
    else
      render :action => 'edit'
    end
  end

  def destroy
    @blog_category.destroy
    flash[:notice] = 'Successfully destroyed the blog_category.'
    redirect_to @blog_category.root? ? admin_blog_categories_path : admin_blog_category_path(@blog_category.parent)
  end

  private

  def find_blog_category
    @blog_category = BlogCategory.find params[:id]
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
blog_logic-1.4.15 app/controllers/admin/blog_categories_controller.rb
blog_logic-1.4.14 app/controllers/admin/blog_categories_controller.rb
blog_logic-1.4.13 app/controllers/admin/blog_categories_controller.rb
blog_logic-1.4.12 app/controllers/admin/blog_categories_controller.rb
blog_logic-1.4.11 app/controllers/admin/blog_categories_controller.rb
blog_logic-1.4.10 app/controllers/admin/blog_categories_controller.rb
blog_logic-1.4.9 app/controllers/admin/blog_categories_controller.rb
blog_logic-1.4.8 app/controllers/admin/blog_categories_controller.rb
blog_logic-1.4.7 app/controllers/admin/blog_categories_controller.rb
blog_logic-1.4.6 app/controllers/admin/blog_categories_controller.rb
blog_logic-1.4.5 app/controllers/admin/blog_categories_controller.rb
blog_logic-1.4.4 app/controllers/admin/blog_categories_controller.rb
blog_logic-1.4.3 app/controllers/admin/blog_categories_controller.rb
blog_logic-1.4.2 app/controllers/admin/blog_categories_controller.rb
blog_logic-1.4.1 app/controllers/admin/blog_categories_controller.rb
blog_logic-1.4.0 app/controllers/admin/blog_categories_controller.rb
blog_logic-1.3.1 app/controllers/admin/blog_categories_controller.rb
blog_logic-1.3.0 app/controllers/admin/blog_categories_controller.rb
blog_logic-1.2.4 app/controllers/admin/blog_categories_controller.rb
blog_logic-1.2.3 app/controllers/admin/blog_categories_controller.rb