Skip to content

Scaffold Generator for Rails 3.1 and Sencha Extjs 4

License

Notifications You must be signed in to change notification settings

DeathBorn/extjs_scaffold

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Need support for higher version of Rails. I am trying to add it.

#Original author mojomaze

ExtjsScaffold

Rails 3.1 Scaffold generator for Extjs 4

Usage

Install

  1. Add pagination gem to Gemfile

    gem "kaminari"

    or

    gem "will_paginate", "~> 3.0.0"

  2. Install Sencha Extjs 4 into public

    public/extjs

  3. Add Extjs to app/views/layouts/application.html.erb

    <title>TestApp</title> <%= stylesheet_link_tag "/extjs/resources/css/ext-all.css" %> <%= stylesheet_link_tag "application" %> <%= javascript_include_tag "/extjs/ext-all-debug.js" %> <%= javascript_include_tag "application" %> <%= csrf_meta_tags %>

    <%= yield %>

  4. Add Extjs MVC structure app/assets/javascripts/application.js

     //= require_self
     //= require_tree ./ux
     //= require_tree ./util
     //= require_tree ./model
     //= require_tree ./store
     //= require_tree ./view
     //= require_tree ./controller
     //= require_tree .
    
  5. Run the install generator

    rails generate extjs_scaffold:install

Which will create an Extjs application file and the scaffold ux files. By default the application file and the application name are set to the rails app name.

These can be customized using the --file-name and --app-name class options

rails generate extjs_scaffold:install --file-name=ExtjsApp --app-name=TestApp

or

rails generate extjs_scaffold:install -n=ExtjsApp -a=TestApp

Scaffold

rails generate scaffold extjs_scaffold:scaffold widget name:string

Class Options

If the file or app name were customized during the install, they must be passed into the scaffold generator:

rails generate extjs_scaffold:scaffold widget name:string -n=ExtjsApp -a=TestApp

Reference field lookups default to a 'name' field in the parent table. This can be customized by setting the --reference_fields option:

rails generate extjs_scaffold:scaffold widget category:references name:string --reference_fields category:category_type

Which would look for a 'category_type' field in the category table

Pagination defaults to Kaminari. To use Will Paginate, set the --pagination option:

rails generate extjs_scaffold:scaffold widget name:string --pagination=will_paginate

Views support erb (default) and haml

Controller tests for TestUnit and Rspec are generated

ORM is generated using Rails::Generators::ScaffoldGenerator and then injected with additional methods

About

Scaffold Generator for Rails 3.1 and Sencha Extjs 4

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 66.6%
  • JavaScript 33.4%