flexi_generators 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. data/README.textile +71 -0
  2. data/Rakefile +38 -0
  3. data/VERSION +1 -0
  4. data/flexi_generators.gemspec +176 -0
  5. data/flexi_template.rb +28 -0
  6. data/generators/flexi_authentication/USAGE +50 -0
  7. data/generators/flexi_authentication/flexi_authentication_generator.rb +127 -0
  8. data/generators/flexi_authentication/lib/insert_commands.rb +74 -0
  9. data/generators/flexi_authentication/templates/admin_users_controller.rb +60 -0
  10. data/generators/flexi_authentication/templates/authentication.rb +61 -0
  11. data/generators/flexi_authentication/templates/authlogic_session.rb +2 -0
  12. data/generators/flexi_authentication/templates/fixtures.yml +24 -0
  13. data/generators/flexi_authentication/templates/migration.rb +30 -0
  14. data/generators/flexi_authentication/templates/sessions_controller.rb +52 -0
  15. data/generators/flexi_authentication/templates/sessions_helper.rb +2 -0
  16. data/generators/flexi_authentication/templates/tests/rspec/sessions_controller.rb +39 -0
  17. data/generators/flexi_authentication/templates/tests/rspec/user.rb +83 -0
  18. data/generators/flexi_authentication/templates/tests/rspec/users_controller.rb +26 -0
  19. data/generators/flexi_authentication/templates/tests/shoulda/sessions_controller.rb +40 -0
  20. data/generators/flexi_authentication/templates/tests/shoulda/user.rb +85 -0
  21. data/generators/flexi_authentication/templates/tests/shoulda/users_controller.rb +27 -0
  22. data/generators/flexi_authentication/templates/tests/testunit/sessions_controller.rb +36 -0
  23. data/generators/flexi_authentication/templates/tests/testunit/user.rb +88 -0
  24. data/generators/flexi_authentication/templates/tests/testunit/users_controller.rb +23 -0
  25. data/generators/flexi_authentication/templates/user.rb +43 -0
  26. data/generators/flexi_authentication/templates/users_helper.rb +2 -0
  27. data/generators/flexi_authentication/templates/views/erb/admin_user_edit.html.erb +23 -0
  28. data/generators/flexi_authentication/templates/views/erb/admin_user_index.html.erb +33 -0
  29. data/generators/flexi_authentication/templates/views/erb/admin_user_new.html.erb +23 -0
  30. data/generators/flexi_authentication/templates/views/erb/login.html.erb +38 -0
  31. data/generators/flexi_layout/USAGE +18 -0
  32. data/generators/flexi_layout/flexi_layout_generator.rb +51 -0
  33. data/generators/flexi_layout/lib/insert_commands.rb +28 -0
  34. data/generators/flexi_layout/templates/add.png +0 -0
  35. data/generators/flexi_layout/templates/admin_home_controller.rb +6 -0
  36. data/generators/flexi_layout/templates/admin_home_index.html.erb +16 -0
  37. data/generators/flexi_layout/templates/bg.png +0 -0
  38. data/generators/flexi_layout/templates/custom_field_error.rb +12 -0
  39. data/generators/flexi_layout/templates/helper.rb +19 -0
  40. data/generators/flexi_layout/templates/home_controller.rb +9 -0
  41. data/generators/flexi_layout/templates/home_helper.rb +2 -0
  42. data/generators/flexi_layout/templates/home_index.html.erb +17 -0
  43. data/generators/flexi_layout/templates/inflector_portuguese.rb +62 -0
  44. data/generators/flexi_layout/templates/layout.html.erb +47 -0
  45. data/generators/flexi_layout/templates/layout_login.html.erb +27 -0
  46. data/generators/flexi_layout/templates/layout_site.html.erb +22 -0
  47. data/generators/flexi_layout/templates/logo.png +0 -0
  48. data/generators/flexi_layout/templates/pt-BR.yml +143 -0
  49. data/generators/flexi_layout/templates/stylesheet.css +132 -0
  50. data/generators/flexi_layout/templates/stylesheet_login.css +73 -0
  51. data/generators/flexi_layout/templates/stylesheet_site.css +63 -0
  52. data/generators/flexi_layout/templates/users.png +0 -0
  53. data/generators/flexi_resource_scaffold/USAGE +29 -0
  54. data/generators/flexi_resource_scaffold/flexi_resource_scaffold_generator.rb +179 -0
  55. data/generators/flexi_resource_scaffold/templates/controller.rb +29 -0
  56. data/generators/flexi_resource_scaffold/templates/fixtures.yml +10 -0
  57. data/generators/flexi_resource_scaffold/templates/functional_test.rb +57 -0
  58. data/generators/flexi_resource_scaffold/templates/helper.rb +2 -0
  59. data/generators/flexi_resource_scaffold/templates/migration.rb +15 -0
  60. data/generators/flexi_resource_scaffold/templates/model.rb +2 -0
  61. data/generators/flexi_resource_scaffold/templates/old_migration.rb +13 -0
  62. data/generators/flexi_resource_scaffold/templates/rspec/functional_spec.rb +255 -0
  63. data/generators/flexi_resource_scaffold/templates/rspec/helper_spec.rb +11 -0
  64. data/generators/flexi_resource_scaffold/templates/rspec/routing_spec.rb +61 -0
  65. data/generators/flexi_resource_scaffold/templates/rspec/unit_spec.rb +11 -0
  66. data/generators/flexi_resource_scaffold/templates/rspec/views/edit_spec.rb +28 -0
  67. data/generators/flexi_resource_scaffold/templates/rspec/views/index_spec.rb +26 -0
  68. data/generators/flexi_resource_scaffold/templates/rspec/views/new_spec.rb +30 -0
  69. data/generators/flexi_resource_scaffold/templates/rspec/views/show_spec.rb +25 -0
  70. data/generators/flexi_resource_scaffold/templates/shoulda_functional_test.rb +19 -0
  71. data/generators/flexi_resource_scaffold/templates/unit_test.rb +7 -0
  72. data/generators/flexi_resource_scaffold/templates/view__form.erb +6 -0
  73. data/generators/flexi_resource_scaffold/templates/view__form.haml +5 -0
  74. data/generators/flexi_resource_scaffold/templates/view_edit.erb +8 -0
  75. data/generators/flexi_resource_scaffold/templates/view_edit.haml +11 -0
  76. data/generators/flexi_resource_scaffold/templates/view_index.erb +27 -0
  77. data/generators/flexi_resource_scaffold/templates/view_index.haml +19 -0
  78. data/generators/flexi_resource_scaffold/templates/view_new.erb +9 -0
  79. data/generators/flexi_resource_scaffold/templates/view_new.haml +9 -0
  80. data/generators/flexi_resource_scaffold/templates/view_show.erb +10 -0
  81. data/generators/flexi_resource_scaffold/templates/view_show.haml +9 -0
  82. data/generators/flexi_scaffold/USAGE +51 -0
  83. data/generators/flexi_scaffold/flexi_scaffold_generator.rb +232 -0
  84. data/generators/flexi_scaffold/templates/actions/create.rb +9 -0
  85. data/generators/flexi_scaffold/templates/actions/destroy.rb +6 -0
  86. data/generators/flexi_scaffold/templates/actions/edit.rb +3 -0
  87. data/generators/flexi_scaffold/templates/actions/index.rb +4 -0
  88. data/generators/flexi_scaffold/templates/actions/new.rb +3 -0
  89. data/generators/flexi_scaffold/templates/actions/show.rb +3 -0
  90. data/generators/flexi_scaffold/templates/actions/update.rb +9 -0
  91. data/generators/flexi_scaffold/templates/controller.rb +5 -0
  92. data/generators/flexi_scaffold/templates/fixtures.yml +9 -0
  93. data/generators/flexi_scaffold/templates/helper.rb +2 -0
  94. data/generators/flexi_scaffold/templates/migration.rb +16 -0
  95. data/generators/flexi_scaffold/templates/model.rb +3 -0
  96. data/generators/flexi_scaffold/templates/tests/rspec/actions/create.rb +11 -0
  97. data/generators/flexi_scaffold/templates/tests/rspec/actions/destroy.rb +6 -0
  98. data/generators/flexi_scaffold/templates/tests/rspec/actions/edit.rb +4 -0
  99. data/generators/flexi_scaffold/templates/tests/rspec/actions/index.rb +4 -0
  100. data/generators/flexi_scaffold/templates/tests/rspec/actions/new.rb +4 -0
  101. data/generators/flexi_scaffold/templates/tests/rspec/actions/show.rb +4 -0
  102. data/generators/flexi_scaffold/templates/tests/rspec/actions/update.rb +11 -0
  103. data/generators/flexi_scaffold/templates/tests/rspec/controller.rb +8 -0
  104. data/generators/flexi_scaffold/templates/tests/rspec/model.rb +7 -0
  105. data/generators/flexi_scaffold/templates/tests/shoulda/actions/create.rb +13 -0
  106. data/generators/flexi_scaffold/templates/tests/shoulda/actions/destroy.rb +8 -0
  107. data/generators/flexi_scaffold/templates/tests/shoulda/actions/edit.rb +6 -0
  108. data/generators/flexi_scaffold/templates/tests/shoulda/actions/index.rb +6 -0
  109. data/generators/flexi_scaffold/templates/tests/shoulda/actions/new.rb +6 -0
  110. data/generators/flexi_scaffold/templates/tests/shoulda/actions/show.rb +6 -0
  111. data/generators/flexi_scaffold/templates/tests/shoulda/actions/update.rb +13 -0
  112. data/generators/flexi_scaffold/templates/tests/shoulda/controller.rb +5 -0
  113. data/generators/flexi_scaffold/templates/tests/shoulda/model.rb +7 -0
  114. data/generators/flexi_scaffold/templates/tests/testunit/actions/create.rb +11 -0
  115. data/generators/flexi_scaffold/templates/tests/testunit/actions/destroy.rb +6 -0
  116. data/generators/flexi_scaffold/templates/tests/testunit/actions/edit.rb +4 -0
  117. data/generators/flexi_scaffold/templates/tests/testunit/actions/index.rb +4 -0
  118. data/generators/flexi_scaffold/templates/tests/testunit/actions/new.rb +4 -0
  119. data/generators/flexi_scaffold/templates/tests/testunit/actions/show.rb +4 -0
  120. data/generators/flexi_scaffold/templates/tests/testunit/actions/update.rb +11 -0
  121. data/generators/flexi_scaffold/templates/tests/testunit/controller.rb +5 -0
  122. data/generators/flexi_scaffold/templates/tests/testunit/model.rb +7 -0
  123. data/generators/flexi_scaffold/templates/views/erb/_form.html.erb +6 -0
  124. data/generators/flexi_scaffold/templates/views/erb/edit.html.erb +8 -0
  125. data/generators/flexi_scaffold/templates/views/erb/index.html.erb +41 -0
  126. data/generators/flexi_scaffold/templates/views/erb/new.html.erb +10 -0
  127. data/generators/flexi_scaffold/templates/views/erb/show.html.erb +19 -0
  128. data/generators/flexi_scaffold/templates/views/haml/_form.html.haml +10 -0
  129. data/generators/flexi_scaffold/templates/views/haml/edit.html.haml +14 -0
  130. data/generators/flexi_scaffold/templates/views/haml/index.html.haml +25 -0
  131. data/generators/flexi_scaffold/templates/views/haml/new.html.haml +7 -0
  132. data/generators/flexi_scaffold/templates/views/haml/show.html.haml +20 -0
  133. data/init.rb +2 -0
  134. data/lib/flexi_generators.rb +4 -0
  135. data/test/flexi_generators_test.rb +8 -0
  136. data/test/test_helper.rb +3 -0
  137. metadata +203 -0
@@ -0,0 +1,2 @@
1
+ module <%= user_plural_class_name %>Helper
2
+ end
@@ -0,0 +1,23 @@
1
+ <%% title("Editando Usuário") %>
2
+
3
+ <%% form_for(@user, :url=> admin_user_url ,:html => { :method => :put }) do |f| %>
4
+ <p>
5
+ <%%= f.label :username, "Usuário:" %><br />
6
+ <%%= f.text_field :username, :readonly=>"readonly" %>
7
+ </p>
8
+ <p>
9
+ <%%= f.label :email, "E-mail:" %><br />
10
+ <%%= f.text_field :email %>
11
+ </p>
12
+ <p>
13
+ <%%= f.label :password, "Senha:" %><br />
14
+ <%%= f.password_field :password %>
15
+ </p>
16
+ <p>
17
+ <%%= f.label :password_confirmation, "Confirmar Senha:" %><br />
18
+ <%%= f.password_field :password_confirmation %>
19
+ </p>
20
+ <div id="control_box">
21
+ <%%=submit_tag "Alterar" %> | <%%= link_to 'Cancelar', admin_users_url %>
22
+ </div>
23
+ <%% end %>
@@ -0,0 +1,33 @@
1
+ <%% title("Usuários") %>
2
+
3
+ <div id="new_box">
4
+ <%%= link_to 'Novo Usuário', new_admin_user_url, :class=>'new' %>
5
+ </div>
6
+
7
+ <table cellspacing="1" cellpadding="2">
8
+ <tr>
9
+
10
+ <th>Usuário</th>
11
+
12
+ <th>E-mail</th>
13
+
14
+ <th></th>
15
+ <th></th>
16
+ </tr>
17
+ <%%- @users.each do |user|%>
18
+ <tr>
19
+
20
+ <td width="46%"><%%=h user.username %></td>
21
+
22
+ <td width="46%"><%%=h user.email %></td>
23
+
24
+ <td width="8%" align="center"><%%=link_to 'Editar', edit_admin_user_url(user), :class=>'edit' %></td>
25
+ <%% if (user.username == 'admin') %>
26
+ <td width="8%" align="center"><%%=link_to 'Excluir', "#delete", :class=>'delete', :onclick => "alert('Não é possível excluir o usuário Admin.');" %></td>
27
+ <%% else %>
28
+ <td width="8%" align="center"><%%=link_to 'Excluir', admin_user_url(user), :class=>'delete', :confirm => 'Tem certeza que deseja excluir?', :method => :delete %></td>
29
+ <%% end %>
30
+ </tr>
31
+ <%% end %>
32
+ </table>
33
+ <%%= will_paginate @users, :previous_label=>'&laquo; Anterior', :next_label=>'Próximo &raquo;' %>
@@ -0,0 +1,23 @@
1
+ <%% title("Novo Usuário") %>
2
+
3
+ <%% form_for(@user, :url => admin_users_url ) do |f| %>
4
+ <p>
5
+ <%%= f.label :username, "Usuário:" %><br />
6
+ <%%= f.text_field :username %>
7
+ </p>
8
+ <p>
9
+ <%%= f.label :email, "E-mail:" %><br />
10
+ <%%= f.text_field :email %>
11
+ </p>
12
+ <p>
13
+ <%%= f.label :password, "Senha:" %><br />
14
+ <%%= f.password_field :password %>
15
+ </p>
16
+ <p>
17
+ <%%= f.label :password_confirmation, "Confirmar Senha:" %><br />
18
+ <%%= f.password_field :password_confirmation %>
19
+ </p>
20
+ <div id="control_box">
21
+ <%%= submit_tag "Salvar" %> | <%%= link_to 'Cancelar', admin_users_url %>
22
+ </div>
23
+ <%% end %>
@@ -0,0 +1,38 @@
1
+ <%% title "Autenticação" %>
2
+
3
+ <%- if options[:authlogic] -%>
4
+
5
+ <%% form_for @<%= session_singular_name %> do |f| %>
6
+ <%%= f.error_messages %>
7
+ <p>
8
+ <%%= f.label :username, "Usuário:" %><br />
9
+ <%%= f.text_field :username %>
10
+ </p>
11
+ <p>
12
+ <%%= f.label :password, "Senha:" %><br />
13
+ <%%= f.password_field :password %>
14
+ </p>
15
+ <div id="control_box">
16
+ <%%= f.submit "Acessar" %>
17
+ </div>
18
+ <%% end %>
19
+
20
+ <%- else -%>
21
+
22
+ <%% form_tag <%= session_plural_name %>_path do %>
23
+ <table cellspacing="1" cellpadding="2" align="center" style="padding-top:20px;padding-bottom:20px;">
24
+ <tr>
25
+ <td align="right"><%%= label_tag :login, "Usuário ou E-mail:" %></td>
26
+ <td><%%= text_field_tag :login, params[:login] %></td>
27
+ </tr>
28
+ <tr>
29
+ <td align="right"><%%= label_tag :password, "Senha:" %></td>
30
+ <td><%%= password_field_tag :password %></td>
31
+ </tr>
32
+ </table>
33
+ <div id="control_box">
34
+ <%%= submit_tag "Acessar" %>
35
+ </div>
36
+ <%% end %>
37
+
38
+ <%- end -%>
@@ -0,0 +1,18 @@
1
+ Description:
2
+ The flexi_layout generator creates a basic layout and login 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
+ script/generate flexi_layout
15
+
16
+ Layout: app/views/layouts/application.html.erb | login.html.erb
17
+ Stylesheet: public/stylesheets/application.css | login.css
18
+ Helper: app/helpers/layout_helper.rb
@@ -0,0 +1,51 @@
1
+ require File.expand_path(File.dirname(__FILE__) + "/lib/insert_commands.rb")
2
+
3
+ class FlexiLayoutGenerator < Rails::Generator::Base
4
+
5
+ def manifest
6
+ record do |m|
7
+ m.directory "app/views/layouts"
8
+ m.directory "public/stylesheets"
9
+ m.directory "public/images"
10
+ m.directory "app/helpers"
11
+ m.directory "app/views/home"
12
+ m.directory "app/views/admin/home"
13
+ m.directory "app/controllers/admin"
14
+ m.template "layout.html.erb", "app/views/layouts/application.html.erb"
15
+ m.template "layout_login.html.erb", "app/views/layouts/login.html.erb"
16
+ m.template "layout_site.html.erb", "app/views/layouts/site.html.erb"
17
+ m.template "home_index.html.erb", "app/views/home/index.html.erb"
18
+ m.template "admin_home_index.html.erb", "app/views/admin/home/index.html.erb"
19
+ m.file "admin_home_controller.rb", "app/controllers/admin/home_controller.rb"
20
+ m.file "home_controller.rb", "app/controllers/home_controller.rb"
21
+ m.file "home_helper.rb", "app/helpers/home_helper.rb"
22
+ m.file "stylesheet.css", "public/stylesheets/application.css"
23
+ m.file "stylesheet_login.css", "public/stylesheets/login.css"
24
+ m.file "stylesheet_site.css", "public/stylesheets/site.css"
25
+ m.file "logo.png", "public/images/logo.png"
26
+ m.file "add.png", "public/images/add.png"
27
+ m.file "users.png", "public/images/users.png"
28
+ m.file "bg.png", "public/images/bg.png"
29
+ m.file "helper.rb", "app/helpers/layout_helper.rb"
30
+ m.file "custom_field_error.rb", "config/initializers/custom_field_error.rb"
31
+ m.file "inflector_portuguese.rb", "config/initializers/inflector_portuguese.rb"
32
+ m.file "pt-BR.yml", "config/locales/pt-BR.yml"
33
+ m.route "map.root :controller => :home"
34
+ m.route "map.admin 'admin', :controller => 'sessions', :action => 'new'"
35
+ m.route "map.namespace :admin do |admin|
36
+ admin.home 'home', :controller => 'home', :action => 'index'
37
+ admin.resources :users
38
+ end"
39
+ end
40
+ end
41
+
42
+ protected
43
+
44
+ def banner
45
+ <<-EOS
46
+ Creates generic layout, stylesheet, and helper files.
47
+
48
+ USAGE: #{$0} #{spec.name} [layout_name]
49
+ EOS
50
+ end
51
+ end
@@ -0,0 +1,28 @@
1
+ Rails::Generator::Commands::Create.class_eval do
2
+ def route(route)
3
+ sentinel = 'ActionController::Routing::Routes.draw do |map|'
4
+
5
+ logger.route "#{route}"
6
+ unless options[:pretend]
7
+ gsub_file 'config/routes.rb', /(#{Regexp.escape(sentinel)})/mi do |match|
8
+ "#{match}\n #{route}"
9
+ end
10
+ end
11
+ end
12
+ end
13
+
14
+ Rails::Generator::Commands::Destroy.class_eval do
15
+ def route_name(route)
16
+ look_for = "\n #{route}"
17
+ logger.route "#{route}"
18
+ unless options[:pretend]
19
+ gsub_file 'config/routes.rb', /(#{look_for})/mi, ''
20
+ end
21
+ end
22
+ end
23
+
24
+ Rails::Generator::Commands::List.class_eval do
25
+ def route(route)
26
+ logger.route "{route}"
27
+ end
28
+ end
@@ -0,0 +1,6 @@
1
+ class Admin::HomeController < ApplicationController
2
+
3
+ def index
4
+ end
5
+
6
+ end
@@ -0,0 +1,16 @@
1
+ <%% title("Admin::Home") %>
2
+ <h1>Primeiros passos</h1>
3
+ <ul>
4
+ <li>
5
+ <h2>Edite este layout em app/views/layouts/application.html.erb</h2>
6
+ <p>Crie seu layout, menus e altere o logo e estilos.</p>
7
+ </li>
8
+ <li>
9
+ <h2>Edite esta página em app/views/admin/home/index.html.erb</h2>
10
+ <p>Crie sua página administrativa.</p>
11
+ </li>
12
+ <li>
13
+ <h2>Gere seu scaffold</h2>
14
+ <p>ruby script/generate flexi_scaffold Post title:string body:text</p>
15
+ </li>
16
+ </ul>
@@ -0,0 +1,12 @@
1
+ #Personalizando mensagens de erro
2
+ ActionView::Base.field_error_proc = Proc.new do |html_tag, instance|
3
+ error_style = "background-color: #FFEBEB"
4
+ if html_tag =~ /<(input|textarea|select)[^>]+style=/
5
+ style_attribute = html_tag =~ /style=['"]/
6
+ html_tag.insert(style_attribute + 7, "#{error_style}; ")
7
+ elsif html_tag =~ /<(input|textarea|select)/
8
+ first_whitespace = html_tag =~ /\s/
9
+ html_tag[first_whitespace] = " style='#{error_style}' "
10
+ end
11
+ html_tag
12
+ end
@@ -0,0 +1,19 @@
1
+ # helper :layout
2
+ module LayoutHelper
3
+ def title(page_title, show_title = true)
4
+ @content_for_title = page_title.to_s
5
+ @show_title = show_title
6
+ end
7
+
8
+ def show_title?
9
+ @show_title
10
+ end
11
+
12
+ def stylesheet(*args)
13
+ content_for(:head) { stylesheet_link_tag(*args) }
14
+ end
15
+
16
+ def javascript(*args)
17
+ content_for(:head) { javascript_include_tag(*args) }
18
+ end
19
+ end
@@ -0,0 +1,9 @@
1
+ class HomeController < ApplicationController
2
+ skip_before_filter :login_required
3
+
4
+ layout 'site'
5
+
6
+ def index
7
+ end
8
+
9
+ end
@@ -0,0 +1,2 @@
1
+ module HomeHelper
2
+ end
@@ -0,0 +1,17 @@
1
+ <%% title("Home#index") %>
2
+ <h1>Primeiros passos</h1>
3
+ <ul>
4
+ <li>
5
+ <h2>Edite este layout em app/views/layouts/site.html.erb</h2>
6
+ <p>Crie seu layout, altere o logo e estilos.</p>
7
+ </li>
8
+ <li>
9
+ <h2>Edite esta página em app/views/home/index.html.erb</h2>
10
+ <p>Crie sua página inicial.</p>
11
+ </li>
12
+ <li>
13
+ <h2>Acesse a área administrativa <%%= link_to 'aqui', login_path %></h2>
14
+ <p>Usuário: admin</p>
15
+ <p>Senha: admin123</p>
16
+ </li>
17
+ </ul>
@@ -0,0 +1,62 @@
1
+ # Infelizmente não é possível colocar todas as regras...
2
+ #
3
+ # http://pt.wikipedia.org/wiki/Plural e
4
+ # http://pt.wikipedia.org/wiki/Singular
5
+ module Inflector
6
+ ActiveSupport::Inflector.inflections do |inflect|
7
+ inflect.clear
8
+
9
+ inflect.plural(/$/, 's')
10
+ inflect.plural(/(s)$/i, '\1')
11
+ inflect.plural(/^(paí)s$/i, '\1ses')
12
+ #inflect.plural(/(z|r)$/i, '\1es')
13
+ inflect.plural(/al$/i, 'ais')
14
+ inflect.plural(/el$/i, 'eis')
15
+ inflect.plural(/ol$/i, 'ois')
16
+ inflect.plural(/ul$/i, 'uis')
17
+ inflect.plural(/([^aeou])il$/i, '\1is')
18
+ inflect.plural(/m$/i, 'ns')
19
+ inflect.plural(/^(japon|escoc|ingl|dinamarqu|fregu|portugu)ês$/i, '\1eses')
20
+ inflect.plural(/^(|g)ás$/i, '\1ases')
21
+ inflect.plural(/ão$/i, 'ões')
22
+ inflect.plural(/^(irm|m)ão$/i, '\1ãos')
23
+ inflect.plural(/^(alem|c|p)ão$/i, '\1ães')
24
+ inflect.plural(/or$/i, 'ores')
25
+ # Sem acentos...
26
+ inflect.plural(/ao$/i, 'oes')
27
+ inflect.plural(/^(irm|m)ao$/i, '\1aos')
28
+ inflect.plural(/^(alem|c|p)ao$/i, '\1aes')
29
+
30
+ inflect.singular(/ores$/i, 'or')
31
+ inflect.singular(/([^ê])s$/i, '\1')
32
+ inflect.singular(/^(á|gá|paí)s$/i, '\1s')
33
+ inflect.singular(/(r|z)es$/i, '\1')
34
+ inflect.singular(/([^p])ais$/i, '\1al')
35
+ inflect.singular(/eis$/i, 'el')
36
+ inflect.singular(/ois$/i, 'ol')
37
+ inflect.singular(/uis$/i, 'ul')
38
+ inflect.singular(/(r|t|f|v)is$/i, '\1il')
39
+ inflect.singular(/ns$/i, 'm')
40
+ inflect.singular(/sses$/i, 'sse')
41
+ inflect.singular(/^(.*[^s]s)es$/i, '\1')
42
+ inflect.singular(/ães$/i, 'ão')
43
+ inflect.singular(/aes$/i, 'ao')
44
+ inflect.singular(/ãos$/i, 'ão')
45
+ inflect.singular(/aos$/i, 'ao')
46
+ inflect.singular(/ões$/i, 'ão')
47
+ inflect.singular(/oes$/i, 'ao')
48
+ inflect.singular(/(japon|escoc|ingl|dinamarqu|fregu|portugu)eses$/i, '\1ês')
49
+ inflect.singular(/^(g|)ases$/i, '\1ás')
50
+
51
+ # #irregulares
52
+ # irregulares = {'país' => 'paises'}
53
+ #
54
+ #
55
+ # irregulares.each do |key, value|
56
+ # inflect.plural(/^#{key.to_s}$/, value)
57
+ # inflect.singular(/^#{value}$/, key.to_s)
58
+ # end
59
+
60
+ inflect.uncountable %w( tórax tênis ônibus lápis fênix )
61
+ end
62
+ end
@@ -0,0 +1,47 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml">
4
+ <head>
5
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
6
+ <title><%%= "Área administrativa - #{h(yield(:title))}" %></title>
7
+ <%%= stylesheet_link_tag 'application' %>
8
+ <%%= yield(:head) %>
9
+ </head>
10
+ <body>
11
+ <div id="top_nav">
12
+ <%% if logged_in? %>
13
+ <%%= current_user.username %> | <%%= current_user.email %> | <%%= link_to "&raquo; Sair", logout_path, :class => 'logout' %>
14
+ <%% else %>
15
+ <%%= link_to "&raquo; Entrar", login_path, :class => 'login' %>
16
+ <%% end %>
17
+ </div>
18
+ <div id="header">
19
+ <%%= link_to image_tag("logo.png"), admin_home_url %>
20
+ </div>
21
+ <div id="container">
22
+ <div id="sidenav">
23
+ <%% tabs do |tab| %>
24
+ <%% tab.users admin_users_path do %>
25
+ <%%= image_tag 'users.png' %> Usuários
26
+ <%% end %>
27
+ <%%= tab.menu1 'Menu1', "#menu" %>
28
+ <%%= tab.menu2 'Menu2', "#menu" %>
29
+ <%%= tab.menu3 'Menu3', "#menu" %>
30
+ <%%= tab.menu4 'Menu4', "#menu" %>
31
+ <%% end %>
32
+ </div>
33
+ <div id="main">
34
+ <%%- if show_title? -%>
35
+ <div id="title_box">
36
+ <h2><%%=h yield(:title) %></h2>
37
+ </div>
38
+ <%%- end -%>
39
+ <%%- flash.each do |name, msg| -%>
40
+ <%%= content_tag :div, msg, :id => "flash_#{name}" %>
41
+ <%%- end -%>
42
+
43
+ <%%= yield %>
44
+ </div>
45
+ </div>
46
+ </body>
47
+ </html>
@@ -0,0 +1,27 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml">
4
+ <head>
5
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
6
+ <title><%%= "Área administrativa - #{h(yield(:title))}" %></title>
7
+ <%%= stylesheet_link_tag 'login' %>
8
+ <%%= yield(:head) %>
9
+ </head>
10
+ <body>
11
+ <div align="center">
12
+ <%%= image_tag("logo.png") %>
13
+ </div>
14
+ <div id="container">
15
+ <%%- if show_title? -%>
16
+ <div id="title_box">
17
+ <h2><%%=h yield(:title) %></h2>
18
+ </div>
19
+ <%%- end -%>
20
+ <%%- flash.each do |name, msg| -%>
21
+ <%%= content_tag :div, msg, :id => "flash_#{name}" %>
22
+ <%%- end -%>
23
+
24
+ <%%= yield %>
25
+ </div>
26
+ </body>
27
+ </html>
@@ -0,0 +1,22 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml">
4
+ <head>
5
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
6
+ <title><%%= "Página inicial - #{h(yield(:title))}" %></title>
7
+ <%%= stylesheet_link_tag 'site' %>
8
+ <%%= yield(:head) %>
9
+ </head>
10
+ <body>
11
+ <div id="header">
12
+ <%%= link_to image_tag("logo.png"), root_path %>
13
+ </div>
14
+ <div id="container">
15
+ <%%- flash.each do |name, msg| -%>
16
+ <%%= content_tag :div, msg, :id => "flash_#{name}" %>
17
+ <%%- end -%>
18
+
19
+ <%%= yield %>
20
+ </div>
21
+ </body>
22
+ </html>
@@ -0,0 +1,143 @@
1
+ pt-BR:
2
+ # formatos de data e hora
3
+ date:
4
+ formats:
5
+ default: "%d/%m/%Y"
6
+ short: "%d de %B"
7
+ long: "%d de %B de %Y"
8
+
9
+ day_names: [Domingo, Segunda, Terça, Quarta, Quinta, Sexta, Sábado]
10
+ abbr_day_names: [Dom, Seg, Ter, Qua, Qui, Sex, Sáb]
11
+ month_names: [~, Janeiro, Fevereiro, Março, Abril, Maio, Junho, Julho, Agosto, Setembro, Outubro, Novembro, Dezembro]
12
+ abbr_month_names: [~, Jan, Fev, Mar, Abr, Mai, Jun, Jul, Ago, Set, Out, Nov, Dez]
13
+ order: [ :day, :month, :year ]
14
+
15
+ time:
16
+ formats:
17
+ default1: "%A, %d de %B de %Y, %H:%M h"
18
+ default: "%d/%m/%Y, %H:%M"
19
+ short: "%d/%m, %H:%M h"
20
+ long: "%A, %d de %B de %Y, %H:%M h"
21
+ am: ''
22
+ pm: ''
23
+
24
+ # date helper distanci em palavras
25
+ datetime:
26
+ distance_in_words:
27
+ half_a_minute: 'meio minuto'
28
+ less_than_x_seconds:
29
+ one: 'menos de 1 segundo'
30
+ other: 'menos de {{count}} segundos'
31
+
32
+ x_seconds:
33
+ one: '1 segundo'
34
+ other: '{{count}} segundos'
35
+
36
+ less_than_x_minutes:
37
+ one: 'menos de um minuto'
38
+ other: 'menos de {{count}} minutos'
39
+
40
+ x_minutes:
41
+ one: '1 minuto'
42
+ other: '{{count}} minutos'
43
+
44
+ about_x_hours:
45
+ one: 'aproximadamente 1 hora'
46
+ other: 'aproximadamente {{count}} horas'
47
+
48
+ x_days:
49
+ one: '1 dia'
50
+ other: '{{count}} dias'
51
+
52
+ about_x_months:
53
+ one: 'aproximadamente 1 mês'
54
+ other: 'aproximadamente {{count}} meses'
55
+
56
+ x_months:
57
+ one: '1 mês'
58
+ other: '{{count}} meses'
59
+
60
+ about_x_years:
61
+ one: 'aproximadamente 1 ano'
62
+ other: 'aproximadamente {{count}} anos'
63
+
64
+ over_x_years:
65
+ one: 'mais de 1 ano'
66
+ other: 'mais de {{count}} anos'
67
+ prompts:
68
+ year: "Ano"
69
+ month: "Mês"
70
+ day: "Dia"
71
+ hour: "Hora"
72
+ minute: "Minuto"
73
+ second: "Segundos"
74
+
75
+ # numeros
76
+ number:
77
+ format:
78
+ precision: 3
79
+ separator: ','
80
+ delimiter: '.'
81
+ currency:
82
+ format:
83
+ unit: 'R$'
84
+ precision: 2
85
+ format: '%u %n'
86
+ separator: ','
87
+ delimiter: '.'
88
+ percentage:
89
+ format:
90
+ delimiter: '.'
91
+ precision:
92
+ format:
93
+ delimiter: '.'
94
+ human:
95
+ format:
96
+ precision: 1
97
+ delimiter: '.'
98
+ storage_units:
99
+ format: "%n %u"
100
+ units:
101
+ byte:
102
+ one: "Byte"
103
+ other: "Bytes"
104
+ kb: "KB"
105
+ mb: "MB"
106
+ gb: "GB"
107
+ tb: "TB"
108
+
109
+ # Used in array.to_sentence.
110
+ support:
111
+ array:
112
+ words_connector: ", "
113
+ two_words_connector: " e "
114
+ last_word_connector: " e "
115
+
116
+ # Active Record
117
+ activerecord:
118
+ errors:
119
+ template:
120
+ header:
121
+ one: "Não foi possível gravar {{model}}: 1 erro"
122
+ other: "Não foi possível gravar {{model}}: {{count}} erros."
123
+ body: "Por favor, verifique o(s) seguinte(s) campo(s):"
124
+ messages:
125
+ inclusion: "não está incluído na lista"
126
+ exclusion: "não está disponível"
127
+ invalid: "não é válido"
128
+ confirmation: "não está de acordo com a confirmação"
129
+ accepted: "deve ser aceito"
130
+ empty: "não pode ficar vazio"
131
+ blank: "não pode ficar em branco"
132
+ too_long: "é muito longo (máximo: {{count}} caracteres)"
133
+ too_short: "é muito curto (mínimo: {{count}} caracteres)"
134
+ wrong_length: "não possui o tamanho esperado ({{count}} caracteres)"
135
+ taken: "já está em uso"
136
+ not_a_number: "não é um número"
137
+ greater_than: "deve ser maior do que {{count}}"
138
+ greater_than_or_equal_to: "deve ser maior ou igual a {{count}}"
139
+ equal_to: "deve ser igual a {{count}}"
140
+ less_than: "deve ser menor do que {{count}}"
141
+ less_than_or_equal_to: "deve ser menor ou igual a {{count}}"
142
+ odd: "deve ser ímpar"
143
+ even: "deve ser par"