extjs_scaffold 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (101) hide show
  1. data/.gitignore +9 -0
  2. data/.rspec +1 -0
  3. data/Gemfile +4 -0
  4. data/MIT-LICENSE +20 -0
  5. data/README.md +80 -0
  6. data/Rakefile +28 -0
  7. data/extjs_scaffold.gemspec +27 -0
  8. data/features/scaffold_generator.feature +124 -0
  9. data/features/step_definitions/aruba_ext_steps.rb +6 -0
  10. data/features/support/setup.rb +5 -0
  11. data/lib/extjs_scaffold.rb +1 -0
  12. data/lib/extjs_scaffold/version.rb +3 -0
  13. data/lib/generators/extjs_scaffold.rb +15 -0
  14. data/lib/generators/extjs_scaffold/install/USAGE +28 -0
  15. data/lib/generators/extjs_scaffold/install/install_generator.rb +82 -0
  16. data/lib/generators/extjs_scaffold/install/templates/Actionable.js +27 -0
  17. data/lib/generators/extjs_scaffold/install/templates/App.js +11 -0
  18. data/lib/generators/extjs_scaffold/install/templates/EditWindow.js +135 -0
  19. data/lib/generators/extjs_scaffold/install/templates/FormPanel.js +27 -0
  20. data/lib/generators/extjs_scaffold/install/templates/Format.js +34 -0
  21. data/lib/generators/extjs_scaffold/install/templates/GridPanel.js +289 -0
  22. data/lib/generators/extjs_scaffold/install/templates/ParentComboField.js +39 -0
  23. data/lib/generators/extjs_scaffold/install/templates/Rails.js +162 -0
  24. data/lib/generators/extjs_scaffold/install/templates/ScrollingToolbar.js +170 -0
  25. data/lib/generators/extjs_scaffold/install/templates/SearchField.js +104 -0
  26. data/lib/generators/extjs_scaffold/install/templates/UpdateWindow.js +112 -0
  27. data/lib/generators/extjs_scaffold/install/templates/Updateable.js +31 -0
  28. data/lib/generators/extjs_scaffold/install/templates/ext_auth.html.erb +3 -0
  29. data/lib/generators/extjs_scaffold/install/templates/extjs_scaffold.css.scss +9 -0
  30. data/lib/generators/extjs_scaffold/install/templates/images/README.txt +1 -0
  31. data/lib/generators/extjs_scaffold/install/templates/images/add.gif +0 -0
  32. data/lib/generators/extjs_scaffold/install/templates/images/application_form_edit.png +0 -0
  33. data/lib/generators/extjs_scaffold/install/templates/images/delete.gif +0 -0
  34. data/lib/generators/extjs_scaffold/install/templates/images/tick.png +0 -0
  35. data/lib/generators/extjs_scaffold/scaffold/USAGE +24 -0
  36. data/lib/generators/extjs_scaffold/scaffold/scaffold_generator.rb +19 -0
  37. data/lib/generators/extjs_scaffold/scaffold_controller/USAGE +20 -0
  38. data/lib/generators/extjs_scaffold/scaffold_controller/scaffold_controller_generator.rb +296 -0
  39. data/lib/generators/extjs_scaffold/scaffold_controller/templates/controller.rb +191 -0
  40. data/lib/generators/extjs_scaffold/scaffold_controller/templates/js/Controller.js +53 -0
  41. data/lib/generators/extjs_scaffold/scaffold_controller/templates/js/EditForm.js +17 -0
  42. data/lib/generators/extjs_scaffold/scaffold_controller/templates/js/EditWindow.js +27 -0
  43. data/lib/generators/extjs_scaffold/scaffold_controller/templates/js/Grid.js +26 -0
  44. data/lib/generators/extjs_scaffold/scaffold_controller/templates/js/Model.js +43 -0
  45. data/lib/generators/extjs_scaffold/scaffold_controller/templates/js/ReferenceStore.js +27 -0
  46. data/lib/generators/extjs_scaffold/scaffold_controller/templates/js/Store.js +28 -0
  47. data/lib/generators/extjs_scaffold/scaffold_controller/templates/js/UpdateForm.js +17 -0
  48. data/lib/generators/extjs_scaffold/scaffold_controller/templates/js/UpdateWindow.js +21 -0
  49. data/lib/generators/extjs_scaffold/scaffold_controller/templates/model.rb +57 -0
  50. data/lib/generators/extjs_scaffold/scaffold_controller/templates/tests/controller_spec.rb +197 -0
  51. data/lib/generators/extjs_scaffold/scaffold_controller/templates/tests/controller_test.rb +85 -0
  52. data/lib/generators/extjs_scaffold/scaffold_controller/templates/views/erb/index.html.erb +3 -0
  53. data/lib/generators/extjs_scaffold/scaffold_controller/templates/views/haml/index.html.haml +3 -0
  54. data/spec/dummy/.gitignore +15 -0
  55. data/spec/dummy/README +261 -0
  56. data/spec/dummy/Rakefile +7 -0
  57. data/spec/dummy/app/assets/images/rails.png +0 -0
  58. data/spec/dummy/app/assets/javascripts/application.js +7 -0
  59. data/spec/dummy/app/assets/stylesheets/application.css +7 -0
  60. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  61. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  62. data/spec/dummy/app/mailers/.gitkeep +0 -0
  63. data/spec/dummy/app/models/.gitkeep +0 -0
  64. data/spec/dummy/app/views/layouts/application.html.erb +16 -0
  65. data/spec/dummy/config.ru +4 -0
  66. data/spec/dummy/config/application.rb +48 -0
  67. data/spec/dummy/config/boot.rb +7 -0
  68. data/spec/dummy/config/database.yml +25 -0
  69. data/spec/dummy/config/environment.rb +5 -0
  70. data/spec/dummy/config/environments/development.rb +30 -0
  71. data/spec/dummy/config/environments/production.rb +60 -0
  72. data/spec/dummy/config/environments/test.rb +39 -0
  73. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  74. data/spec/dummy/config/initializers/inflections.rb +10 -0
  75. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  76. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  77. data/spec/dummy/config/initializers/session_store.rb +8 -0
  78. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  79. data/spec/dummy/config/locales/en.yml +5 -0
  80. data/spec/dummy/config/routes.rb +58 -0
  81. data/spec/dummy/db/schema.rb +23 -0
  82. data/spec/dummy/db/seeds.rb +7 -0
  83. data/spec/dummy/doc/README_FOR_APP +2 -0
  84. data/spec/dummy/lib/assets/.gitkeep +0 -0
  85. data/spec/dummy/lib/tasks/.gitkeep +0 -0
  86. data/spec/dummy/log/.gitkeep +0 -0
  87. data/spec/dummy/public/404.html +26 -0
  88. data/spec/dummy/public/422.html +26 -0
  89. data/spec/dummy/public/500.html +26 -0
  90. data/spec/dummy/public/favicon.ico +0 -0
  91. data/spec/dummy/public/index.html +241 -0
  92. data/spec/dummy/public/robots.txt +5 -0
  93. data/spec/dummy/script/rails +6 -0
  94. data/spec/dummy/vendor/assets/stylesheets/.gitkeep +0 -0
  95. data/spec/dummy/vendor/plugins/.gitkeep +0 -0
  96. data/spec/generators/install_spec.rb +140 -0
  97. data/spec/generators/scaffold_spec.rb +244 -0
  98. data/spec/spec_helper.rb +26 -0
  99. data/spec/support/App.js +12 -0
  100. data/spec/support/rails_routes.rb +4 -0
  101. metadata +290 -0
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
5
+ .rvmrc
6
+ tmp/*
7
+ resources/*
8
+ .DS_Store
9
+
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in extjs_scaffold.gemspec
4
+ gemspec
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2012 Mark H Winkler
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,80 @@
1
+ # ExtjsScaffold
2
+
3
+ Rails 3.1 Scaffold generator for Extjs 4
4
+
5
+ ## Usage
6
+
7
+ ### Install
8
+
9
+ 1) Install Sencha Extjs 4 into public
10
+
11
+ public/extjs
12
+
13
+ 2) Add Extjs to app/views/layouts/application.html.erb
14
+
15
+ <html>
16
+ <head>
17
+ <title>TestApp</title>
18
+ <%= stylesheet_link_tag "/extjs/resources/css/ext-all.css" %>
19
+ <%= stylesheet_link_tag "application" %>
20
+ <%= javascript_include_tag "/extjs/ext-all-debug.js" %>
21
+ <%= javascript_include_tag "application" %>
22
+ <%= csrf_meta_tags %>
23
+ </head>
24
+ <body>
25
+
26
+ <%= yield %>
27
+
28
+ </body>
29
+ </html>
30
+
31
+ 3) Add Extjs MVC structure app/assets/javascripts/application.js
32
+
33
+ //= require_self
34
+ //= require_tree ./ux
35
+ //= require_tree ./util
36
+ //= require_tree ./model
37
+ //= require_tree ./store
38
+ //= require_tree ./view
39
+ //= require_tree ./controller
40
+ //= require_tree .
41
+
42
+ 4) Run the install generator
43
+
44
+ rails generate extjs_scaffold:install
45
+
46
+ 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.
47
+
48
+ These can be customized using the --file-name and --app-name class options
49
+
50
+ rails generate extjs_scaffold:install --file-name=ExtjsApp --app-name=TestApp
51
+
52
+ or
53
+
54
+ rails generate extjs_scaffold:install -n=ExtjsApp -a=TestApp
55
+
56
+ ### Scaffold
57
+
58
+ rails generate scaffold extjs_scaffold:scaffold widget name:string
59
+
60
+ Class Options
61
+
62
+ If the file or app name were customized during the install, they must be passed into the scaffold generator:
63
+
64
+ rails generate extjs_scaffold:scaffold widget name:string -n=ExtjsApp -a=TestApp
65
+
66
+ Reference field lookups default to a 'name' field in the parent table. This can be customized by setting the --reference_fields option:
67
+
68
+ rails generate extjs_scaffold:scaffold widget category:references name:string --reference_fields category:category_type
69
+
70
+ Which would look for a 'category_type' field in the category table
71
+
72
+ Pagination defaults to Kaminari. To use Will Paginate, set the --pagination option:
73
+
74
+ rails generate extjs_scaffold:scaffold widget name:string --pagination=will_paginate
75
+
76
+ Views support erb (default) and haml
77
+
78
+ Controller tests for TestUnit and Rspec are generated
79
+
80
+ ORM is generated using Rails::Generators::ScaffoldGenerator and then injected with additional methods
data/Rakefile ADDED
@@ -0,0 +1,28 @@
1
+ # encoding: UTF-8
2
+ require "bundler/gem_tasks"
3
+ require "rubygems"
4
+
5
+ begin
6
+ require 'bundler/setup'
7
+ rescue LoadError
8
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
9
+ end
10
+
11
+ require 'rake'
12
+ require 'rake/rdoctask'
13
+
14
+ require 'rspec/core'
15
+ require 'rspec/core/rake_task'
16
+
17
+ RSpec::Core::RakeTask.new(:spec)
18
+
19
+ task :default => :spec
20
+
21
+ Rake::RDocTask.new(:rdoc) do |rdoc|
22
+ rdoc.rdoc_dir = 'rdoc'
23
+ rdoc.title = 'ExtjsScaffold'
24
+ rdoc.options << '--line-numbers' << '--inline-source'
25
+ rdoc.rdoc_files.include('README.md')
26
+ rdoc.rdoc_files.include('lib/**/*.rb')
27
+ end
28
+
@@ -0,0 +1,27 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "extjs_scaffold/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "extjs_scaffold"
7
+ s.version = ExtjsScaffold::VERSION
8
+ s.authors = ["mwinkler"]
9
+ s.email = ["mhwinkler@gmail.com"]
10
+ s.homepage = "https://github.com/mojomaze/extjs_scaffold"
11
+ s.summary = "Scaffold Generator for Rails 3.1 and Extjs 4"
12
+ s.description = "Scaffold Generator for Rails 3.1 and Sencha Extjs 4"
13
+
14
+ s.files = `git ls-files`.split("\n")
15
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
16
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
17
+ s.require_paths = ["lib"]
18
+
19
+ s.add_development_dependency "sqlite3"
20
+ s.add_development_dependency "rspec", "~> 2.7.0"
21
+ s.add_development_dependency "rspec-rails", "~> 2.7.0"
22
+ s.add_development_dependency "generator_spec"
23
+ s.add_development_dependency "cucumber"
24
+ s.add_development_dependency "cucumber-rails"
25
+ s.add_development_dependency "aruba", "< 0.4.7"
26
+ s.add_runtime_dependency "rails", "~> 3.1.0"
27
+ end
@@ -0,0 +1,124 @@
1
+ Feature: Generate Extjs Install and Scaffold
2
+ In order to use extjs as a scaffold replacement
3
+ As a user of Rails3 and extjs4
4
+ I would like to generate an extjs scaffold
5
+
6
+ Scenario: Generate ExtJs Scaffold
7
+ When I run `rails new test_app`
8
+ And I cd to "test_app"
9
+ Then the following files should exist:
10
+ | Gemfile |
11
+ | app/assets/javascripts/application.js |
12
+ | app/assets/stylesheets/application.css |
13
+ And I append to "Gemfile" with:
14
+ """
15
+ gem "haml"
16
+ gem "kaminari"
17
+ gem "extjs_renderer", "~> 0.1.0"
18
+ gem 'extjs_scaffold', :path => '../../../'
19
+
20
+ """
21
+ And I overwrite "app/views/layouts/application.html.erb" with:
22
+ """
23
+ <!DOCTYPE html>
24
+ <html>
25
+ <head>
26
+ <title>TestApp</title>
27
+ <%= stylesheet_link_tag "/extjs/resources/css/ext-all.css" %>
28
+ <%= stylesheet_link_tag "application" %>
29
+ <%= javascript_include_tag "/extjs/ext-all-debug.js" %>
30
+ <%= javascript_include_tag "application" %>
31
+ <%= csrf_meta_tags %>
32
+ </head>
33
+ <body>
34
+
35
+ <%= yield %>
36
+
37
+ </body>
38
+ </html>
39
+ """
40
+ And I overwrite "app/assets/javascripts/application.js" with:
41
+ """
42
+ //= require_self
43
+ //= require_tree ./ux
44
+ //= require_tree ./util
45
+ //= require_tree ./model
46
+ //= require_tree ./store
47
+ //= require_tree ./view
48
+ //= require_tree ./controller
49
+ //= require_tree .
50
+ """
51
+ And I install extjs in "test_app"
52
+ Then the following files should exist:
53
+ | public/extjs/bootstrap.js |
54
+ | public/extjs/ext-all-debug.js |
55
+ And I run `bundle install`
56
+ Then the output should contain:
57
+ """
58
+ Your bundle is complete!
59
+ """
60
+ And I run `rails g extjs_scaffold:install`
61
+ Then the following files should exist:
62
+ | app/assets/javascripts/TestApp.js |
63
+ And I run `rails g extjs_scaffold:scaffold category name:string`
64
+ Then the following files should exist:
65
+ | app/assets/javascripts/controller/Categories.js |
66
+ | app/controllers/categories_controller.rb |
67
+ | app/models/category.rb |
68
+ | app/views/categories/index.html.erb |
69
+ | test/functional/categories_controller_test.rb |
70
+ And I run `rails g extjs_scaffold:scaffold product category:references name:string`
71
+ Then the following files should exist:
72
+ | app/assets/javascripts/controller/Products.js |
73
+ | app/controllers/products_controller.rb |
74
+ | app/models/product.rb |
75
+ | app/views/products/index.html.erb |
76
+ | test/functional/products_controller_test.rb |
77
+ And I append to "Gemfile" with:
78
+ """
79
+ gem "rspec", "~> 2.7.0"
80
+ gem "rspec-rails", "~> 2.7.0"
81
+ """
82
+ And I run `bundle install`
83
+ Then the output should contain:
84
+ """
85
+ Your bundle is complete!
86
+ """
87
+ And I run `rails g rspec:install`
88
+ Then the following files should exist:
89
+ | spec/spec_helper.rb |
90
+ And I run `rails g extjs_scaffold:scaffold widget name:string sku:string in_stock:boolean price:decimal last_received_on:date --template_engine=haml`
91
+ Then the following files should exist:
92
+ | app/assets/javascripts/controller/Widgets.js |
93
+ | app/controllers/widgets_controller.rb |
94
+ | app/models/widget.rb |
95
+ | app/views/widgets/index.html.haml |
96
+ | spec/controllers/widgets_controller_spec.rb |
97
+ And I run `rails g extjs_scaffold:scaffold part widget:references name:string quantity:integer --template_engine=haml --reference-fields widget:sku`
98
+ Then the following files should exist:
99
+ | app/assets/javascripts/controller/Parts.js |
100
+ | app/controllers/parts_controller.rb |
101
+ | app/models/part.rb |
102
+ | app/views/parts/index.html.haml |
103
+ | spec/controllers/parts_controller_spec.rb |
104
+ And I run `rake db:migrate`
105
+ Then the output should contain:
106
+ """
107
+ CreateParts: migrated
108
+ """
109
+ And I run `rake db:test:prepare`
110
+ And I run `ruby -Itest test/functional/categories_controller_test.rb`
111
+ Then the output should contain:
112
+ """
113
+ 0 failures, 0 errors, 0 skips
114
+ """
115
+ And I run `ruby -Itest test/functional/products_controller_test.rb`
116
+ Then the output should contain:
117
+ """
118
+ 0 failures, 0 errors, 0 skips
119
+ """
120
+ And I run `rspec spec`
121
+ Then the output should contain:
122
+ """
123
+ 0 failures
124
+ """
@@ -0,0 +1,6 @@
1
+ Given /^I install extjs in "([^"]*)"$/ do |app_name|
2
+ src = File.expand_path('../../../resources/extjs', __FILE__ )
3
+ dest = File.expand_path("../../../#{@dirs.first}/#{app_name}/public", __FILE__ )
4
+ FileUtils.cp_r src, dest
5
+ end
6
+
@@ -0,0 +1,5 @@
1
+ require 'aruba/cucumber'
2
+
3
+ Before do
4
+ @aruba_timeout_seconds = 30
5
+ end
@@ -0,0 +1 @@
1
+ require "extjs_scaffold/version"
@@ -0,0 +1,3 @@
1
+ module ExtjsScaffold
2
+ VERSION = "0.1.1"
3
+ end
@@ -0,0 +1,15 @@
1
+ require "rails/generators/named_base"
2
+
3
+ module ExtjsScaffold
4
+ module Generators
5
+ class Base < Rails::Generators::NamedBase
6
+ def self.source_root
7
+ @_extjs_scaffold_source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'extjs_scaffold', generator_name, 'templates'))
8
+ end
9
+
10
+ def self.rails_app_name
11
+ Rails.root.to_s.split('/').last.titlecase.split.join
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,28 @@
1
+ Description:
2
+ Installs Ext Application file and ux files needed for scaffold
3
+
4
+ Example:
5
+ rails new MyCoolApp
6
+ rails generate extjs_scaffold:install
7
+
8
+ This will create:
9
+ app/assests/images/extjs_scaffold/add.gif
10
+ app/assests/images/extjs_scaffold/application_form_edit.png
11
+ app/assests/images/extjs_scaffold/delete.gif
12
+ app/assests/images/extjs_scaffold/README.txt
13
+ app/assests/images/extjs_scaffold/tick.png
14
+ app/assets/javascripts/MyCoolApp.js
15
+ app/assets/javascripts/model/ParentCombo.js
16
+ app/assets/javascripts/util/Format.js
17
+ app/assets/javascripts/ux/data/Actionable.js
18
+ app/assets/javascripts/ux/data/Updateable.js
19
+ app/assets/javascripts/ux/proxy/Rails.js
20
+ app/assets/javascripts/ux/form/Panel.js
21
+ app/assets/javascripts/ux/field/ParentCombo.js
22
+ app/assets/javascripts/ux/field/SearchField.js
23
+ app/assets/javascripts/ux/grid/Panel.js
24
+ app/assets/javascripts/ux/toolbar/Scrolling.js
25
+ app/assets/javascripts/ux/window/EditWindow.js
26
+ app/assets/javascripts/ux/window/UpdateWindow.js
27
+ app/assets/stylesheets/extjs_scaffold.css.scss
28
+ public/images/extjs_scaffold/tick.png
@@ -0,0 +1,82 @@
1
+ require 'generators/extjs_scaffold'
2
+
3
+ module ExtjsScaffold
4
+ module Generators
5
+ class InstallGenerator < Rails::Generators::Base
6
+
7
+ class_option :file_name, :desc => "Name of file used to hold Ext.application",
8
+ :aliases => '-n', :default => ExtjsScaffold::Generators::Base.rails_app_name
9
+ class_option :app_name, :desc => "Name of app used in Ext.application",
10
+ :aliases => '-a', :default => ExtjsScaffold::Generators::Base.rails_app_name
11
+
12
+ def self.source_root
13
+ @source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
14
+ end
15
+
16
+ def css_and_images
17
+ copy_file 'extjs_scaffold.css.scss', 'app/assets/stylesheets/extjs_scaffold.css.scss'
18
+ directory 'images', 'app/assets/images/extjs_scaffold'
19
+ copy_file 'images/tick.png', 'public/images/extjs_scaffold/tick.png'
20
+ end
21
+
22
+ def ext_auth_partial
23
+ copy_file 'ext_auth.html.erb', 'app/views/shared/_ext_auth.html.erb'
24
+ end
25
+
26
+ def create_application_file
27
+ empty_directory File.join("app/assets", "javascripts")
28
+ template 'App.js', File.join('app/assets/javascripts/', app_file_name)
29
+ end
30
+
31
+ def create_util_file
32
+ empty_directory File.join("app/assets/javascripts", "util")
33
+ template 'Format.js', File.join('app/assets/javascripts/util/', 'Format.js')
34
+ end
35
+
36
+ def create_ux_files
37
+ empty_directory File.join("app/assets/javascripts", "ux")
38
+ # data
39
+ empty_directory File.join("app/assets/javascripts/ux", "data")
40
+ empty_directory File.join("app/assets/javascripts/ux/data", "proxy")
41
+
42
+ template 'Actionable.js', File.join('app/assets/javascripts/ux/data/', 'Actionable.js')
43
+ template 'Updateable.js', File.join('app/assets/javascripts/ux/data/', 'Updateable.js')
44
+ template 'Rails.js', File.join('app/assets/javascripts/ux/data/proxy/', 'Rails.js')
45
+
46
+ # form
47
+ empty_directory File.join("app/assets/javascripts/ux", "form")
48
+ empty_directory File.join("app/assets/javascripts/ux/form", "field")
49
+
50
+ template 'FormPanel.js', File.join('app/assets/javascripts/ux/form/', 'Panel.js')
51
+ template 'ParentComboField.js', File.join('app/assets/javascripts/ux/form/field', 'ParentCombo.js')
52
+ template 'SearchField.js', File.join('app/assets/javascripts/ux/form/field/', 'SearchField.js')
53
+
54
+ #grid
55
+ empty_directory File.join("app/assets/javascripts/ux", "grid")
56
+ template 'GridPanel.js', File.join('app/assets/javascripts/ux/grid/', 'Panel.js')
57
+
58
+ #toolbar
59
+ empty_directory File.join("app/assets/javascripts/ux", "toolbar")
60
+ template 'ScrollingToolbar.js', File.join('app/assets/javascripts/ux/toolbar/', 'Scrolling.js')
61
+
62
+ #window
63
+ empty_directory File.join("app/assets/javascripts/ux", "window")
64
+ template 'EditWindow.js', File.join('app/assets/javascripts/ux/window/', 'EditWindow.js')
65
+ template 'UpdateWindow.js', File.join('app/assets/javascripts/ux/window/', 'UpdateWindow.js')
66
+
67
+ end
68
+
69
+ protected
70
+
71
+ def app_file_name
72
+ #file_name = options.file_name || rails_app_name
73
+ [options.file_name, :js].compact.join(".")
74
+ end
75
+
76
+ def app_name
77
+ options.app_name
78
+ end
79
+
80
+ end
81
+ end
82
+ end