diff options
author | José Valim <jose.valim@gmail.com> | 2010-03-23 13:40:19 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-03-23 13:40:41 +0100 |
commit | b61f6f59805eec4f5bb873a85910c9fe00e839a9 (patch) | |
tree | 485dc3cee827ab4d79756e90d639ccc4dad464e1 /railties/lib/generators/erb | |
parent | b144b56d8288246f0de7437d10361a0f1ed2bd83 (diff) | |
download | rails-b61f6f59805eec4f5bb873a85910c9fe00e839a9.tar.gz rails-b61f6f59805eec4f5bb873a85910c9fe00e839a9.tar.bz2 rails-b61f6f59805eec4f5bb873a85910c9fe00e839a9.zip |
Load generators from both lib/rails/generators and lib/generators. Using the former since it's less obstrusive.
Diffstat (limited to 'railties/lib/generators/erb')
11 files changed, 0 insertions, 157 deletions
diff --git a/railties/lib/generators/erb/controller/controller_generator.rb b/railties/lib/generators/erb/controller/controller_generator.rb deleted file mode 100644 index b8e8898900..0000000000 --- a/railties/lib/generators/erb/controller/controller_generator.rb +++ /dev/null @@ -1,20 +0,0 @@ -require 'generators/erb' - -module Erb - module Generators - class ControllerGenerator < Base - argument :actions, :type => :array, :default => [], :banner => "action action" - - def copy_view_files - base_path = File.join("app/views", class_path, file_name) - empty_directory base_path - - actions.each do |action| - @action = action - @path = File.join(base_path, filename_with_extensions(action)) - template filename_with_extensions(:view), @path - end - end - end - end -end diff --git a/railties/lib/generators/erb/controller/templates/view.html.erb b/railties/lib/generators/erb/controller/templates/view.html.erb deleted file mode 100644 index cd54d13d83..0000000000 --- a/railties/lib/generators/erb/controller/templates/view.html.erb +++ /dev/null @@ -1,2 +0,0 @@ -<h1><%= class_name %>#<%= @action %></h1> -<p>Find me in <%= @path %></p> diff --git a/railties/lib/generators/erb/mailer/mailer_generator.rb b/railties/lib/generators/erb/mailer/mailer_generator.rb deleted file mode 100644 index 65fa4a86c5..0000000000 --- a/railties/lib/generators/erb/mailer/mailer_generator.rb +++ /dev/null @@ -1,13 +0,0 @@ -require 'generators/erb/controller/controller_generator' - -module Erb - module Generators - class MailerGenerator < ControllerGenerator - protected - - def format - :text - end - end - end -end diff --git a/railties/lib/generators/erb/mailer/templates/view.text.erb b/railties/lib/generators/erb/mailer/templates/view.text.erb deleted file mode 100644 index 6d597256a6..0000000000 --- a/railties/lib/generators/erb/mailer/templates/view.text.erb +++ /dev/null @@ -1,3 +0,0 @@ -<%= class_name %>#<%= @action %> - -<%%= @greeting %>, find me in app/views/<%= @path %> diff --git a/railties/lib/generators/erb/scaffold/scaffold_generator.rb b/railties/lib/generators/erb/scaffold/scaffold_generator.rb deleted file mode 100644 index 267c9c8063..0000000000 --- a/railties/lib/generators/erb/scaffold/scaffold_generator.rb +++ /dev/null @@ -1,41 +0,0 @@ -require 'generators/erb' -require 'rails/generators/resource_helpers' - -module Erb - module Generators - class ScaffoldGenerator < Base - include Rails::Generators::ResourceHelpers - - argument :attributes, :type => :array, :default => [], :banner => "field:type field:type" - - class_option :layout, :type => :boolean - class_option :singleton, :type => :boolean, :desc => "Supply to skip index view" - - def create_root_folder - empty_directory File.join("app/views", controller_file_path) - end - - def copy_view_files - views = available_views - views.delete("index") if options[:singleton] - - views.each do |view| - filename = filename_with_extensions(view) - template filename, File.join("app/views", controller_file_path, filename) - end - end - - def copy_layout_file - return unless options[:layout] - template filename_with_extensions(:layout), - File.join("app/views/layouts", controller_class_path, filename_with_extensions(controller_file_name)) - end - - protected - - def available_views - %w(index edit show new _form) - end - end - end -end diff --git a/railties/lib/generators/erb/scaffold/templates/_form.html.erb b/railties/lib/generators/erb/scaffold/templates/_form.html.erb deleted file mode 100644 index 01ec58c615..0000000000 --- a/railties/lib/generators/erb/scaffold/templates/_form.html.erb +++ /dev/null @@ -1,13 +0,0 @@ -<%%= form_for(@<%= singular_name %>) do |f| %> - <%%= f.error_messages %> - -<% for attribute in attributes -%> - <div class="field"> - <%%= f.label :<%= attribute.name %> %><br /> - <%%= f.<%= attribute.field_type %> :<%= attribute.name %> %> - </div> -<% end -%> - <div class="actions"> - <%%= f.submit %> - </div> -<%% end %> diff --git a/railties/lib/generators/erb/scaffold/templates/edit.html.erb b/railties/lib/generators/erb/scaffold/templates/edit.html.erb deleted file mode 100644 index 5bc507ffc8..0000000000 --- a/railties/lib/generators/erb/scaffold/templates/edit.html.erb +++ /dev/null @@ -1,6 +0,0 @@ -<h1>Editing <%= singular_name %></h1> - -<%%= render 'form' %> - -<%%= link_to 'Show', @<%= singular_name %> %> | -<%%= link_to 'Back', <%= plural_name %>_path %> diff --git a/railties/lib/generators/erb/scaffold/templates/index.html.erb b/railties/lib/generators/erb/scaffold/templates/index.html.erb deleted file mode 100644 index d30d306d42..0000000000 --- a/railties/lib/generators/erb/scaffold/templates/index.html.erb +++ /dev/null @@ -1,27 +0,0 @@ -<h1>Listing <%= plural_name %></h1> - -<table> - <tr> -<% for attribute in attributes -%> - <th><%= attribute.human_name %></th> -<% end -%> - <th></th> - <th></th> - <th></th> - </tr> - -<%% @<%= plural_name %>.each do |<%= singular_name %>| %> - <tr> -<% for attribute in attributes -%> - <td><%%= <%= singular_name %>.<%= attribute.name %> %></td> -<% end -%> - <td><%%= link_to 'Show', <%= singular_name %> %></td> - <td><%%= link_to 'Edit', edit_<%= singular_name %>_path(<%= singular_name %>) %></td> - <td><%%= link_to 'Destroy', <%= singular_name %>, :confirm => 'Are you sure?', :method => :delete %></td> - </tr> -<%% end %> -</table> - -<br /> - -<%%= link_to 'New <%= human_name %>', new_<%= singular_name %>_path %> diff --git a/railties/lib/generators/erb/scaffold/templates/layout.html.erb b/railties/lib/generators/erb/scaffold/templates/layout.html.erb deleted file mode 100644 index 3f64be0c45..0000000000 --- a/railties/lib/generators/erb/scaffold/templates/layout.html.erb +++ /dev/null @@ -1,17 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <title><%= controller_class_name %>: <%%= controller.action_name %></title> - <%%= stylesheet_link_tag 'scaffold' %> - <%%= javascript_include_tag :defaults %> - <%%= csrf_meta_tag %> -</head> -<body> - -<p class="notice"><%%= notice %></p> -<p class="alert"><%%= alert %></p> - -<%%= yield %> - -</body> -</html> diff --git a/railties/lib/generators/erb/scaffold/templates/new.html.erb b/railties/lib/generators/erb/scaffold/templates/new.html.erb deleted file mode 100644 index 9a1c489331..0000000000 --- a/railties/lib/generators/erb/scaffold/templates/new.html.erb +++ /dev/null @@ -1,5 +0,0 @@ -<h1>New <%= singular_name %></h1> - -<%%= render 'form' %> - -<%%= link_to 'Back', <%= plural_name %>_path %> diff --git a/railties/lib/generators/erb/scaffold/templates/show.html.erb b/railties/lib/generators/erb/scaffold/templates/show.html.erb deleted file mode 100644 index 24f13fc0f8..0000000000 --- a/railties/lib/generators/erb/scaffold/templates/show.html.erb +++ /dev/null @@ -1,10 +0,0 @@ -<% for attribute in attributes -%> -<p> - <b><%= attribute.human_name %>:</b> - <%%= @<%= singular_name %>.<%= attribute.name %> %> -</p> - -<% end -%> - -<%%= link_to 'Edit', edit_<%= singular_name %>_path(@<%= singular_name %>) %> | -<%%= link_to 'Back', <%= plural_name %>_path %> |