flexi_generators 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (192) hide show
  1. data/README.textile +83 -70
  2. data/Rakefile +0 -22
  3. data/VERSION +1 -1
  4. data/flexi_generators.gemspec +75 -136
  5. data/init.rb +0 -1
  6. data/lib/flexi_generators.rb +2 -4
  7. data/lib/generators/flexi_auth/USAGE +5 -0
  8. data/lib/generators/flexi_auth/flexi_auth_generator.rb +117 -0
  9. data/{generators/flexi_authentication → lib/generators/flexi_auth}/templates/authentication.rb +2 -9
  10. data/{generators/flexi_authentication → lib/generators/flexi_auth}/templates/authlogic_session.rb +0 -0
  11. data/{generators/flexi_authentication → lib/generators/flexi_auth}/templates/fixtures.yml +0 -0
  12. data/lib/generators/flexi_auth/templates/migration.rb +16 -0
  13. data/lib/generators/flexi_auth/templates/sessions_controller.rb +25 -0
  14. data/{generators/flexi_authentication → lib/generators/flexi_auth}/templates/sessions_helper.rb +0 -0
  15. data/{generators/flexi_authentication → lib/generators/flexi_auth}/templates/tests/testunit/sessions_controller.rb +1 -17
  16. data/lib/generators/flexi_auth/templates/tests/testunit/user.rb +4 -0
  17. data/{generators/flexi_authentication → lib/generators/flexi_auth}/templates/tests/testunit/users_controller.rb +1 -1
  18. data/lib/generators/flexi_auth/templates/user.rb +3 -0
  19. data/lib/generators/flexi_auth/templates/users_controller.rb +42 -0
  20. data/{generators/flexi_authentication → lib/generators/flexi_auth}/templates/users_helper.rb +0 -0
  21. data/lib/generators/flexi_auth/templates/views/erb/_error_messages.html.erb +11 -0
  22. data/lib/generators/flexi_auth/templates/views/erb/edit.html.erb +24 -0
  23. data/lib/generators/flexi_auth/templates/views/erb/index.html.erb +27 -0
  24. data/lib/generators/flexi_auth/templates/views/erb/login.html.erb +22 -0
  25. data/lib/generators/flexi_auth/templates/views/erb/new.html.erb +24 -0
  26. data/lib/generators/flexi_auth/templates/views/erb/show.html.erb +16 -0
  27. data/lib/generators/flexi_prepare/USAGE +6 -0
  28. data/lib/generators/flexi_prepare/flexi_prepare_generator.rb +56 -0
  29. data/{generators/flexi_layout → lib/generators/flexi_prepare}/templates/add.png +0 -0
  30. data/{generators/flexi_layout → lib/generators/flexi_prepare}/templates/admin_home_controller.rb +0 -0
  31. data/{generators/flexi_layout → lib/generators/flexi_prepare}/templates/admin_home_index.html.erb +1 -1
  32. data/lib/generators/flexi_prepare/templates/application.css +278 -0
  33. data/lib/generators/flexi_prepare/templates/application.html.erb +57 -0
  34. data/lib/generators/flexi_prepare/templates/application_helper.rb +42 -0
  35. data/lib/generators/flexi_prepare/templates/back.png +0 -0
  36. data/lib/generators/flexi_prepare/templates/bg.png +0 -0
  37. data/lib/generators/flexi_prepare/templates/bg2.png +0 -0
  38. data/lib/generators/flexi_prepare/templates/boxheader.gif +0 -0
  39. data/lib/generators/flexi_prepare/templates/btn-bg-hover.png +0 -0
  40. data/lib/generators/flexi_prepare/templates/btn-bg.png +0 -0
  41. data/{generators/flexi_layout → lib/generators/flexi_prepare}/templates/custom_field_error.rb +1 -1
  42. data/lib/generators/flexi_prepare/templates/delete.png +0 -0
  43. data/lib/generators/flexi_prepare/templates/edit.png +0 -0
  44. data/lib/generators/flexi_prepare/templates/inflector_portuguese.rb +59 -0
  45. data/lib/generators/flexi_prepare/templates/login.css +142 -0
  46. data/lib/generators/flexi_prepare/templates/login.html.erb +26 -0
  47. data/lib/generators/flexi_prepare/templates/logo.png +0 -0
  48. data/lib/generators/flexi_prepare/templates/menu.png +0 -0
  49. data/lib/generators/flexi_prepare/templates/messages/Thumbs.db +0 -0
  50. data/lib/generators/flexi_prepare/templates/messages/error.png +0 -0
  51. data/lib/generators/flexi_prepare/templates/messages/info.png +0 -0
  52. data/lib/generators/flexi_prepare/templates/messages/success.png +0 -0
  53. data/lib/generators/flexi_prepare/templates/messages/tip.png +0 -0
  54. data/lib/generators/flexi_prepare/templates/messages/warning.png +0 -0
  55. data/lib/generators/flexi_prepare/templates/pt-BR.yml +204 -0
  56. data/lib/generators/flexi_prepare/templates/show.png +0 -0
  57. data/{generators/flexi_layout/templates/stylesheet_site.css → lib/generators/flexi_prepare/templates/site.css} +32 -23
  58. data/lib/generators/flexi_prepare/templates/site.html.erb +20 -0
  59. data/{generators/flexi_layout/templates/home_controller.rb → lib/generators/flexi_prepare/templates/site_controller.rb} +1 -1
  60. data/lib/generators/flexi_prepare/templates/site_helper.rb +2 -0
  61. data/lib/generators/flexi_prepare/templates/site_index.html.erb +27 -0
  62. data/{generators/flexi_layout → lib/generators/flexi_prepare}/templates/users.png +0 -0
  63. data/lib/generators/flexi_scaffold/USAGE +8 -0
  64. data/lib/generators/flexi_scaffold/flexi_scaffold_generator.rb +98 -0
  65. data/lib/generators/flexi_scaffold/templates/controller.rb +42 -0
  66. data/{generators → lib/generators}/flexi_scaffold/templates/fixtures.yml +3 -3
  67. data/{generators → lib/generators}/flexi_scaffold/templates/helper.rb +1 -1
  68. data/{generators → lib/generators}/flexi_scaffold/templates/migration.rb +3 -5
  69. data/lib/generators/flexi_scaffold/templates/model.rb +3 -0
  70. data/lib/generators/flexi_scaffold/templates/tests/controller.rb +50 -0
  71. data/lib/generators/flexi_scaffold/templates/tests/helper.rb +4 -0
  72. data/{test/flexi_generators_test.rb → lib/generators/flexi_scaffold/templates/tests/model.rb} +2 -2
  73. data/lib/generators/flexi_scaffold/templates/views/erb/_error_messages.html.erb +11 -0
  74. data/lib/generators/flexi_scaffold/templates/views/erb/_form.html.erb +13 -0
  75. data/lib/generators/flexi_scaffold/templates/views/erb/edit.html.erb +3 -0
  76. data/lib/generators/flexi_scaffold/templates/views/erb/index.html.erb +29 -0
  77. data/lib/generators/flexi_scaffold/templates/views/erb/new.html.erb +3 -0
  78. data/lib/generators/flexi_scaffold/templates/views/erb/show.html.erb +15 -0
  79. data/template.rb +6 -0
  80. metadata +79 -137
  81. data/flexi_template.rb +0 -28
  82. data/generators/flexi_authentication/USAGE +0 -50
  83. data/generators/flexi_authentication/flexi_authentication_generator.rb +0 -127
  84. data/generators/flexi_authentication/lib/insert_commands.rb +0 -74
  85. data/generators/flexi_authentication/templates/admin_users_controller.rb +0 -60
  86. data/generators/flexi_authentication/templates/migration.rb +0 -30
  87. data/generators/flexi_authentication/templates/sessions_controller.rb +0 -52
  88. data/generators/flexi_authentication/templates/tests/rspec/sessions_controller.rb +0 -39
  89. data/generators/flexi_authentication/templates/tests/rspec/user.rb +0 -83
  90. data/generators/flexi_authentication/templates/tests/rspec/users_controller.rb +0 -26
  91. data/generators/flexi_authentication/templates/tests/shoulda/sessions_controller.rb +0 -40
  92. data/generators/flexi_authentication/templates/tests/shoulda/user.rb +0 -85
  93. data/generators/flexi_authentication/templates/tests/shoulda/users_controller.rb +0 -27
  94. data/generators/flexi_authentication/templates/tests/testunit/user.rb +0 -88
  95. data/generators/flexi_authentication/templates/user.rb +0 -43
  96. data/generators/flexi_authentication/templates/views/erb/admin_user_edit.html.erb +0 -23
  97. data/generators/flexi_authentication/templates/views/erb/admin_user_index.html.erb +0 -33
  98. data/generators/flexi_authentication/templates/views/erb/admin_user_new.html.erb +0 -23
  99. data/generators/flexi_authentication/templates/views/erb/login.html.erb +0 -38
  100. data/generators/flexi_layout/USAGE +0 -18
  101. data/generators/flexi_layout/flexi_layout_generator.rb +0 -51
  102. data/generators/flexi_layout/lib/insert_commands.rb +0 -28
  103. data/generators/flexi_layout/templates/bg.png +0 -0
  104. data/generators/flexi_layout/templates/helper.rb +0 -19
  105. data/generators/flexi_layout/templates/home_helper.rb +0 -2
  106. data/generators/flexi_layout/templates/home_index.html.erb +0 -17
  107. data/generators/flexi_layout/templates/inflector_portuguese.rb +0 -62
  108. data/generators/flexi_layout/templates/layout.html.erb +0 -47
  109. data/generators/flexi_layout/templates/layout_login.html.erb +0 -27
  110. data/generators/flexi_layout/templates/layout_site.html.erb +0 -22
  111. data/generators/flexi_layout/templates/logo.png +0 -0
  112. data/generators/flexi_layout/templates/pt-BR.yml +0 -143
  113. data/generators/flexi_layout/templates/stylesheet.css +0 -132
  114. data/generators/flexi_layout/templates/stylesheet_login.css +0 -73
  115. data/generators/flexi_resource_scaffold/USAGE +0 -29
  116. data/generators/flexi_resource_scaffold/flexi_resource_scaffold_generator.rb +0 -179
  117. data/generators/flexi_resource_scaffold/templates/controller.rb +0 -29
  118. data/generators/flexi_resource_scaffold/templates/fixtures.yml +0 -10
  119. data/generators/flexi_resource_scaffold/templates/functional_test.rb +0 -57
  120. data/generators/flexi_resource_scaffold/templates/helper.rb +0 -2
  121. data/generators/flexi_resource_scaffold/templates/migration.rb +0 -15
  122. data/generators/flexi_resource_scaffold/templates/model.rb +0 -2
  123. data/generators/flexi_resource_scaffold/templates/old_migration.rb +0 -13
  124. data/generators/flexi_resource_scaffold/templates/rspec/functional_spec.rb +0 -255
  125. data/generators/flexi_resource_scaffold/templates/rspec/helper_spec.rb +0 -11
  126. data/generators/flexi_resource_scaffold/templates/rspec/routing_spec.rb +0 -61
  127. data/generators/flexi_resource_scaffold/templates/rspec/unit_spec.rb +0 -11
  128. data/generators/flexi_resource_scaffold/templates/rspec/views/edit_spec.rb +0 -28
  129. data/generators/flexi_resource_scaffold/templates/rspec/views/index_spec.rb +0 -26
  130. data/generators/flexi_resource_scaffold/templates/rspec/views/new_spec.rb +0 -30
  131. data/generators/flexi_resource_scaffold/templates/rspec/views/show_spec.rb +0 -25
  132. data/generators/flexi_resource_scaffold/templates/shoulda_functional_test.rb +0 -19
  133. data/generators/flexi_resource_scaffold/templates/unit_test.rb +0 -7
  134. data/generators/flexi_resource_scaffold/templates/view__form.erb +0 -6
  135. data/generators/flexi_resource_scaffold/templates/view__form.haml +0 -5
  136. data/generators/flexi_resource_scaffold/templates/view_edit.erb +0 -8
  137. data/generators/flexi_resource_scaffold/templates/view_edit.haml +0 -11
  138. data/generators/flexi_resource_scaffold/templates/view_index.erb +0 -27
  139. data/generators/flexi_resource_scaffold/templates/view_index.haml +0 -19
  140. data/generators/flexi_resource_scaffold/templates/view_new.erb +0 -9
  141. data/generators/flexi_resource_scaffold/templates/view_new.haml +0 -9
  142. data/generators/flexi_resource_scaffold/templates/view_show.erb +0 -10
  143. data/generators/flexi_resource_scaffold/templates/view_show.haml +0 -9
  144. data/generators/flexi_scaffold/USAGE +0 -51
  145. data/generators/flexi_scaffold/flexi_scaffold_generator.rb +0 -232
  146. data/generators/flexi_scaffold/templates/actions/create.rb +0 -9
  147. data/generators/flexi_scaffold/templates/actions/destroy.rb +0 -6
  148. data/generators/flexi_scaffold/templates/actions/edit.rb +0 -3
  149. data/generators/flexi_scaffold/templates/actions/index.rb +0 -4
  150. data/generators/flexi_scaffold/templates/actions/new.rb +0 -3
  151. data/generators/flexi_scaffold/templates/actions/show.rb +0 -3
  152. data/generators/flexi_scaffold/templates/actions/update.rb +0 -9
  153. data/generators/flexi_scaffold/templates/controller.rb +0 -5
  154. data/generators/flexi_scaffold/templates/model.rb +0 -3
  155. data/generators/flexi_scaffold/templates/tests/rspec/actions/create.rb +0 -11
  156. data/generators/flexi_scaffold/templates/tests/rspec/actions/destroy.rb +0 -6
  157. data/generators/flexi_scaffold/templates/tests/rspec/actions/edit.rb +0 -4
  158. data/generators/flexi_scaffold/templates/tests/rspec/actions/index.rb +0 -4
  159. data/generators/flexi_scaffold/templates/tests/rspec/actions/new.rb +0 -4
  160. data/generators/flexi_scaffold/templates/tests/rspec/actions/show.rb +0 -4
  161. data/generators/flexi_scaffold/templates/tests/rspec/actions/update.rb +0 -11
  162. data/generators/flexi_scaffold/templates/tests/rspec/controller.rb +0 -8
  163. data/generators/flexi_scaffold/templates/tests/rspec/model.rb +0 -7
  164. data/generators/flexi_scaffold/templates/tests/shoulda/actions/create.rb +0 -13
  165. data/generators/flexi_scaffold/templates/tests/shoulda/actions/destroy.rb +0 -8
  166. data/generators/flexi_scaffold/templates/tests/shoulda/actions/edit.rb +0 -6
  167. data/generators/flexi_scaffold/templates/tests/shoulda/actions/index.rb +0 -6
  168. data/generators/flexi_scaffold/templates/tests/shoulda/actions/new.rb +0 -6
  169. data/generators/flexi_scaffold/templates/tests/shoulda/actions/show.rb +0 -6
  170. data/generators/flexi_scaffold/templates/tests/shoulda/actions/update.rb +0 -13
  171. data/generators/flexi_scaffold/templates/tests/shoulda/controller.rb +0 -5
  172. data/generators/flexi_scaffold/templates/tests/shoulda/model.rb +0 -7
  173. data/generators/flexi_scaffold/templates/tests/testunit/actions/create.rb +0 -11
  174. data/generators/flexi_scaffold/templates/tests/testunit/actions/destroy.rb +0 -6
  175. data/generators/flexi_scaffold/templates/tests/testunit/actions/edit.rb +0 -4
  176. data/generators/flexi_scaffold/templates/tests/testunit/actions/index.rb +0 -4
  177. data/generators/flexi_scaffold/templates/tests/testunit/actions/new.rb +0 -4
  178. data/generators/flexi_scaffold/templates/tests/testunit/actions/show.rb +0 -4
  179. data/generators/flexi_scaffold/templates/tests/testunit/actions/update.rb +0 -11
  180. data/generators/flexi_scaffold/templates/tests/testunit/controller.rb +0 -5
  181. data/generators/flexi_scaffold/templates/tests/testunit/model.rb +0 -7
  182. data/generators/flexi_scaffold/templates/views/erb/_form.html.erb +0 -6
  183. data/generators/flexi_scaffold/templates/views/erb/edit.html.erb +0 -8
  184. data/generators/flexi_scaffold/templates/views/erb/index.html.erb +0 -41
  185. data/generators/flexi_scaffold/templates/views/erb/new.html.erb +0 -10
  186. data/generators/flexi_scaffold/templates/views/erb/show.html.erb +0 -19
  187. data/generators/flexi_scaffold/templates/views/haml/_form.html.haml +0 -10
  188. data/generators/flexi_scaffold/templates/views/haml/edit.html.haml +0 -14
  189. data/generators/flexi_scaffold/templates/views/haml/index.html.haml +0 -25
  190. data/generators/flexi_scaffold/templates/views/haml/new.html.haml +0 -7
  191. data/generators/flexi_scaffold/templates/views/haml/show.html.haml +0 -20
  192. data/test/test_helper.rb +0 -3
@@ -6,7 +6,6 @@ class <%= session_plural_class_name %>ControllerTest < ActionController::TestCas
6
6
  assert_template 'new'
7
7
  end
8
8
 
9
- <%- if options[:authlogic] -%>
10
9
  def test_create_invalid
11
10
  post :create, :<%= session_singular_name %> => { :username => "foo", :password => "badpassword" }
12
11
  assert_template 'new'
@@ -15,22 +14,7 @@ class <%= session_plural_class_name %>ControllerTest < ActionController::TestCas
15
14
 
16
15
  def test_create_valid
17
16
  post :create, :<%= session_singular_name %> => { :username => "foo", :password => "secret" }
18
- assert_redirected_to root_url
17
+ assert_redirected_to "/"
19
18
  assert_equal <%= user_plural_name %>(:foo), <%= session_class_name %>.find.<%= user_singular_name %>
20
19
  end
21
- <%- else -%>
22
- def test_create_invalid
23
- <%= user_class_name %>.stubs(:authenticate).returns(nil)
24
- post :create
25
- assert_template 'new'
26
- assert_nil session['<%= user_singular_name %>_id']
27
- end
28
-
29
- def test_create_valid
30
- <%= user_class_name %>.stubs(:authenticate).returns(<%= user_class_name %>.first)
31
- post :create
32
- assert_redirected_to root_url
33
- assert_equal <%= user_class_name %>.first.id, session['<%= user_singular_name %>_id']
34
- end
35
- <%- end -%>
36
20
  end
@@ -0,0 +1,4 @@
1
+ require 'test_helper'
2
+
3
+ class <%= user_class_name %>Test < ActiveSupport::TestCase
4
+ end
@@ -15,7 +15,7 @@ class <%= user_plural_class_name %>ControllerTest < ActionController::TestCase
15
15
  def test_create_valid
16
16
  <%= user_class_name %>.any_instance.stubs(:valid?).returns(true)
17
17
  post :create
18
- assert_redirected_to root_url
18
+ assert_redirected_to "/"
19
19
  <%- unless options[:authlogic] -%>
20
20
  assert_equal assigns['<%= user_singular_name %>'].id, session['<%= user_singular_name %>_id']
21
21
  <%- end -%>
@@ -0,0 +1,3 @@
1
+ class <%= user_class_name %> < ActiveRecord::Base
2
+ acts_as_authentic
3
+ end
@@ -0,0 +1,42 @@
1
+ class Admin::<%= user_plural_class_name %>Controller < ApplicationController
2
+ menu_item :<%= user_plural_name %>
3
+ respond_to :html
4
+
5
+ def index
6
+ @<%= user_plural_name %> = <%= user_class_name %>.paginate :page => params[:page],
7
+ :per_page => 15
8
+ respond_with(:admin, @<%= user_plural_name %>)
9
+ end
10
+
11
+ def show
12
+ @<%= user_singular_name %> = <%= user_class_name %>.find(params[:id])
13
+ respond_with(:admin, @<%= user_singular_name %>)
14
+ end
15
+
16
+ def new
17
+ @<%= user_singular_name %> = <%= user_class_name %>.new
18
+ respond_with(:admin, @<%= user_singular_name %>)
19
+ end
20
+
21
+ def edit
22
+ @<%= user_singular_name %> = <%= user_class_name %>.find(params[:id])
23
+ end
24
+
25
+ def create
26
+ @<%= user_singular_name %> = <%= user_class_name %>.new(params[:<%= user_singular_name %>])
27
+ flash[:notice] = '<%= user_class_name %> foi criado com sucesso.' if @<%= user_singular_name %>.save
28
+ respond_with(:admin, @<%= user_singular_name %>)
29
+ end
30
+
31
+ def update
32
+ @<%= user_singular_name %> = <%= user_class_name %>.new(params[:id])
33
+ flash[:notice] = '<%= user_class_name %> foi alterado com sucesso.' if @<%= user_singular_name %>.update_attributes(params[:<%= user_singular_name %>])
34
+ respond_with(:admin, @<%= user_singular_name %>)
35
+ end
36
+
37
+ def destroy
38
+ @<%= user_singular_name %> = <%= user_class_name %>.find(params[:id])
39
+ flash[:notice] = '<%= user_class_name %> foi excluído com sucesso.' if @<%= user_singular_name %>.destroy
40
+ respond_with(:admin, @<%= user_singular_name %>)
41
+ end
42
+ end
@@ -0,0 +1,11 @@
1
+ <%% if resource.errors.any? %>
2
+ <div class="flash_messages error_explanation">
3
+ <h2>Não foi possível gravar: <%%= pluralize(resource.errors.count, "erro") %></h2>
4
+
5
+ <ul>
6
+ <%% resource.errors.full_messages.each do |msg| %>
7
+ <li><%%= msg %></li>
8
+ <%% end %>
9
+ </ul>
10
+ </div>
11
+ <%% end %>
@@ -0,0 +1,24 @@
1
+ <%% title "Editando <%= user_singular_name.titleize %>" %>
2
+
3
+ <%%= form_for([:admin, @<%= user_singular_name %>]) do |f| %>
4
+ <%%= render "shared/error_messages", :resource => @<%= user_singular_name %> %>
5
+ <div class="field">
6
+ <%%= f.label :username %><br />
7
+ <%%= f.text_field :username, :readonly => true %>
8
+ </div>
9
+ <div class="field">
10
+ <%%= f.label :email %><br />
11
+ <%%= f.text_field :email %>
12
+ </div>
13
+ <div class="field">
14
+ <%%= f.label :password %><br />
15
+ <%%= f.password_field :password %>
16
+ </div>
17
+ <div class="field">
18
+ <%%= f.label :password_confirmation %><br />
19
+ <%%= f.password_field :password_confirmation %>
20
+ </div>
21
+ <div id="control_box">
22
+ <%%= f.submit "Salvar", :class => "button medium save blue" %> | <%%= link_to("Cancelar", admin_<%= user_plural_name %>_path, :class => "button medium red") %>
23
+ </div>
24
+ <%% end %>
@@ -0,0 +1,27 @@
1
+ <%% title("<%= user_plural_name.titleize %>") %>
2
+
3
+ <div id="new_box">
4
+ <%%= link_to 'Adicionar', new_admin_<%= user_singular_name %>_path, :class => 'button medium green' %>
5
+ </div>
6
+
7
+ <table cellspacing="0" cellpadding="2">
8
+ <tr>
9
+ <th>Usuário</th>
10
+ <th>E-mail</th>
11
+ <th></th>
12
+ </tr>
13
+ <%% @<%= user_plural_name %>.each do |<%= user_singular_name %>| %>
14
+ <tr>
15
+ <td><%%= <%= user_singular_name %>.username %></td>
16
+ <td><%%= <%= user_singular_name %>.email %></td>
17
+ <td width="11%">
18
+ <ul class="actions">
19
+ <li><%%= link_to( image_tag("show.png"), [:admin, <%= user_singular_name %>], :title => "Mostrar" ) %></li>
20
+ <li><%%= link_to( image_tag("edit.png"), edit_admin_<%= user_singular_name %>_path(<%= user_singular_name %>), :title => "Editar" ) %></li>
21
+ <li><%%= link_to( image_tag("delete.png"), [:admin, <%= user_singular_name %>], :confirm => 'Tem certeza que deseja excluir?', :method => :delete, :title => "Excluir" ) %></li>
22
+ </ul>
23
+ </td>
24
+ </tr>
25
+ <%% end %>
26
+ </table>
27
+ <%%= will_paginate @<%= user_plural_name %>, :previous_label=>'&laquo; Anterior', :next_label=>'Próximo &raquo;' %>
@@ -0,0 +1,22 @@
1
+ <%% title "Autenticação" %>
2
+
3
+ <%%= form_for @<%= session_singular_name %> do |f| %>
4
+ <table width="100%" cellspacing="1" cellpadding="2" align="center" class="login_box">
5
+ <tr>
6
+ <td><%%= f.label :username, "Usuário ou E-mail:" %></td>
7
+ <td><%%= f.text_field :username %></td>
8
+ </tr>
9
+ <tr>
10
+ <td><%%= f.label :password, "Senha:" %></td>
11
+ <td><%%= f.password_field :password %></td>
12
+ </tr>
13
+ <tr>
14
+ <td></td>
15
+ <td><%%= f.check_box :remember_me %><%%= f.label :remember_me, "Lembrar-me" %></td>
16
+ </tr>
17
+ </table>
18
+
19
+ <div id="control_box">
20
+ <%%= submit_tag "Acessar", :class => "button grey" %>
21
+ </div>
22
+ <%% end %>
@@ -0,0 +1,24 @@
1
+ <%% title "Novo <%= user_singular_name.titleize %>" %>
2
+
3
+ <%%= form_for([:admin, @<%= user_singular_name %>]) do |f| %>
4
+ <%%= render "shared/error_messages", :resource => @<%= user_singular_name %> %>
5
+ <div class="field">
6
+ <%%= f.label :username %><br />
7
+ <%%= f.text_field :username %>
8
+ </div>
9
+ <div class="field">
10
+ <%%= f.label :email %><br />
11
+ <%%= f.text_field :email %>
12
+ </div>
13
+ <div class="field">
14
+ <%%= f.label :password %><br />
15
+ <%%= f.password_field :password %>
16
+ </div>
17
+ <div class="field">
18
+ <%%= f.label :password_confirmation %><br />
19
+ <%%= f.password_field :password_confirmation %>
20
+ </div>
21
+ <div id="control_box">
22
+ <%%= f.submit "Salvar", :class => "button medium save blue" %> | <%%= link_to("Cancelar", admin_<%= user_plural_name %>_path, :class => "button medium red") %>
23
+ </div>
24
+ <%% end %>
@@ -0,0 +1,16 @@
1
+ <%% title "<%= user_singular_name.titleize %>" %>
2
+ <p>
3
+ <b>Usuário:</b>
4
+ <%%= @<%= user_singular_name %>.username %>
5
+ </p>
6
+ <p>
7
+ <b>E-mail:</b>
8
+ <%%= @<%= user_singular_name %>.email %>
9
+ </p>
10
+
11
+ <div id="control_box">
12
+ <%%= link_to( image_tag("back.png"), admin_<%= user_plural_name %>_path, :title => "Voltar" ) %> |
13
+ <%%= link_to( image_tag("edit.png"), edit_admin_<%= user_singular_name %>_path(@<%= user_singular_name %>), :title => "Editar" ) %> |
14
+ <%%= link_to( image_tag("delete.png"), [:admin, @<%= user_singular_name %>], :confirm => 'Tem certeza que deseja excluir?', :method => :delete, :title => "Exlcuir" ) %>
15
+ </div>
16
+
@@ -0,0 +1,6 @@
1
+ Description:
2
+ The flexi_prepare generator creates a basic layout and config files and
3
+ helper which will give some structure to a starting Rails app.
4
+
5
+ Example:
6
+ rails generate flexi_prepare
@@ -0,0 +1,56 @@
1
+ class FlexiPrepareGenerator < Rails::Generators::Base
2
+ source_root File.expand_path('../templates', __FILE__)
3
+
4
+ def generate_flexi_prepare
5
+ remove_file "app/views/layouts/application.html.erb"
6
+ remove_file "app/helpers/application_helper.rb"
7
+ remove_file "public/index.html"
8
+
9
+ copy_file "pt-BR.yml", "config/locales/pt-BR.yml"
10
+ copy_file "inflector_portuguese.rb", "config/initializers/inflector_portuguese.rb"
11
+ copy_file "custom_field_error.rb", "config/initializers/custom_field_error.rb"
12
+ copy_file "application.css", "public/stylesheets/application.css"
13
+ copy_file "login.css", "public/stylesheets/login.css"
14
+ copy_file "site.css", "public/stylesheets/site.css"
15
+ copy_file "logo.png", "public/images/logo.png"
16
+ copy_file "add.png", "public/images/add.png"
17
+ copy_file "bg.png", "public/images/bg.png"
18
+ copy_file "bg2.png", "public/images/bg2.png"
19
+ copy_file "users.png", "public/images/users.png"
20
+ copy_file "boxheader.gif", "public/images/boxheader.gif"
21
+ copy_file "menu.png", "public/images/menu.png"
22
+ copy_file "btn-bg.png", "public/images/btn-bg.png"
23
+ copy_file "btn-bg-hover.png", "public/images/btn-bg-hover.png"
24
+ copy_file "edit.png", "public/images/edit.png"
25
+ copy_file "show.png", "public/images/show.png"
26
+ copy_file "delete.png", "public/images/delete.png"
27
+ copy_file "back.png", "public/images/back.png"
28
+ copy_file "messages/error.png", "public/images/messages/error.png"
29
+ copy_file "messages/info.png", "public/images/messages/info.png"
30
+ copy_file "messages/success.png", "public/images/messages/success.png"
31
+ copy_file "messages/tip.png", "public/images/messages/tip.png"
32
+ copy_file "messages/warning.png", "public/images/messages/warning.png"
33
+ copy_file "admin_home_controller.rb", "app/controllers/admin/home_controller.rb"
34
+ copy_file "site_controller.rb", "app/controllers/site_controller.rb"
35
+ copy_file "site_helper.rb", "app/helpers/site_helper.rb"
36
+ copy_file "application_helper.rb", "app/helpers/application_helper.rb"
37
+
38
+ template "application.html.erb", "app/views/layouts/application.html.erb"
39
+ template "login.html.erb", "app/views/layouts/login.html.erb"
40
+ template "site.html.erb", "app/views/layouts/site.html.erb"
41
+ template "site_index.html.erb", "app/views/site/index.html.erb"
42
+ template "admin_home_index.html.erb", "app/views/admin/home/index.html.erb"
43
+
44
+ gem 'menu_builder', '=0.3.3'
45
+ gem 'will_paginate', '~> 3.0.beta'
46
+
47
+ route 'root :to => "site#index"'
48
+ route 'namespace :admin do
49
+ match "home" => "home#index"
50
+ end'
51
+
52
+ inject_into_file "config/application.rb", "\tconfig.i18n.default_locale = 'pt-BR'\n", :after => "class Application < Rails::Application\n"
53
+ inject_into_file "config/application.rb", "\tconfig.time_zone = 'Brasilia'\n", :after => "class Application < Rails::Application\n"
54
+ end
55
+
56
+ end
@@ -11,6 +11,6 @@
11
11
  </li>
12
12
  <li>
13
13
  <h2>Gere seu scaffold</h2>
14
- <p>ruby script/generate flexi_scaffold Post title:string body:text</p>
14
+ <p>rails g flexi_scaffold Post title:string body:text</p>
15
15
  </li>
16
16
  </ul>
@@ -0,0 +1,278 @@
1
+ /* Basic */
2
+ html { background: url('/images/bg.png');}
3
+ body {
4
+ margin:0;
5
+ padding:0;
6
+ background: url('/images/bg2.png') repeat-x top;
7
+ font-family: Arial,Helvetica,sans-serif;
8
+ font-size: 13px;
9
+ color: #333333;
10
+ }
11
+ a {text-decoration: none;}
12
+ a:hover {text-decoration: underline;}
13
+ input[type=text],input[type=password],input[type=file],select,textarea {
14
+ padding: 5px;
15
+ border-top: solid 1px #c4c4c4;
16
+ border-left: solid 1px #e9e9e9;
17
+ border-bottom: solid 1px #e9e9e9;
18
+ border-right: solid 1px #c4c4c4;
19
+ -moz-border-radius:5px;
20
+ }
21
+ .logout{ color:#D30000; font-weight:bold;}
22
+ .login { font-weight:bold; }
23
+ label { font-weight:bold;}
24
+ h1, h2 { padding:2px; margin:2px; }
25
+ a img { border: none; }
26
+ a { color: #0000FF; }
27
+ .clear { clear: both; height: 0; overflow: hidden; }
28
+ div#control_box {
29
+ -moz-border-radius:5px;
30
+ background-color:#F3F3F3;
31
+ border:1px solid #E5E5E5;
32
+ padding:5px;
33
+ text-align:center;
34
+ }
35
+ div#title_box {
36
+ background-color:#F3F3F3;
37
+ border:1px solid #E5E5E5;
38
+ padding:1px;
39
+ text-align:center;
40
+ }
41
+ div#new_box { padding:0 0 15px; }
42
+ ul.actions {visibility:hidden; margin:0; padding:0;}
43
+ ul.actions li {display:inline; margin-right:5px;}
44
+ .field{padding-bottom:15px;}
45
+
46
+ /* Pagination */
47
+ .pagination{ margin-top: 15px; text-align: center; }
48
+ .pagination a {
49
+ color:#008BBF;
50
+ -moz-border-radius:5px 5px 5px 5px;
51
+ border:1px solid #CCCCCC;
52
+ margin:0 2px;
53
+ padding:3px 6px;
54
+ }
55
+ .pagination span {
56
+ -moz-border-radius:5px 5px 5px 5px;
57
+ border:1px solid #CCCCCC;
58
+ margin:0 2px;
59
+ padding:3px 6px;
60
+ }
61
+ .pagination em {
62
+ color:#fff;
63
+ padding:3px 6px;
64
+ margin:0 2px;
65
+ background: #398BD1 url("/images/btn-bg.png") repeat-x scroll center top;
66
+ text-shadow:0 -1px 1px rgba(0, 0, 0, 0.25);
67
+ -moz-border-radius :5px;
68
+ border:1px solid rgba(0, 0, 0, 0.25);
69
+ }
70
+
71
+ /* Navigation */
72
+ #sidenav {
73
+ width: 156px;
74
+ float:left;
75
+ background-color: #F3F3F3;
76
+ padding: 0px 0px 0px 0px;
77
+ font-size: 14px;
78
+ font-weight: bold;
79
+ margin: 0px 0px 0px 0px;
80
+ }
81
+ #sidenav ul {
82
+ list-style-type:none;
83
+ list-style-position:outside;
84
+ list-style-image: none;
85
+ padding:0px 0px 0px 0px;
86
+ margin:0px 0px 0px 0px;
87
+ }
88
+ #sidenav li { }
89
+ #sidenav li a {
90
+ width: 156px;
91
+ display:block;
92
+ width:93%;
93
+ height: 100%;
94
+ line-height: 25px;
95
+ border-bottom: 1px solid #DDDDDD;
96
+ padding-left: 10px;
97
+ color: #4E5660;
98
+ }
99
+ #sidenav li a:hover { background: #FFFADF; }
100
+ #sidenav li.current a {background: #DFF6FF; color: #000; }
101
+
102
+ div.top_nav{
103
+ text-align: right;
104
+ width: 900px;
105
+ margin: 0 auto;
106
+ border-bottom:1px solid #4E5660;
107
+ margin-bottom: 10px;
108
+ padding-bottom: 2px;
109
+ padding-top: 2px;
110
+ text-shadow:0 1px 0 #FFFFFF;
111
+ color: #333333;
112
+ font-size: 15px;
113
+ font-weight: bold;
114
+ }
115
+
116
+ /* Content */
117
+ div#header{ width: 900px; margin: 0 auto; }
118
+ #container {
119
+ width: 900px;
120
+ overflow: auto;
121
+ margin: 0 auto;
122
+ margin-top: 10px;
123
+ }
124
+
125
+ #main{
126
+ width: 733px;
127
+ float:right;
128
+ padding: 0 ;
129
+ margin:0;
130
+ }
131
+
132
+ #main .box table { width: 100%; }
133
+ #main .box table th {
134
+ background:url("/images/boxheader.gif") repeat-x scroll 0 0 #E2E2E2;
135
+ color:#333333;
136
+ font-weight:bold;
137
+ text-shadow:1px 1px 1px #FFFFFF;
138
+ padding:8px;
139
+ text-align:left;
140
+ }
141
+ /*#main table th { background-color: #F3F3F3 }*/
142
+ #main .box table tr td { border-bottom: 1px solid #DDDDDD; height:40px;}
143
+ #main .box table tr:hover td { background: #FFFADF none repeat scroll 0 0; }
144
+ #main .box table tr:hover .actions{ visibility:visible; }
145
+
146
+ /* Box */
147
+ .box {
148
+ background:#fff;
149
+ border:1px solid #c5c5c5;
150
+ margin-bottom:15px;
151
+ padding:15px;
152
+ border-top:0;
153
+ -moz-border-radius-bottomleft :5px;
154
+ -moz-border-radius-bottomright :5px;
155
+ -webkit-border-bottom-left-radius:5px;
156
+ -webkit-border-bottom-right-radius:5px;
157
+ }
158
+ .box-header {
159
+ border:1px solid #c5c5c5;
160
+ font-weight:bold;
161
+ text-align:center;
162
+ font-size:14px;
163
+ background:#e2e2e2 url('/images/boxheader.gif') repeat-x top;
164
+ padding:10px 15px;
165
+ color:#333333;
166
+ text-shadow:1px 1px 1px #FFFFFF;
167
+ -moz-border-radius-topleft:5px;
168
+ -webkit-border-top-left-radius:5px;
169
+ -moz-border-radius-topright:5px;
170
+ -webkit-border-top-right-radius:5px;
171
+ }
172
+ .menu {
173
+ background:#fff;
174
+ border:1px solid #c5c5c5;
175
+ padding:15px;
176
+ -moz-border-radius :5px;
177
+ }
178
+
179
+ /* Buttons */
180
+ .button {
181
+ cursor:pointer;
182
+ display:inline-block;
183
+ font:14px/100% Arial, Helvetica, sans-serif;
184
+ font-weight:bold;
185
+ margin:0 5px;
186
+ outline:none;
187
+ padding:8px 20px;
188
+ width:auto;
189
+ text-align:center;
190
+ text-decoration:none;
191
+ vertical-align:baseline;
192
+ background:#202020 url('/images/btn-bg.png') repeat-x top;
193
+ color:#fff;
194
+ border:1px solid rgba(0, 0, 0, 0.25);
195
+ -moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
196
+ -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
197
+ text-shadow:0 -1px 1px rgba(0, 0, 0, 0.25);
198
+ -moz-border-radius:5px;
199
+ -webkit-border-radius:5px;
200
+ }
201
+ .button:hover {
202
+ background-image: url('/images/btn-bg-hover.png');
203
+ text-decoration:none;
204
+ outline:none;
205
+ }
206
+ .button:active {
207
+ position:relative;
208
+ top:1px;
209
+ outline:none;
210
+ }
211
+ .button.blue { background-color:#398BD1; }
212
+ .button.green { background-color:#55a34a; }
213
+ .button.red { background-color:#d13a39; }
214
+ .button.yellow { background-color:#c5a059; }
215
+ .button.grey {
216
+ background-color:#eee;
217
+ color:#4d4d4d;
218
+ text-shadow:0 -1px 1px #fff;
219
+ }
220
+ .button.medium {
221
+ font-size:13px;
222
+ padding:6px 15px;
223
+ }
224
+ .button.medium.save {
225
+ font-size:13px;
226
+ padding:4px 15px;
227
+ }
228
+ .button.small {
229
+ font-size:11px;
230
+ padding:3px 10px;
231
+ width:auto;
232
+ }
233
+
234
+ /* Notices */
235
+ .flash_messages {
236
+ border-width:1px;
237
+ border-style:solid;
238
+ padding:17px 17px 17px 55px;
239
+ -moz-border-radius:5px;
240
+ margin-bottom:10px;
241
+ -webkit-border:5px;
242
+ border-radius:5px;
243
+ -moz-box-shadow:1px 1px rgba(255, 255, 255, 0.6) inset;
244
+ -webkit-box-shadow:1px 1px rgba(255, 255, 255, 0.6) inset;
245
+ }
246
+ .flash_messages.notice {
247
+ background:#f1ffbf url('/images/messages/success.png') no-repeat 10px 10px;
248
+ border-color:#a6d50f;
249
+ color:#1E5F1D;
250
+ }
251
+ .flash_messages.error {
252
+ background:#fecdc6 url('/images/messages/error.png') no-repeat 10px 10px;
253
+ border-color:#E17984;
254
+ color:#9E0B0F;
255
+ }
256
+ .flash_messages.warning {
257
+ background:#ffecb0 url('/images/messages/warning.png') no-repeat 10px 10px;
258
+ border-color:#ffbc2a;
259
+ color:#BF8F00;
260
+ }
261
+ .flash_messages.info {
262
+ background:#d4e7f5 url('/images/messages/info.png') no-repeat 10px 10px;
263
+ border-color:#589ad7;
264
+ color:#0089EF;
265
+ }
266
+ .flash_messages.tip {
267
+ background:#ffeccd url('/images/messages/tip.png') no-repeat 10px 10px;
268
+ border-color:#dd9854;
269
+ color:#CF7E00;
270
+ }
271
+ .flash_messages.error_explanation{
272
+ background:#F9E1DE url('/images/messages/error.png') no-repeat 15px 18px;
273
+ border-color:#E17984;
274
+ color:#9E0B0F;
275
+ }
276
+ /* Errors */
277
+ .field_with_errors{ margin:0;padding:0;}
278
+ .field_with_errors input { background-color:#FFEBEB; }
@@ -0,0 +1,57 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
5
+ <title><%%= "Área administrativa - #{ yield(:title) }" %></title>
6
+ <%%= stylesheet_link_tag 'application' %>
7
+ <%%= javascript_include_tag :defaults %>
8
+ <%%= yield(:head) %>
9
+ <%%= csrf_meta_tag %>
10
+ </head>
11
+ <body>
12
+ <div class="top_nav">
13
+ <%% if logged_in? %>
14
+ <%%= current_user.username %> | <%%= current_user.email %> | <%%= link_to "» Sair", logout_path, :class => 'logout' %>
15
+ <%% else %>
16
+ <%%= link_to "» Entrar", login_path, :class => 'login' %>
17
+ <%% end %>
18
+ </div>
19
+ <div id="header">
20
+ <%%= link_to image_tag("logo.png"), admin_home_url %>
21
+ </div>
22
+ <div id="container">
23
+ <div id="sidenav">
24
+ <div class="menu">
25
+ <%%= menu do |m| %>
26
+ <%% m.users admin_users_path do %>
27
+ <%%= image_tag 'users.png' %> Usuários
28
+ <%% end %>
29
+ <%%= m.menu1 "#menu" do %>
30
+ <%%= image_tag 'menu.png' %> Menu 1
31
+ <%% end %>
32
+ <%%= m.menu2 "#menu" do %>
33
+ <%%= image_tag 'menu.png' %> Menu 2
34
+ <%% end %>
35
+ <%%= m.menu3 "#menu" do %>
36
+ <%%= image_tag 'menu.png' %> Menu 3
37
+ <%% end %>
38
+ <%%= m.menu4 "#menu" do %>
39
+ <%%= image_tag 'menu.png' %> Menu 4
40
+ <%% end %>
41
+ <%% end %>
42
+ </div>
43
+ </div>
44
+ <div id="main">
45
+ <div class="box-header">
46
+ <%% if show_title? %>
47
+ <h2><%%= yield(:title) %></h2>
48
+ <%% end %>
49
+ </div>
50
+ <div class="box">
51
+ <%%= raw flash_messages %>
52
+ <%%= yield %>
53
+ </div>
54
+ </div>
55
+ </div>
56
+ </body>
57
+ </html>