aslon_scaffold 0.0.11 → 0.0.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (176) hide show
  1. data/.gitignore +6 -0
  2. data/Gemfile +4 -0
  3. data/MIT-LICENSE +20 -0
  4. data/README +26 -0
  5. data/Rakefile +2 -0
  6. data/aslon_scaffold.gemspec +33 -0
  7. data/config/locales/aslon_scaffold.fr.yml +14 -0
  8. data/init.rb +1 -0
  9. data/install.rb +1 -0
  10. data/lib/app/controllers/articles_controller.rb +7 -0
  11. data/lib/app/helpers/application_helper.rb +410 -0
  12. data/lib/app/views/aslon_scaffolds/_search.haml +1 -0
  13. data/lib/app/views/aslon_scaffolds/index.haml +4 -0
  14. data/lib/app/views/aslon_scaffolds/new_edit.haml +8 -0
  15. data/lib/app/views/aslon_scaffolds/show.haml +9 -0
  16. data/lib/aslon_scaffold.rb +34 -0
  17. data/lib/aslon_scaffold/aslon_scaffold.rb +237 -0
  18. data/lib/aslon_scaffold/version.rb +4 -0
  19. data/lib/generators/haml.rb +11 -0
  20. data/lib/generators/haml/scaffold/scaffold_generator.rb +25 -0
  21. data/lib/generators/haml/scaffold/templates/_new_edit.haml.erb +6 -0
  22. data/lib/generators/haml/scaffold/templates/_search.haml.erb +6 -0
  23. data/lib/generators/haml/scaffold/templates/edit.haml.erb +5 -0
  24. data/lib/generators/haml/scaffold/templates/index.haml.erb +10 -0
  25. data/lib/generators/haml/scaffold/templates/layout.haml.erb +17 -0
  26. data/lib/generators/haml/scaffold/templates/new.haml.erb +6 -0
  27. data/lib/generators/haml/scaffold/templates/new_edit.haml.erb +13 -0
  28. data/lib/generators/haml/scaffold/templates/show.haml.erb +14 -0
  29. data/lib/generators/nifty.rb +28 -0
  30. data/lib/generators/nifty/aslon/USAGE +51 -0
  31. data/lib/generators/nifty/aslon/aslon_generator.rb +320 -0
  32. data/lib/generators/nifty/aslon/templates/actions/create.rb +8 -0
  33. data/lib/generators/nifty/aslon/templates/actions/destroy.rb +5 -0
  34. data/lib/generators/nifty/aslon/templates/actions/edit.rb +3 -0
  35. data/lib/generators/nifty/aslon/templates/actions/index.rb +3 -0
  36. data/lib/generators/nifty/aslon/templates/actions/new.rb +3 -0
  37. data/lib/generators/nifty/aslon/templates/actions/show.rb +3 -0
  38. data/lib/generators/nifty/aslon/templates/actions/update.rb +8 -0
  39. data/lib/generators/nifty/aslon/templates/controller.rb +10 -0
  40. data/lib/generators/nifty/aslon/templates/fixtures.yml +9 -0
  41. data/lib/generators/nifty/aslon/templates/helper.rb +2 -0
  42. data/lib/generators/nifty/aslon/templates/migration.rb +16 -0
  43. data/lib/generators/nifty/aslon/templates/model.rb +4 -0
  44. data/lib/generators/nifty/aslon/templates/tests/rspec/actions/create.rb +11 -0
  45. data/lib/generators/nifty/aslon/templates/tests/rspec/actions/destroy.rb +6 -0
  46. data/lib/generators/nifty/aslon/templates/tests/rspec/actions/edit.rb +4 -0
  47. data/lib/generators/nifty/aslon/templates/tests/rspec/actions/index.rb +4 -0
  48. data/lib/generators/nifty/aslon/templates/tests/rspec/actions/new.rb +4 -0
  49. data/lib/generators/nifty/aslon/templates/tests/rspec/actions/show.rb +4 -0
  50. data/lib/generators/nifty/aslon/templates/tests/rspec/actions/update.rb +11 -0
  51. data/lib/generators/nifty/aslon/templates/tests/rspec/controller.rb +8 -0
  52. data/lib/generators/nifty/aslon/templates/tests/rspec/model.rb +7 -0
  53. data/lib/generators/nifty/aslon/templates/tests/shoulda/actions/create.rb +13 -0
  54. data/lib/generators/nifty/aslon/templates/tests/shoulda/actions/destroy.rb +8 -0
  55. data/lib/generators/nifty/aslon/templates/tests/shoulda/actions/edit.rb +6 -0
  56. data/lib/generators/nifty/aslon/templates/tests/shoulda/actions/index.rb +6 -0
  57. data/lib/generators/nifty/aslon/templates/tests/shoulda/actions/new.rb +6 -0
  58. data/lib/generators/nifty/aslon/templates/tests/shoulda/actions/show.rb +6 -0
  59. data/lib/generators/nifty/aslon/templates/tests/shoulda/actions/update.rb +13 -0
  60. data/lib/generators/nifty/aslon/templates/tests/shoulda/controller.rb +5 -0
  61. data/lib/generators/nifty/aslon/templates/tests/shoulda/model.rb +7 -0
  62. data/lib/generators/nifty/aslon/templates/tests/testunit/actions/create.rb +11 -0
  63. data/lib/generators/nifty/aslon/templates/tests/testunit/actions/destroy.rb +6 -0
  64. data/lib/generators/nifty/aslon/templates/tests/testunit/actions/edit.rb +4 -0
  65. data/lib/generators/nifty/aslon/templates/tests/testunit/actions/index.rb +4 -0
  66. data/lib/generators/nifty/aslon/templates/tests/testunit/actions/new.rb +4 -0
  67. data/lib/generators/nifty/aslon/templates/tests/testunit/actions/show.rb +4 -0
  68. data/lib/generators/nifty/aslon/templates/tests/testunit/actions/update.rb +11 -0
  69. data/lib/generators/nifty/aslon/templates/tests/testunit/controller.rb +5 -0
  70. data/lib/generators/nifty/aslon/templates/tests/testunit/model.rb +7 -0
  71. data/lib/generators/nifty/aslon/templates/views/haml/_new_edit.html.haml +6 -0
  72. data/lib/generators/nifty/aslon/templates/views/haml/_search.html.haml +6 -0
  73. data/lib/generators/nifty/aslon/templates/views/haml/index.html.haml +10 -0
  74. data/lib/generators/nifty/aslon/templates/views/haml/layout.haml.erb +17 -0
  75. data/lib/generators/nifty/aslon/templates/views/haml/new_edit.html.haml +13 -0
  76. data/lib/generators/nifty/aslon/templates/views/haml/show.html.haml +14 -0
  77. data/lib/generators/nifty/layout/USAGE +25 -0
  78. data/lib/generators/nifty/layout/layout_generator.rb +42 -0
  79. data/lib/generators/nifty/layout/templates/_default.html.haml +9 -0
  80. data/lib/generators/nifty/layout/templates/assets/images/aslon_scaffold/add.gif +0 -0
  81. data/lib/generators/nifty/layout/templates/assets/images/aslon_scaffold/delete.gif +0 -0
  82. data/lib/generators/nifty/layout/templates/assets/images/aslon_scaffold/edit.gif +0 -0
  83. data/lib/generators/nifty/layout/templates/assets/images/aslon_scaffold/folder.gif +0 -0
  84. data/lib/generators/nifty/layout/templates/assets/images/aslon_scaffold/grid-blue-hd.gif +0 -0
  85. data/lib/generators/nifty/layout/templates/assets/images/aslon_scaffold/grid-split.gif +0 -0
  86. data/lib/generators/nifty/layout/templates/assets/images/aslon_scaffold/grid3-hrow.gif +0 -0
  87. data/lib/generators/nifty/layout/templates/assets/images/aslon_scaffold/indicator.gif +0 -0
  88. data/lib/generators/nifty/layout/templates/assets/images/aslon_scaffold/magnifier.png +0 -0
  89. data/lib/generators/nifty/layout/templates/assets/images/aslon_scaffold/sort_asc.gif +0 -0
  90. data/lib/generators/nifty/layout/templates/assets/images/aslon_scaffold/sort_desc.gif +0 -0
  91. data/lib/generators/nifty/layout/templates/assets/stylesheets/aslon_scaffold/base.css.sass +263 -0
  92. data/lib/generators/nifty/layout/templates/assets/stylesheets/aslon_scaffold/formtastic.css.sass +176 -0
  93. data/lib/generators/nifty/layout/templates/assets/stylesheets/aslon_scaffold/formtastic_changes.css.sass +31 -0
  94. data/lib/generators/nifty/layout/templates/assets/stylesheets/aslon_scaffold/table_coffee_with_milk.css.sass +94 -0
  95. data/lib/generators/nifty/layout/templates/error_messages_helper.rb +23 -0
  96. data/lib/generators/nifty/layout/templates/layout.html.haml +13 -0
  97. data/lib/generators/nifty/layout/templates/layout_helper.rb +22 -0
  98. data/lib/generators/nifty/layout/templates/locales/aslon_scaffold.fr.yml +14 -0
  99. data/lib/generators/nifty/scaffold/USAGE +51 -0
  100. data/lib/generators/nifty/scaffold/scaffold_generator.rb +319 -0
  101. data/lib/generators/nifty/scaffold/templates/actions/create.rb +8 -0
  102. data/lib/generators/nifty/scaffold/templates/actions/destroy.rb +5 -0
  103. data/lib/generators/nifty/scaffold/templates/actions/edit.rb +3 -0
  104. data/lib/generators/nifty/scaffold/templates/actions/index.rb +3 -0
  105. data/lib/generators/nifty/scaffold/templates/actions/new.rb +3 -0
  106. data/lib/generators/nifty/scaffold/templates/actions/show.rb +3 -0
  107. data/lib/generators/nifty/scaffold/templates/actions/update.rb +8 -0
  108. data/lib/generators/nifty/scaffold/templates/controller.rb +3 -0
  109. data/lib/generators/nifty/scaffold/templates/fixtures.yml +9 -0
  110. data/lib/generators/nifty/scaffold/templates/helper.rb +2 -0
  111. data/lib/generators/nifty/scaffold/templates/migration.rb +16 -0
  112. data/lib/generators/nifty/scaffold/templates/model.rb +4 -0
  113. data/lib/generators/nifty/scaffold/templates/tests/rspec/actions/create.rb +11 -0
  114. data/lib/generators/nifty/scaffold/templates/tests/rspec/actions/destroy.rb +6 -0
  115. data/lib/generators/nifty/scaffold/templates/tests/rspec/actions/edit.rb +4 -0
  116. data/lib/generators/nifty/scaffold/templates/tests/rspec/actions/index.rb +4 -0
  117. data/lib/generators/nifty/scaffold/templates/tests/rspec/actions/new.rb +4 -0
  118. data/lib/generators/nifty/scaffold/templates/tests/rspec/actions/show.rb +4 -0
  119. data/lib/generators/nifty/scaffold/templates/tests/rspec/actions/update.rb +11 -0
  120. data/lib/generators/nifty/scaffold/templates/tests/rspec/controller.rb +8 -0
  121. data/lib/generators/nifty/scaffold/templates/tests/rspec/model.rb +7 -0
  122. data/lib/generators/nifty/scaffold/templates/tests/shoulda/actions/create.rb +13 -0
  123. data/lib/generators/nifty/scaffold/templates/tests/shoulda/actions/destroy.rb +8 -0
  124. data/lib/generators/nifty/scaffold/templates/tests/shoulda/actions/edit.rb +6 -0
  125. data/lib/generators/nifty/scaffold/templates/tests/shoulda/actions/index.rb +6 -0
  126. data/lib/generators/nifty/scaffold/templates/tests/shoulda/actions/new.rb +6 -0
  127. data/lib/generators/nifty/scaffold/templates/tests/shoulda/actions/show.rb +6 -0
  128. data/lib/generators/nifty/scaffold/templates/tests/shoulda/actions/update.rb +13 -0
  129. data/lib/generators/nifty/scaffold/templates/tests/shoulda/controller.rb +5 -0
  130. data/lib/generators/nifty/scaffold/templates/tests/shoulda/model.rb +7 -0
  131. data/lib/generators/nifty/scaffold/templates/tests/testunit/actions/create.rb +11 -0
  132. data/lib/generators/nifty/scaffold/templates/tests/testunit/actions/destroy.rb +6 -0
  133. data/lib/generators/nifty/scaffold/templates/tests/testunit/actions/edit.rb +4 -0
  134. data/lib/generators/nifty/scaffold/templates/tests/testunit/actions/index.rb +4 -0
  135. data/lib/generators/nifty/scaffold/templates/tests/testunit/actions/new.rb +4 -0
  136. data/lib/generators/nifty/scaffold/templates/tests/testunit/actions/show.rb +4 -0
  137. data/lib/generators/nifty/scaffold/templates/tests/testunit/actions/update.rb +11 -0
  138. data/lib/generators/nifty/scaffold/templates/tests/testunit/controller.rb +5 -0
  139. data/lib/generators/nifty/scaffold/templates/tests/testunit/model.rb +7 -0
  140. data/lib/generators/nifty/scaffold/templates/views/erb/_form.html.erb +10 -0
  141. data/lib/generators/nifty/scaffold/templates/views/erb/edit.html.erb +14 -0
  142. data/lib/generators/nifty/scaffold/templates/views/erb/index.html.erb +29 -0
  143. data/lib/generators/nifty/scaffold/templates/views/erb/new.html.erb +7 -0
  144. data/lib/generators/nifty/scaffold/templates/views/erb/show.html.erb +20 -0
  145. data/lib/generators/nifty/scaffold/templates/views/haml/_new_edit.html.haml +6 -0
  146. data/lib/generators/nifty/scaffold/templates/views/haml/_search.html.haml +6 -0
  147. data/lib/generators/nifty/scaffold/templates/views/haml/index.html.haml +10 -0
  148. data/lib/generators/nifty/scaffold/templates/views/haml/layout.haml.erb +17 -0
  149. data/lib/generators/nifty/scaffold/templates/views/haml/new_edit.haml.erb +13 -0
  150. data/lib/generators/nifty/scaffold/templates/views/haml/show.haml.erb +14 -0
  151. data/lib/generators/templates/rails/scaffold_controller/controller.rb +11 -0
  152. data/lib/tasks/aslon_scaffold_tasks.rake +91 -0
  153. data/lib/tasks/task.rake +113 -0
  154. data/test/articles_controller_test.rb +24 -0
  155. data/test/database.yml +8 -0
  156. data/test/schema.rb +6 -0
  157. data/test/test_helper.rb +39 -0
  158. data/test/undeletable_plugin.sqlite.db +0 -0
  159. data/test/undeletable_plugin2.sqlite3.db +0 -0
  160. data/uninstall.rb +1 -0
  161. data/vendor/assets/images/aslon_scaffold/add.gif +0 -0
  162. data/vendor/assets/images/aslon_scaffold/delete.gif +0 -0
  163. data/vendor/assets/images/aslon_scaffold/edit.gif +0 -0
  164. data/vendor/assets/images/aslon_scaffold/folder.gif +0 -0
  165. data/vendor/assets/images/aslon_scaffold/grid-blue-hd.gif +0 -0
  166. data/vendor/assets/images/aslon_scaffold/grid-split.gif +0 -0
  167. data/vendor/assets/images/aslon_scaffold/grid3-hrow.gif +0 -0
  168. data/vendor/assets/images/aslon_scaffold/indicator.gif +0 -0
  169. data/vendor/assets/images/aslon_scaffold/magnifier.png +0 -0
  170. data/vendor/assets/images/aslon_scaffold/sort_asc.gif +0 -0
  171. data/vendor/assets/images/aslon_scaffold/sort_desc.gif +0 -0
  172. data/vendor/assets/stylesheets/aslon_scaffold_base.css.sass +116 -0
  173. data/vendor/assets/stylesheets/aslon_scaffold_base.css.sass.old +263 -0
  174. data/vendor/assets/stylesheets/aslon_scaffold_table.css.sass +94 -0
  175. data/vendor/assets/stylesheets/formtastic_changes.css.sass +31 -0
  176. metadata +185 -4
@@ -0,0 +1,4 @@
1
+ class <%= class_name %> < ActiveRecord::Base
2
+ <%= " set_table_name :#{table_name}\n" if table_name -%>
3
+ attr_accessible <%= model_attributes.map { |a| ":#{a.name}" }.join(", ") %>
4
+ end
@@ -0,0 +1,11 @@
1
+ it "create action should render new template when model is invalid" do
2
+ <%= class_name %>.any_instance.stubs(:valid?).returns(false)
3
+ post :create
4
+ response.should render_template(:new)
5
+ end
6
+
7
+ it "create action should redirect when model is valid" do
8
+ <%= class_name %>.any_instance.stubs(:valid?).returns(true)
9
+ post :create
10
+ response.should redirect_to(<%= item_path_for_spec('url') %>)
11
+ end
@@ -0,0 +1,6 @@
1
+ it "destroy action should destroy model and redirect to index action" do
2
+ <%= instance_name %> = <%= class_name %>.first
3
+ delete :destroy, :id => <%= instance_name %>
4
+ response.should redirect_to(<%= items_url %>)
5
+ <%= class_name %>.exists?(<%= instance_name %>.id).should be_false
6
+ end
@@ -0,0 +1,4 @@
1
+ it "edit action should render edit template" do
2
+ get :edit, :id => <%= class_name %>.first
3
+ response.should render_template(:edit)
4
+ end
@@ -0,0 +1,4 @@
1
+ it "index action should render index template" do
2
+ get :index
3
+ response.should render_template(:index)
4
+ end
@@ -0,0 +1,4 @@
1
+ it "new action should render new template" do
2
+ get :new
3
+ response.should render_template(:new)
4
+ end
@@ -0,0 +1,4 @@
1
+ it "show action should render show template" do
2
+ get :show, :id => <%= class_name %>.first
3
+ response.should render_template(:show)
4
+ end
@@ -0,0 +1,11 @@
1
+ it "update action should render edit template when model is invalid" do
2
+ <%= class_name %>.any_instance.stubs(:valid?).returns(false)
3
+ put :update, :id => <%= class_name %>.first
4
+ response.should render_template(:edit)
5
+ end
6
+
7
+ it "update action should redirect when model is valid" do
8
+ <%= class_name %>.any_instance.stubs(:valid?).returns(true)
9
+ put :update, :id => <%= class_name %>.first
10
+ response.should redirect_to(<%= item_path_for_spec('url') %>)
11
+ end
@@ -0,0 +1,8 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ describe <%= plural_class_name %>Controller do
4
+ fixtures :all
5
+ render_views
6
+
7
+ <%= controller_methods 'tests/rspec/actions' %>
8
+ end
@@ -0,0 +1,7 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ describe <%= class_name %> do
4
+ it "should be valid" do
5
+ <%= class_name %>.new.should be_valid
6
+ end
7
+ end
@@ -0,0 +1,13 @@
1
+ context "create action" do
2
+ should "render new template when model is invalid" do
3
+ <%= class_name %>.any_instance.stubs(:valid?).returns(false)
4
+ post :create
5
+ assert_template 'new'
6
+ end
7
+
8
+ should "redirect when model is valid" do
9
+ <%= class_name %>.any_instance.stubs(:valid?).returns(true)
10
+ post :create
11
+ assert_redirected_to <%= item_path_for_test('url') %>
12
+ end
13
+ end
@@ -0,0 +1,8 @@
1
+ context "destroy action" do
2
+ should "destroy model and redirect to index action" do
3
+ <%= instance_name %> = <%= class_name %>.first
4
+ delete :destroy, :id => <%= instance_name %>
5
+ assert_redirected_to <%= items_url %>
6
+ assert !<%= class_name %>.exists?(<%= instance_name %>.id)
7
+ end
8
+ end
@@ -0,0 +1,6 @@
1
+ context "edit action" do
2
+ should "render edit template" do
3
+ get :edit, :id => <%= class_name %>.first
4
+ assert_template 'edit'
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ context "index action" do
2
+ should "render index template" do
3
+ get :index
4
+ assert_template 'index'
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ context "new action" do
2
+ should "render new template" do
3
+ get :new
4
+ assert_template 'new'
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ context "show action" do
2
+ should "render show template" do
3
+ get :show, :id => <%= class_name %>.first
4
+ assert_template 'show'
5
+ end
6
+ end
@@ -0,0 +1,13 @@
1
+ context "update action" do
2
+ should "render edit template when model is invalid" do
3
+ <%= class_name %>.any_instance.stubs(:valid?).returns(false)
4
+ put :update, :id => <%= class_name %>.first
5
+ assert_template 'edit'
6
+ end
7
+
8
+ should "redirect when model is valid" do
9
+ <%= class_name %>.any_instance.stubs(:valid?).returns(true)
10
+ put :update, :id => <%= class_name %>.first
11
+ assert_redirected_to <%= item_path_for_test('url') %>
12
+ end
13
+ end
@@ -0,0 +1,5 @@
1
+ require 'test_helper'
2
+
3
+ class <%= plural_class_name %>ControllerTest < ActionController::TestCase
4
+ <%= controller_methods 'tests/shoulda/actions' %>
5
+ end
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class <%= class_name %>Test < ActiveSupport::TestCase
4
+ should "be valid" do
5
+ assert <%= class_name %>.new.valid?
6
+ end
7
+ end
@@ -0,0 +1,11 @@
1
+ def test_create_invalid
2
+ <%= class_name %>.any_instance.stubs(:valid?).returns(false)
3
+ post :create
4
+ assert_template 'new'
5
+ end
6
+
7
+ def test_create_valid
8
+ <%= class_name %>.any_instance.stubs(:valid?).returns(true)
9
+ post :create
10
+ assert_redirected_to <%= item_path_for_test('url') %>
11
+ end
@@ -0,0 +1,6 @@
1
+ def test_destroy
2
+ <%= instance_name %> = <%= class_name %>.first
3
+ delete :destroy, :id => <%= instance_name %>
4
+ assert_redirected_to <%= items_url %>
5
+ assert !<%= class_name %>.exists?(<%= instance_name %>.id)
6
+ end
@@ -0,0 +1,4 @@
1
+ def test_edit
2
+ get :edit, :id => <%= class_name %>.first
3
+ assert_template 'edit'
4
+ end
@@ -0,0 +1,4 @@
1
+ def test_index
2
+ get :index
3
+ assert_template 'index'
4
+ end
@@ -0,0 +1,4 @@
1
+ def test_new
2
+ get :new
3
+ assert_template 'new'
4
+ end
@@ -0,0 +1,4 @@
1
+ def test_show
2
+ get :show, :id => <%= class_name %>.first
3
+ assert_template 'show'
4
+ end
@@ -0,0 +1,11 @@
1
+ def test_update_invalid
2
+ <%= class_name %>.any_instance.stubs(:valid?).returns(false)
3
+ put :update, :id => <%= class_name %>.first
4
+ assert_template 'edit'
5
+ end
6
+
7
+ def test_update_valid
8
+ <%= class_name %>.any_instance.stubs(:valid?).returns(true)
9
+ put :update, :id => <%= class_name %>.first
10
+ assert_redirected_to <%= item_path_for_test('url') %>
11
+ end
@@ -0,0 +1,5 @@
1
+ require 'test_helper'
2
+
3
+ class <%= plural_class_name %>ControllerTest < ActionController::TestCase
4
+ <%= controller_methods 'tests/testunit/actions' %>
5
+ end
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class <%= class_name %>Test < ActiveSupport::TestCase
4
+ def test_should_be_valid
5
+ assert <%= class_name %>.new.valid?
6
+ end
7
+ end
@@ -0,0 +1,6 @@
1
+ - semantic_form_for @<%= singular_name %> do |f|
2
+ - f.inputs :name => "Basic", :id => "basic" do
3
+ <% for attribute in attributes -%>
4
+ = f.input :<%= attribute.name%>
5
+ <% end -%>
6
+ = f.buttons
@@ -0,0 +1,6 @@
1
+ -# encoding UTF-8
2
+ -# autogenerated_by_scaffold
3
+ =table("<%= singular_name %>",@<%= plural_name %>,[<% for attribute in attributes -%>{:<%=attribute.name%>=>'<%= attribute.name %>'},<% end -%>],['show','edit','delete'])
4
+
5
+
6
+
@@ -0,0 +1,10 @@
1
+ -# ruby <%=$0%> scaffold <%ARGV.each {|a|%><%=a%> <%}%> --force
2
+ -# encoding UTF-8
3
+ -# autogenerated_by_scaffold
4
+
5
+
6
+ =titre("<%= plural_name %>","<%= singular_name %>")
7
+
8
+ #ajaxw
9
+ = render :partial=>'search'
10
+
@@ -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 %>: <%%= aslon_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,13 @@
1
+ -# encoding UTF-8
2
+ -# autogenerated_by_scaffold
3
+
4
+ = titre_action(controller.action_name,"<%= singular_name %>")
5
+ = error_messages_for :<%= singular_name %>
6
+
7
+ - semantic_form_for @<%= singular_name %> do |f|
8
+
9
+ - f.inputs :name => "Basic", :id => "basic" do
10
+ <% for attribute in attributes -%>
11
+ = f.input :<%= attribute.name%>
12
+ <% end -%>
13
+ = f.buttons
@@ -0,0 +1,14 @@
1
+ -# encoding UTF-8
2
+ -# autogenerated_by_scaffold
3
+
4
+ =titre_show(@<%= singular_name %>,@<%= singular_name %>.lib)
5
+ %form.formtastic
6
+ %fieldset.inputs
7
+ %legend
8
+ %span=@as_options[:legend]
9
+
10
+ <% for attribute in attributes -%>
11
+ = show @<%= singular_name %>,:<%= attribute.name %>
12
+ <%end%>
13
+ = link_to 'Back', <%= plural_name %>_path
14
+
@@ -0,0 +1,25 @@
1
+ Description:
2
+ The nifty_layout generator creates a basic layout, stylesheet and
3
+ helper which will give some structure to a starting Rails app.
4
+
5
+ The generator takes one argument which will be the name of the
6
+ layout and stylesheet files. If no argument is passed then it defaults
7
+ to "application".
8
+
9
+ The helper module includes some methods which can be called in any
10
+ template or partial to set variables to be used in the layout, such as
11
+ page title and javascript/stylesheet includes.
12
+
13
+ Examples:
14
+ rails generate nifty:layout
15
+
16
+ Layout: app/views/layouts/application.html.erb
17
+ Stylesheet: public/stylesheets/application.css
18
+ Helper: app/helpers/layout_helper.rb
19
+
20
+
21
+ rails generate nifty:layout admin
22
+
23
+ Layout: app/views/layouts/admin.html.erb
24
+ Stylesheet: public/stylesheets/admin.css
25
+ Helper: app/helpers/layout_helper.rb
@@ -0,0 +1,42 @@
1
+ require 'generators/nifty'
2
+
3
+ module Nifty
4
+ module Generators
5
+ class LayoutGenerator < Base
6
+ argument :layout_name, :type => :string, :default => 'application', :banner => 'layout_name'
7
+
8
+ class_option :haml, :desc => 'Generate HAML for view, and SASS for stylesheet.', :type => :boolean
9
+
10
+ def create_layout
11
+ template '_default.html.haml', "app/views/layouts/_default.html.haml"
12
+ template 'layout.html.haml', "app/views/layouts/#{file_name}.html.haml"
13
+
14
+ copy_file 'layout_helper.rb', 'app/helpers/layout_helper.rb'
15
+ copy_file 'error_messages_helper.rb', 'app/helpers/error_messages_helper.rb'
16
+ end
17
+ def copy_stylesheet
18
+ %w( base formtastic formtastic_changes table_coffee_with_milk ).each do |filename|
19
+ copy_file "assets/stylesheets/aslon_scaffold/#{filename}.css.sass", "assets/stylesheets/aslon_scaffold/#{filename}.css.sass"
20
+ end
21
+ end
22
+ def copy_locales
23
+ %w(aslon_scaffold.fr.yml).each do |filename|
24
+ copy_file "locales/#{filename}", "app/config/locales/#{filename}"
25
+ end
26
+ end
27
+ def copy_image
28
+ puts File.dirname(__FILE__)
29
+ Dir.foreach(File.join(File.dirname(__FILE__),"templates","assets",'images','aslon_scaffold')) do |filename|
30
+ if File.file?(File.join(File.dirname(__FILE__),"templates","assets",'images','aslon_scaffold',filename))
31
+ copy_file "assets/images/aslon_scaffold/#{filename}", "app/assets/images/aslon_scaffold/#{filename}"
32
+ end
33
+ end
34
+ end
35
+ private
36
+
37
+ def file_name
38
+ layout_name.underscore
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,9 @@
1
+ %html{ "xml:lang" => "en", :lang => "en", :xmlns => "http://www.w3.org/1999/xhtml" }
2
+ %head
3
+ %title
4
+ = yield(:title) || "Untitled"
5
+ %meta{"http-equiv"=>"Content-Type", :content=>"text/html; charset=utf-8"}/
6
+ = stylesheet_link_tag 'aslon_scaffold/base', :media=>"all"
7
+ = stylesheet_link_tag 'aslon_scaffold/application', :media=>"all"
8
+ = javascript_include_tag :defaults
9
+ = csrf_meta_tag
@@ -0,0 +1,263 @@
1
+ body
2
+ margin: 0px
3
+ padding: 0px
4
+ font:
5
+ family: verdana, arial, helvetica, sans-serif
6
+ size: 80%
7
+ color: #333
8
+ background-color: white
9
+
10
+ h1
11
+ margin: 0px 0px 1px 0px
12
+ padding: 0px
13
+ line-height: 28px
14
+ font:
15
+ weight: 900
16
+ size: 14px
17
+ color: red
18
+ border-bottom: solid 1px #C5DBF7
19
+ h2
20
+ margin: 0px 0px 1px 0px
21
+ padding: 0px
22
+ font:
23
+ weight: 900
24
+ size: 14px
25
+ line-height: 28px
26
+ color: black
27
+ border-bottom: solid 1px #C5DBF7
28
+
29
+ #menu
30
+ float: left
31
+ margin: 2px
32
+ width: 150px
33
+ height: 400px
34
+
35
+
36
+ #titre1
37
+ margin: 0px 0px 10px 0px
38
+ padding: 0px
39
+ font-size: 14px
40
+ line-height: 28px
41
+ font-weight: 900
42
+ color: black
43
+ border-bottom: solid 1px #C5DBF7
44
+ background-color: #eee
45
+ text-indent: 30px
46
+
47
+
48
+ #titre2
49
+ margin: 0px 0px 10px 0px
50
+ padding: 0px
51
+ font-size: 14px
52
+ line-height: 28px
53
+ font-weight: 900
54
+ color: black
55
+ border-bottom: solid 1px #C5DBF7
56
+ background-color: #eee
57
+ text-indent: 30px
58
+ margin: 10px 0px 10px 0px
59
+
60
+
61
+ p
62
+ font: 11px/20px verdana, arial, helvetica, sans-serif
63
+ margin: 0px 0px 16px 0px
64
+ padding: 0px
65
+
66
+
67
+ a
68
+ color: #09c
69
+ font-size: 11px
70
+ text-decoration: none
71
+ font-weight: 600
72
+ font-family: verdana, arial, helvetica, sans-serif
73
+
74
+ &:link
75
+ color: #09c
76
+
77
+ &:visited
78
+ color: #07a
79
+
80
+ &:hover
81
+ background-color: #eee
82
+
83
+
84
+
85
+ .flash
86
+ ul
87
+ padding-left: 0pt
88
+ margin-bottom: 0pt
89
+ margin-top: 0pt
90
+ list-style-type: none
91
+ margin-left: 0pt
92
+
93
+ li
94
+ margin-bottom: 0em
95
+ padding-left: 1em
96
+ vertical-align: top
97
+ text-align: center
98
+ font-size: 1em
99
+
100
+ .container
101
+ padding-top: 0em
102
+ padding-left: 2em
103
+ position: absolute
104
+ top: 1px
105
+ left: 200px
106
+ width: 500px
107
+ height: 25px
108
+
109
+ .containerild
110
+ padding: 1em
111
+ padding-left: 5em
112
+ margin-bottom: 1.5em
113
+
114
+ .error
115
+ color: red
116
+
117
+ .errorold
118
+ background: #fcf6d0 url(../images/icons/flashes/error.gif) 1.5em 1.5em no-repeat
119
+ border-top: 1px solid #ecd757
120
+ border-bottom: 1px solid #ecd757
121
+ border-left: 1px solid #ecd757
122
+ border-right: 1px solid #ecd757
123
+
124
+ .back
125
+ background: #e9f3dc url(../images/icons/flashes/back.gif) 1.5em 1em no-repeat
126
+ border-top: 1px solid #bfcbb0
127
+ border-bottom: 1px solid #bfcbb0
128
+
129
+ .confirm
130
+ background: #e9f3dc url(../images/icons/flashes/confirm.gif) 1.5em 1em no-repeat
131
+ border-top: 1px solid #bfcbb0
132
+ border-bottom: 1px solid #bfcbb0
133
+
134
+ .info, .notice
135
+ color: green
136
+
137
+ .warn
138
+ color: orange
139
+
140
+
141
+ .fieldWithErrors
142
+ padding: 3px
143
+ background-color: red
144
+ display: table
145
+
146
+
147
+ #errorExplanation
148
+ width: 500px
149
+ border: 1px solid red
150
+ padding: 7px
151
+ padding-bottom: 12px
152
+ margin-bottom: 20px
153
+ background-color: #f0f0f0
154
+
155
+ h2
156
+ text-align: left
157
+ font-weight: bold
158
+ padding: 5px 5px 5px 60px
159
+ font-size: 12px
160
+ margin: -7px
161
+ background: url(../images/icons/flashes/error.gif) 1.5em 0.2em no-repeat
162
+ color: red
163
+
164
+ p
165
+ color: #333
166
+ margin-bottom: 0
167
+ padding: 5px
168
+
169
+ ul li
170
+ font-size: 12px
171
+ list-style: square
172
+
173
+
174
+ .pagination
175
+ font-size: 10px
176
+ padding: 3px
177
+ margin: 3px
178
+
179
+ a
180
+ padding: 2px 5px 2px 5px
181
+ margin: 2px
182
+ border: 1px solid #aaaadd
183
+ text-decoration: none
184
+ color: gray
185
+
186
+ &:hover, &:active
187
+ border: 1px solid gray
188
+ color: #000
189
+
190
+ span
191
+ &.current
192
+ padding: 2px 5px 2px 5px
193
+ margin: 2px
194
+ border: 1px solid lightgray
195
+ font-weight: bold
196
+ background-color: gray
197
+ color: white
198
+
199
+ &.disabled
200
+ padding: 2px 5px 2px 5px
201
+ margin: 2px
202
+ border: 1px solid #eee
203
+ color: #ddd
204
+
205
+
206
+ form#demoForm
207
+ width: 40ex
208
+ padding: 1em
209
+ margin: 0em auto
210
+ border: 1ex solid silver
211
+ background: #eee
212
+ font-family: sans-serif
213
+
214
+ p
215
+ position: relative
216
+ margin: 0 0 0.5em
217
+
218
+ &.submit
219
+ margin: 0.5em
220
+ text-align: center
221
+ color: red
222
+
223
+ label
224
+ font-weight: bold
225
+ display: block
226
+ width: 100px
227
+ float: left
228
+ color: red
229
+ font-size: 12pt
230
+ vertical-align: text-bottom
231
+
232
+
233
+ input
234
+ &#login, &#password
235
+
236
+ label
237
+ font-weight: bold
238
+
239
+
240
+ input
241
+ &:focus
242
+ border: 1px solid gray
243
+ background: #ffd
244
+
245
+ &.to_dest
246
+ position: absolute
247
+ left: 10ex
248
+ right: 5ex
249
+
250
+
251
+ label.required
252
+ font-weight: bold
253
+
254
+ &:after
255
+ content: '*'
256
+
257
+
258
+ span.accessKey
259
+ text-decoration: underline
260
+
261
+ @import aslon_scaffold/formtastic
262
+ @import aslon_scaffold/formtastic_changes
263
+ @import aslon_scaffold/table_coffee_with_milk