Sha256: 2c45926e852dfac43774f5797379ee893bd7142cd99474a3919289fa6e33369b

Contents?: true

Size: 910 Bytes

Versions: 7

Compression:

Stored size: 910 Bytes

Contents

class Admin::HitsController < Admin::ResourcesController

  def index
    @items = Hit.page(params[:page]).per(15)
    add_resource_action("Edit", {:action => 'edit'}, {})
    add_resource_action("Trash", {:action => "destroy"}, {:confirm => "#{Typus::I18n.t("Trash")}?", :method => 'delete'})
  end

  def new
    @item = Hit.new
  end

  def create
    @item = Hit.new(params[:hit])
    if @item.save
      flash[:notice] = Typus::I18n::t("Hit was successfully created.")
      redirect_to :action => 'edit', :id => @item.id
    else
      render :action => 'new'
    end
  end

  def edit
    @item = Hit.find(params[:id])
  end

  def update
    @item = Hit.find(params[:id])
    if @item.update_attributes(params[:entry])
      flash[:notice] = Typus::I18n::t("Hit was successfully updated.")
      redirect_to :action => 'edit', :id => @item.id
    else
      render :action => "edit"
    end
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
typus-3.1.0.rc7 test/fixtures/rails_app/app/controllers/admin/hits_controller.rb
typus-3.1.0.rc6 test/fixtures/rails_app/app/controllers/admin/hits_controller.rb
typus-3.1.0.rc5 test/fixtures/rails_app/app/controllers/admin/hits_controller.rb
typus-3.1.0.rc4 test/fixtures/rails_app/app/controllers/admin/hits_controller.rb
typus-3.1.0.rc3 test/fixtures/rails_app/app/controllers/admin/hits_controller.rb
typus-3.1.0.rc2 test/fixtures/rails_app/app/controllers/admin/hits_controller.rb
typus-3.1.0.rc1 test/fixtures/rails_app/app/controllers/admin/hits_controller.rb