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
@@ -1,143 +0,0 @@
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"
@@ -1,132 +0,0 @@
1
- /* Basic ---------------------------------------- */
2
- a {text-decoration: none;}
3
- a:hover {text-decoration: underline;}
4
- body {
5
- background-color: #E6E6E6;
6
- font-family: Arial,Helvetica,sans-serif;
7
- font-size: 13px;
8
- color: #333333;
9
- background-image:url(../images/bg.png);
10
- background-repeat:repeat-x;
11
- }
12
- input[type=text]{ border:1px solid #CCCCCC; }
13
- input[type=password] { border:1px solid #CCCCCC; }
14
- select{ border:1px solid #CCCCCC;}
15
- textarea{ border:1px solid #CCCCCC; }
16
- .logout{ color:#D30000; font-weight:bold;}
17
- .login { font-weight:bold; }
18
- .view{color: #55a34a;}
19
- .back{color: #0085CF;}
20
- .edit{color:#C5A059;}
21
- .delete{color:#A02B2B;}
22
- .new{
23
- background: url(../images/add.png) no-repeat;
24
- text-align: center;
25
- font-size: 14px;
26
- font-weight: bold;
27
- padding-left: 17px;
28
- color: #55A34A
29
- }
30
- .pagination{ margin-top: 15px; text-align: center; }
31
- label { font-weight:bold;}
32
- h1, h2 { padding:2px; margin:2px; }
33
- a img { border: none; }
34
- a { color: #0000FF; }
35
- .clear { clear: both; height: 0; overflow: hidden; }
36
- div#control_box {
37
- background-color:#F3F3F3;
38
- border:1px solid #E5E5E5;
39
- padding:1px;
40
- text-align:center;
41
- }
42
- div#title_box {
43
- background-color:#F3F3F3;
44
- border:1px solid #E5E5E5;
45
- padding:1px;
46
- text-align:center;
47
- }
48
- div#new_box { padding:15px 5px 5px 5px; }
49
-
50
- /* Navigation ---------------------------------------- */
51
- #sidenav {
52
- width: 156px;
53
- float:left;
54
- background-color: #F3F3F3;
55
- padding: 0px 0px 0px 0px;
56
- font-size: 14px;
57
- font-weight: bold;
58
- margin: 0px 0px 0px 0px;
59
- }
60
- #sidenav ul {
61
- list-style-type:none;
62
- list-style-position:outside;
63
- list-style-image: none;
64
- padding:0px 0px 0px 0px;
65
- margin:0px 0px 0px 0px;
66
- }
67
- #sidenav li { }
68
- #sidenav li a {
69
- width: 156px;
70
- display:block;
71
- width:93%;
72
- height: 100%;
73
- line-height: 25px;
74
- border-bottom: 1px solid #DDDDDD;
75
- padding-left: 10px;
76
- color: #4E5660;
77
- }
78
- #sidenav li a:hover { background: #FFFADF; }
79
- #sidenav li.current a {background: #DFF6FF; color: #000; }
80
-
81
- div#top_nav{
82
- text-align: right;
83
- width: 920px;
84
- margin: 0 auto;
85
- border-bottom:1px solid #E5E5E5;
86
- margin-bottom: 10px;
87
- }
88
-
89
- /* Content ---------------------------------------- */
90
- div#header{ width: 920px; margin: 0 auto; }
91
- #container {
92
- width: 900px;
93
- overflow: auto;
94
- margin: 0 auto;
95
- background-color: #FFF;
96
- margin-top: 10px;
97
- padding: 10px;
98
- border: solid 5px #E4E2E2;
99
- }
100
-
101
- #main{
102
- width: 733px;
103
- float:right;
104
- padding: 0 ;
105
- margin:0;
106
- }
107
-
108
- #main table { width: 100%; }
109
- #main table th { background-color: #F3F3F3 }
110
- #main table tr td { border-bottom: 1px solid #DDDDDD; }
111
- #main table tr:hover td { background: #FFFADF none repeat scroll 0 0; }
112
-
113
- /* Notices ---------------------------------------- */
114
- #flash_notice, #flash_error {
115
- padding: 10px ;
116
- margin: 10px 0 0 0;
117
- font-weight: bold;
118
- text-align: center;
119
- }
120
- #flash_notice {
121
- background-color: #CFC;
122
- border: dashed 1px #6C6;
123
- color: #1E5F1D;
124
- }
125
- #flash_error {
126
- background-color: #FCC;
127
- border: dashed 1px #C66;
128
- color:#9E0B0F;
129
- }
130
-
131
- .fieldWithErrors { display: inline; }
132
- #errorExplanation { background-color: #FCC; border: solid 1px #C66; }
@@ -1,73 +0,0 @@
1
- a {text-decoration: none;}
2
- a:hover {text-decoration: underline;}
3
-
4
- body {
5
- background-color: #E6E6E6;
6
- font-family: Arial,Helvetica,sans-serif;
7
- font-size: 13px;
8
- color: #333333;
9
- background-image:url(../images/bg.png);
10
- background-repeat:repeat-x;
11
- }
12
-
13
- input[type=text]{ border:1px solid #CCCCCC; }
14
-
15
- input[type=password] { border:1px solid #CCCCCC; }
16
-
17
- div#control_box {
18
- background-color:#F3F3F3;
19
- border:1px solid #E5E5E5;
20
- padding:1px;
21
- text-align:center;
22
- }
23
-
24
- div#title_box {
25
- background-color:#F3F3F3;
26
- border:1px solid #E5E5E5;
27
- padding:1px;
28
- text-align:center;
29
- }
30
-
31
- label { font-weight:bold;}
32
-
33
- h1, h2 { padding:2px; margin:2px; }
34
-
35
- a img { border: none; }
36
-
37
- a { color: #0000FF; }
38
-
39
- .clear { clear: both; height: 0; overflow: hidden; }
40
-
41
- #main{
42
- width: 633px;
43
- float:right;
44
- padding: 0 ;
45
- margin:0;
46
- }
47
-
48
- #container {
49
- width: 350px;
50
- overflow: auto;
51
- margin: 0 auto;
52
- background-color: #FFF;
53
- margin-top: 10px;
54
- padding: 10px;
55
- border: solid 5px #E4E2E2;
56
- }
57
-
58
- #flash_notice, #flash_error {
59
- padding: 10px ;
60
- margin: 10px 0 0 0;
61
- font-weight: bold;
62
- text-align: center;
63
- }
64
- #flash_notice {
65
- background-color: #CFC;
66
- border: dashed 1px #6C6;
67
- color: #1E5F1D;
68
- }
69
- #flash_error {
70
- background-color: #FCC;
71
- border: dashed 1px #C66;
72
- color:#9E0B0F;
73
- }
@@ -1,29 +0,0 @@
1
- Description:
2
- The scaffold resource generator creates a model, a controller, and a set of templates that's ready to use as the
3
- starting point for your REST-like, resource-oriented application. This basically means that it follows a set of
4
- conventions to exploit the full set of HTTP verbs (GET/POST/PUT/DELETE) and is prepared for multi-client access
5
- (like one view for HTML, one for an XML API, one for ATOM, etc). Everything comes with sample unit and functional
6
- tests as well.
7
-
8
- The generator takes the name of the model as its first argument. This model name is then pluralized to get the
9
- controller name. So "flexi_resource_scaffold post" will generate a Post model and a PostsController and will be intended
10
- for URLs like /posts and /posts/45.
11
-
12
- As additional parameters, the generator will take attribute pairs described by name and type. These attributes will
13
- be used to prepopulate the migration to create the table for the model and to give you a set of templates for the
14
- view. For example, "flexi_resource_scaffold post title:string created_on:date body:text published:boolean" will give
15
- you a model with those four attributes, forms to create and edit those models from, and an index that'll list them
16
- all.
17
-
18
- You don't have to think up all attributes up front, but it's a good idea of adding just the baseline of what's
19
- needed to start really working with the resource.
20
-
21
- Once the generator has run, you'll need to add a declaration to your config/routes.rb file to hook up the rules
22
- that'll point URLs to this new resource. If you create a resource like "flexi_scaffold post", you'll need to
23
- add "map.resources :posts" (notice the plural form) in the routes file. Then your new resource is accessible from
24
- /posts.
25
-
26
- Examples:
27
- ./script/generate flexi_resource_scaffold post # no attributes, view will be anemic
28
- ./script/generate flexi_resource_scaffold post title:string created_on:date body:text published:boolean
29
- ./script/generate flexi_resource_scaffold purchase order_id:integer created_at:datetime amount:decimal
@@ -1,179 +0,0 @@
1
- class FlexiResourceScaffoldGenerator < Rails::Generator::NamedBase
2
- attr_reader :controller_name,
3
- :controller_class_path,
4
- :controller_file_path,
5
- :controller_class_nesting,
6
- :controller_class_nesting_depth,
7
- :controller_class_name,
8
- :controller_singular_name,
9
- :controller_plural_name,
10
- :resource_edit_path,
11
- :default_file_extension,
12
- :generator_default_file_extension
13
- alias_method :controller_file_name, :controller_singular_name
14
- alias_method :controller_table_name, :controller_plural_name
15
-
16
- def initialize(runtime_args, runtime_options = {})
17
- super
18
-
19
- if @rspec = has_rspec?
20
- if ActionController::Base.respond_to?(:resource_action_separator)
21
- @resource_edit_path = "/edit"
22
- else
23
- @resource_edit_path = ";edit"
24
- end
25
- end
26
-
27
- @generator_default_file_extension = (defined? Haml )? "haml" : "erb"
28
-
29
- # we want to call erb templates .rhtml or .haml if this is rails 1
30
- if RAILS_GEM_VERSION.to_i == 1
31
- @default_file_extension = @generator_default_file_extension == 'erb' ? 'rhtml' : @generator_default_file_extension
32
- else
33
- @default_file_extension = "html.#{@generator_default_file_extension}"
34
- end
35
-
36
- @controller_name = @name.pluralize
37
-
38
- base_name, @controller_class_path, @controller_file_path, @controller_class_nesting, @controller_class_nesting_depth = extract_modules(@controller_name)
39
- @controller_class_name_without_nesting, @controller_singular_name, @controller_plural_name = inflect_names(base_name)
40
-
41
- if @controller_class_nesting.empty?
42
- @controller_class_name = @controller_class_name_without_nesting
43
- else
44
- @controller_class_name = "#{@controller_class_nesting}::#{@controller_class_name_without_nesting}"
45
- end
46
- end
47
-
48
- def manifest
49
- record do |m|
50
- # Check for class naming collisions.
51
- m.class_collisions(controller_class_path, "#{controller_class_name}Controller", "#{controller_class_name}Helper")
52
- m.class_collisions(class_path, "#{class_name}")
53
-
54
- # Controller, helper, views, and test directories.
55
- m.directory(File.join('app/models', class_path))
56
- m.directory(File.join('app/controllers', controller_class_path))
57
- m.directory(File.join('app/helpers', controller_class_path))
58
- m.directory(File.join('app/views', controller_class_path, controller_file_name))
59
-
60
- if @rspec
61
- m.directory(File.join('spec/controllers', controller_class_path))
62
- m.directory(File.join('spec/helpers', class_path))
63
- m.directory(File.join('spec/models', class_path))
64
- m.directory File.join('spec/views', controller_class_path, controller_file_name)
65
- m.directory(File.join('spec/fixtures', class_path))
66
- else
67
- m.directory(File.join('test/functional', controller_class_path))
68
- m.directory(File.join('test/unit', class_path))
69
- end
70
-
71
- scaffold_views.each do |action|
72
- m.template(
73
- "view_#{action}.#{generator_default_file_extension}",
74
- File.join('app/views', controller_class_path, controller_file_name, "#{action}.#{default_file_extension}")
75
- )
76
- end
77
-
78
- m.template('model.rb', File.join('app/models', class_path, "#{file_name}.rb"))
79
- m.template('controller.rb', File.join('app/controllers', controller_class_path, "#{controller_file_name}_controller.rb"))
80
- m.template('helper.rb', File.join('app/helpers', controller_class_path, "#{controller_file_name}_helper.rb"))
81
-
82
- if @rspec
83
- m.template('rspec/functional_spec.rb', File.join('spec/controllers', controller_class_path, "#{controller_file_name}_controller_spec.rb"))
84
- m.template('rspec/routing_spec.rb', File.join('spec/controllers', controller_class_path, "#{controller_file_name}_routing_spec.rb"))
85
- m.template('rspec/helper_spec.rb', File.join('spec/helpers', class_path, "#{controller_file_name}_helper_spec.rb"))
86
- m.template('rspec/unit_spec.rb', File.join('spec/models', class_path, "#{file_name}_spec.rb"))
87
- m.template('fixtures.yml', File.join('spec/fixtures', "#{table_name}.yml"))
88
-
89
- rspec_views.each do |action|
90
- m.template(
91
- "rspec/views/#{action}_spec.rb",
92
- File.join('spec/views', controller_class_path, controller_file_name, "#{action}_spec.rb")
93
- )
94
- end
95
-
96
- else
97
- functional_test = (defined? ThoughtBot::Shoulda) ? "shoulda_functional_test.rb" : "functional_test.rb"
98
-
99
- m.template("#{functional_test}", File.join('test/functional', controller_class_path, "#{controller_file_name}_controller_test.rb"))
100
- m.template('unit_test.rb', File.join('test/unit', class_path, "#{file_name}_test.rb"))
101
- m.template('fixtures.yml', File.join('test/fixtures', "#{table_name}.yml"))
102
- end
103
-
104
-
105
- unless options[:skip_migration]
106
- migration_template = RAILS_GEM_VERSION.to_i == 1 ? 'old_migration.rb' : 'migration.rb'
107
-
108
- m.migration_template(
109
- migration_template, 'db/migrate',
110
- :assigns => {
111
- :migration_name => "Create#{class_name.pluralize.gsub(/::/, '')}",
112
- :attributes => attributes
113
- },
114
- :migration_file_name => "create_#{file_path.gsub(/\//, '_').pluralize}"
115
- )
116
- end
117
-
118
- m.route_resources controller_file_name
119
- end
120
- end
121
-
122
- # Lifted from Rick Olson's restful_authentication
123
- def has_rspec?
124
- options[:rspec] || (File.exist?('spec') && File.directory?('spec'))
125
- end
126
-
127
- protected
128
- # Override with your own usage banner.
129
- def banner
130
- "Usage: #{$0} scaffold_resource ModelName [field:type, field:type]"
131
- end
132
-
133
- def rspec_views
134
- %w[ index show new edit ]
135
- end
136
-
137
- def scaffold_views
138
- rspec_views + %w[ _form ]
139
- end
140
-
141
- def model_name
142
- class_name.demodulize
143
- end
144
-
145
- def add_options!(opt)
146
- opt.separator ''
147
- opt.separator 'Options:'
148
- opt.on("--rspec", "Force rspec mode (checks for RAILS_ROOT/spec by default)") { |v| options[:rspec] = true }
149
- end
150
- end
151
-
152
- module Rails
153
- module Generator
154
- class GeneratedAttribute
155
- def default_value
156
- @default_value ||= case type
157
- when :int, :integer then "\"1\""
158
- when :float then "\"1.5\""
159
- when :decimal then "\"9.99\""
160
- when :datetime, :timestamp, :time then "Time.now"
161
- when :date then "Date.today"
162
- when :string then "\"MyString\""
163
- when :text then "\"MyText\""
164
- when :boolean then "false"
165
- else
166
- ""
167
- end
168
- end
169
-
170
- def input_type
171
- @input_type ||= case type
172
- when :text then "textarea"
173
- else
174
- "input"
175
- end
176
- end
177
- end
178
- end
179
- end
@@ -1,29 +0,0 @@
1
- class <%= controller_class_name %>Controller < ResourceController::Base
2
- current_tab :<%= plural_name %>
3
-
4
- private
5
- def collection
6
- @collection ||= end_of_association_chain.paginate :page => params[:page],
7
- :per_page => 15
8
- end
9
-
10
- create do
11
- flash "<%= singular_name.capitalize %> adicionada com sucesso!"
12
- end
13
-
14
- update do
15
- flash "<%= singular_name.capitalize %> alterada com sucesso!"
16
- end
17
-
18
- destroy do
19
- flash "<%= singular_name.capitalize %> excluída com sucesso!"
20
- end
21
-
22
- create.response do |wants|
23
- wants.html { redirect_to(collection_url) }
24
- end
25
-
26
- update.response do |wants|
27
- wants.html { redirect_to(collection_url) }
28
- end
29
- end
@@ -1,10 +0,0 @@
1
- one:
2
- id: 1
3
- <% for attribute in attributes -%>
4
- <%= attribute.name %>: <%= attribute.default %>
5
- <% end -%>
6
- two:
7
- id: 2
8
- <% for attribute in attributes -%>
9
- <%= attribute.name %>: <%= attribute.default %>
10
- <% end -%>
@@ -1,57 +0,0 @@
1
- require File.dirname(__FILE__) + '<%= '/..' * controller_class_nesting_depth %>/../test_helper'
2
- require '<%= controller_file_path %>_controller'
3
-
4
- # Re-raise errors caught by the controller.
5
- class <%= controller_class_name %>Controller; def rescue_action(e) raise e end; end
6
-
7
- class <%= controller_class_name %>ControllerTest < Test::Unit::TestCase
8
- fixtures :<%= table_name %>
9
-
10
- def setup
11
- @controller = <%= controller_class_name %>Controller.new
12
- @request = ActionController::TestRequest.new
13
- @response = ActionController::TestResponse.new
14
- end
15
-
16
- def test_should_get_index
17
- get :index
18
- assert_response :success
19
- assert assigns(:<%= table_name %>)
20
- end
21
-
22
- def test_should_get_new
23
- get :new
24
- assert_response :success
25
- end
26
-
27
- def test_should_create_<%= file_name %>
28
- old_count = <%= class_name %>.count
29
- post :create, :<%= file_name %> => { }
30
- assert_equal old_count+1, <%= class_name %>.count
31
-
32
- assert_redirected_to <%= file_name %>_path(assigns(:<%= file_name %>))
33
- end
34
-
35
- def test_should_show_<%= file_name %>
36
- get :show, :id => 1
37
- assert_response :success
38
- end
39
-
40
- def test_should_get_edit
41
- get :edit, :id => 1
42
- assert_response :success
43
- end
44
-
45
- def test_should_update_<%= file_name %>
46
- put :update, :id => 1, :<%= file_name %> => { }
47
- assert_redirected_to <%= file_name %>_path(assigns(:<%= file_name %>))
48
- end
49
-
50
- def test_should_destroy_<%= file_name %>
51
- old_count = <%= class_name %>.count
52
- delete :destroy, :id => 1
53
- assert_equal old_count-1, <%= class_name %>.count
54
-
55
- assert_redirected_to <%= table_name %>_path
56
- end
57
- end
@@ -1,2 +0,0 @@
1
- module <%= controller_class_name %>Helper
2
- end
@@ -1,15 +0,0 @@
1
- class <%= migration_name %> < ActiveRecord::Migration
2
- def self.up
3
- create_table :<%= table_name %>, :force => true do |t|
4
- <% for attribute in attributes -%>
5
- t.<%= attribute.type %> :<%= attribute.name %>
6
- <% end -%>
7
-
8
- t.timestamps
9
- end
10
- end
11
-
12
- def self.down
13
- drop_table :<%= table_name %>
14
- end
15
- end
@@ -1,2 +0,0 @@
1
- class <%= class_name %> < ActiveRecord::Base
2
- end
@@ -1,13 +0,0 @@
1
- class <%= migration_name %> < ActiveRecord::Migration
2
- def self.up
3
- create_table :<%= table_name %>, :force => true do |t|
4
- <% for attribute in attributes -%>
5
- t.column :<%= attribute.name %>, :<%= attribute.type %>
6
- <% end -%>
7
- end
8
- end
9
-
10
- def self.down
11
- drop_table :<%= table_name %>
12
- end
13
- end