Class: ExtjsScaffold::Generators::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/extjs_scaffold/install/install_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



12
13
14
# File 'lib/generators/extjs_scaffold/install/install_generator.rb', line 12

def self.source_root
  @source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
end

Instance Method Details

#create_application_fileObject



26
27
28
29
# File 'lib/generators/extjs_scaffold/install/install_generator.rb', line 26

def create_application_file
  empty_directory File.join("app/assets", "javascripts")
  template 'App.js', File.join('app/assets/javascripts/', app_file_name)
end

#create_util_fileObject



31
32
33
34
# File 'lib/generators/extjs_scaffold/install/install_generator.rb', line 31

def create_util_file
  empty_directory File.join("app/assets/javascripts", "util")
  template 'Format.js', File.join('app/assets/javascripts/util/', 'Format.js')
end

#create_ux_filesObject



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/generators/extjs_scaffold/install/install_generator.rb', line 36

def create_ux_files
  empty_directory File.join("app/assets/javascripts", "ux")
  # data
  empty_directory File.join("app/assets/javascripts/ux", "data")
  empty_directory File.join("app/assets/javascripts/ux/data", "proxy")
  
  template 'Actionable.js', File.join('app/assets/javascripts/ux/data/', 'Actionable.js')
  template 'Updateable.js', File.join('app/assets/javascripts/ux/data/', 'Updateable.js')
  template 'Rails.js', File.join('app/assets/javascripts/ux/data/proxy/', 'Rails.js')

  # form
  empty_directory File.join("app/assets/javascripts/ux", "form")
  empty_directory File.join("app/assets/javascripts/ux/form", "field")
  
  template 'FormPanel.js', File.join('app/assets/javascripts/ux/form/', 'Panel.js')
  template 'ParentComboField.js', File.join('app/assets/javascripts/ux/form/field', 'ParentCombo.js')
  template 'SearchField.js', File.join('app/assets/javascripts/ux/form/field/', 'SearchField.js')
  
  #grid
  empty_directory File.join("app/assets/javascripts/ux", "grid")
  template 'GridPanel.js', File.join('app/assets/javascripts/ux/grid/', 'Panel.js')
  
  #window
  empty_directory File.join("app/assets/javascripts/ux", "window")
  template 'EditWindow.js', File.join('app/assets/javascripts/ux/window/', 'EditWindow.js')
  template 'UpdateWindow.js', File.join('app/assets/javascripts/ux/window/', 'UpdateWindow.js')
  
end

#css_and_imagesObject



16
17
18
19
20
# File 'lib/generators/extjs_scaffold/install/install_generator.rb', line 16

def css_and_images
  copy_file 'extjs_scaffold.css.scss', 'app/assets/stylesheets/extjs_scaffold.css.scss'
  directory 'images', 'app/assets/images/extjs_scaffold'
  copy_file 'images/tick.png', 'public/images/extjs_scaffold/tick.png'
end

#ext_auth_partialObject



22
23
24
# File 'lib/generators/extjs_scaffold/install/install_generator.rb', line 22

def ext_auth_partial
  copy_file 'ext_auth.html.erb', 'app/views/shared/_ext_auth.html.erb'
end