Skip to content

Advanced administration generator, much better than scaffold. (Ruby on Rails 2.x plug-in)

License

Notifications You must be signed in to change notification settings

jana4u/cute_admin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CuteAdmin
=========

CuteAdmin is Ruby on Rails plug-in. It is mainly generator,
replacement of classic Ruby on Rails scaffold.
Generated code allows you immediately to use advanced features
such as pagination, ordering, search and i18n translations.

CuteAdmin is based on ActiveRecord extension Searchlogic.

CuteAdmin works fine with Ruby on Rails 2.2 and 2.3.

This is upgraded version for Searchlogic 2.4.x (may work with any 2.x.x version).
Legacy version for Searchlogic 1.6.6 is available in branch searchlogic_1_6_6.


Installation
============

In your rails application folder run:

  `./script/plugin install git://github.com/jana4u/cute_admin.git`


CuteAdmin requires Searchlogic. You can use a gem (recommended):

  `sudo gem install searchlogic`

Don't forget to add it to config/environment.rb:

  config.gem "searchlogic"

Or you can install it as a rails plug-in:

  `./script/plugin install git://github.com/binarylogic/searchlogic.git`


If you are running Ruby on Rails prior to 2.3.6
you should install I18nLabel rails plug-in as well:

  `./script/plugin install git://github.com/iain/i18n_label.git`

(I18nLabel is not necessary if you don't want to automatically translate labels
for ActiveRecord attributes using I18n.)


Usage
=====

1. generate models
2. run `rake db:migrate` to create database tables for your models
3. set associations (belongs_to, has_many etc.) in your models
4. set acts_as_cute_admin in your models
5. run `rake cute_admin:generate_with_associations`
   or you can run generator directly for selected model:
   `./script/generate cute_admin Developer --add-associated`


Example
=======

class Country < ActiveRecord::Base
  acts_as_cute_admin
  has_many :companies
end

class Company < ActiveRecord::Base
  acts_as_cute_admin
  belongs_to :country
  has_many :developers
end

class Developer < ActiveRecord::Base
  acts_as_cute_admin :display_name => :full_name
  belongs_to :company

  named_scope :ascend_by_full_name, { :order => "developers.last_name, developers.first_name" }
  named_scope :descend_by_full_name, { :order => "developers.last_name DESC, developers.first_name DESC" }
  named_scope :full_name_contains, lambda { |string| { :conditions => [
    "(developers.last_name LIKE ? OR developers.first_name LIKE ?)",
    "%#{string}%",
    "%#{string}%"
  ] } }

  def full_name
    "#{last_name}, #{first_name}"
  end
end


Source code is available at: http://github.com/jana4u/cute_admin
Source code of sample application is available at: http://github.com/jana4u/cute_admin_example

Copyright (c) 2008 Jana4U <jana4u@seznam.cz>, released under the MIT license

About

Advanced administration generator, much better than scaffold. (Ruby on Rails 2.x plug-in)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages