typus 1.0.0.pre8 → 1.0.0.pre9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (247) hide show
  1. data/CHANGELOG +4 -6
  2. data/Gemfile +16 -13
  3. data/Gemfile.lock +26 -2
  4. data/Rakefile +2 -3
  5. data/app/controllers/admin/base_controller.rb +3 -5
  6. data/app/controllers/admin/resources_controller.rb +24 -26
  7. data/app/helpers/admin/base_helper.rb +14 -22
  8. data/app/helpers/admin/dashboard_helper.rb +2 -5
  9. data/app/helpers/admin/filters_helper.rb +6 -8
  10. data/app/helpers/admin/form_helper.rb +3 -9
  11. data/app/helpers/admin/preview_helper.rb +4 -6
  12. data/app/helpers/admin/relationships_helper.rb +9 -11
  13. data/app/helpers/admin/resources_helper.rb +6 -24
  14. data/app/helpers/admin/search_helper.rb +1 -1
  15. data/app/helpers/admin/sidebar_helper.rb +12 -15
  16. data/app/helpers/admin/table_helper.rb +13 -13
  17. data/app/views/admin/dashboard/show.html.erb +1 -1
  18. data/app/views/admin/helpers/_apps.html.erb +4 -3
  19. data/app/views/admin/helpers/_header.html.erb +2 -2
  20. data/app/views/admin/helpers/dashboard/_applications.html.erb +3 -3
  21. data/app/views/admin/helpers/dashboard/_resources.html.erb +17 -13
  22. data/app/views/admin/helpers/filters/_filters.html.erb +9 -27
  23. data/app/views/admin/helpers/resources/_pagination.html.erb +8 -9
  24. data/app/views/admin/helpers/search/_search.html.erb +1 -1
  25. data/app/views/admin/mailer/reset_password_link.text.erb +3 -0
  26. data/app/views/admin/resources/_form.html.erb +4 -4
  27. data/app/views/admin/resources/edit.html.erb +2 -3
  28. data/app/views/admin/resources/index.html.erb +15 -13
  29. data/app/views/admin/resources/new.html.erb +2 -2
  30. data/app/views/admin/resources/show.html.erb +1 -2
  31. data/app/views/admin/templates/_boolean.html.erb +1 -1
  32. data/app/views/admin/templates/_has_many.html.erb +2 -4
  33. data/app/views/admin/templates/_has_n.html.erb +1 -1
  34. data/app/views/admin/templates/_selector.html.erb +0 -1
  35. data/app/views/admin/templates/_string.html.erb +1 -1
  36. data/app/views/layouts/admin/session.html.erb +1 -1
  37. data/config/available_locales/ca.yml +3 -5
  38. data/config/available_locales/de.yml +2 -4
  39. data/config/available_locales/es.yml +2 -4
  40. data/config/available_locales/fr.yml +40 -39
  41. data/config/available_locales/fr_models.yml +2 -2
  42. data/config/available_locales/hu.yml +3 -5
  43. data/config/available_locales/it.yml +0 -4
  44. data/config/available_locales/language.yml.template +2 -4
  45. data/config/available_locales/pt-BR.yml +2 -4
  46. data/config/available_locales/ru.yml +2 -4
  47. data/config/routes.rb +1 -0
  48. data/lib/generators/templates/config/initializers/typus.rb +5 -5
  49. data/lib/generators/templates/config/initializers/typus_authentication.rb +5 -5
  50. data/lib/generators/templates/config/initializers/typus_resources.rb +7 -7
  51. data/lib/generators/templates/config/typus/README +11 -13
  52. data/lib/generators/templates/controller.rb +0 -2
  53. data/lib/generators/templates/functional_test.rb +4 -15
  54. data/lib/generators/typus/migration_generator.rb +0 -1
  55. data/lib/support/active_record.rb +18 -9
  56. data/lib/support/fake_user.rb +42 -0
  57. data/lib/support/object.rb +1 -0
  58. data/lib/support/string.rb +0 -32
  59. data/lib/tasks/typus.rake +0 -8
  60. data/lib/typus.rb +34 -18
  61. data/lib/typus/authentication/base.rb +26 -0
  62. data/lib/typus/authentication/http_basic.rb +22 -0
  63. data/lib/typus/authentication/none.rb +19 -0
  64. data/lib/typus/authentication/session.rb +190 -0
  65. data/lib/typus/format.rb +12 -19
  66. data/lib/typus/orm/active_record.rb +13 -51
  67. data/lib/typus/resources.rb +0 -9
  68. data/lib/typus/version.rb +1 -1
  69. data/test/factories.rb +43 -0
  70. data/test/fixtures/rails_app/app/controllers/application_controller.rb +0 -1
  71. data/test/fixtures/rails_app/app/models/page.rb +0 -4
  72. data/test/fixtures/rails_app/config/application.rb +6 -3
  73. data/test/fixtures/rails_app/config/database.yml +12 -20
  74. data/test/fixtures/rails_app/config/typus/application.yml +4 -8
  75. data/test/fixtures/rails_app/db/test.sqlite3 +0 -0
  76. data/test/fixtures/rails_app/log/test.log +227115 -0
  77. data/test/fixtures/rails_app/tmp/export-posts-20101012213057.csv +2 -0
  78. data/test/fixtures/rails_app/tmp/export-posts-20101012213132.csv +2 -0
  79. data/test/fixtures/rails_app/tmp/export-posts-20101012213234.csv +2 -0
  80. data/test/fixtures/rails_app/tmp/export-posts-20101012213506.csv +2 -0
  81. data/test/fixtures/rails_app/tmp/export-posts-20101012215057.csv +2 -0
  82. data/test/fixtures/rails_app/tmp/export-posts-20101012215217.csv +2 -0
  83. data/test/fixtures/rails_app/tmp/export-posts-20101012215415.csv +2 -0
  84. data/test/fixtures/rails_app/tmp/export-posts-20101012215443.csv +2 -0
  85. data/test/fixtures/rails_app/tmp/export-posts-20101012215509.csv +2 -0
  86. data/test/fixtures/rails_app/tmp/export-posts-20101012215528.csv +2 -0
  87. data/test/fixtures/rails_app/tmp/export-posts-20101012215551.csv +2 -0
  88. data/test/fixtures/rails_app/tmp/export-posts-20101012215615.csv +2 -0
  89. data/test/fixtures/rails_app/tmp/export-posts-20101012215640.csv +2 -0
  90. data/test/fixtures/rails_app/tmp/export-posts-20101012215714.csv +2 -0
  91. data/test/fixtures/rails_app/tmp/export-posts-20101012215744.csv +2 -0
  92. data/test/fixtures/rails_app/tmp/export-posts-20101012215814.csv +2 -0
  93. data/test/fixtures/rails_app/tmp/export-posts-20101012215836.csv +2 -0
  94. data/test/fixtures/rails_app/tmp/export-posts-20101012215906.csv +2 -0
  95. data/test/fixtures/rails_app/tmp/export-posts-20101012220659.csv +2 -0
  96. data/test/fixtures/rails_app/tmp/export-posts-20101012221043.csv +2 -0
  97. data/test/fixtures/rails_app/tmp/export-posts-20101012221258.csv +2 -0
  98. data/test/fixtures/rails_app/tmp/export-posts-20101012222558.csv +2 -0
  99. data/test/fixtures/rails_app/tmp/export-posts-20101012222752.csv +2 -0
  100. data/test/fixtures/rails_app/tmp/export-posts-20101012222848.csv +2 -0
  101. data/test/fixtures/rails_app/tmp/export-posts-20101012223433.csv +2 -0
  102. data/test/fixtures/rails_app/tmp/export-posts-20101012223535.csv +2 -0
  103. data/test/fixtures/rails_app/tmp/export-posts-20101012224003.csv +2 -0
  104. data/test/fixtures/rails_app/tmp/export-posts-20101012224052.csv +2 -0
  105. data/test/fixtures/rails_app/tmp/export-posts-20101012224109.csv +2 -0
  106. data/test/fixtures/rails_app/tmp/export-posts-20101012224139.csv +2 -0
  107. data/test/fixtures/rails_app/tmp/export-posts-20101012224205.csv +2 -0
  108. data/test/fixtures/rails_app/tmp/export-posts-20101012224243.csv +2 -0
  109. data/test/fixtures/rails_app/tmp/export-posts-20101012225119.csv +2 -0
  110. data/test/fixtures/rails_app/tmp/export-posts-20101013063215.csv +2 -0
  111. data/test/fixtures/rails_app/tmp/export-posts-20101013063300.csv +2 -0
  112. data/test/fixtures/rails_app/tmp/export-posts-20101013063352.csv +2 -0
  113. data/test/fixtures/rails_app/tmp/export-posts-20101013063427.csv +2 -0
  114. data/test/fixtures/rails_app/tmp/export-posts-20101013063448.csv +2 -0
  115. data/test/fixtures/rails_app/tmp/export-posts-20101013063530.csv +2 -0
  116. data/test/fixtures/rails_app/tmp/export-posts-20101013063559.csv +2 -0
  117. data/test/fixtures/rails_app/tmp/export-posts-20101013063646.csv +2 -0
  118. data/test/fixtures/rails_app/tmp/export-posts-20101013063737.csv +2 -0
  119. data/test/fixtures/rails_app/tmp/export-posts-20101013063822.csv +2 -0
  120. data/test/fixtures/rails_app/tmp/export-posts-20101013063837.csv +2 -0
  121. data/test/fixtures/rails_app/tmp/export-posts-20101013063919.csv +2 -0
  122. data/test/fixtures/rails_app/tmp/export-posts-20101013063939.csv +2 -0
  123. data/test/fixtures/rails_app/tmp/export-posts-20101013063952.csv +2 -0
  124. data/test/fixtures/rails_app/tmp/export-posts-20101013064220.csv +2 -0
  125. data/test/fixtures/rails_app/tmp/export-posts-20101013064253.csv +2 -0
  126. data/test/fixtures/rails_app/tmp/export-posts-20101013064318.csv +2 -0
  127. data/test/fixtures/rails_app/tmp/export-posts-20101013064404.csv +2 -0
  128. data/test/fixtures/rails_app/tmp/export-posts-20101013064452.csv +2 -0
  129. data/test/fixtures/rails_app/tmp/export-posts-20101013064536.csv +2 -0
  130. data/test/fixtures/rails_app/tmp/export-posts-20101013064652.csv +2 -0
  131. data/test/fixtures/rails_app/tmp/export-posts-20101013064845.csv +2 -0
  132. data/test/fixtures/rails_app/tmp/export-posts-20101013065023.csv +2 -0
  133. data/test/fixtures/rails_app/tmp/export-posts-20101013065137.csv +2 -0
  134. data/test/fixtures/rails_app/tmp/export-posts-20101013065713.csv +2 -0
  135. data/test/fixtures/rails_app/tmp/export-posts-20101013065954.csv +2 -0
  136. data/test/fixtures/rails_app/tmp/export-posts-20101013070057.csv +2 -0
  137. data/test/fixtures/rails_app/tmp/export-posts-20101013070116.csv +2 -0
  138. data/test/fixtures/rails_app/tmp/export-posts-20101013070156.csv +2 -0
  139. data/test/fixtures/rails_app/tmp/export-posts-20101013070349.csv +2 -0
  140. data/test/fixtures/rails_app/tmp/export-posts-20101013070429.csv +2 -0
  141. data/test/fixtures/rails_app/tmp/export-posts-20101013070448.csv +2 -0
  142. data/test/fixtures/rails_app/tmp/export-posts-20101013070514.csv +2 -0
  143. data/test/fixtures/rails_app/tmp/export-posts-20101013070709.csv +2 -0
  144. data/test/fixtures/rails_app/tmp/export-posts-20101013070745.csv +2 -0
  145. data/test/fixtures/rails_app/tmp/export-posts-20101013070809.csv +2 -0
  146. data/test/fixtures/rails_app/tmp/export-posts-20101013070905.csv +2 -0
  147. data/test/fixtures/rails_app/tmp/export-posts-20101013070955.csv +2 -0
  148. data/test/fixtures/rails_app/tmp/export-posts-20101013071116.csv +2 -0
  149. data/test/fixtures/rails_app/tmp/export-posts-20101013071209.csv +2 -0
  150. data/test/fixtures/rails_app/tmp/export-posts-20101013071335.csv +2 -0
  151. data/test/fixtures/rails_app/tmp/export-posts-20101013071632.csv +2 -0
  152. data/test/fixtures/rails_app/tmp/export-posts-20101013071643.csv +2 -0
  153. data/test/fixtures/rails_app/tmp/export-posts-20101013071735.csv +2 -0
  154. data/test/fixtures/rails_app/tmp/export-posts-20101013071749.csv +2 -0
  155. data/test/fixtures/rails_app/tmp/export-posts-20101013072030.csv +2 -0
  156. data/test/fixtures/rails_app/tmp/export-posts-20101013072050.csv +2 -0
  157. data/test/fixtures/rails_app/tmp/export-posts-20101013072108.csv +2 -0
  158. data/test/fixtures/rails_app/tmp/export-posts-20101013072713.csv +2 -0
  159. data/test/fixtures/rails_app/tmp/export-posts-20101013072751.csv +2 -0
  160. data/test/fixtures/rails_app/tmp/export-posts-20101013072912.csv +2 -0
  161. data/test/fixtures/rails_app/tmp/export-posts-20101013074546.csv +2 -0
  162. data/test/fixtures/rails_app/tmp/export-posts-20101018180512.csv +2 -0
  163. data/test/fixtures/rails_app/tmp/export-posts-20101018183359.csv +2 -0
  164. data/test/fixtures/rails_app/tmp/export-posts-20101018183608.csv +2 -0
  165. data/test/fixtures/rails_app/tmp/export-posts-20101018183759.csv +2 -0
  166. data/test/functional/admin/account_controller_test.rb +1 -1
  167. data/test/functional/admin/{resources_controller_assets_relationships.rb → assets_controller_test.rb} +12 -16
  168. data/test/functional/admin/categories_controller_test.rb +62 -0
  169. data/test/functional/admin/{resources_controller_comments_toggle_test.rb → comments_controller_test.rb} +0 -0
  170. data/test/functional/admin/dashboard_controller_test.rb +34 -2
  171. data/test/functional/admin/posts_controller_test.rb +548 -0
  172. data/test/functional/admin/session_controller_test.rb +2 -2
  173. data/test/functional/admin/{resources_controller_tableless_resource_test.rb → status_controller_test.rb} +0 -0
  174. data/test/functional/admin/{resources_controller_typus_users_test.rb → typus_users_controller_test.rb} +2 -2
  175. data/test/helpers/admin/base_helper_test.rb +35 -37
  176. data/test/helpers/admin/dashboard_helper_test.rb +4 -8
  177. data/test/helpers/admin/form_helper_test.rb +9 -34
  178. data/test/helpers/admin/resources_helper_test.rb +28 -16
  179. data/test/helpers/admin/sidebar_helper_test.rb +14 -27
  180. data/test/helpers/admin/table_helper_test.rb +24 -68
  181. data/test/integration/login_test.rb +13 -0
  182. data/test/integration_test_helper.rb +21 -0
  183. data/test/lib/support/active_record_test.rb +72 -21
  184. data/test/lib/support/array_test.rb +2 -6
  185. data/test/lib/support/string_test.rb +21 -30
  186. data/test/lib/typus/active_record_test.rb +162 -100
  187. data/test/lib/typus/resource_test.rb +2 -3
  188. data/test/lib/typus_test.rb +25 -22
  189. data/test/test_helper.rb +4 -17
  190. data/test/unit/admin/mailer_test.rb +2 -2
  191. data/test/unit/typus_user_roles_test.rb +23 -23
  192. data/test/unit/typus_user_test.rb +30 -24
  193. data/typus.gemspec +0 -1
  194. metadata +111 -60
  195. data/app/models/admin/fake_user.rb +0 -46
  196. data/lib/generators/templates/model.yml +0 -10
  197. data/lib/typus/authentication.rb +0 -241
  198. data/lib/vendor/paginator.rb +0 -143
  199. data/test/factories/assets.rb +0 -5
  200. data/test/factories/categories.rb +0 -3
  201. data/test/factories/comments.rb +0 -6
  202. data/test/factories/pages.rb +0 -5
  203. data/test/factories/pictures.rb +0 -7
  204. data/test/factories/posts.rb +0 -6
  205. data/test/factories/typus_users.rb +0 -8
  206. data/test/fixtures/rails_app/README +0 -244
  207. data/test/fixtures/rails_app/app/helpers/application_helper.rb +0 -2
  208. data/test/fixtures/rails_app/app/views/layouts/application.html.erb +0 -14
  209. data/test/fixtures/rails_app/config/environments/development.rb +0 -19
  210. data/test/fixtures/rails_app/config/environments/production.rb +0 -42
  211. data/test/fixtures/rails_app/config/initializers/acts_as_list.rb +0 -258
  212. data/test/fixtures/rails_app/config/initializers/acts_as_tree.rb +0 -98
  213. data/test/fixtures/rails_app/config/initializers/backtrace_silencers.rb +0 -7
  214. data/test/fixtures/rails_app/config/initializers/inflections.rb +0 -10
  215. data/test/fixtures/rails_app/config/initializers/mime_types.rb +0 -5
  216. data/test/fixtures/rails_app/config/locales/en.yml +0 -5
  217. data/test/fixtures/rails_app/db/seeds.rb +0 -7
  218. data/test/fixtures/rails_app/public/404.html +0 -26
  219. data/test/fixtures/rails_app/public/422.html +0 -26
  220. data/test/fixtures/rails_app/public/500.html +0 -26
  221. data/test/fixtures/rails_app/public/favicon.ico +0 -0
  222. data/test/fixtures/rails_app/public/images/rails.png +0 -0
  223. data/test/fixtures/rails_app/public/index.html +0 -279
  224. data/test/fixtures/rails_app/public/javascripts/application.js +0 -2
  225. data/test/fixtures/rails_app/public/javascripts/controls.js +0 -965
  226. data/test/fixtures/rails_app/public/javascripts/dragdrop.js +0 -974
  227. data/test/fixtures/rails_app/public/javascripts/effects.js +0 -1123
  228. data/test/fixtures/rails_app/public/javascripts/prototype.js +0 -4874
  229. data/test/fixtures/rails_app/public/javascripts/rails.js +0 -118
  230. data/test/fixtures/rails_app/public/robots.txt +0 -5
  231. data/test/fixtures/rails_app/script/rails +0 -9
  232. data/test/functional/admin/dashboard_controller_http_basic_test.rb +0 -24
  233. data/test/functional/admin/dashboard_controller_none_test.rb +0 -18
  234. data/test/functional/admin/resources_controller_categories_before_test.rb +0 -10
  235. data/test/functional/admin/resources_controller_categories_lists_test.rb +0 -44
  236. data/test/functional/admin/resources_controller_categories_views_test.rb +0 -10
  237. data/test/functional/admin/resources_controller_posts_before_test.rb +0 -10
  238. data/test/functional/admin/resources_controller_posts_crud_custom_test.rb +0 -27
  239. data/test/functional/admin/resources_controller_posts_crud_test.rb +0 -44
  240. data/test/functional/admin/resources_controller_posts_formats_test.rb +0 -39
  241. data/test/functional/admin/resources_controller_posts_forms_test.rb +0 -58
  242. data/test/functional/admin/resources_controller_posts_permissions_test.rb +0 -100
  243. data/test/functional/admin/resources_controller_posts_relationships_test.rb +0 -91
  244. data/test/functional/admin/resources_controller_posts_roles.rb +0 -52
  245. data/test/functional/admin/resources_controller_posts_views_test.rb +0 -143
  246. data/test/lib/vendor/paginator_test.rb +0 -141
  247. data/typus-1.0.0.pre7.gem +0 -0
@@ -9,8 +9,6 @@ it:
9
9
  "Are you sure you want to leave this page?": "Sei sicuro di volere lasciare questa pagina?"
10
10
  "Are you sure you want to sign out and end your session?": "Sei sicuro che vuoi disconnetterti dal sistema?"
11
11
  "As you're not the admin or the owner of this record you cannot edit it": "Non puoi modificare questo elemento poichè non sei un amministratore o il proprietario dello stesso"
12
-
13
- "Back to list": "Torna alla lista"
14
12
 
15
13
  "Cancel and go back": "Annulla e torna indietro"
16
14
  "Change %{attribute}?": "Vuoi cambiare %{attribute}?"
@@ -23,7 +21,6 @@ it:
23
21
  "Dashboard": "Panoramica"
24
22
  "Developed by": "Realizzato da"
25
23
  "Do you want to cancel it?": "Vuoi annullare e tornare indietro?"
26
- "Documentation": "Documentazione"
27
24
  "Down": "Giù"
28
25
 
29
26
  "Edit": "Modifica"
@@ -47,7 +44,6 @@ it:
47
44
  "Last few days": "Ultimi giorni"
48
45
  "Last 30 days": "Ultimi 30 giorni"
49
46
  "Last 7 days": "Ultimi 7 giorni"
50
- "License": "Licenza"
51
47
  "List": "Lista"
52
48
  "Loading": "Caricamento"
53
49
  "Logged as": "Loggato come"
@@ -14,8 +14,6 @@
14
14
  "Are you sure you want to sign out and end your session?":
15
15
  "As you're not the admin or the owner of this record you cannot edit it":
16
16
 
17
- "Back to list":
18
-
19
17
  "Change %{attribute}?":
20
18
  "Change password":
21
19
  "Checked if active":
@@ -25,7 +23,6 @@
25
23
 
26
24
  "Dashboard":
27
25
  "Do you want to cancel it?":
28
- "Documentation":
29
26
  "Down":
30
27
 
31
28
  "Edit":
@@ -46,7 +43,7 @@
46
43
  "Last few days":
47
44
  "Last 30 days":
48
45
  "Last 7 days":
49
- "License":
46
+ "List":
50
47
  "Logged as":
51
48
  "Login":
52
49
 
@@ -92,6 +89,7 @@
92
89
  "Unrelate %{unrelate_model} from %{unrelate_model_from}?":
93
90
  "Up":
94
91
 
92
+ "View all %{attribute}":
95
93
  "View site":
96
94
 
97
95
  "You're adding a new %{resource_from}":
@@ -14,8 +14,6 @@ pt-BR:
14
14
  "Are you sure you want to sign out and end your session?": "Tem certeza que quer sair e encerrar sua sessão?"
15
15
  "As you're not the admin or the owner of this record you cannot edit it": "Como você não é o dono desse registro ou o admin, você não pode editá-lo."
16
16
 
17
- "Back to list": "Voltar à lista"
18
-
19
17
  "Cancel and go back":
20
18
  "Change password": "Trocar senha"
21
19
  "Change %{attribute}?": "Mudar %{attribute}?"
@@ -26,7 +24,6 @@ pt-BR:
26
24
 
27
25
  "Dashboard": "Painel"
28
26
  "Do you want to cancel it?": "Quer cancelar?"
29
- "Documentation":
30
27
  "Down": "Descer"
31
28
 
32
29
  "Edit": "Editar"
@@ -48,7 +45,7 @@ pt-BR:
48
45
  "Last few days": "Últimos dias"
49
46
  "Last 30 days": "Últimos 30 dias"
50
47
  "Last 7 days": "Últimos 7 dias"
51
- "License":
48
+ "List":
52
49
  "Logged as": "Logado como"
53
50
  "Login": "Login"
54
51
 
@@ -94,6 +91,7 @@ pt-BR:
94
91
  "Unrelate %{unrelate_model} from %{unrelate_model_from}?": "Desvincular %{unrelate_model} de %{unrelate_model_from}?"
95
92
  "Up": "Subir"
96
93
 
94
+ "View all %{attribute}":
97
95
  "View site": "Ver site"
98
96
 
99
97
  "You're adding a new %{resource_from} to %{resource_to}": "Você está adicionando um novo %{resource_from} a %{resource_to}."
@@ -14,8 +14,6 @@ ru:
14
14
  "Are you sure you want to sign out and end your session?":
15
15
  "As you're not the admin or the owner of this record you cannot edit it": "Вы не администратор и не владелец записи и не можете ее редактировать"
16
16
 
17
- "Back to list": "Назад к списку"
18
-
19
17
  "Cancel and go back":
20
18
  "Change password": "Сменить пароль"
21
19
  "Change %{attribute}?": "Изменить %{attribute}?"
@@ -26,7 +24,6 @@ ru:
26
24
 
27
25
  "Dashboard": "Обзор"
28
26
  "Do you want to cancel it?": "Вы хотите отменить это?"
29
- "Documentation":
30
27
  "Down": "Вниз"
31
28
 
32
29
  "Edit": "Изменить"
@@ -48,7 +45,7 @@ ru:
48
45
  "Last few days": "Последние дней"
49
46
  "Last 7 days": "Последние 7 дней"
50
47
  "Last 30 days": "Последние 30 дней"
51
- "License":
48
+ "List":
52
49
  "Logged as": "Вы вошли как"
53
50
  "Login": "Редактировать"
54
51
 
@@ -94,6 +91,7 @@ ru:
94
91
  "Unrelate %{unrelate_model} from %{unrelate_model_from}?": "Отсоединить %{unrelate_model} от %{unrelate_model_from}?"
95
92
  "Up": "Вверх"
96
93
 
94
+ "View all %{attribute}":
97
95
  "View site": "Перейти к сайту"
98
96
 
99
97
  "You can update your password at": "Вы можете установить свой пароль на"
data/config/routes.rb CHANGED
@@ -16,5 +16,6 @@ Rails.application.routes.draw do
16
16
  end
17
17
 
18
18
  match ':controller(/:action(/:id))', :controller => /admin\/[^\/]+/
19
+ match ':controller(/:action(.:format))', :controller => /admin\/[^\/]+/
19
20
 
20
21
  end
@@ -4,19 +4,19 @@ Typus.setup do |config|
4
4
  config.admin_title = "<%= options[:admin_title] %>"
5
5
  # config.admin_sub_title = ""
6
6
 
7
- # Configure the e-mail address which will be shown in Admin::Mailer.
8
- # When this option is define Typus will allow admin users to recover
9
- # lost passwords.
7
+ # When mailer_sender is set, password recover is enabled. This email
8
+ # address will be used in Admin::Mailer.
10
9
  # config.mailer_sender = "admin@example.com"
11
10
 
12
11
  # Define file attachment settings.
13
12
  # config.file_preview = :typus_preview
14
13
  # config.file_thumbnail = :typus_thumbnail
15
14
 
16
- # Authentication: :none, :http_basic
15
+ # Authentication: +:none+, +:http_basic+
16
+ # Run `rails g typus:migration` if you need an advanced authentication system.
17
17
  # config.authentication = :none
18
18
 
19
- # Define username and password for http authentication
19
+ # Define username and password for +:http_basic+ authentication
20
20
  # config.username = "admin"
21
21
  # config.password = "columbia"
22
22
 
@@ -1,18 +1,18 @@
1
1
  Typus.setup do |config|
2
2
 
3
- # Authentication: none, http_basic, session
3
+ # Define authentication: +:none+, +:http_basic+, +:session+
4
4
  config.authentication = :session
5
5
 
6
- # Define the default root.
6
+ # Define master_role.
7
7
  # config.master_role = "admin"
8
8
 
9
- # Define relationship table.
9
+ # Define relationship.
10
10
  # config.relationship = "typus_users"
11
11
 
12
- # Define user_class_name and user_fk.
12
+ # Define user_class_name.
13
13
  config.user_class_name = "<%= options[:user_class_name] %>"
14
14
 
15
- # Define the user_fk
15
+ # Define user_fk.
16
16
  config.user_fk = "<%= options[:user_fk] %>"
17
17
 
18
18
  end
@@ -1,18 +1,18 @@
1
1
  Typus::Resources.setup do |config|
2
2
 
3
- # Defines the default_action_on_item.
3
+ # Defines default_action_on_item.
4
4
  # config.default_action_on_item = "edit"
5
5
 
6
- # Defines the end_year.
6
+ # Defines end_year.
7
7
  # config.end_year = nil
8
8
 
9
- # Defines the form_rows.
9
+ # Defines form_rows.
10
10
  # config.form_rows = 15
11
11
 
12
- # Defines the action_after_save.
12
+ # Defines action_after_save.
13
13
  # config.action_after_save = "edit"
14
14
 
15
- # Defines the minute step.
15
+ # Defines minute_step.
16
16
  # config.minute_step = 5
17
17
 
18
18
  # Defines nil.
@@ -21,10 +21,10 @@ Typus::Resources.setup do |config|
21
21
  # Defines only_user_items.
22
22
  # config.only_user_items = false
23
23
 
24
- # Defines per_page
24
+ # Defines per_page.
25
25
  # config.per_page = 15
26
26
 
27
- # Defines start year
27
+ # Defines start_year.
28
28
  # config.start_year = nil
29
29
 
30
30
  end
@@ -1,8 +1,8 @@
1
1
  # Models
2
2
 
3
- This is an example of a **Typus** enabled model with all available
4
- options. You can use this example to customize your YAML files which
5
- only have set the most common settings.
3
+ This is an example of a **Typus** enabled model with all available options. You
4
+ can use this example to customize your YAML files which only have set the most
5
+ common settings.
6
6
 
7
7
  Post:
8
8
  fields:
@@ -26,7 +26,7 @@ only have set the most common settings.
26
26
  index: cleanup
27
27
  edit: send_as_newsletter
28
28
  show: rebuild
29
- export: csv, xml, pdf
29
+ export: csv, xml
30
30
  order_by: created_at
31
31
  relationships:
32
32
  filters: is_published?, created_at, category_id
@@ -34,10 +34,10 @@ only have set the most common settings.
34
34
  application: Application
35
35
  description: Some text to describe the model
36
36
  options:
37
+ action_after_save: :index
37
38
  default_action_on_item: show
38
39
  end_year: 2015
39
40
  form_rows: 25
40
- action_after_save: :index
41
41
  minute_step: 15
42
42
  nil: 'nil'
43
43
  only_user_items: true
@@ -48,9 +48,9 @@ Note: To define namespace models use :: as a separator. (i.e. Delayed::Job)
48
48
 
49
49
  # Roles
50
50
 
51
- In this file you can configure the actions available for each of
52
- your models on the application. You can also use the 'all' shortcut
53
- to allow the user the access to all actions.
51
+ In this file you can configure the actions available for each of your models on
52
+ the application. You can also use the 'all' shortcut to allow the user the
53
+ access to all actions.
54
54
 
55
55
  admin:
56
56
  Post: create, read, update, delete
@@ -61,10 +61,8 @@ to allow the user the access to all actions.
61
61
  Post: create, read, update
62
62
  Category: read, update
63
63
 
64
- You can also define `resources` which are not related to a model,
65
- for example to control MemCached or see the Starling queue
66
- statistics.
64
+ You can also define `resources` which are not related to a model, for example
65
+ to control `Redis`.
67
66
 
68
67
  admin:
69
- Starling: index
70
- MemCached: index, cleanup
68
+ Redis: index, flush_all
@@ -1,4 +1,2 @@
1
- # Controller generated by Typus, use it to extend admin functionality.
2
1
  class Admin::<%= resource %>Controller < <%= inherits_from %>
3
-
4
2
  end
@@ -1,21 +1,10 @@
1
- require "test_helper"
1
+ require 'test_helper'
2
2
 
3
- # ControllerTest generated by Typus, use it to test the extended admin functionality.
4
3
  class Admin::<%= resource %>ControllerTest < ActionController::TestCase
5
4
 
6
- setup do
7
- admin = admin_users(:admin)
8
- @request.session[:typus_user_id] = admin.id
9
- end
10
-
11
- test "should render index" do
12
- get :index
13
- assert_template :index
14
- end
15
-
16
- test "should render new" do
17
- get :new
18
- assert_template :new
5
+ # Replace this with your real tests.
6
+ test "the truth" do
7
+ assert true
19
8
  end
20
9
 
21
10
  end
@@ -46,7 +46,6 @@ Examples:
46
46
  template "config/typus/typus.yml", "config/typus/typus.yml"
47
47
  template "config/typus/typus_roles.yml", "config/typus/typus_roles.yml"
48
48
  template "model.rb", "app/models/#{options[:user_class_name].underscore}.rb"
49
- template "model.yml", "test/fixtures/#{options[:user_class_name].underscore.pluralize}.yml"
50
49
  end
51
50
 
52
51
  def generate_controllers
@@ -11,12 +11,11 @@ class ActiveRecord::Base
11
11
  end
12
12
 
13
13
  #--
14
- # TODO: This has been copied from Rails 2 because has been removed
15
- # from Rails 3. Once the "build_conditions" has been refactored
16
- # to use Arel this can be removed.
14
+ # TODO: This has been copied from Rails 2 because has been removed from
15
+ # Rails 3. Once the "build_conditions" has been refactored to use Arel
16
+ # this can be removed.
17
17
  #++
18
18
  def self.merge_conditions(*conditions)
19
-
20
19
  segments = []
21
20
 
22
21
  conditions.each do |condition|
@@ -27,16 +26,15 @@ class ActiveRecord::Base
27
26
  end
28
27
 
29
28
  "(#{segments.join(') AND (')})" unless segments.empty?
30
-
31
29
  end
32
30
 
33
31
  #--
34
32
  # On a model:
35
33
  #
36
34
  # class Post < ActiveRecord::Base
37
- # STATUS = { "published" => t("Published"),
38
- # "pending" => t("Pending"),
39
- # "draft" => t("Draft") }
35
+ # STATUS = { t("Published") => "published",
36
+ # t("Pending") => "pending",
37
+ # t("Draft") => "draft" }
40
38
  # end
41
39
  #
42
40
  # >> Post.first.status
@@ -50,7 +48,18 @@ class ActiveRecord::Base
50
48
  #++
51
49
  def mapping(attribute)
52
50
  values = self.class::const_get(attribute.to_s.upcase)
53
- values.kind_of?(Hash) ? values[send(attribute)] : send(attribute)
51
+
52
+ if values.kind_of?(Array)
53
+ case values.first
54
+ when Array
55
+ array_keys, array_values = values.transpose
56
+ else
57
+ array_keys = array_values = values
58
+ end
59
+ values = array_keys.to_hash_with(array_values)
60
+ end
61
+
62
+ values.invert[send(attribute)]
54
63
  end
55
64
 
56
65
  def to_label
@@ -0,0 +1,42 @@
1
+ class FakeUser
2
+
3
+ def id
4
+ 0
5
+ end
6
+
7
+ def can?(*args)
8
+ true
9
+ end
10
+
11
+ def cannot?(*args)
12
+ !can?(*args)
13
+ end
14
+
15
+ def is_root?
16
+ true
17
+ end
18
+
19
+ def is_not_root?
20
+ !is_root?
21
+ end
22
+
23
+ def resources
24
+ Typus::Configuration.roles[role].compact
25
+ end
26
+
27
+ def applications
28
+ Typus.applications
29
+ end
30
+
31
+ def application(name)
32
+ Typus.application(name)
33
+ end
34
+
35
+ def role
36
+ Typus.master_role
37
+ end
38
+
39
+ def name
40
+ end
41
+
42
+ end
@@ -1,5 +1,6 @@
1
1
  class Object
2
2
 
3
+ ##
3
4
  # Instead of having to translate strings and defining a default value:
4
5
  #
5
6
  # t("Hello World!", :default => 'Hello World!')
@@ -8,40 +8,8 @@ class String
8
8
  partition(prefix).last
9
9
  end
10
10
 
11
- def extract_resource
12
- remove_prefix
13
- end
14
-
15
11
  def extract_class
16
12
  remove_prefix.camelize.classify.constantize
17
13
  end
18
14
 
19
- def extract_human_name
20
- extract_class.model_name.human.gsub('/', ' ')
21
- end
22
-
23
- #--
24
- # OPTIMIZE: Find a way to remove the rescue.
25
- #++
26
- def typus_actions_on(filter)
27
- if settings = Typus::Configuration.config[self]['actions'][filter.to_s]
28
- settings.extract_settings
29
- else
30
- []
31
- end
32
- rescue
33
- []
34
- end
35
-
36
- #--
37
- # OPTIMIZE: Find a way to remove the rescue.
38
- #++
39
- def typus_defaults_for(filter)
40
- if settings = Typus::Configuration.config[self][filter.to_s]
41
- settings.extract_settings
42
- else
43
- []
44
- end
45
- end
46
-
47
15
  end