base_rails_app 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (194) hide show
  1. data/LICENSE +1 -0
  2. data/README +1 -0
  3. data/lib/app/controllers/application_controller.rb +55 -0
  4. data/lib/app/controllers/password_resets_controller.rb +45 -0
  5. data/lib/app/controllers/user_sessions_controller.rb +25 -0
  6. data/lib/app/controllers/users_controller.rb +37 -0
  7. data/lib/app/helpers/application_helper.rb +4 -0
  8. data/lib/app/helpers/user_sessions_helper.rb +2 -0
  9. data/lib/app/helpers/users_helper.rb +2 -0
  10. data/lib/app/models/postman.rb +20 -0
  11. data/lib/app/models/user.rb +12 -0
  12. data/lib/app/models/user_session.rb +2 -0
  13. data/lib/app/views/application/404_not_found.html.erb +8 -0
  14. data/lib/app/views/layouts/application.html.erb +57 -0
  15. data/lib/app/views/password_resets/_sidebar.html.erb +0 -0
  16. data/lib/app/views/password_resets/edit.html.erb +33 -0
  17. data/lib/app/views/password_resets/new.html.erb +26 -0
  18. data/lib/app/views/postman/password_reset_instructions.html.erb +3 -0
  19. data/lib/app/views/postman/welcome_email.html.erb +3 -0
  20. data/lib/app/views/user_sessions/_form.html.erb +19 -0
  21. data/lib/app/views/user_sessions/_sidebar.html.erb +13 -0
  22. data/lib/app/views/user_sessions/new.html.erb +15 -0
  23. data/lib/app/views/users/_form.html.erb +28 -0
  24. data/lib/app/views/users/_sidebar.html.erb +6 -0
  25. data/lib/app/views/users/edit.html.erb +19 -0
  26. data/lib/app/views/users/new.html.erb +15 -0
  27. data/lib/app/views/users/show.html.erb +46 -0
  28. data/lib/base_rails_app.rb +5 -0
  29. data/lib/base_rails_app/boot.rb +2 -0
  30. data/lib/base_rails_app/tasks.rb +12 -0
  31. data/lib/config/configatron/cucumber.rb +0 -0
  32. data/lib/config/configatron/defaults.rb +4 -0
  33. data/lib/config/configatron/development.rb +1 -0
  34. data/lib/config/configatron/production.rb +0 -0
  35. data/lib/config/configatron/test.rb +0 -0
  36. data/lib/config/database.yml +25 -0
  37. data/lib/config/deploy.rb +15 -0
  38. data/lib/config/environments/cucumber.rb +22 -0
  39. data/lib/config/environments/development.rb +17 -0
  40. data/lib/config/environments/production.rb +28 -0
  41. data/lib/config/environments/test.rb +28 -0
  42. data/lib/config/gemtronics.rb +36 -0
  43. data/lib/config/initializers/backtrace_silencers.rb +7 -0
  44. data/lib/config/initializers/configatron.rb +1 -0
  45. data/lib/config/initializers/hoptoad.rb +3 -0
  46. data/lib/config/initializers/inflections.rb +10 -0
  47. data/lib/config/initializers/mailers.rb +1 -0
  48. data/lib/config/initializers/mime_types.rb +5 -0
  49. data/lib/config/initializers/new_rails_defaults.rb +21 -0
  50. data/lib/config/initializers/session_store.rb +17 -0
  51. data/lib/config/locales/en.yml +5 -0
  52. data/lib/config/routes.rb +51 -0
  53. data/lib/config/schedule.rb +20 -0
  54. data/lib/db/migrate/20090809175903_create_users.rb +30 -0
  55. data/lib/db/migrate/20090809204840_acts_as_taggable_on_migration.rb +29 -0
  56. data/lib/db/migrate/20090912171353_create_delayed_jobs.rb +20 -0
  57. data/lib/db/migrate/20090912171829_add_delayed_job_extras.rb +11 -0
  58. data/lib/db/migrate/20090929201455_add_more_time_columns_to_dj.rb +11 -0
  59. data/lib/db/schema.rb +72 -0
  60. data/lib/db/seeds.rb +7 -0
  61. data/lib/lib/tasks/cucumber.rake +36 -0
  62. data/lib/lib/tasks/rcov.rake +27 -0
  63. data/lib/lib/tasks/rspec.rake +183 -0
  64. data/lib/vendor/plugins/delayed_job/generators/delayed_job/delayed_job_generator.rb +22 -0
  65. data/lib/vendor/plugins/delayed_job/generators/delayed_job/templates/migration.rb +20 -0
  66. data/lib/vendor/plugins/delayed_job/init.rb +2 -0
  67. data/lib/vendor/plugins/delayed_job/lib/delayed/command.rb +65 -0
  68. data/lib/vendor/plugins/delayed_job/lib/delayed/job.rb +271 -0
  69. data/lib/vendor/plugins/delayed_job/lib/delayed/message_sending.rb +18 -0
  70. data/lib/vendor/plugins/delayed_job/lib/delayed/performable_method.rb +55 -0
  71. data/lib/vendor/plugins/delayed_job/lib/delayed/tasks.rb +15 -0
  72. data/lib/vendor/plugins/delayed_job/lib/delayed/worker.rb +54 -0
  73. data/lib/vendor/plugins/delayed_job/lib/delayed_job.rb +13 -0
  74. data/lib/vendor/plugins/delayed_job/recipes/delayed_job.rb +26 -0
  75. data/lib/vendor/plugins/delayed_job/tasks/jobs.rake +1 -0
  76. data/lib/vendor/plugins/hoptoad_notifier/install.rb +1 -0
  77. data/lib/vendor/plugins/hoptoad_notifier/lib/hoptoad_notifier.rb +418 -0
  78. data/lib/vendor/plugins/hoptoad_notifier/lib/hoptoad_tasks.rb +26 -0
  79. data/lib/vendor/plugins/hoptoad_notifier/recipes/hoptoad.rb +22 -0
  80. data/lib/vendor/plugins/hoptoad_notifier/tasks/hoptoad_notifier_tasks.rake +66 -0
  81. data/lib/vendor/plugins/inherited_resources/README.rdoc +524 -0
  82. data/lib/vendor/plugins/inherited_resources/inherited_resources.gemspec +71 -0
  83. data/lib/vendor/plugins/inherited_resources/init.rb +1 -0
  84. data/lib/vendor/plugins/inherited_resources/lib/inherited_resources.rb +23 -0
  85. data/lib/vendor/plugins/inherited_resources/lib/inherited_resources/actions.rb +79 -0
  86. data/lib/vendor/plugins/inherited_resources/lib/inherited_resources/base.rb +42 -0
  87. data/lib/vendor/plugins/inherited_resources/lib/inherited_resources/base_helpers.rb +363 -0
  88. data/lib/vendor/plugins/inherited_resources/lib/inherited_resources/belongs_to_helpers.rb +89 -0
  89. data/lib/vendor/plugins/inherited_resources/lib/inherited_resources/class_methods.rb +338 -0
  90. data/lib/vendor/plugins/inherited_resources/lib/inherited_resources/dsl.rb +26 -0
  91. data/lib/vendor/plugins/inherited_resources/lib/inherited_resources/dumb_responder.rb +20 -0
  92. data/lib/vendor/plugins/inherited_resources/lib/inherited_resources/has_scope_helpers.rb +83 -0
  93. data/lib/vendor/plugins/inherited_resources/lib/inherited_resources/legacy/respond_to.rb +156 -0
  94. data/lib/vendor/plugins/inherited_resources/lib/inherited_resources/legacy/responder.rb +200 -0
  95. data/lib/vendor/plugins/inherited_resources/lib/inherited_resources/polymorphic_helpers.rb +155 -0
  96. data/lib/vendor/plugins/inherited_resources/lib/inherited_resources/singleton_helpers.rb +95 -0
  97. data/lib/vendor/plugins/inherited_resources/lib/inherited_resources/url_helpers.rb +179 -0
  98. data/lib/vendor/plugins/inherited_resources/test/aliases_test.rb +139 -0
  99. data/lib/vendor/plugins/inherited_resources/test/association_chain_test.rb +125 -0
  100. data/lib/vendor/plugins/inherited_resources/test/base_test.rb +225 -0
  101. data/lib/vendor/plugins/inherited_resources/test/belongs_to_test.rb +87 -0
  102. data/lib/vendor/plugins/inherited_resources/test/class_methods_test.rb +138 -0
  103. data/lib/vendor/plugins/inherited_resources/test/customized_base_test.rb +162 -0
  104. data/lib/vendor/plugins/inherited_resources/test/customized_belongs_to_test.rb +76 -0
  105. data/lib/vendor/plugins/inherited_resources/test/defaults_test.rb +70 -0
  106. data/lib/vendor/plugins/inherited_resources/test/flash_test.rb +88 -0
  107. data/lib/vendor/plugins/inherited_resources/test/has_scope_test.rb +139 -0
  108. data/lib/vendor/plugins/inherited_resources/test/locales/en.yml +17 -0
  109. data/lib/vendor/plugins/inherited_resources/test/nested_belongs_to_test.rb +108 -0
  110. data/lib/vendor/plugins/inherited_resources/test/optional_belongs_to_test.rb +164 -0
  111. data/lib/vendor/plugins/inherited_resources/test/polymorphic_test.rb +186 -0
  112. data/lib/vendor/plugins/inherited_resources/test/redirect_to_test.rb +51 -0
  113. data/lib/vendor/plugins/inherited_resources/test/respond_to_test.rb +155 -0
  114. data/lib/vendor/plugins/inherited_resources/test/singleton_test.rb +83 -0
  115. data/lib/vendor/plugins/inherited_resources/test/test_helper.rb +38 -0
  116. data/lib/vendor/plugins/inherited_resources/test/url_helpers_test.rb +537 -0
  117. data/lib/vendor/plugins/inherited_resources/test/views/cars/edit.html.erb +1 -0
  118. data/lib/vendor/plugins/inherited_resources/test/views/cars/index.html.erb +1 -0
  119. data/lib/vendor/plugins/inherited_resources/test/views/cars/new.html.erb +1 -0
  120. data/lib/vendor/plugins/inherited_resources/test/views/cars/show.html.erb +1 -0
  121. data/lib/vendor/plugins/inherited_resources/test/views/cities/edit.html.erb +1 -0
  122. data/lib/vendor/plugins/inherited_resources/test/views/cities/index.html.erb +1 -0
  123. data/lib/vendor/plugins/inherited_resources/test/views/cities/new.html.erb +1 -0
  124. data/lib/vendor/plugins/inherited_resources/test/views/cities/show.html.erb +1 -0
  125. data/lib/vendor/plugins/inherited_resources/test/views/comments/edit.html.erb +1 -0
  126. data/lib/vendor/plugins/inherited_resources/test/views/comments/index.html.erb +1 -0
  127. data/lib/vendor/plugins/inherited_resources/test/views/comments/new.html.erb +1 -0
  128. data/lib/vendor/plugins/inherited_resources/test/views/comments/show.html.erb +1 -0
  129. data/lib/vendor/plugins/inherited_resources/test/views/employees/edit.html.erb +1 -0
  130. data/lib/vendor/plugins/inherited_resources/test/views/employees/index.html.erb +1 -0
  131. data/lib/vendor/plugins/inherited_resources/test/views/employees/new.html.erb +1 -0
  132. data/lib/vendor/plugins/inherited_resources/test/views/employees/show.html.erb +1 -0
  133. data/lib/vendor/plugins/inherited_resources/test/views/managers/edit.html.erb +1 -0
  134. data/lib/vendor/plugins/inherited_resources/test/views/managers/new.html.erb +1 -0
  135. data/lib/vendor/plugins/inherited_resources/test/views/managers/show.html.erb +1 -0
  136. data/lib/vendor/plugins/inherited_resources/test/views/painters/edit.html.erb +1 -0
  137. data/lib/vendor/plugins/inherited_resources/test/views/painters/index.html.erb +1 -0
  138. data/lib/vendor/plugins/inherited_resources/test/views/painters/new.html.erb +1 -0
  139. data/lib/vendor/plugins/inherited_resources/test/views/painters/show.html.erb +1 -0
  140. data/lib/vendor/plugins/inherited_resources/test/views/pets/edit.html.erb +1 -0
  141. data/lib/vendor/plugins/inherited_resources/test/views/pets/index.html.erb +1 -0
  142. data/lib/vendor/plugins/inherited_resources/test/views/pets/new.html.erb +1 -0
  143. data/lib/vendor/plugins/inherited_resources/test/views/pets/show.html.erb +1 -0
  144. data/lib/vendor/plugins/inherited_resources/test/views/products/edit.html.erb +1 -0
  145. data/lib/vendor/plugins/inherited_resources/test/views/products/index.html.erb +1 -0
  146. data/lib/vendor/plugins/inherited_resources/test/views/products/new.html.erb +1 -0
  147. data/lib/vendor/plugins/inherited_resources/test/views/products/show.html.erb +1 -0
  148. data/lib/vendor/plugins/inherited_resources/test/views/professors/edit.html.erb +1 -0
  149. data/lib/vendor/plugins/inherited_resources/test/views/professors/index.html.erb +1 -0
  150. data/lib/vendor/plugins/inherited_resources/test/views/professors/new.html.erb +1 -0
  151. data/lib/vendor/plugins/inherited_resources/test/views/professors/show.html.erb +1 -0
  152. data/lib/vendor/plugins/inherited_resources/test/views/projects/index.html.erb +1 -0
  153. data/lib/vendor/plugins/inherited_resources/test/views/projects/index.json.erb +1 -0
  154. data/lib/vendor/plugins/inherited_resources/test/views/projects/respond_to_skip_default_template.html.erb +1 -0
  155. data/lib/vendor/plugins/inherited_resources/test/views/projects/respond_with_resource.html.erb +1 -0
  156. data/lib/vendor/plugins/inherited_resources/test/views/students/edit.html.erb +1 -0
  157. data/lib/vendor/plugins/inherited_resources/test/views/students/new.html.erb +1 -0
  158. data/lib/vendor/plugins/inherited_resources/test/views/trees/edit.html.erb +1 -0
  159. data/lib/vendor/plugins/inherited_resources/test/views/trees/index.html.erb +1 -0
  160. data/lib/vendor/plugins/inherited_resources/test/views/trees/new.html.erb +1 -0
  161. data/lib/vendor/plugins/inherited_resources/test/views/trees/show.html.erb +1 -0
  162. data/lib/vendor/plugins/inherited_resources/test/views/users/edit.html.erb +1 -0
  163. data/lib/vendor/plugins/inherited_resources/test/views/users/index.html.erb +1 -0
  164. data/lib/vendor/plugins/inherited_resources/test/views/users/new.html.erb +1 -0
  165. data/lib/vendor/plugins/inherited_resources/test/views/users/show.html.erb +1 -0
  166. data/lib/vendor/plugins/web-app-theme/README.md +22 -0
  167. data/lib/vendor/plugins/web-app-theme/images/avatar.png +0 -0
  168. data/lib/vendor/plugins/web-app-theme/index.html +473 -0
  169. data/lib/vendor/plugins/web-app-theme/javascripts/jquery-1.3.min.js +19 -0
  170. data/lib/vendor/plugins/web-app-theme/javascripts/jquery.localscroll.js +104 -0
  171. data/lib/vendor/plugins/web-app-theme/javascripts/jquery.scrollTo.js +150 -0
  172. data/lib/vendor/plugins/web-app-theme/rails_generators/theme/templates/view_layout_administration.html.erb +48 -0
  173. data/lib/vendor/plugins/web-app-theme/rails_generators/theme/templates/view_layout_sign.html.erb +15 -0
  174. data/lib/vendor/plugins/web-app-theme/rails_generators/theme/theme_generator.rb +38 -0
  175. data/lib/vendor/plugins/web-app-theme/rails_generators/themed/templates/view_edit.html.erb +20 -0
  176. data/lib/vendor/plugins/web-app-theme/rails_generators/themed/templates/view_form.html.erb +10 -0
  177. data/lib/vendor/plugins/web-app-theme/rails_generators/themed/templates/view_new.html.erb +19 -0
  178. data/lib/vendor/plugins/web-app-theme/rails_generators/themed/templates/view_show.html.erb +23 -0
  179. data/lib/vendor/plugins/web-app-theme/rails_generators/themed/templates/view_sidebar.html.erb +13 -0
  180. data/lib/vendor/plugins/web-app-theme/rails_generators/themed/templates/view_signin.html.erb +39 -0
  181. data/lib/vendor/plugins/web-app-theme/rails_generators/themed/templates/view_signup.html.erb +56 -0
  182. data/lib/vendor/plugins/web-app-theme/rails_generators/themed/templates/view_tables.html.erb +50 -0
  183. data/lib/vendor/plugins/web-app-theme/rails_generators/themed/themed_generator.rb +89 -0
  184. data/lib/vendor/plugins/web-app-theme/stylesheets/base.css +336 -0
  185. data/lib/vendor/plugins/web-app-theme/stylesheets/themes/bec-green/style.css +290 -0
  186. data/lib/vendor/plugins/web-app-theme/stylesheets/themes/bec/style.css +301 -0
  187. data/lib/vendor/plugins/web-app-theme/stylesheets/themes/blue/style.css +280 -0
  188. data/lib/vendor/plugins/web-app-theme/stylesheets/themes/default/style.css +267 -0
  189. data/lib/vendor/plugins/web-app-theme/stylesheets/themes/djime-cerulean/style.css +298 -0
  190. data/lib/vendor/plugins/web-app-theme/stylesheets/themes/drastic-dark/style.css +373 -0
  191. data/lib/vendor/plugins/web-app-theme/stylesheets/themes/kathleene/style.css +272 -0
  192. data/lib/vendor/plugins/web-app-theme/stylesheets/themes/orange/style.css +263 -0
  193. data/lib/vendor/plugins/web-app-theme/stylesheets/themes/reidb-greenish/style.css +301 -0
  194. metadata +257 -0
@@ -0,0 +1,13 @@
1
+ <div class="block">
2
+ <h3>Simple Block</h3>
3
+ <div class="content">
4
+ <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
5
+ </div>
6
+ </div>
7
+ <div class="block">
8
+ <h3>Links</h3>
9
+ <ul class="navigation">
10
+ <li><a href="#">Link 1</a></li>
11
+ <li><a href="#">Link 2</a></li>
12
+ </ul>
13
+ </div>
@@ -0,0 +1,39 @@
1
+ <h1><%= options[:app_name] %></h1>
2
+ <div class="block" id="block-login">
3
+ <h2>Login Box</h2>
4
+ <div class="content login">
5
+ <div class="flash">
6
+ <%% flash.each do |type, message| -%>
7
+ <div class="message <%%= type %>">
8
+ <p><%%= message %></p>
9
+ </div>
10
+ <%% end -%>
11
+ </div>
12
+ <%% form_tag({:action => :create}, :class => 'form login') do -%>
13
+ <div class="group">
14
+ <div class="left">
15
+ <label class="label right">Login</label>
16
+ </div>
17
+ <div class="right">
18
+ <%%= text_field_tag :login, @login, :class => 'text_field' %>
19
+ </div>
20
+ <div class="clear"></div>
21
+ </div>
22
+ <div class="group">
23
+ <div class="left">
24
+ <label class="label right">Password</label>
25
+ </div>
26
+ <div class="right">
27
+ <%%= password_field_tag :password, nil, :class => 'text_field' %>
28
+ </div>
29
+ <div class="clear"></div>
30
+ </div>
31
+ <div class="group navform">
32
+ <div class="right">
33
+ <input type="submit" class="button" value="Sign in" />
34
+ </div>
35
+ <div class="clear"></div>
36
+ </div>
37
+ <%% end -%>
38
+ </div>
39
+ </div>
@@ -0,0 +1,56 @@
1
+ <h1><%= options[:app_name] %></h1>
2
+ <div class="block" id="block-signup">
3
+ <h2>Sign up</h2>
4
+ <div class="content">
5
+ <div class="flash">
6
+ <%% flash.each do |type, message| -%>
7
+ <div class="message <%%= type %>">
8
+ <p><%%= message %></p>
9
+ </div>
10
+ <%% end -%>
11
+ </div>
12
+ <%% form_for :<%= resource_name %>, :url => <%= controller_routing_path %>_path, :html => { :class => 'form' } do |f| -%>
13
+ <div class="group">
14
+ <div class="left">
15
+ <label class="label">Login</label>
16
+ </div>
17
+ <div class="right">
18
+ <%%= f.text_field :login, :class => 'text_field' %>
19
+ </div>
20
+ <div class="clear"></div>
21
+ </div>
22
+ <div class="group">
23
+ <div class="left">
24
+ <label class="label">Email</label>
25
+ </div>
26
+ <div class="right">
27
+ <%%= f.text_field :email, :class => 'text_field' %>
28
+ </div>
29
+ <div class="clear"></div>
30
+ </div>
31
+ <div class="group">
32
+ <div class="left">
33
+ <label class="label">Password</label>
34
+ </div>
35
+ <div class="right">
36
+ <%%= f.password_field :password, :class => 'text_field' %>
37
+ </div>
38
+ <div class="clear"></div>
39
+ </div>
40
+
41
+ <div class="group">
42
+ <div class="left">
43
+ <label class="label">Password</label>
44
+ </div>
45
+ <div class="right">
46
+ <%%= f.password_field :password_confirmation, :class => 'text_field' %>
47
+ </div>
48
+ <div class="clear"></div>
49
+ </div>
50
+
51
+ <div class="group navform">
52
+ <input type="submit" class="button" value="Sign up" />
53
+ </div>
54
+ <%% end -%>
55
+ </div>
56
+ </div>
@@ -0,0 +1,50 @@
1
+ <div class="block">
2
+ <div class="secondary-navigation">
3
+ <ul>
4
+ <li class="first active"><%%= link_to 'List', <%= controller_routing_path %>_path %></li>
5
+ <li><%%= link_to 'New', new_<%= singular_controller_routing_path %>_path %></li>
6
+ </ul>
7
+ <div class="clear"></div>
8
+ </div>
9
+ <div class="content">
10
+ <h2 class="title">All <%= plural_model_name %></h2>
11
+ <div class="inner">
12
+ <table class="table">
13
+ <tr>
14
+ <th class="first">ID</th>
15
+ <th><%= columns.first.name.capitalize %></th>
16
+ <th>Created at</th>
17
+ <th class="last">&nbsp;</th>
18
+ </tr>
19
+ <%% @<%= plural_resource_name %>.each do |<%= resource_name %>| -%>
20
+ <tr>
21
+ <td>
22
+ <%%= <%= resource_name %>.id %>
23
+ </td>
24
+ <td>
25
+ <%%= link_to <%= resource_name %>.<%= columns.first.name %>, <%= singular_controller_routing_path %>_path(<%= resource_name %>) %>
26
+ </td>
27
+ <td>
28
+ <%%= <%= resource_name %>.created_at %>
29
+ </td>
30
+ <td class="last">
31
+ <%%= link_to 'show', <%= singular_controller_routing_path %>_path(<%= resource_name %>) %> |
32
+ <%%= link_to 'edit', edit_<%= singular_controller_routing_path %>_path(<%= resource_name %>) %> |
33
+ <%%= link_to 'destroy', <%= singular_controller_routing_path %>_path(<%= resource_name %>), :method => :delete, :confirm => 'Are you sure?' %>
34
+ </td>
35
+ </tr>
36
+ <%% end -%>
37
+ </table>
38
+ <div class="actions-bar">
39
+ <div class="actions">
40
+ </div>
41
+ <% if options[:will_paginate] %>
42
+ <%%= will_paginate @<%= resource_name %> %>
43
+ <% end %>
44
+ <div class="clear"></div>
45
+ </div>
46
+ </div>
47
+ </div>
48
+ </div>
49
+
50
+ <%% content_for :sidebar, render(:partial => 'sidebar') -%>
@@ -0,0 +1,89 @@
1
+ class ThemedGenerator < Rails::Generator::NamedBase
2
+
3
+ default_options :app_name => 'Web App',
4
+ :themed_type => :crud,
5
+ :layout => false,
6
+ :will_paginate => false
7
+
8
+ attr_reader :controller_routing_path,
9
+ :singular_controller_routing_path,
10
+ :columns,
11
+ :model_name,
12
+ :plural_model_name,
13
+ :resource_name,
14
+ :plural_resource_name
15
+
16
+ def initialize(runtime_args, runtime_options = {})
17
+ super
18
+ @controller_path = runtime_args.shift
19
+ @model_name = runtime_args.shift
20
+ end
21
+
22
+ def manifest
23
+ @controller_routing_path = @table_name
24
+ @singular_controller_routing_path = @table_name.singularize
25
+ base_name, @controller_class_path, @controller_file_path, @controller_class_nesting, @controller_class_nesting_depth = extract_modules(@controller_path)
26
+ @model_name = base_name.singularize unless @model_name
27
+
28
+ # Post
29
+ @model_name = @model_name.camelize
30
+ # Posts
31
+ @plural_model_name = @model_name.pluralize
32
+ # post
33
+ @resource_name = @model_name.downcase
34
+ # posts
35
+ @plural_resource_name = @resource_name.pluralize
36
+
37
+ manifest_method = "manifest_for_#{options[:themed_type]}"
38
+ record do |m|
39
+ send(manifest_method, m) if respond_to?(manifest_method)
40
+ end
41
+ end
42
+
43
+ protected
44
+
45
+ def manifest_for_crud(m)
46
+ @columns = get_columns
47
+ m.directory(File.join('app/views', @controller_file_path))
48
+ m.template('view_tables.html.erb', File.join("app/views", @controller_file_path, "index.html.erb"))
49
+ m.template('view_new.html.erb', File.join("app/views", @controller_file_path, "new.html.erb"))
50
+ m.template('view_edit.html.erb', File.join("app/views", @controller_file_path, "edit.html.erb"))
51
+ m.template('view_form.html.erb', File.join("app/views", @controller_file_path, "_form.html.erb"))
52
+ m.template('view_show.html.erb', File.join("app/views", @controller_file_path, "show.html.erb"))
53
+ m.template('view_sidebar.html.erb', File.join("app/views", @controller_file_path, "_sidebar.html.erb"))
54
+
55
+ if options[:layout]
56
+ m.gsub_file(File.join("app/views/layouts", "#{options[:layout]}.html.erb"), /\<div\s+id=\"main-navigation\">.*\<\/ul\>/mi) do |match|
57
+ match.gsub!(/\<\/ul\>/, "")
58
+ %|#{match} <li class="<%= controller.controller_path == '#{@controller_file_path}' ? 'active' : '' %>"><a href="<%= #{controller_routing_path}_path %>">#{plural_model_name}</a></li></ul>|
59
+ end
60
+ end
61
+ end
62
+
63
+ def manifest_for_restful_authentication(m)
64
+ signup_controller_path = @controller_file_path
65
+ signin_controller_path = @model_name.downcase # just here I use the second argument as a controller path
66
+ @resource_name = @controller_path.singularize
67
+ m.template('view_signup.html.erb', File.join("app/views", signup_controller_path, "new.html.erb"))
68
+ m.template('view_signin.html.erb', File.join("app/views", signin_controller_path, "new.html.erb"))
69
+ end
70
+
71
+ def get_columns
72
+ excluded_column_names = %w[id created_at updated_at]
73
+ Kernel.const_get(@model_name).columns.reject{|c| excluded_column_names.include?(c.name) }.collect{|c| Rails::Generator::GeneratedAttribute.new(c.name, c.type)}
74
+ end
75
+
76
+ def banner
77
+ "Usage: #{$0} themed ControllerPath [ModelName] [options]"
78
+ end
79
+
80
+ def add_options!(opt)
81
+ opt.separator ''
82
+ opt.separator 'Options:'
83
+ opt.on("--app_name=app_name", String, "") { |v| options[:app_name] = v }
84
+ opt.on("--type=themed_type", String, "") { |v| options[:themed_type] = v }
85
+ opt.on("--layout=layout", String, "Add menu link") { |v| options[:layout] = v }
86
+ opt.on("--with_will_paginate", "Add pagination using will_paginate") { |v| options[:will_paginate] = true }
87
+ end
88
+
89
+ end
@@ -0,0 +1,336 @@
1
+ * {margin:0;padding:0}
2
+ .clear { clear: both; height: 0; }
3
+
4
+ h1 { margin: 15px 0; font-size: 22px; font-weight: normal; }
5
+ h2 { font-size: 22px; margin: 15px 0; font-weight: normal;}
6
+ h3 { font-size: 18px; margin: 10px 0; font-weight: normal;}
7
+ h4 { font-size: 16px; margin: 10px 0; font-weight: normal;}
8
+ hr {height: 1px; border: 0; }
9
+ p { margin: 15px 0;}
10
+ a img { border: none; }
11
+
12
+ body {
13
+ font-size: 12px;
14
+ font-family: sans-serif;
15
+ }
16
+
17
+ #container {
18
+ min-width: 960px;
19
+ }
20
+
21
+ #header, #wrapper {
22
+ padding: 0 20px;
23
+ }
24
+
25
+ #header {
26
+ position: relative;
27
+ padding-top: 1px;
28
+ }
29
+
30
+ #header h1 {
31
+ margin: 0;
32
+ padding: 10px 0;
33
+ font-size: 30px;
34
+ }
35
+
36
+ #header h1 a:link, #header h1 a:active, #header h1 a:hover, #header h1 a:visited {
37
+ text-decoration: none;
38
+ }
39
+
40
+ #main {
41
+ width: 70%;
42
+ float: left;
43
+ }
44
+
45
+ .actions-bar {
46
+ padding: 10px 1px;
47
+ }
48
+
49
+ .actions-bar .actions {
50
+ float: left;
51
+ }
52
+
53
+
54
+ .actions-bar .pagination {
55
+ float: right;
56
+ padding: 1px 0;
57
+ }
58
+
59
+ #sidebar {
60
+ width: 25%;
61
+ float: right;
62
+ }
63
+
64
+ #sidebar h3 {
65
+ padding: 10px 15px;
66
+ margin: 0;
67
+ font-size: 13px;
68
+ }
69
+
70
+ #sidebar .block {
71
+ margin-bottom: 20px;
72
+ padding-bottom: 10px;
73
+ }
74
+
75
+ #sidebar .block .content {
76
+ padding: 0 15px;
77
+ }
78
+
79
+ #sidebar ul.navigation li a:link, #sidebar ul.navigation li a:visited {
80
+ display: block;
81
+ padding: 10px 15px;
82
+ }
83
+
84
+ #sidebar .block .sidebar-block, #sidebar .notice {
85
+ padding:10px;
86
+ }
87
+
88
+ #wrapper {
89
+ padding-top: 20px;
90
+ }
91
+
92
+ #main .block {
93
+ margin-bottom: 20px;
94
+ padding-top: 1px;
95
+ }
96
+
97
+ #main .block .content .inner {
98
+ padding: 0 15px 15px;
99
+ }
100
+
101
+ #main .main p.first {
102
+ margin-top: 0;
103
+ }
104
+
105
+ #user-navigation {
106
+ position: absolute;
107
+ top: 0px;
108
+ right: 20px;
109
+ }
110
+
111
+ #main-navigation {
112
+ width: 100%;
113
+ }
114
+
115
+ #user-navigation ul, #main-navigation ul, .secondary-navigation ul, #sidebar ul.navigation {
116
+ margin: 0;
117
+ padding: 0;
118
+ list-style-type: none;
119
+ }
120
+
121
+ #user-navigation ul li, #main-navigation ul li, .secondary-navigation ul li {
122
+ float: left;
123
+ }
124
+
125
+ #main-navigation ul li {
126
+ margin-right: 5px;
127
+ }
128
+
129
+ #user-navigation ul li {
130
+ padding: 5px 10px;
131
+ }
132
+
133
+ #main-navigation ul li a:link, #main-navigation ul li a:visited, #main-navigation ul li a:hover, #main-navigation ul li a:active,
134
+ .secondary-navigation ul li a:link, .secondary-navigation ul li a:visited, .secondary-navigation ul li a:hover, .secondary-navigation ul li a:active,
135
+ #user-navigation ul li a:link, #user-navigation ul li a:visited, #user-navigation ul li a:hover, #user-navigation ul li a:active {
136
+ text-decoration: none;
137
+ }
138
+
139
+ #main-navigation ul li a {
140
+ font-size: 15px;
141
+ display: block;
142
+ padding: 8px 15px;
143
+ }
144
+
145
+ .secondary-navigation {
146
+ font-size: 13px;
147
+ border-bottom-width: 10px;
148
+ border-bottom-style: solid;
149
+ }
150
+
151
+ .secondary-navigation ul li a {
152
+ display: block;
153
+ padding: 10px 15px;
154
+ }
155
+
156
+ #footer {
157
+ padding-bottom: 20px;
158
+ }
159
+
160
+ /* pagination */
161
+
162
+ .pagination a, .pagination span {
163
+ padding: 2px 5px;
164
+ margin-right: 5px;
165
+ display: block;
166
+ float: left;
167
+ border-style: solid;
168
+ border-width: 1px;
169
+ }
170
+
171
+ .pagination span.current {
172
+ font-weight: bold;
173
+ }
174
+
175
+ .pagination a {
176
+ text-decoration: none;
177
+ }
178
+
179
+ /* tables */
180
+ .table {
181
+ width: 100%;
182
+ border-collapse: collapse;
183
+ margin-bottom: 15px;
184
+ }
185
+
186
+ .table th {
187
+ padding: 10px;
188
+ font-weight: bold;
189
+ text-align: left;
190
+ }
191
+
192
+ .table th.first {
193
+ width: 30px;
194
+ }
195
+
196
+ .table th.last {
197
+ width: 200px;
198
+ }
199
+
200
+ .table .checkbox {
201
+ margin-left: 10px;
202
+ }
203
+
204
+ .table td {
205
+ padding: 10px;
206
+ }
207
+
208
+ .table td.last {
209
+ text-align: right;
210
+ }
211
+
212
+ /* forms */
213
+
214
+ input.checkbox {
215
+ margin: 0;
216
+ padding: 0;
217
+ }
218
+
219
+ .form .group {
220
+ margin-bottom: 15px;
221
+ }
222
+
223
+ .form div.left {
224
+ width: 20%;
225
+ float: left;
226
+ }
227
+
228
+ .form div.right {
229
+ width: 75%;
230
+ float: right;
231
+ }
232
+
233
+ .form .columns .column {
234
+ width: 48%;
235
+ }
236
+
237
+ .form .columns .left {
238
+ float: left;
239
+ }
240
+
241
+ .form .columns .right {
242
+ float: right;
243
+ }
244
+
245
+ .form label.label, .form input.text_field, .form textarea.text_area {
246
+ font-size: 1.2em;
247
+ padding: 1px 0;
248
+ margin: 0;
249
+ }
250
+
251
+ .form label.right {
252
+ text-align: right;
253
+ }
254
+
255
+ .form input.checkbox, .form input.radio {
256
+ margin-right: 5px;
257
+ }
258
+
259
+ .form label.checkbox, .form label.radio {
260
+ line-height: 1.5em;
261
+ }
262
+
263
+ .form label.label {
264
+ display: block;
265
+ padding-bottom: 2px;
266
+ font-weight: bold;
267
+ }
268
+
269
+ .form div.fieldWithErrors label.label {
270
+ display: inline;
271
+ }
272
+
273
+ .form .fieldWithErrors .error {
274
+ color: red;
275
+ }
276
+
277
+ .form input.text_field, .form textarea.text_area {
278
+ width: 100%;
279
+ border-width: 1px;
280
+ border-style: solid;
281
+ }
282
+
283
+ /* lists */
284
+
285
+ ul.list {
286
+ margin: 0;
287
+ padding: 0;
288
+ list-style-type: none;
289
+ }
290
+
291
+ ul.list li {
292
+ clear: left;
293
+ padding-bottom: 5px;
294
+ }
295
+
296
+ ul.list li .left {
297
+ float: left;
298
+ }
299
+
300
+ ul.list li .left .avatar {
301
+ width: 50px;
302
+ height: 50px;
303
+ }
304
+
305
+ ul.list li .item {
306
+ margin-left: 80px;
307
+ }
308
+
309
+ ul.list li .item .avatar {
310
+ float: left;
311
+ margin: 0 5px 5px 0;
312
+ width: 30px;
313
+ height: 30px;
314
+ }
315
+
316
+ /* box */
317
+
318
+ #box {
319
+ width: 500px;
320
+ margin: 50px auto;
321
+ }
322
+
323
+ #box .block {
324
+ margin-bottom: 20px;
325
+ }
326
+
327
+ #box .block h2 {
328
+ padding: 10px 15px;
329
+ margin: 0;
330
+ }
331
+
332
+ #box .block .content {
333
+ padding: 10px 20px;
334
+ }
335
+
336
+