beef-admin_area 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (124) hide show
  1. data/.document +5 -0
  2. data/.gitignore +5 -0
  3. data/LICENSE +20 -0
  4. data/README.rdoc +7 -0
  5. data/Rakefile +59 -0
  6. data/VERSION +1 -0
  7. data/admin_area.gemspec +168 -0
  8. data/app/controllers/admin/base_controller.rb +8 -0
  9. data/app/controllers/admin/settings_controller.rb +43 -0
  10. data/app/controllers/admin/users_controller.rb +74 -0
  11. data/app/helpers/admin/base_helper.rb +59 -0
  12. data/app/helpers/admin/settings_helper.rb +8 -0
  13. data/app/helpers/admin/users_helper.rb +2 -0
  14. data/app/models/settings.rb +92 -0
  15. data/app/views/admin/base/index.html.erb +2 -0
  16. data/app/views/admin/settings/_form.html.erb +31 -0
  17. data/app/views/admin/settings/update.js.rjs +1 -0
  18. data/app/views/admin/users/index.html.erb +39 -0
  19. data/app/views/admin/users/show.html.erb +37 -0
  20. data/app/views/layouts/admin.html.erb +68 -0
  21. data/config/routes.rb +8 -0
  22. data/generators/admin_area_files/USAGE +8 -0
  23. data/generators/admin_area_files/admin_area_files_generator.rb +114 -0
  24. data/generators/admin_area_files/lib/insert_commands.rb +47 -0
  25. data/generators/admin_area_files/templates/app/models/content_sweeper.rb +43 -0
  26. data/generators/admin_area_files/templates/app/views/admin/settings/show.html.erb +52 -0
  27. data/generators/admin_area_files/templates/config/initializers/admin_area.rb +2 -0
  28. data/generators/admin_area_files/templates/config/initializers/settings.rb +8 -0
  29. data/generators/admin_area_files/templates/lib/tasks/admin_area.rake +10 -0
  30. data/generators/admin_area_files/templates/migration.rb +21 -0
  31. data/generators/admin_area_files/templates/public/images/admin/accept_button.gif +0 -0
  32. data/generators/admin_area_files/templates/public/images/admin/add.png +0 -0
  33. data/generators/admin_area_files/templates/public/images/admin/application_cascade.png +0 -0
  34. data/generators/admin_area_files/templates/public/images/admin/arrow_left.gif +0 -0
  35. data/generators/admin_area_files/templates/public/images/admin/arrow_right.gif +0 -0
  36. data/generators/admin_area_files/templates/public/images/admin/button_bg.gif +0 -0
  37. data/generators/admin_area_files/templates/public/images/admin/cancel_button.gif +0 -0
  38. data/generators/admin_area_files/templates/public/images/admin/cursor_arrow.gif +0 -0
  39. data/generators/admin_area_files/templates/public/images/admin/delete_button.gif +0 -0
  40. data/generators/admin_area_files/templates/public/images/admin/down_icon.gif +0 -0
  41. data/generators/admin_area_files/templates/public/images/admin/edit_button.gif +0 -0
  42. data/generators/admin_area_files/templates/public/images/admin/file-uploads.png +0 -0
  43. data/generators/admin_area_files/templates/public/images/admin/folder.png +0 -0
  44. data/generators/admin_area_files/templates/public/images/admin/folder_image.png +0 -0
  45. data/generators/admin_area_files/templates/public/images/admin/head_bg.gif +0 -0
  46. data/generators/admin_area_files/templates/public/images/admin/image_add.png +0 -0
  47. data/generators/admin_area_files/templates/public/images/admin/images-pointer.png +0 -0
  48. data/generators/admin_area_files/templates/public/images/admin/info_bg.gif +0 -0
  49. data/generators/admin_area_files/templates/public/images/admin/nav_bg.gif +0 -0
  50. data/generators/admin_area_files/templates/public/images/admin/over_button_bg.gif +0 -0
  51. data/generators/admin_area_files/templates/public/images/admin/page_bg.gif +0 -0
  52. data/generators/admin_area_files/templates/public/images/admin/page_white.png +0 -0
  53. data/generators/admin_area_files/templates/public/images/admin/page_white_get.png +0 -0
  54. data/generators/admin_area_files/templates/public/images/admin/page_white_link.png +0 -0
  55. data/generators/admin_area_files/templates/public/images/admin/page_white_stack.png +0 -0
  56. data/generators/admin_area_files/templates/public/images/admin/picture.png +0 -0
  57. data/generators/admin_area_files/templates/public/images/admin/picture_medium.png +0 -0
  58. data/generators/admin_area_files/templates/public/images/admin/picture_square.png +0 -0
  59. data/generators/admin_area_files/templates/public/images/admin/picture_thumb.png +0 -0
  60. data/generators/admin_area_files/templates/public/images/admin/pictures.png +0 -0
  61. data/generators/admin_area_files/templates/public/images/admin/unapproved.png +0 -0
  62. data/generators/admin_area_files/templates/public/images/admin/up_icon.gif +0 -0
  63. data/generators/admin_area_files/templates/public/images/lightwindow/Thumbs.db +0 -0
  64. data/generators/admin_area_files/templates/public/images/lightwindow/ajax-loading.gif +0 -0
  65. data/generators/admin_area_files/templates/public/images/lightwindow/arrow-down.gif +0 -0
  66. data/generators/admin_area_files/templates/public/images/lightwindow/arrow-up.gif +0 -0
  67. data/generators/admin_area_files/templates/public/images/lightwindow/black-70.png +0 -0
  68. data/generators/admin_area_files/templates/public/images/lightwindow/black.png +0 -0
  69. data/generators/admin_area_files/templates/public/images/lightwindow/nextlabel.gif +0 -0
  70. data/generators/admin_area_files/templates/public/images/lightwindow/pattern_148-70.png +0 -0
  71. data/generators/admin_area_files/templates/public/images/lightwindow/pattern_148.gif +0 -0
  72. data/generators/admin_area_files/templates/public/images/lightwindow/prevlabel.gif +0 -0
  73. data/generators/admin_area_files/templates/public/images/textile-editor/background.png +0 -0
  74. data/generators/admin_area_files/templates/public/images/textile-editor/blockquote.png +0 -0
  75. data/generators/admin_area_files/templates/public/images/textile-editor/bold.png +0 -0
  76. data/generators/admin_area_files/templates/public/images/textile-editor/center.png +0 -0
  77. data/generators/admin_area_files/templates/public/images/textile-editor/h1.png +0 -0
  78. data/generators/admin_area_files/templates/public/images/textile-editor/h2.png +0 -0
  79. data/generators/admin_area_files/templates/public/images/textile-editor/h3.png +0 -0
  80. data/generators/admin_area_files/templates/public/images/textile-editor/h4.png +0 -0
  81. data/generators/admin_area_files/templates/public/images/textile-editor/h5.png +0 -0
  82. data/generators/admin_area_files/templates/public/images/textile-editor/h6.png +0 -0
  83. data/generators/admin_area_files/templates/public/images/textile-editor/indent.png +0 -0
  84. data/generators/admin_area_files/templates/public/images/textile-editor/italic.png +0 -0
  85. data/generators/admin_area_files/templates/public/images/textile-editor/justify.png +0 -0
  86. data/generators/admin_area_files/templates/public/images/textile-editor/left.png +0 -0
  87. data/generators/admin_area_files/templates/public/images/textile-editor/link.png +0 -0
  88. data/generators/admin_area_files/templates/public/images/textile-editor/list_bullets.png +0 -0
  89. data/generators/admin_area_files/templates/public/images/textile-editor/list_numbers.png +0 -0
  90. data/generators/admin_area_files/templates/public/images/textile-editor/omega.png +0 -0
  91. data/generators/admin_area_files/templates/public/images/textile-editor/outdent.png +0 -0
  92. data/generators/admin_area_files/templates/public/images/textile-editor/paragraph.png +0 -0
  93. data/generators/admin_area_files/templates/public/images/textile-editor/preview.png +0 -0
  94. data/generators/admin_area_files/templates/public/images/textile-editor/right.png +0 -0
  95. data/generators/admin_area_files/templates/public/images/textile-editor/strikethrough.png +0 -0
  96. data/generators/admin_area_files/templates/public/images/textile-editor/underline.png +0 -0
  97. data/generators/admin_area_files/templates/public/javascripts/admin/application.js +185 -0
  98. data/generators/admin_area_files/templates/public/javascripts/lightwindow.js +1921 -0
  99. data/generators/admin_area_files/templates/public/javascripts/textile-editor-config.js +107 -0
  100. data/generators/admin_area_files/templates/public/javascripts/textile-editor.js +788 -0
  101. data/generators/admin_area_files/templates/public/stylesheets/admin/handheld.css +6 -0
  102. data/generators/admin_area_files/templates/public/stylesheets/admin/ie.css +21 -0
  103. data/generators/admin_area_files/templates/public/stylesheets/admin/print.css +27 -0
  104. data/generators/admin_area_files/templates/public/stylesheets/admin/screen.css +996 -0
  105. data/generators/admin_area_files/templates/public/stylesheets/admin/theme-1.0.css +131 -0
  106. data/generators/admin_area_files/templates/public/stylesheets/lightwindow.css +376 -0
  107. data/generators/admin_area_files/templates/public/stylesheets/textile-editor.css +60 -0
  108. data/generators/admin_scaffold/USAGE +8 -0
  109. data/generators/admin_scaffold/admin_scaffold_generator.rb +53 -0
  110. data/generators/admin_scaffold/lib/insert_commands.rb +61 -0
  111. data/generators/admin_scaffold/templates/admin_controller.rb +83 -0
  112. data/generators/admin_scaffold/templates/admin_index.html.erb +38 -0
  113. data/generators/admin_scaffold/templates/admin_show.html.erb +16 -0
  114. data/generators/admin_scaffold/templates/helper.rb +2 -0
  115. data/generators/admin_scaffold/templates/helper_test.rb +4 -0
  116. data/generators/admin_scaffold/templates/layout.html.erb +17 -0
  117. data/generators/admin_scaffold/templates/style.css +54 -0
  118. data/generators/admin_scaffold/templates/view_controller.rb +14 -0
  119. data/generators/admin_scaffold/templates/view_index.html.erb +17 -0
  120. data/lib/admin_area.rb +82 -0
  121. data/rails/init.rb +4 -0
  122. data/test/admin_area_test.rb +7 -0
  123. data/test/test_helper.rb +10 -0
  124. metadata +206 -0
@@ -0,0 +1,60 @@
1
+ div.textile-toolbar span.ed_sep {
2
+ xposition: relative;
3
+ xtop: -4px;
4
+ padding: 0;
5
+ height: 6px;
6
+ width: 2px;
7
+ margin: 0 2px;
8
+ border-left: solid 1px #d5d5d5;
9
+ border-right: solid 1px #f5f5f5;
10
+ }
11
+
12
+ div.textile-toolbar button {
13
+ margin: 0;
14
+ background-color: #f0f0ee;
15
+ background-repeat: no-repeat;
16
+ border: 1px solid #f0f0ee;
17
+ padding: 2px 0;
18
+ }
19
+
20
+ div.textile-toolbar button.standard {
21
+ text-align: center;
22
+ width: 24px;
23
+ }
24
+
25
+ div.textile-toolbar button img {
26
+ vertical-align: text-bottom;
27
+ }
28
+
29
+ div.textile-toolbar button:hover,
30
+ div.textile-toolbar button.unselected:hover {
31
+ border: 1px solid #999;
32
+ }
33
+
34
+ div.textile-toolbar button.selected {
35
+ border: 1px solid #ce9100;
36
+ background-color: #ffffff;
37
+ }
38
+
39
+ div.textile-toolbar button.unselected {
40
+ border: 1px solid #f0f0ee;
41
+ background-color: #f0f0ee;
42
+ }
43
+
44
+ div.textile-toolbar button.publish {
45
+ padding:5px;
46
+ display:block;
47
+ }
48
+
49
+ div.textile-toolbar {
50
+ background-color: #f0f0ee;
51
+ padding: 3px;
52
+ margin-bottom: 4px;
53
+ }
54
+
55
+ div.preview-area {
56
+ background: #FFF;
57
+ border: 1px solid #666;
58
+ color: #666;
59
+ overflow: auto;
60
+ }
@@ -0,0 +1,8 @@
1
+ Description:
2
+ Explain the generator
3
+
4
+ Example:
5
+ ./script/generate content_node_scaffold Thing
6
+
7
+ This will create:
8
+ what/will/it/create
@@ -0,0 +1,53 @@
1
+ require File.expand_path(File.dirname(__FILE__) + "/lib/insert_commands.rb")
2
+
3
+ class AdminScaffoldGenerator < ScaffoldGenerator
4
+
5
+ def manifest
6
+ record do |m|
7
+ # Check for class naming collisions.
8
+ m.class_collisions("#{controller_class_name}Controller", "Admin::#{controller_class_name}Controller", "#{controller_class_name}Helper")
9
+ m.class_collisions(class_name)
10
+
11
+ # Controller, helper, views, test and stylesheets directories.
12
+ m.directory(File.join('app/models', class_path))
13
+ m.directory(File.join('app/controllers', controller_class_path))
14
+ m.directory(File.join('app/controllers/admin', controller_class_path))
15
+ m.directory(File.join('app/helpers', controller_class_path))
16
+ m.directory(File.join('app/views', controller_class_path, controller_file_name))
17
+ m.directory(File.join('app/views/admin', controller_class_path, controller_file_name))
18
+ m.directory(File.join('app/views/layouts', controller_class_path))
19
+ m.directory(File.join('test/unit', class_path))
20
+ m.directory(File.join('test/unit/helpers', class_path))
21
+ m.directory(File.join('public/stylesheets', class_path))
22
+
23
+ for action in ['index', 'show']
24
+ m.template(
25
+ "admin_#{action}.html.erb",
26
+ File.join('app/views/admin', controller_class_path, controller_file_name, "#{action}.html.erb")
27
+ )
28
+ end
29
+
30
+ m.template(
31
+ "view_index.html.erb",
32
+ File.join('app/views/admin', controller_class_path, controller_file_name, "view.html.erb")
33
+ )
34
+
35
+
36
+ m.template(
37
+ 'view_controller.rb', File.join('app/controllers', controller_class_path, "#{controller_file_name}_controller.rb")
38
+ )
39
+ m.template(
40
+ 'admin_controller.rb', File.join('app/controllers/admin', controller_class_path, "#{controller_file_name}_controller.rb")
41
+ )
42
+
43
+ m.template('helper.rb', File.join('app/helpers', controller_class_path, "#{controller_file_name}_helper.rb"))
44
+ m.template('helper_test.rb', File.join('test/unit/helpers', controller_class_path, "#{controller_file_name}_helper_test.rb"))
45
+
46
+ m.route_resources controller_file_name
47
+ m.route_resources_to_namespace('admin', controller_file_name)
48
+
49
+ m.dependency 'model', [name, '--skip-fixture'] + @args, :collision => :skip
50
+ end
51
+ end
52
+
53
+ end
@@ -0,0 +1,61 @@
1
+ # Mostly pinched from http://github.com/ryanb/nifty-generators/tree/master
2
+ Rails::Generator::Commands::Base.class_eval do
3
+ def file_contains?(relative_destination, line)
4
+ File.read(destination_path(relative_destination)).include?(line)
5
+ end
6
+ end
7
+
8
+ Rails::Generator::Commands::Create.class_eval do
9
+
10
+ def route_resources_to_namespace(namespace, resource_list)
11
+ sentinel = 'ActionController::Routing::Routes.draw do |map|'
12
+
13
+ namespace_map = "map.namespace(:#{namespace}) do |#{namespace}|"
14
+ logger.route namespace_map
15
+ unless options[:pretend] || file_contains?('config/routes.rb', namespace_map)
16
+ gsub_file 'config/routes.rb', /(#{Regexp.escape(sentinel)})/mi do |match|
17
+ "#{match}\n #{namespace_map}\n end"
18
+ end
19
+ end
20
+
21
+ namespace_route = "#{namespace}.resources :#{resource_list}"
22
+
23
+ logger.route namespace_route
24
+ unless options[:pretend] || file_contains?('config/routes.rb', namespace_route)
25
+ gsub_file 'config/routes.rb', /(#{Regexp.escape(namespace_map)})/mi do |match|
26
+ "#{match}\n #{namespace_route}"
27
+ end
28
+ end
29
+ end
30
+
31
+ end
32
+
33
+ Rails::Generator::Commands::Destroy.class_eval do
34
+
35
+ def route_resources_to_namespace(namespace, resource_list)
36
+ # do ni
37
+ end
38
+
39
+ def insert_into(file, line)
40
+ logger.remove "#{line} from #{file}"
41
+ unless options[:pretend]
42
+ gsub_file file, "\n #{line}", ''
43
+ end
44
+ end
45
+
46
+ end
47
+
48
+ Rails::Generator::Commands::List.class_eval do
49
+
50
+ def route_resources_to_namespace(namespace, resource_list)
51
+ namespace_map = "map.namespace(:#{namespace}) do |#{namespace}|"
52
+ logger.route namespace_map
53
+ namespace_route = "#{namespace}.resources :#{resource_list}"
54
+ logger.route namespace_route
55
+ end
56
+
57
+ def insert_into(file, line)
58
+ logger.insert "#{line} into #{file}"
59
+ end
60
+
61
+ end
@@ -0,0 +1,83 @@
1
+ class Admin::<%= controller_class_name %>Controller < Admin::BaseController
2
+ sortable_attributes :<%= attributes.collect{|a| a.name}.join(', :') %>
3
+
4
+ # GET /<%= table_name %>
5
+ # GET /<%= table_name %>.xml
6
+ def index
7
+ @<%= table_name %> = <%= class_name %>.paginate :page => params[:page], :order => sort_order
8
+
9
+ respond_to do |format|
10
+ format.html # index.html.erb
11
+ format.xml { render :xml => @<%= table_name %> }
12
+ end
13
+ end
14
+
15
+ # GET /<%= table_name %>/1
16
+ # GET /<%= table_name %>/1.xml
17
+ def show
18
+ @<%= file_name %> = <%= class_name %>.find(params[:id])
19
+
20
+ respond_to do |format|
21
+ format.html
22
+ format.xml { render :xml => @<%= file_name %> }
23
+ end
24
+ end
25
+
26
+ # GET /<%= table_name %>/new
27
+ # GET /<%= table_name %>/new.xml
28
+ def new
29
+ @<%= file_name %> = <%= class_name %>.new
30
+
31
+ respond_to do |format|
32
+ format.html { render :action =>'show' }
33
+ format.xml { render :xml => @<%= file_name %> }
34
+ end
35
+ end
36
+
37
+ # POST /<%= table_name %>
38
+ # POST /<%= table_name %>.xml
39
+ def create
40
+ @<%= file_name %> = <%= class_name %>.new(params[:<%= file_name %>])
41
+
42
+ respond_to do |format|
43
+ if @<%= file_name %>.save
44
+ flash[:notice] = '<%= class_name %> was successfully created.'
45
+ format.html { redirect_to(admin_<%= table_name %>_url) }
46
+ format.xml { render :xml => @<%= file_name %>, :status => :created, :location => @<%= file_name %> }
47
+ else
48
+ format.html { render :action => "new" }
49
+ format.xml { render :xml => @<%= file_name %>.errors, :status => :unprocessable_entity }
50
+ end
51
+ end
52
+ end
53
+
54
+ # PUT /<%= table_name %>/1
55
+ # PUT /<%= table_name %>/1.xml
56
+ def update
57
+ @<%= file_name %> = <%= class_name %>.find(params[:id])
58
+
59
+ respond_to do |format|
60
+ if @<%= file_name %>.update_attributes(params[:<%= file_name %>])
61
+ flash[:notice] = '<%= class_name %> was successfully updated.'
62
+ format.html { redirect_to(admin_<%= table_name %>_url) }
63
+ format.xml { head :ok }
64
+ else
65
+ format.html { render :action => "edit" }
66
+ format.xml { render :xml => @<%= file_name %>.errors, :status => :unprocessable_entity }
67
+ end
68
+ end
69
+ end
70
+
71
+ # DELETE /<%= table_name %>/1
72
+ # DELETE /<%= table_name %>/1.xml
73
+ def destroy
74
+ @<%= file_name %> = <%= class_name %>.find(params[:id])
75
+ @<%= file_name %>.destroy
76
+ flash[:notice] = '<%= class_name %> was successfully deleted.'
77
+
78
+ respond_to do |format|
79
+ format.html { redirect_to(admin_<%= table_name %>_url) }
80
+ format.xml { head :ok }
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,38 @@
1
+ <h1>Listing <%= plural_name %></h1>
2
+
3
+ <ul class="choices">
4
+ <li><%%= link_to 'New <%= singular_name %>', new_admin_<%= singular_name %>_path %></li>
5
+ </ul>
6
+
7
+ <table>
8
+ <thead>
9
+ <tr>
10
+ <% for attribute in attributes -%>
11
+ <%%= sortable_table_header :name => "<%= attribute.column.human_name %>", :sort => "<%= attribute.name %>" %>
12
+ <% end -%>
13
+ </tr>
14
+ <th colspan="2">Actions</th>
15
+ </thead>
16
+ <tbody>
17
+ <%% @<%= plural_name %>.each do |<%= singular_name %>| %>
18
+ <tr id="<%= singular_name %>-<%%= <%= singular_name %>.id %>">
19
+ <% for attribute in attributes -%>
20
+ <% if attribute == attributes.first -%>
21
+ <td><%%= link_to <%= singular_name %>.<%= attribute.name %>, admin_<%= singular_name %>_path(<%= singular_name %>) %></td>
22
+ <% else -%>
23
+ <td><%%=h <%= singular_name %>.<%= attribute.name %> %></td>
24
+ <% end -%>
25
+ <% end -%>
26
+ <td><%%= link_to 'Edit', admin_<%= singular_name %>_path(<%= singular_name %>), :class => 'edit' %></td>
27
+ <td><%%= link_to 'Destroy', admin_<%= singular_name %>_path(<%= singular_name %>), :confirm => 'Are you sure?', :method => :delete, :class => 'delete' %></td>
28
+ </tr>
29
+ <%% end %>
30
+ </tbody>
31
+ <tfoot>
32
+ <tr>
33
+ <% for attribute in attributes -%>
34
+ <%%= sortable_table_header :name => "<%= attribute.column.human_name %>", :sort => "<%= attribute.name %>" %>
35
+ <% end -%>
36
+ </tr>
37
+ </tfoot>
38
+ </table>
@@ -0,0 +1,16 @@
1
+ <h1><%%= @<%= singular_name %>.new_record? ? 'New' : 'Editing' %> <%= singular_name %></h1>
2
+
3
+ <%% form_for([:admin, @<%= singular_name %>]) do |f| %>
4
+ <%%= f.error_messages %>
5
+
6
+ <% for attribute in attributes -%>
7
+ <p>
8
+ <%%= f.label :<%= attribute.name %> %><br />
9
+ <%%= f.<%= attribute.field_type %> :<%= attribute.name %> %>
10
+ </p>
11
+ <% end -%>
12
+ <p class="submission">
13
+ <%%= f.submit @<%= singular_name %>.new_record? ? 'Create' : 'Update', :disable_with => 'Submitting...' %> or <%%= link_to 'Back', admin_<%= plural_name %>_path %>
14
+ </p>
15
+ <%% end %>
16
+
@@ -0,0 +1,2 @@
1
+ module <%= controller_class_name %>Helper
2
+ end
@@ -0,0 +1,4 @@
1
+ require 'test_helper'
2
+
3
+ class <%= controller_class_name %>HelperTest < ActionView::TestCase
4
+ end
@@ -0,0 +1,17 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+
4
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
+ <head>
6
+ <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
7
+ <title><%= controller_class_name %>: <%%= controller.action_name %></title>
8
+ <%%= stylesheet_link_tag 'scaffold' %>
9
+ </head>
10
+ <body>
11
+
12
+ <p style="color: green"><%%= flash[:notice] %></p>
13
+
14
+ <%%= yield %>
15
+
16
+ </body>
17
+ </html>
@@ -0,0 +1,54 @@
1
+ body { background-color: #fff; color: #333; }
2
+
3
+ body, p, ol, ul, td {
4
+ font-family: verdana, arial, helvetica, sans-serif;
5
+ font-size: 13px;
6
+ line-height: 18px;
7
+ }
8
+
9
+ pre {
10
+ background-color: #eee;
11
+ padding: 10px;
12
+ font-size: 11px;
13
+ }
14
+
15
+ a { color: #000; }
16
+ a:visited { color: #666; }
17
+ a:hover { color: #fff; background-color:#000; }
18
+
19
+ .fieldWithErrors {
20
+ padding: 2px;
21
+ background-color: red;
22
+ display: table;
23
+ }
24
+
25
+ #errorExplanation {
26
+ width: 400px;
27
+ border: 2px solid red;
28
+ padding: 7px;
29
+ padding-bottom: 12px;
30
+ margin-bottom: 20px;
31
+ background-color: #f0f0f0;
32
+ }
33
+
34
+ #errorExplanation h2 {
35
+ text-align: left;
36
+ font-weight: bold;
37
+ padding: 5px 5px 5px 15px;
38
+ font-size: 12px;
39
+ margin: -7px;
40
+ background-color: #c00;
41
+ color: #fff;
42
+ }
43
+
44
+ #errorExplanation p {
45
+ color: #333;
46
+ margin-bottom: 0;
47
+ padding: 5px;
48
+ }
49
+
50
+ #errorExplanation ul li {
51
+ font-size: 12px;
52
+ list-style: square;
53
+ }
54
+
@@ -0,0 +1,14 @@
1
+ class <%= controller_class_name %>Controller < ApplicationController
2
+ # GET /<%= table_name %>
3
+ # GET /<%= table_name %>.xml
4
+ def index
5
+ @<%= table_name %> = <%= class_name %>.all
6
+
7
+ respond_to do |format|
8
+ format.html # index.html.erb
9
+ format.xml { render :xml => @<%= table_name %> }
10
+ format.json { render :json => @<%= table_name %> }
11
+ end
12
+ end
13
+
14
+ end
@@ -0,0 +1,17 @@
1
+ <h1>Listing <%= plural_name %></h1>
2
+
3
+ <table>
4
+ <tr>
5
+ <% for attribute in attributes -%>
6
+ <th><%= attribute.column.human_name %></th>
7
+ <% end -%>
8
+ </tr>
9
+
10
+ <%% @<%= plural_name %>.each do |<%= singular_name %>| %>
11
+ <tr>
12
+ <% for attribute in attributes -%>
13
+ <td><%%=h <%= singular_name %>.<%= attribute.name %> %></td>
14
+ <% end -%>
15
+ </tr>
16
+ <%% end %>
17
+ </table>