activeadmin 0.3.4 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of activeadmin might be problematic. Click here for more details.

Files changed (244) hide show
  1. data/.gitignore +1 -0
  2. data/.travis.yml +3 -0
  3. data/CHANGELOG.md +164 -5
  4. data/CONTRIBUTING.md +113 -0
  5. data/Gemfile +7 -9
  6. data/LICENSE +1 -1
  7. data/README.rdoc +19 -20
  8. data/activeadmin.gemspec +4 -2
  9. data/app/assets/javascripts/active_admin/application.js +9 -0
  10. data/app/assets/javascripts/active_admin/base.js +4 -12
  11. data/app/assets/stylesheets/active_admin/_base.css.scss +17 -341
  12. data/app/assets/stylesheets/active_admin/_forms.css.scss +13 -7
  13. data/app/assets/stylesheets/active_admin/_header.css.scss +23 -4
  14. data/app/assets/stylesheets/active_admin/components/_blank_slates.scss +31 -0
  15. data/app/assets/stylesheets/active_admin/components/_breadcrumbs.scss +20 -0
  16. data/app/assets/stylesheets/active_admin/components/_buttons.scss +12 -0
  17. data/app/assets/stylesheets/active_admin/components/_flash_messages.css.scss +2 -0
  18. data/app/assets/stylesheets/active_admin/components/_grid.scss +9 -0
  19. data/app/assets/stylesheets/active_admin/components/_links.scss +5 -0
  20. data/app/assets/stylesheets/active_admin/components/_pagination.scss +34 -0
  21. data/app/assets/stylesheets/active_admin/components/_panels.scss +6 -0
  22. data/app/assets/stylesheets/active_admin/components/_scopes.scss +10 -0
  23. data/app/assets/stylesheets/active_admin/components/_status_tags.scss +12 -0
  24. data/app/assets/stylesheets/active_admin/components/_table_tools.css.scss +101 -0
  25. data/app/assets/stylesheets/active_admin/components/_tables.css.scss +43 -2
  26. data/app/assets/stylesheets/active_admin/mixins/_all.css.scss +2 -1
  27. data/app/assets/stylesheets/active_admin/mixins/_buttons.css.scss +50 -13
  28. data/app/assets/stylesheets/active_admin/mixins/_gradients.css.scss +9 -1
  29. data/app/assets/stylesheets/active_admin/mixins/_sections.css.scss +7 -5
  30. data/app/assets/stylesheets/active_admin/mixins/_shadows.css.scss +1 -0
  31. data/app/assets/stylesheets/active_admin/mixins/_typography.scss +3 -0
  32. data/app/assets/stylesheets/active_admin/mixins/_utilities.scss +9 -0
  33. data/app/assets/stylesheets/active_admin/mixins/_variables.css.scss +1 -0
  34. data/app/assets/stylesheets/active_admin/pages/_dashboard.scss +5 -0
  35. data/app/assets/stylesheets/active_admin/pages/_logged_out.scss +44 -0
  36. data/app/assets/stylesheets/active_admin/structure/_footer.scss +14 -0
  37. data/app/assets/stylesheets/active_admin/structure/_main_structure.scss +26 -0
  38. data/app/assets/stylesheets/active_admin/structure/_title_bar.scss +44 -0
  39. data/app/views/active_admin/devise/passwords/edit.html.erb +1 -1
  40. data/app/views/active_admin/devise/passwords/new.html.erb +1 -1
  41. data/app/views/active_admin/devise/sessions/new.html.erb +1 -1
  42. data/app/views/active_admin/devise/shared/_links.erb +1 -1
  43. data/app/views/active_admin/devise/unlocks/new.html.erb +1 -1
  44. data/app/views/active_admin/page/index.html.arb +1 -0
  45. data/app/views/layouts/active_admin_logged_out.html.erb +2 -2
  46. data/cucumber.yml +3 -2
  47. data/docs/1-general-configuration.md +46 -10
  48. data/docs/6-show-screens.md +7 -0
  49. data/docs/8-custom-actions.md +12 -2
  50. data/docs/9-custom-pages.md +84 -0
  51. data/features/belongs_to.feature +27 -0
  52. data/features/comments/commenting.feature +3 -2
  53. data/features/dashboard.feature +18 -0
  54. data/features/development_reloading.feature +43 -0
  55. data/features/index/filter_with_check_boxes.feature +25 -0
  56. data/features/index/index_as_table.feature +14 -0
  57. data/features/index/index_scopes.feature +59 -0
  58. data/features/index/pagination.feature +19 -1
  59. data/features/menu.feature +22 -2
  60. data/features/registering_assets.feature +2 -2
  61. data/features/registering_pages.feature +66 -0
  62. data/features/specifying_actions.feature +5 -0
  63. data/features/step_definitions/action_item_steps.rb +2 -6
  64. data/features/step_definitions/action_link_steps.rb +7 -0
  65. data/features/step_definitions/additional_web_steps.rb +11 -3
  66. data/features/step_definitions/asset_steps.rb +5 -1
  67. data/features/step_definitions/breadcrumb_steps.rb +5 -0
  68. data/features/step_definitions/comment_steps.rb +3 -3
  69. data/features/step_definitions/configuration_steps.rb +69 -13
  70. data/features/step_definitions/dashboard_steps.rb +7 -3
  71. data/features/step_definitions/factory_steps.rb +9 -2
  72. data/features/step_definitions/flash_steps.rb +9 -1
  73. data/features/step_definitions/format_steps.rb +9 -1
  74. data/features/step_definitions/index_scope_steps.rb +18 -6
  75. data/features/step_definitions/member_link_steps.rb +7 -0
  76. data/features/step_definitions/pagination_steps.rb +2 -2
  77. data/features/step_definitions/site_title_steps.rb +15 -0
  78. data/features/step_definitions/tab_steps.rb +1 -1
  79. data/features/step_definitions/user_steps.rb +1 -1
  80. data/features/step_definitions/web_steps.rb +4 -4
  81. data/features/support/paths.rb +6 -0
  82. data/features/users/logging_out.feature +11 -0
  83. data/lib/active_admin.rb +26 -10
  84. data/lib/active_admin/application.rb +64 -22
  85. data/lib/active_admin/arbre.rb +0 -1
  86. data/lib/active_admin/arbre/builder.rb +8 -5
  87. data/lib/active_admin/arbre/context.rb +1 -1
  88. data/lib/active_admin/arbre/html/attributes.rb +1 -1
  89. data/lib/active_admin/arbre/html/class_list.rb +0 -4
  90. data/lib/active_admin/arbre/html/collection.rb +2 -2
  91. data/lib/active_admin/arbre/html/document.rb +1 -1
  92. data/lib/active_admin/arbre/html/element.rb +19 -9
  93. data/lib/active_admin/arbre/html/tag.rb +3 -3
  94. data/lib/active_admin/arbre/html/text_node.rb +2 -2
  95. data/lib/active_admin/asset_registration.rb +15 -2
  96. data/lib/active_admin/base_controller.rb +61 -0
  97. data/lib/active_admin/{resource_controller → base_controller}/menu.rb +1 -1
  98. data/lib/active_admin/callbacks.rb +16 -18
  99. data/lib/active_admin/comments.rb +48 -54
  100. data/lib/active_admin/comments/comment.rb +13 -2
  101. data/lib/active_admin/comments/namespace_helper.rb +1 -1
  102. data/lib/active_admin/comments/views/active_admin_comments.rb +7 -3
  103. data/lib/active_admin/dashboards.rb +4 -0
  104. data/lib/active_admin/dashboards/dashboard_controller.rb +21 -5
  105. data/lib/active_admin/dsl.rb +6 -159
  106. data/lib/active_admin/event.rb +5 -3
  107. data/lib/active_admin/filter_form_builder.rb +53 -0
  108. data/lib/active_admin/form_builder.rb +25 -19
  109. data/lib/active_admin/helpers/settings.rb +6 -10
  110. data/lib/active_admin/inputs.rb +14 -0
  111. data/lib/active_admin/inputs/datepicker_input.rb +11 -0
  112. data/lib/active_admin/inputs/filter_base.rb +46 -0
  113. data/lib/active_admin/inputs/filter_check_boxes_input.rb +40 -0
  114. data/lib/active_admin/inputs/filter_date_range_input.rb +34 -0
  115. data/lib/active_admin/inputs/filter_numeric_input.rb +55 -0
  116. data/lib/active_admin/inputs/filter_select_input.rb +23 -0
  117. data/lib/active_admin/inputs/filter_string_input.rb +22 -0
  118. data/lib/active_admin/locales/ca.yml +44 -0
  119. data/lib/active_admin/locales/cs.yml +14 -10
  120. data/lib/active_admin/locales/de.yml +44 -0
  121. data/lib/active_admin/locales/en.yml +5 -0
  122. data/lib/active_admin/locales/hr.yml +40 -0
  123. data/lib/active_admin/locales/hu.yml +45 -0
  124. data/lib/active_admin/locales/it.yml +11 -6
  125. data/lib/active_admin/locales/ko.yml +40 -0
  126. data/lib/active_admin/locales/lv.yml +43 -0
  127. data/lib/active_admin/locales/nl.yml +40 -0
  128. data/lib/active_admin/locales/no-NB.yml +40 -0
  129. data/lib/active_admin/locales/pl.yml +7 -1
  130. data/lib/active_admin/locales/pt-BR.yml +6 -2
  131. data/lib/active_admin/menu_item.rb +25 -17
  132. data/lib/active_admin/namespace.rb +48 -33
  133. data/lib/active_admin/page.rb +65 -0
  134. data/lib/active_admin/page_controller.rb +15 -0
  135. data/lib/active_admin/page_dsl.rb +21 -0
  136. data/lib/active_admin/page_presenter.rb +30 -0
  137. data/lib/active_admin/reloader.rb +109 -42
  138. data/lib/active_admin/resource.rb +38 -44
  139. data/lib/active_admin/resource/action_items.rb +5 -0
  140. data/lib/active_admin/resource/belongs_to.rb +4 -2
  141. data/lib/active_admin/resource/controllers.rb +35 -0
  142. data/lib/active_admin/resource/menu.rb +1 -2
  143. data/lib/active_admin/resource/naming.rb +53 -31
  144. data/lib/active_admin/resource/page_presenters.rb +28 -0
  145. data/lib/active_admin/resource/scopes.rb +16 -3
  146. data/lib/active_admin/resource/sidebars.rb +4 -0
  147. data/lib/active_admin/resource_collection.rb +88 -0
  148. data/lib/active_admin/resource_controller.rb +18 -54
  149. data/lib/active_admin/resource_controller/action_builder.rb +1 -1
  150. data/lib/active_admin/resource_controller/actions.rb +8 -8
  151. data/lib/active_admin/resource_controller/callbacks.rb +1 -1
  152. data/lib/active_admin/resource_controller/collection.rb +8 -4
  153. data/lib/active_admin/resource_controller/filters.rb +1 -1
  154. data/lib/active_admin/resource_controller/resource_class_methods.rb +24 -0
  155. data/lib/active_admin/resource_controller/scoping.rb +1 -1
  156. data/lib/active_admin/resource_controller/sidebars.rb +1 -1
  157. data/lib/active_admin/resource_dsl.rb +157 -0
  158. data/lib/active_admin/router.rb +21 -14
  159. data/lib/active_admin/scope.rb +15 -3
  160. data/lib/active_admin/version.rb +1 -1
  161. data/lib/active_admin/view_factory.rb +4 -3
  162. data/lib/active_admin/view_helpers/auto_link_helper.rb +1 -10
  163. data/lib/active_admin/view_helpers/breadcrumb_helper.rb +25 -21
  164. data/lib/active_admin/view_helpers/filter_form_helper.rb +0 -150
  165. data/lib/active_admin/views/components/attributes_table.rb +1 -1
  166. data/lib/active_admin/views/components/columns.rb +4 -4
  167. data/lib/active_admin/views/components/paginated_collection.rb +42 -13
  168. data/lib/active_admin/views/components/panel.rb +8 -0
  169. data/lib/active_admin/views/components/scopes.rb +24 -18
  170. data/lib/active_admin/views/components/status_tag.rb +6 -5
  171. data/lib/active_admin/views/components/table_for.rb +6 -2
  172. data/lib/active_admin/views/header_renderer.rb +31 -12
  173. data/lib/active_admin/views/index_as_block.rb +2 -2
  174. data/lib/active_admin/views/index_as_blog.rb +3 -3
  175. data/lib/active_admin/views/index_as_grid.rb +4 -4
  176. data/lib/active_admin/views/index_as_table.rb +13 -6
  177. data/lib/active_admin/views/pages/base.rb +4 -4
  178. data/lib/active_admin/views/pages/form.rb +49 -0
  179. data/lib/active_admin/views/pages/index.rb +18 -6
  180. data/lib/active_admin/views/pages/page.rb +24 -0
  181. data/lib/active_admin/views/pages/show.rb +1 -1
  182. data/lib/generators/active_admin/assets/assets_generator.rb +19 -1
  183. data/lib/generators/active_admin/install/templates/active_admin.rb.erb +38 -12
  184. data/lib/generators/active_admin/install/templates/dashboards.rb +6 -0
  185. data/script/use_rails +14 -7
  186. data/spec/spec_helper.rb +9 -14
  187. data/spec/spec_helper_without_rails.rb +10 -0
  188. data/spec/support/detect_rails_version.rb +22 -3
  189. data/spec/support/integration_example_group.rb +5 -7
  190. data/spec/support/rails_template.rb +11 -0
  191. data/spec/support/rails_template_with_data.rb +25 -0
  192. data/spec/support/templates/cucumber_with_reloading.rb +5 -0
  193. data/spec/unit/active_admin_spec.rb +8 -0
  194. data/spec/unit/application_spec.rb +48 -2
  195. data/spec/unit/arbre/context_spec.rb +1 -1
  196. data/spec/unit/arbre/html/element_finder_methods_spec.rb +58 -2
  197. data/spec/unit/arbre/html/element_spec.rb +18 -5
  198. data/spec/unit/arbre/html/tag_attributes_spec.rb +3 -3
  199. data/spec/unit/arbre/html/tag_spec.rb +1 -1
  200. data/spec/unit/arbre/html_spec.rb +32 -22
  201. data/spec/unit/asset_registration_spec.rb +9 -3
  202. data/spec/unit/auto_link_spec.rb +2 -2
  203. data/spec/unit/base_controller_shared_examples.rb +28 -0
  204. data/spec/unit/base_controller_spec.rb +8 -0
  205. data/spec/unit/belongs_to_spec.rb +30 -33
  206. data/spec/unit/comments_spec.rb +45 -15
  207. data/spec/unit/config_shared_examples.rb +119 -0
  208. data/spec/unit/dashboard_controller_spec.rb +44 -0
  209. data/spec/unit/event_spec.rb +6 -0
  210. data/spec/unit/filter_form_builder_spec.rb +9 -0
  211. data/spec/unit/form_builder_spec.rb +8 -14
  212. data/spec/unit/menu_item_spec.rb +25 -20
  213. data/spec/unit/namespace/register_page_spec.rb +102 -0
  214. data/spec/unit/namespace/register_resource_spec.rb +188 -0
  215. data/spec/unit/namespace_spec.rb +11 -183
  216. data/spec/unit/page_controller_spec.rb +8 -0
  217. data/spec/unit/page_spec.rb +60 -0
  218. data/spec/unit/reloader_spec.rb +82 -38
  219. data/spec/unit/resource/menu_spec.rb +1 -51
  220. data/spec/unit/resource/naming_spec.rb +25 -20
  221. data/spec/unit/resource/page_presenters_spec.rb +32 -0
  222. data/spec/unit/resource/scopes_spec.rb +13 -0
  223. data/spec/unit/resource_collection_spec.rb +101 -0
  224. data/spec/unit/resource_controller_spec.rb +40 -32
  225. data/spec/unit/{registration_spec.rb → resource_registration_spec.rb} +0 -0
  226. data/spec/unit/resource_spec.rb +8 -24
  227. data/spec/unit/routing_spec.rb +50 -1
  228. data/spec/unit/scope_spec.rb +18 -4
  229. data/spec/unit/views/components/paginated_collection_spec.rb +163 -0
  230. data/spec/unit/views/components/panel_spec.rb +9 -0
  231. data/spec/unit/views/components/status_tag_spec.rb +9 -0
  232. data/spec/unit/views/tabbed_navigation_spec.rb +2 -1
  233. data/tasks/test.rake +44 -26
  234. metadata +176 -69
  235. data/app/assets/javascripts/active_admin/vendor.js +0 -382
  236. data/lib/active_admin/arbre/core_extensions.rb +0 -5
  237. data/lib/active_admin/comments/configuration.rb +0 -18
  238. data/lib/active_admin/page_config.rb +0 -15
  239. data/lib/active_admin/resource_controller/form.rb +0 -42
  240. data/lib/active_admin/resource_controller/page_configurations.rb +0 -53
  241. data/lib/active_admin/views/pages/edit.rb +0 -28
  242. data/lib/active_admin/views/pages/new.rb +0 -28
  243. data/lib/generators/active_admin/assets/templates/3.0/active_admin.js +0 -427
  244. data/spec/integration/belongs_to_spec.rb +0 -42
@@ -0,0 +1,45 @@
1
+ hu:
2
+ active_admin:
3
+ dashboard: Vezérlőpult
4
+ dashboard_welcome:
5
+ welcome: "Üdvözöljük az Active Admin felületén. Ez a vezérlőpult kezdőlapja"
6
+ call_to_action: "Elemek hozzáadásához nézze meg a 'app/admin/dashboards.rb' fájlt"
7
+ view: "Megtekintés"
8
+ edit: "Szerkesztés"
9
+ delete: "Törlés"
10
+ delete_confirmation: "Biztosan törli ezt az elemet?"
11
+ new_model: "Új %{model}"
12
+ create_model: "%{model} létrehozása"
13
+ edit_model: "%{model} módosítása"
14
+ update_model: "%{model} módosítása"
15
+ delete_model: "%{model} törlése"
16
+ details: "%{model} részletei"
17
+ cancel: "Mégsem"
18
+ empty: "Üres"
19
+ previous: "Előző"
20
+ next: "Következő"
21
+ download: "Letöltés:"
22
+ has_many_new: "Új %{model} hozzáadása"
23
+ has_many_delete: "Törlés"
24
+ filter: "Szűrés"
25
+ clear_filters: "Feltételek törlése"
26
+ search_field: "Keresés %{field} alapján"
27
+ equal_to: "Pontosan"
28
+ greater_than: "Nagyobb, mint"
29
+ less_than: "Kisebb, mint"
30
+ main_content: "Kérem, implementálja a %{model}#main_content metódust a tartalom megjelenítéséhez."
31
+ logout: "Kilépés"
32
+ sidebars:
33
+ filters: "Szűrők"
34
+ pagination:
35
+ empty: "Nincs több %{model}"
36
+ one: "<b>Egy</b> %{model} megjelenítése"
37
+ one_page: "<b>Az összes (%{n} db)</b> %{model} megjelenítése"
38
+ multiple: "%{model} listájának megjelenítése, <b>%{from}&nbsp;-&nbsp;%{to}</b>/<b>%{total}</b> "
39
+ entry:
40
+ one: "elem"
41
+ other: "elem"
42
+ any: "Összes"
43
+ blank_slate:
44
+ content: "Még nincs létrehozva %{resource_name}."
45
+ link: "Létrehozás most"
@@ -7,20 +7,22 @@ it:
7
7
  view: "Mostra"
8
8
  edit: "Modifica"
9
9
  delete: "Rimuovi"
10
- delete_confirmation: "Sicuro di volere rimuovere?"
10
+ delete_confirmation: "Sei sicuro di volerlo rimuovere?"
11
11
  new_model: "Aggiungi %{model}"
12
+ create_model: "Aggiungi %{model}"
12
13
  edit_model: "Modifica %{model}"
14
+ update_model: "Modifica %{model}"
13
15
  delete_model: "Rimuovi %{model}"
14
16
  details: "%{model} Dettagli"
15
17
  cancel: "Annulla"
16
18
  empty: "Vuoto"
17
19
  previous: "Precedente"
18
- next: "Avanti"
20
+ next: "Prossimo"
19
21
  download: "Download:"
20
- has_many_new: "Aggiungi Nuovo/a %{model}"
22
+ has_many_new: "Aggiungi nuovo/a %{model}"
21
23
  has_many_delete: "Rimuovi"
22
24
  filter: "Filtra"
23
- clear_filters: "Rimuovi Filtri"
25
+ clear_filters: "Rimuovi filtri"
24
26
  search_field: "Cerca %{field}"
25
27
  equal_to: "Uguale a"
26
28
  greater_than: "Maggiore di"
@@ -34,7 +36,10 @@ it:
34
36
  one: "Sto mostrando <b>1</b> %{model}"
35
37
  one_page: "Sto mostrando <b>%{n}</b> %{model}. Lista completa."
36
38
  multiple: "Sto mostrando %{model} <b>%{from}&nbsp;-&nbsp;%{to}</b> di <b>%{total}</b> in totale"
37
- any: "Qualunque"
39
+ entry:
40
+ one: "voce"
41
+ other: "voci"
42
+ any: "Qualsiasi"
38
43
  blank_slate:
39
44
  content: "Non sono presenti %{resource_name}"
40
- link: "Crea nuovo/a"
45
+ link: "Crea nuovo/a"
@@ -0,0 +1,40 @@
1
+ ko:
2
+ active_admin:
3
+ dashboard: "대시보드"
4
+ dashboard_welcome:
5
+ welcome: "Active Admin 에 오신 것을 환영합니다. 이것은 디폴트 대시보드 페이지 입니다."
6
+ call_to_action: "대시보드에 섹션을 추가하시려면 'app/admin/dashboards.rb' 소스를 확인해 주세요."
7
+ view: "보기"
8
+ edit: "수정"
9
+ delete: "삭제"
10
+ delete_confirmation: "정말로 삭제 하시겠습니까?"
11
+ new_model: "새 %{model}"
12
+ edit_model: "%{model} 수정"
13
+ delete_model: "%{model} 삭제"
14
+ details: "%{model} 상세보기"
15
+ cancel: "취소"
16
+ empty: "비었음"
17
+ previous: "이전"
18
+ next: "다음"
19
+ download: "다운로드:"
20
+ has_many_new: "%{model} 추가"
21
+ has_many_delete: "삭제"
22
+ filter: "필터"
23
+ clear_filters: "필터 초기화"
24
+ search_field: "%{field} 검색"
25
+ equal_to: "같다"
26
+ greater_than: "크다"
27
+ less_than: "작다"
28
+ main_content: "내용을 보시려면 %{model}#main_content 를 구현해 주시기 바랍니다."
29
+ logout: "로그아웃"
30
+ sidebars:
31
+ filters: "필터 목록"
32
+ pagination:
33
+ empty: "%{model} 이/가 없습니다."
34
+ one: "<b>1</b> %{model} 표시중"
35
+ one_page: "<b>전체 %{n}</b> %{model} 표시중"
36
+ multiple: "전체 <b>%{total}</b> 중 <b>%{from}&nbsp;-&nbsp;%{to}</b> %{model} 표시중"
37
+ any: "어떤"
38
+ blank_slate:
39
+ content: "아직 %{resource_name} 이/가 없습니다."
40
+ link: "만들기"
@@ -0,0 +1,43 @@
1
+ lv:
2
+ active_admin:
3
+ dashboard: Panelis
4
+ dashboard_welcome:
5
+ welcome: "Laipni lūgti Active Admin."
6
+ call_to_action: "Izmantojiet 'app/admin/dashboards.rb', lai pievienotu sadaļas panelim."
7
+ view: "Apskatīt"
8
+ edit: "Labot"
9
+ delete: "Dzēst"
10
+ delete_confirmation: "Vai Tu tiešām vēlies dzēst?"
11
+ new_model: "Pievienot '%{model}' ierasktu"
12
+ edit_model: "Labot '%{model}' ierakstu"
13
+ delete_model: "Dzēst '%{model}' ierakstu"
14
+ details: "Apraksts"
15
+ cancel: "Atcelt"
16
+ empty: "Tukšs"
17
+ previous: "Iepriekšējā"
18
+ next: "Nākošā"
19
+ download: "Lejuplādēt:"
20
+ has_many_new: "Pievienot jaunu '%{model}' ierakstu"
21
+ has_many_delete: "Dzēst"
22
+ filter: "Filtrēt"
23
+ clear_filters: "Novākt filtrus"
24
+ search_field: "Meklēt '%{field}' laukā"
25
+ equal_to: "Vienāds ar"
26
+ greater_than: "Lielāks par"
27
+ less_than: "Mazāks par"
28
+ main_content: "Lūdzu implementēt %{model}#main_content, lai rādītos saturs."
29
+ logout: "Iziet"
30
+ sidebars:
31
+ filters: "Filtri"
32
+ pagination:
33
+ empty: "Nav ierakstu"
34
+ one: "<b>1</b> ieraksts"
35
+ one_page: "<b>%{n}</b> ieraksti"
36
+ multiple: "<b>%{from}&nbsp;-&nbsp;%{to}</b> ieraksti no <b>%{total}</b> kopā"
37
+ entry:
38
+ one: "ieraksts"
39
+ other: "ieraksti"
40
+ any: "Jebkurš"
41
+ blank_slate:
42
+ content: "Sadaļā '%{resource_name}' nav neviena ieraksta."
43
+ link: "Izveidot jaunu"
@@ -0,0 +1,40 @@
1
+ nl:
2
+ active_admin:
3
+ dashboard: Dashboard
4
+ dashboard_welcome:
5
+ welcome: "Welkom bij Active Admin. Dit is de standaard dashboard pagina"
6
+ call_to_action: "Pas je eigen dashboard aan in het bestand 'app/admin/dashboards.rb'"
7
+ view: "Bekijk"
8
+ edit: "Wijzig"
9
+ delete: "Verwijder"
10
+ delete_confirmation: "Weet je zeker dat je dit item wilt verwijderen?"
11
+ new_model: "Nieuwe %{model}"
12
+ edit_model: "Wijzig %{model}"
13
+ delete_model: "Verwijder %{model}"
14
+ details: "%{model} details"
15
+ cancel: "Annuleren"
16
+ empty: "Leeg"
17
+ previous: "Vorige"
18
+ next: "Volgende"
19
+ download: "Download"
20
+ has_many_new: "Voeg nieuwe %{model} toe"
21
+ has_many_delete: "Verwijderen"
22
+ filter: "Filter"
23
+ clear_filters: "Maak Filters Ongedaan"
24
+ search_field: "Zoek %{field}"
25
+ equal_to: "Gelijk aan"
26
+ greater_than: "Groter dan"
27
+ less_than: "Kleiner dan"
28
+ main_content: "Implementeer %{model}#main_content om de content weer te geven."
29
+ logout: "Uitloggen"
30
+ sidebars:
31
+ filters: "Filters"
32
+ pagination:
33
+ empty: "Geen %{model} gevonden"
34
+ one: "Geeft <b>1</b> %{model} weer"
35
+ one_page: "Geeft <b>%{n}</b> %{model} weer"
36
+ multiple: "Geeft %{model} <b>%{from}&nbsp;-&nbsp;%{to}</b> van de <b>%{total}</b> weer"
37
+ any: "Alle"
38
+ blank_slate:
39
+ content: "Er zijn geen %{resource_name} gevonden."
40
+ link: "Maak aan"
@@ -0,0 +1,40 @@
1
+ "no-NB":
2
+ active_admin:
3
+ dashboard: Oversikt
4
+ dashboard_welcome:
5
+ welcome: "Velkommen til Active Admin. Dette er standardoversiktssiden."
6
+ call_to_action: "Rediger 'app/admin/dashboards.rb' for at legge til elementer i oversikten."
7
+ view: "Vis"
8
+ edit: "Rediger"
9
+ delete: "Slett"
10
+ delete_confirmation: "Er du sikker på at du vil slette denne?"
11
+ new_model: "Ny %{model}"
12
+ edit_model: "Rediger %{model}"
13
+ delete_model: "Slett %{model}"
14
+ details: "%{model} Detaljer"
15
+ cancel: "Avbryt"
16
+ empty: "Tom"
17
+ previous: "Forrige"
18
+ next: "Neste"
19
+ download: "Last ned:"
20
+ has_many_new: "Legg til ny %{model}"
21
+ has_many_delete: "Slett"
22
+ filter: "Filter"
23
+ clear_filters: "Fjern filter"
24
+ search_field: "Søk %{field}"
25
+ equal_to: "Er lik"
26
+ greater_than: "Større enn"
27
+ less_than: "Mindre enn"
28
+ main_content: "Please implement %{model}#main_content to display content."
29
+ logout: "Logg ut"
30
+ sidebars:
31
+ filters: "Filtere"
32
+ pagination:
33
+ empty: "Fannt ingen %{model}"
34
+ one: "Viser <b>1</b> %{model}"
35
+ one_page: "Viser <b>alle %{n}</b> %{model}"
36
+ multiple: "Viser %{model} <b>%{from}&nbsp;-&nbsp;%{to}</b> av <b>%{total}</b> totalt"
37
+ any: "Noen"
38
+ blank_slate:
39
+ content: "Her er det ingen %{resource_name} enda."
40
+ link: "Opprett en"
@@ -1,6 +1,9 @@
1
1
  pl:
2
2
  active_admin:
3
- dashboard_welcome: "Witaj w Active Adminie. Znajdujesz się na domyślnym dashboardzie. Aby dodać sekcje do dashboarda sprawdź 'app/admin/dashboards.rb'"
3
+ dashboard: Pulpit
4
+ dashboard_welcome:
5
+ welcome: "Witaj w Active Adminie. To jest domyślny pulpit."
6
+ call_to_action: "Aby dodać sekcje do pulpitu, sprawdź 'app/admin/dashboards.rb'"
4
7
  view: "Podgląd"
5
8
  edit: "Edytuj"
6
9
  delete: "Usuń"
@@ -32,3 +35,6 @@ pl:
32
35
  one_page: "Wyświetlanie <b>wszystkich %{n}</b> %{model}"
33
36
  multiple: "Wyświetlanie %{model} <b>%{from}&nbsp;-&nbsp;%{to}</b> z <b>%{total}</b>"
34
37
  any: "Jakikolwiek"
38
+ blank_slate:
39
+ content: "Nie ma jeszcze zasobu %{resource_name}."
40
+ link: "Utwórz go"
@@ -9,7 +9,9 @@
9
9
  delete: "Remover"
10
10
  delete_confirmation: "Você tem certeza que deseja remover este item?"
11
11
  new_model: "Novo(a) %{model}"
12
+ create_model: "Novo(a) %{model}"
12
13
  edit_model: "Editar %{model}"
14
+ update_model: "Atualizar %{model}"
13
15
  delete_model: "Remover %{model}"
14
16
  details: "Detalhes do(a) %{model}"
15
17
  cancel: "Cancelar"
@@ -34,8 +36,10 @@
34
36
  one: "Exibindo <b>1</b> %{model}"
35
37
  one_page: "Exibindo <b>todos(as) os(as) %{n}</b> %{model}"
36
38
  multiple: "Exibindo %{model} <b>%{from}&nbsp;-&nbsp;%{to}</b> de um total de <b>%{total}</b>"
39
+ entry:
40
+ one: "registro"
41
+ other: "registros"
37
42
  any: "Qualquer"
38
43
  blank_slate:
39
44
  content: "Não existem %{resource_name} ainda."
40
- link: "Crie uma"
41
-
45
+ link: "Crie uma"
@@ -1,18 +1,25 @@
1
1
  module ActiveAdmin
2
2
  class MenuItem
3
-
4
- # Use this to get to the routes
5
- include Rails.application.routes.url_helpers
6
-
3
+
4
+
5
+ # Generates a route using the rails application url helpers
6
+ #
7
+ # @param [Symbol] named_route
8
+ #
9
+ # @returns [String] The generated route
10
+ def self.generate_url(named_route)
11
+ Rails.application.routes.url_helpers.send(named_route)
12
+ end
13
+
7
14
  attr_accessor :name, :url, :priority, :parent, :display_if_block
8
-
15
+
9
16
  def initialize(name, url, priority = 10, options = {})
10
17
  @name, @url, @priority = name, url, priority
11
18
  @children = []
12
19
  @cached_url = {} # Stores the cached url in a hash to allow us to change it and still cache it
13
20
 
14
21
  @display_if_block = options.delete(:if)
15
-
22
+
16
23
  yield(self) if block_given? # Builder style syntax
17
24
  end
18
25
 
@@ -20,54 +27,55 @@ module ActiveAdmin
20
27
  item = MenuItem.new(name, url, priority, options, &block)
21
28
  item.parent = self
22
29
  @children << item
23
- end
24
-
30
+ end
31
+
25
32
  def children
26
33
  @children.sort
27
34
  end
28
-
35
+
29
36
  def parent?
30
37
  !parent.nil?
31
38
  end
32
-
39
+
33
40
  def dom_id
34
41
  name.downcase.gsub( " ", '_' ).gsub( /[^a-z0-9_]/, '' )
35
42
  end
36
-
43
+
37
44
  def url
38
45
  case @url
39
46
  when Symbol
40
- generated = send(@url) # Call the named route
47
+ generated = self.class.generate_url(@url) # Call the named route
41
48
  else
42
49
  generated = @url
43
50
  end
44
51
  @cached_url[@url] ||= generated
45
52
  end
46
-
53
+
47
54
  # Returns an array of the ancestory of this menu item
48
55
  # The first item is the immediate parent fo the item
49
56
  def ancestors
50
57
  return [] unless parent?
51
58
  [parent, parent.ancestors].flatten
52
59
  end
53
-
60
+
54
61
  # Returns the child item with the name passed in
55
62
  # @blog_menu["Create New"] => <#MenuItem @name="Create New" >
56
63
  def [](name)
57
64
  @children.find{ |i| i.name == name }
58
65
  end
59
-
66
+
60
67
  def <=>(other)
61
68
  result = priority <=> other.priority
62
69
  result = name <=> other.name if result == 0
63
70
  result
64
71
  end
65
-
72
+
66
73
  # Returns the display if block. If the block was not explicitly defined
67
74
  # a default block always returning true will be returned.
68
75
  def display_if_block
69
76
  @display_if_block || lambda { |_| true }
70
77
  end
71
78
 
72
- end
79
+
80
+ end
73
81
  end
@@ -1,3 +1,6 @@
1
+ require 'active_admin/helpers/settings'
2
+ require 'active_admin/resource_collection'
3
+
1
4
  module ActiveAdmin
2
5
 
3
6
  class ResourceMismatchError < StandardError; end
@@ -25,6 +28,7 @@ module ActiveAdmin
25
28
  # resource will be accessible from "/posts" and the controller will be PostsController.
26
29
  #
27
30
  class Namespace
31
+ include Settings
28
32
 
29
33
  RegisterEvent = 'active_admin.namespace.register'.freeze
30
34
 
@@ -33,7 +37,7 @@ module ActiveAdmin
33
37
  def initialize(application, name)
34
38
  @application = application
35
39
  @name = name.to_s.underscore.to_sym
36
- @resources = {}
40
+ @resources = ResourceCollection.new
37
41
  @menu = Menu.new
38
42
  register_module unless root?
39
43
  generate_dashboard_controller
@@ -42,8 +46,8 @@ module ActiveAdmin
42
46
  # Register a resource into this namespace. The preffered method to access this is to
43
47
  # use the global registration ActiveAdmin.register which delegates to the proper
44
48
  # namespace instance.
45
- def register(resource, options = {}, &block)
46
- config = find_or_build_resource(resource, options)
49
+ def register(resource_class, options = {}, &block)
50
+ config = find_or_build_resource(resource_class, options)
47
51
 
48
52
  # Register the resource
49
53
  register_resource_controller(config)
@@ -60,6 +64,17 @@ module ActiveAdmin
60
64
  config
61
65
  end
62
66
 
67
+ def register_page(name, options = {}, &block)
68
+ config = build_page(name, options)
69
+
70
+ # Register the resource
71
+ register_page_controller(config)
72
+ parse_page_registration_block(config, &block) if block_given?
73
+ register_with_menu(config) if config.include_in_menu?
74
+
75
+ config
76
+ end
77
+
63
78
  def root?
64
79
  name == :root
65
80
  end
@@ -92,22 +107,20 @@ module ActiveAdmin
92
107
  # loaded. This method gets called to register each resource with the menu system.
93
108
  def load_menu!
94
109
  register_dashboard
95
- resources.values.each do |config|
96
- register_with_menu(config) if config.include_in_menu?
110
+ resources.each do |resource|
111
+ register_with_menu(resource) if resource.include_in_menu?
97
112
  end
98
113
  end
99
114
 
100
115
  # Returns the first registered ActiveAdmin::Resource instance for a given class
101
116
  def resource_for(klass)
102
- actual = resources.values.find{|config| config.resource == klass }
103
- return actual if actual
117
+ resources.find_by_resource_class(klass)
118
+ end
104
119
 
105
- if klass.respond_to?(:base_class)
106
- base_class = klass.base_class
107
- resources.values.find{|config| config.resource == base_class }
108
- else
109
- nil
110
- end
120
+ # Override from ActiveAdmin::Settings to inherit default attributes
121
+ # from the application
122
+ def read_default_setting(name)
123
+ application.send(name)
111
124
  end
112
125
 
113
126
  protected
@@ -115,33 +128,27 @@ module ActiveAdmin
115
128
  # Either returns an existing Resource instance or builds a new
116
129
  # one for the resource and options
117
130
  def find_or_build_resource(resource_class, options)
118
- resource = Resource.new(self, resource_class, options)
119
-
120
- # If we've already registered this resource, use the existing
121
- if @resources.has_key? resource.camelized_resource_name
122
- existing_resource = @resources[resource.camelized_resource_name]
131
+ resources.add Resource.new(self, resource_class, options)
132
+ end
123
133
 
124
- if existing_resource.resource != resource_class
125
- raise ActiveAdmin::ResourceMismatchError,
126
- "Tried to register #{resource_class} as #{resource.camelized_resource_name} but already registered to #{resource.resource}"
127
- end
134
+ def build_page(name, options)
135
+ resources.add Page.new(self, name, options)
136
+ end
128
137
 
129
- resource = existing_resource
130
- else
131
- @resources[resource.camelized_resource_name] = resource
132
- end
133
138
 
134
- resource
139
+ def register_page_controller(config)
140
+ eval "class ::#{config.controller_name} < ActiveAdmin::PageController; end"
141
+ config.controller.active_admin_config = config
135
142
  end
136
143
 
137
144
  def unload_resources!
138
- resources.each do |name, config|
145
+ resources.each do |resource|
139
146
  parent = (module_name || 'Object').constantize
140
- const_name = config.controller_name.split('::').last
147
+ const_name = resource.controller_name.split('::').last
141
148
  # Remove the const if its been defined
142
149
  parent.send(:remove_const, const_name) if parent.const_defined?(const_name)
143
150
  end
144
- @resources = {}
151
+ @resources = ResourceCollection.new
145
152
  end
146
153
 
147
154
  def unload_dashboard!
@@ -163,12 +170,20 @@ module ActiveAdmin
163
170
  config.controller.active_admin_config = config
164
171
  end
165
172
 
166
- def dsl
167
- @dsl ||= DSL.new
173
+ def resource_dsl
174
+ @resource_dsl ||= ResourceDSL.new
168
175
  end
169
176
 
170
177
  def parse_registration_block(config, &block)
171
- dsl.run_registration_block(config, &block)
178
+ resource_dsl.run_registration_block(config, &block)
179
+ end
180
+
181
+ def page_dsl
182
+ @page_dsl ||= PageDSL.new
183
+ end
184
+
185
+ def parse_page_registration_block(config, &block)
186
+ page_dsl.run_registration_block(config, &block)
172
187
  end
173
188
 
174
189
  # Creates a dashboard controller for this config