activeadmin 0.6.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (322) hide show
  1. data/.gitignore +5 -1
  2. data/.travis.yml +1 -1
  3. data/.yardopts +2 -3
  4. data/CHANGELOG.md +180 -36
  5. data/CONTRIBUTING.md +12 -2
  6. data/Gemfile +9 -3
  7. data/README.rdoc +38 -65
  8. data/Rakefile +1 -3
  9. data/activeadmin.gemspec +10 -11
  10. data/app/assets/images/active_admin/index_list_icons/block_icon.svg +1 -1
  11. data/app/assets/images/active_admin/index_list_icons/blog_icon.svg +1 -1
  12. data/app/assets/images/active_admin/index_list_icons/grid_icon.svg +1 -1
  13. data/app/assets/images/active_admin/index_list_icons/table_icon.svg +1 -1
  14. data/app/assets/javascripts/active_admin/components/jquery.aa.checkbox-toggler.js.coffee +2 -2
  15. data/app/assets/javascripts/active_admin/components/jquery.aa.dropdown-menu.js.coffee +2 -2
  16. data/app/assets/javascripts/active_admin/components/jquery.aa.popover.js.coffee +2 -2
  17. data/app/assets/javascripts/active_admin/components/jquery.aa.table-checkbox-toggler.js.coffee +2 -2
  18. data/app/assets/javascripts/active_admin/lib/namespace.js.coffee +2 -1
  19. data/app/assets/javascripts/active_admin/pages/application.js.coffee +6 -1
  20. data/app/assets/stylesheets/active_admin/_base.css.scss +29 -34
  21. data/app/assets/stylesheets/active_admin/_forms.css.scss +65 -62
  22. data/app/assets/stylesheets/active_admin/_header.css.scss +57 -45
  23. data/app/assets/stylesheets/active_admin/_typography.css.scss +9 -9
  24. data/app/assets/stylesheets/active_admin/components/_batch_actions.css.scss +1 -1
  25. data/app/assets/stylesheets/active_admin/components/_blank_slates.scss +5 -5
  26. data/app/assets/stylesheets/active_admin/components/_breadcrumbs.scss +2 -2
  27. data/app/assets/stylesheets/active_admin/components/_comments.css.scss +1 -1
  28. data/app/assets/stylesheets/active_admin/components/_date_picker.css.scss +20 -20
  29. data/app/assets/stylesheets/active_admin/components/_dropdown_menu.scss +16 -16
  30. data/app/assets/stylesheets/active_admin/components/_flash_messages.css.scss +25 -23
  31. data/app/assets/stylesheets/active_admin/components/_grid.scss +2 -2
  32. data/app/assets/stylesheets/active_admin/components/_index_list.scss +1 -1
  33. data/app/assets/stylesheets/active_admin/components/_pagination.scss +10 -10
  34. data/app/assets/stylesheets/active_admin/components/_panels.scss +1 -1
  35. data/app/assets/stylesheets/active_admin/components/_popovers.css.scss +27 -27
  36. data/app/assets/stylesheets/active_admin/components/_scopes.scss +1 -1
  37. data/app/assets/stylesheets/active_admin/components/_table_tools.css.scss +10 -10
  38. data/app/assets/stylesheets/active_admin/components/_tables.css.scss +9 -9
  39. data/app/assets/stylesheets/active_admin/mixins/_buttons.css.scss +3 -3
  40. data/app/assets/stylesheets/active_admin/mixins/_gradients.css.scss +4 -4
  41. data/app/assets/stylesheets/active_admin/mixins/_icons.css.scss +4 -7
  42. data/app/assets/stylesheets/active_admin/mixins/_reset.css.scss +5 -5
  43. data/app/assets/stylesheets/active_admin/mixins/_rounded.css.scss +3 -3
  44. data/app/assets/stylesheets/active_admin/mixins/_sections.css.scss +6 -6
  45. data/app/assets/stylesheets/active_admin/mixins/_shadows.css.scss +8 -8
  46. data/app/assets/stylesheets/active_admin/mixins/_typography.scss +1 -1
  47. data/app/assets/stylesheets/active_admin/mixins/_utilities.scss +1 -1
  48. data/app/assets/stylesheets/active_admin/mixins/_variables.css.scss +9 -1
  49. data/app/assets/stylesheets/active_admin/pages/_logged_out.scss +1 -1
  50. data/app/assets/stylesheets/active_admin/print.css.scss +2 -8
  51. data/app/assets/stylesheets/active_admin/structure/_footer.scss +5 -5
  52. data/app/assets/stylesheets/active_admin/structure/_main_structure.scss +13 -13
  53. data/app/assets/stylesheets/active_admin/structure/_title_bar.scss +14 -14
  54. data/app/views/active_admin/devise/passwords/edit.html.erb +1 -1
  55. data/app/views/active_admin/devise/sessions/new.html.erb +1 -1
  56. data/app/views/active_admin/devise/shared/_links.erb +8 -1
  57. data/app/views/active_admin/resource/index.csv.erb +3 -3
  58. data/app/views/layouts/active_admin_logged_out.html.erb +5 -3
  59. data/config/locales/bg.yml +101 -0
  60. data/{lib/active_admin → config}/locales/ca.yml +24 -7
  61. data/{lib/active_admin → config}/locales/cs.yml +34 -12
  62. data/{lib/active_admin → config}/locales/da.yml +29 -7
  63. data/config/locales/de-CH.yml +117 -0
  64. data/{lib/active_admin → config}/locales/de.yml +19 -9
  65. data/config/locales/en-GB.yml +90 -0
  66. data/{lib/active_admin → config}/locales/en.yml +16 -6
  67. data/config/locales/es.yml +106 -0
  68. data/{lib/active_admin/locales/es.yml → config/locales/es_MX.yml} +14 -8
  69. data/{lib/active_admin → config}/locales/fr.yml +14 -6
  70. data/{lib/active_admin → config}/locales/he.yml +16 -6
  71. data/{lib/active_admin → config}/locales/hr.yml +14 -6
  72. data/{lib/active_admin → config}/locales/hu.yml +31 -6
  73. data/{lib/active_admin → config}/locales/it.yml +14 -6
  74. data/{lib/active_admin → config}/locales/ja.yml +32 -7
  75. data/{lib/active_admin → config}/locales/ko.yml +14 -6
  76. data/{lib/active_admin → config}/locales/lt.yml +15 -6
  77. data/{lib/active_admin → config}/locales/lv.yml +14 -6
  78. data/{lib/active_admin → config}/locales/nl.yml +14 -6
  79. data/{lib/active_admin → config}/locales/no-NB.yml +14 -6
  80. data/{lib/active_admin → config}/locales/pl.yml +14 -6
  81. data/{lib/active_admin → config}/locales/pt-BR.yml +14 -6
  82. data/{lib/active_admin → config}/locales/pt-PT.yml +14 -6
  83. data/{lib/active_admin → config}/locales/ro.yml +32 -7
  84. data/{lib/active_admin → config}/locales/ru.yml +30 -8
  85. data/{lib/active_admin → config}/locales/sv-SE.yml +14 -6
  86. data/{lib/active_admin → config}/locales/tr.yml +15 -6
  87. data/config/locales/uk.yml +100 -0
  88. data/{lib/active_admin → config}/locales/vi.yml +15 -6
  89. data/{lib/active_admin → config}/locales/zh-CN.yml +15 -6
  90. data/{lib/active_admin → config}/locales/zh-TW.yml +15 -6
  91. data/docs/0-installation.md +22 -18
  92. data/docs/1-general-configuration.md +1 -1
  93. data/docs/10-custom-pages.md +3 -3
  94. data/docs/11-decorators.md +18 -2
  95. data/docs/12-arbre-components.md +53 -54
  96. data/docs/13-authorization-adapter.md +31 -10
  97. data/docs/2-resource-customization.md +16 -1
  98. data/docs/3-index-pages.md +13 -1
  99. data/docs/3-index-pages/create-an-index.md +4 -4
  100. data/docs/3-index-pages/index-as-block.md +1 -1
  101. data/docs/3-index-pages/index-as-blog.md +1 -1
  102. data/docs/3-index-pages/index-as-grid.md +1 -1
  103. data/docs/4-csv-format.md +4 -4
  104. data/docs/5-forms.md +46 -3
  105. data/docs/{6-show-screens.md → 6-show-pages.md} +3 -3
  106. data/docs/8-custom-actions.md +3 -3
  107. data/docs/9-batch-actions.md +9 -1
  108. data/features/action_item.feature +6 -6
  109. data/features/authorization_cancan.feature +1 -1
  110. data/features/belongs_to.feature +3 -3
  111. data/features/breadcrumb.feature +2 -2
  112. data/features/comments/commenting.feature +7 -5
  113. data/features/dashboard.feature +0 -51
  114. data/features/favicon.feature +20 -0
  115. data/features/global_navigation.feature +0 -1
  116. data/features/index/batch_actions.feature +12 -11
  117. data/features/index/filters.feature +6 -6
  118. data/features/index/format_as_csv.feature +4 -5
  119. data/features/index/index_as_blog.feature +20 -1
  120. data/features/index/index_as_table.feature +1 -1
  121. data/features/index/index_blank_slate.feature +3 -3
  122. data/features/index/index_parameters.feature +4 -10
  123. data/features/index/index_scope_to.feature +24 -0
  124. data/features/index/index_scopes.feature +17 -5
  125. data/features/index/pagination.feature +15 -0
  126. data/features/registering_pages.feature +1 -1
  127. data/features/registering_resources.feature +2 -2
  128. data/features/show/default_content.feature +3 -3
  129. data/features/sidebar_sections.feature +3 -3
  130. data/features/specifying_actions.feature +1 -1
  131. data/features/step_definitions/additional_web_steps.rb +3 -16
  132. data/features/step_definitions/asset_steps.rb +5 -1
  133. data/features/step_definitions/attribute_steps.rb +4 -4
  134. data/features/step_definitions/batch_action_steps.rb +25 -74
  135. data/features/step_definitions/breadcrumb_steps.rb +1 -3
  136. data/features/step_definitions/comment_steps.rb +0 -1
  137. data/features/step_definitions/configuration_steps.rb +53 -69
  138. data/features/step_definitions/dashboard_steps.rb +2 -2
  139. data/features/step_definitions/factory_steps.rb +17 -33
  140. data/features/step_definitions/filter_steps.rb +2 -2
  141. data/features/step_definitions/format_steps.rb +10 -14
  142. data/features/step_definitions/index_scope_steps.rb +9 -25
  143. data/features/step_definitions/index_views_steps.rb +1 -1
  144. data/features/step_definitions/sidebar_steps.rb +2 -1
  145. data/features/step_definitions/site_title_steps.rb +1 -1
  146. data/features/step_definitions/table_steps.rb +6 -1
  147. data/features/step_definitions/user_steps.rb +23 -38
  148. data/features/step_definitions/web_steps.rb +18 -147
  149. data/features/support/env.rb +13 -34
  150. data/features/support/paths.rb +2 -0
  151. data/features/users/logging_in.feature +2 -2
  152. data/features/users/logging_out.feature +0 -12
  153. data/features/users/resetting_password.feature +1 -1
  154. data/lib/active_admin.rb +4 -17
  155. data/lib/active_admin/abstract_view_factory.rb +1 -1
  156. data/lib/active_admin/application.rb +19 -28
  157. data/lib/active_admin/asset_registration.rb +7 -25
  158. data/lib/active_admin/authorization_adapter.rb +9 -5
  159. data/lib/active_admin/base_controller.rb +2 -2
  160. data/lib/active_admin/base_controller/authorization.rb +25 -27
  161. data/lib/active_admin/batch_actions/resource_extension.rb +3 -3
  162. data/lib/active_admin/batch_actions/views/batch_action_selector.rb +1 -1
  163. data/lib/active_admin/batch_actions/views/selection_cells.rb +1 -1
  164. data/lib/active_admin/callbacks.rb +1 -1
  165. data/lib/active_admin/cancan_adapter.rb +2 -2
  166. data/lib/active_admin/comments.rb +32 -38
  167. data/lib/active_admin/comments/comment.rb +6 -8
  168. data/lib/active_admin/comments/views.rb +0 -1
  169. data/lib/active_admin/comments/views/active_admin_comments.rb +27 -38
  170. data/lib/active_admin/csv_builder.rb +4 -6
  171. data/lib/active_admin/dependency_checker.rb +4 -0
  172. data/lib/active_admin/deprecation.rb +3 -3
  173. data/lib/active_admin/dsl.rb +5 -5
  174. data/lib/active_admin/engine.rb +1 -1
  175. data/lib/active_admin/filters.rb +2 -1
  176. data/lib/active_admin/filters/forms.rb +36 -43
  177. data/lib/active_admin/filters/formtastic_addons.rb +45 -0
  178. data/lib/active_admin/filters/resource_extension.rb +9 -1
  179. data/lib/active_admin/form_builder.rb +30 -19
  180. data/lib/active_admin/helpers/optional_display.rb +11 -13
  181. data/lib/active_admin/helpers/settings.rb +50 -8
  182. data/lib/active_admin/inputs/filter_base.rb +5 -18
  183. data/lib/active_admin/inputs/filter_base/search_method_select.rb +73 -0
  184. data/lib/active_admin/inputs/filter_boolean_input.rb +6 -14
  185. data/lib/active_admin/inputs/filter_check_boxes_input.rb +1 -1
  186. data/lib/active_admin/inputs/filter_numeric_input.rb +2 -47
  187. data/lib/active_admin/inputs/filter_select_input.rb +32 -10
  188. data/lib/active_admin/inputs/filter_string_input.rb +12 -14
  189. data/lib/active_admin/namespace.rb +8 -40
  190. data/lib/active_admin/page.rb +2 -2
  191. data/lib/active_admin/page_dsl.rb +1 -1
  192. data/lib/active_admin/reloader.rb +3 -3
  193. data/lib/active_admin/resource.rb +16 -23
  194. data/lib/active_admin/resource/belongs_to.rb +8 -5
  195. data/lib/active_admin/resource/menu.rb +10 -23
  196. data/lib/active_admin/resource/naming.rb +3 -3
  197. data/lib/active_admin/resource/page_presenters.rb +2 -2
  198. data/lib/active_admin/resource/routes.rb +74 -21
  199. data/lib/active_admin/resource/scope_to.rb +74 -0
  200. data/lib/active_admin/resource/scopes.rb +8 -4
  201. data/lib/active_admin/resource_collection.rb +20 -66
  202. data/lib/active_admin/resource_controller.rb +12 -16
  203. data/lib/active_admin/resource_controller/data_access.rb +19 -22
  204. data/lib/active_admin/resource_controller/resource_class_methods.rb +2 -2
  205. data/lib/active_admin/resource_controller/scoping.rb +4 -9
  206. data/lib/active_admin/resource_dsl.rb +5 -32
  207. data/lib/active_admin/router.rb +34 -47
  208. data/lib/active_admin/scope.rb +5 -3
  209. data/lib/active_admin/sidebar_section.rb +1 -1
  210. data/lib/active_admin/version.rb +1 -1
  211. data/lib/active_admin/view_factory.rb +1 -1
  212. data/lib/active_admin/view_helpers/auto_link_helper.rb +1 -1
  213. data/lib/active_admin/view_helpers/breadcrumb_helper.rb +8 -8
  214. data/lib/active_admin/view_helpers/display_helper.rb +15 -6
  215. data/lib/active_admin/view_helpers/download_format_links_helper.rb +2 -2
  216. data/lib/active_admin/view_helpers/form_helper.rb +6 -1
  217. data/lib/active_admin/view_helpers/icon_helper.rb +1 -1
  218. data/lib/active_admin/view_helpers/method_or_proc_helper.rb +5 -5
  219. data/lib/active_admin/view_helpers/title_helper.rb +1 -1
  220. data/lib/active_admin/views/components/action_list_popover.rb +6 -6
  221. data/lib/active_admin/views/components/attributes_table.rb +9 -12
  222. data/lib/active_admin/views/components/blank_slate.rb +4 -4
  223. data/lib/active_admin/views/components/columns.rb +1 -1
  224. data/lib/active_admin/views/components/index_list.rb +1 -1
  225. data/lib/active_admin/views/components/paginated_collection.rb +20 -12
  226. data/lib/active_admin/views/components/panel.rb +1 -1
  227. data/lib/active_admin/views/components/scopes.rb +2 -1
  228. data/lib/active_admin/views/components/sidebar_section.rb +1 -1
  229. data/lib/active_admin/views/components/status_tag.rb +1 -1
  230. data/lib/active_admin/views/header.rb +2 -2
  231. data/lib/active_admin/views/index_as_blog.rb +16 -3
  232. data/lib/active_admin/views/index_as_table.rb +2 -2
  233. data/lib/active_admin/views/pages/base.rb +8 -3
  234. data/lib/active_admin/views/pages/form.rb +2 -2
  235. data/lib/active_admin/views/pages/index.rb +19 -17
  236. data/lib/generators/active_admin/assets/templates/3.0/active_admin.js +1 -1
  237. data/lib/generators/active_admin/assets/templates/3.1/active_admin.css.scss +1 -13
  238. data/lib/generators/active_admin/devise/devise_generator.rb +22 -1
  239. data/lib/generators/active_admin/install/install_generator.rb +1 -5
  240. data/lib/generators/active_admin/install/templates/active_admin.rb.erb +40 -19
  241. data/lib/generators/active_admin/install/templates/admin_user.rb.erb +18 -18
  242. data/lib/generators/active_admin/install/templates/migrations/create_active_admin_comments.rb +19 -0
  243. data/lib/generators/active_admin/resource/resource_generator.rb +1 -1
  244. data/lib/generators/active_admin/resource/templates/admin.rb +1 -1
  245. data/script/use_rails +1 -1
  246. data/spec/integration/memory_spec.rb +3 -2
  247. data/spec/javascripts/coffeescripts/jquery.aa.checkbox-toggler-spec.js.coffee +4 -4
  248. data/spec/javascripts/coffeescripts/jquery.aa.popover-spec.js.coffee +1 -1
  249. data/spec/javascripts/coffeescripts/jquery.aa.table-checkbox-toggler-spec.js.coffee +2 -2
  250. data/spec/javascripts/compiled/jquery.aa.checkbox-toggler-spec.js +4 -4
  251. data/spec/javascripts/compiled/jquery.aa.popover-spec.js +1 -1
  252. data/spec/javascripts/compiled/jquery.aa.table-checkbox-toggler-spec.js +2 -2
  253. data/spec/spec_helper.rb +16 -6
  254. data/spec/spec_helper_without_rails.rb +2 -0
  255. data/spec/support/deferred_garbage_collection.rb +19 -0
  256. data/spec/support/jslint.yml +1 -1
  257. data/spec/support/rails_template.rb +29 -27
  258. data/spec/support/templates/admin/stores.rb +5 -1
  259. data/spec/unit/abstract_view_factory_spec.rb +1 -1
  260. data/spec/unit/action_builder_spec.rb +7 -7
  261. data/spec/unit/active_admin_spec.rb +0 -14
  262. data/spec/unit/application_spec.rb +16 -17
  263. data/spec/unit/asset_registration_spec.rb +21 -8
  264. data/spec/unit/authorization/authorization_adapter_spec.rb +3 -3
  265. data/spec/unit/authorization/controller_authorization_spec.rb +16 -24
  266. data/spec/unit/batch_actions/resource_spec.rb +11 -11
  267. data/spec/unit/belongs_to_spec.rb +1 -1
  268. data/spec/unit/cancan_adapter_spec.rb +11 -3
  269. data/spec/unit/comments_spec.rb +10 -28
  270. data/spec/unit/controller_filters_spec.rb +22 -24
  271. data/spec/unit/csv_builder_spec.rb +3 -3
  272. data/spec/unit/devise_spec.rb +10 -10
  273. data/spec/unit/filters/filter_form_builder_spec.rb +140 -45
  274. data/spec/unit/filters/resource_spec.rb +20 -19
  275. data/spec/unit/form_builder_spec.rb +122 -70
  276. data/spec/unit/menu_item_spec.rb +3 -3
  277. data/spec/unit/namespace/authorization_spec.rb +4 -8
  278. data/spec/unit/namespace/register_page_spec.rb +1 -1
  279. data/spec/unit/namespace/register_resource_spec.rb +12 -7
  280. data/spec/unit/namespace_spec.rb +4 -10
  281. data/spec/unit/page_spec.rb +1 -1
  282. data/spec/unit/resource/menu_spec.rb +1 -1
  283. data/spec/unit/resource/naming_spec.rb +9 -0
  284. data/spec/unit/resource/pagination_spec.rb +2 -2
  285. data/spec/unit/resource/routes_spec.rb +73 -0
  286. data/spec/unit/resource/scopes_spec.rb +1 -1
  287. data/spec/unit/resource_collection_spec.rb +95 -43
  288. data/spec/unit/resource_registration_spec.rb +3 -12
  289. data/spec/unit/resource_spec.rb +41 -48
  290. data/spec/unit/routing_spec.rb +10 -64
  291. data/spec/unit/scope_spec.rb +19 -0
  292. data/spec/unit/settings_spec.rb +88 -0
  293. data/spec/unit/view_factory_spec.rb +1 -0
  294. data/spec/unit/{breadcrumbs_spec.rb → view_helpers/breadcrumbs_spec.rb} +16 -7
  295. data/spec/unit/view_helpers/display_name_spec.rb +41 -0
  296. data/spec/unit/view_helpers/form_helper_spec.rb +36 -2
  297. data/spec/unit/views/components/attributes_table_spec.rb +17 -9
  298. data/spec/unit/views/components/batch_action_popover_spec.rb +4 -4
  299. data/spec/unit/views/components/index_list_spec.rb +2 -2
  300. data/spec/unit/views/components/paginated_collection_spec.rb +42 -0
  301. data/spec/unit/views/components/panel_spec.rb +8 -0
  302. data/spec/unit/views/components/site_title_spec.rb +2 -2
  303. data/spec/unit/views/components/table_for_spec.rb +4 -4
  304. data/spec/unit/views/pages/form_spec.rb +35 -0
  305. data/spec/unit/views/pages/layout_spec.rb +1 -1
  306. data/spec/unit/views/tabbed_navigation_spec.rb +10 -10
  307. data/tasks/parallel_tests.rake +1 -1
  308. data/tasks/test.rake +4 -1
  309. metadata +117 -106
  310. data/app/assets/stylesheets/active_admin/pages/_dashboard.scss +0 -5
  311. data/lib/active_admin/comments/views/active_admin_comment.rb +0 -0
  312. data/lib/active_admin/dashboards.rb +0 -68
  313. data/lib/active_admin/dashboards/dashboard_controller.rb +0 -50
  314. data/lib/active_admin/dashboards/section.rb +0 -34
  315. data/lib/active_admin/locales/bg.yml +0 -77
  316. data/lib/generators/active_admin/install/templates/migrations/1_create_admin_notes.rb +0 -17
  317. data/lib/generators/active_admin/install/templates/migrations/2_move_admin_notes_to_comments.rb +0 -26
  318. data/spec/unit/base_controller_spec.rb +0 -6
  319. data/spec/unit/dashboard_controller_spec.rb +0 -76
  320. data/spec/unit/dashboard_section_spec.rb +0 -56
  321. data/spec/unit/dashboards_spec.rb +0 -59
  322. data/spec/unit/display_name_spec.rb +0 -29
@@ -63,7 +63,13 @@ module ActiveAdmin
63
63
  build_batch_actions_selector
64
64
  build_scopes
65
65
  build_index_list
66
- end
66
+ end if any_table_tools?
67
+ end
68
+
69
+ def any_table_tools?
70
+ active_admin_config.batch_actions.any? ||
71
+ active_admin_config.scopes.any? ||
72
+ active_admin_config.page_presenters[:index].try(:size).try(:>, 1)
67
73
  end
68
74
 
69
75
  def build_batch_actions_selector
@@ -90,7 +96,7 @@ module ActiveAdmin
90
96
  active_admin_config.page_presenters[:index].each do |type, page_presenter|
91
97
  index_classes << find_index_renderer_class(page_presenter[:as])
92
98
  end
93
-
99
+
94
100
  index_list_renderer index_classes
95
101
  end
96
102
  end
@@ -110,17 +116,11 @@ module ActiveAdmin
110
116
 
111
117
  # Returns the actual class for renderering the main content on the index
112
118
  # page. To set this, use the :as option in the page_presenter block.
113
- def find_index_renderer_class(symbol_or_class)
114
- case symbol_or_class
115
- when Symbol
116
- ::ActiveAdmin::Views.const_get("IndexAs" + symbol_or_class.to_s.camelcase)
117
- when Class
118
- symbol_or_class
119
- else
120
- raise ArgumentError, "'as' requires a class or a symbol"
121
- end
119
+ def find_index_renderer_class(klass)
120
+ klass.is_a?(Class) ? klass :
121
+ ::ActiveAdmin::Views.const_get("IndexAs" + klass.to_s.camelcase)
122
122
  end
123
-
123
+
124
124
  def render_blank_slate
125
125
  blank_slate_content = I18n.t("active_admin.blank_slate.content", :resource_name => active_admin_config.plural_resource_label)
126
126
  if controller.action_methods.include?('new')
@@ -128,21 +128,23 @@ module ActiveAdmin
128
128
  end
129
129
  insert_tag(view_factory.blank_slate, blank_slate_content)
130
130
  end
131
-
131
+
132
132
  def render_empty_results
133
133
  empty_results_content = I18n.t("active_admin.pagination.empty", :model => active_admin_config.plural_resource_label)
134
134
  insert_tag(view_factory.blank_slate, empty_results_content)
135
135
  end
136
-
136
+
137
137
  def render_index
138
138
  renderer_class = find_index_renderer_class(config[:as])
139
139
  paginator = config[:paginator].nil? ? true : config[:paginator]
140
140
  download_links = config[:download_links].nil? ? active_admin_config.namespace.download_links : config[:download_links]
141
-
141
+ pagination_total = config[:pagination_total].nil? ? true : config[:pagination_total]
142
+
142
143
  paginated_collection(collection, :entry_name => active_admin_config.resource_label,
143
- :entries_name => active_admin_config.plural_resource_label,
144
+ :entries_name => active_admin_config.plural_resource_label(:count => collection_size),
144
145
  :download_links => download_links,
145
- :paginator => paginator) do
146
+ :paginator => paginator,
147
+ :pagination_total => pagination_total) do
146
148
  div :class => 'index_content' do
147
149
  insert_tag(renderer_class, config, collection)
148
150
  end
@@ -1 +1 @@
1
- (function(){window.AA={}}).call(this),function(){window.AA.CheckboxToggler=AA.CheckboxToggler=function(){function a(a,b){var c;this.options=a,this.container=b,c={},this.options=$.extend({},c,a),this._init(),this._bind()}return a.name="CheckboxToggler",a.prototype._init=function(){if(!this.container)throw new Error("Container element not found");this.$container=$(this.container);if(!this.$container.find(".toggle_all").length)throw new Error("'toggle all' checkbox not found");return this.toggle_all_checkbox=this.$container.find(".toggle_all"),this.checkboxes=this.$container.find(":checkbox").not(this.toggle_all_checkbox)},a.prototype._bind=function(){var a=this;return this.checkboxes.bind("change",function(b){return a._didChangeCheckbox(b.target)}),this.toggle_all_checkbox.bind("change",function(b){return a._didChangeToggleAllCheckbox()})},a.prototype._didChangeCheckbox=function(a){if(this.checkboxes.filter(":checked").length===this.checkboxes.length-1)return this._uncheckToggleAllCheckbox();if(this.checkboxes.filter(":checked").length===this.checkboxes.length)return this._checkToggleAllCheckbox()},a.prototype._didChangeToggleAllCheckbox=function(){return this.toggle_all_checkbox.attr("checked")==="checked"?this._checkAllCheckboxes():this._uncheckAllCheckboxes()},a.prototype._uncheckToggleAllCheckbox=function(){return this.toggle_all_checkbox.removeAttr("checked")},a.prototype._checkToggleAllCheckbox=function(){return this.toggle_all_checkbox.attr("checked","checked")},a.prototype._uncheckAllCheckboxes=function(){var a=this;return this.checkboxes.each(function(b,c){return $(c).removeAttr("checked"),a._didChangeCheckbox(c)})},a.prototype._checkAllCheckboxes=function(){var a=this;return this.checkboxes.each(function(b,c){return $(c).attr("checked","checked"),a._didChangeCheckbox(c)})},a}(),function(a){return a.widget.bridge("checkboxToggler",AA.CheckboxToggler)}(jQuery)}.call(this),function(){window.AA.DropdownMenu=AA.DropdownMenu=function(){function a(a,b){var c;return this.options=a,this.element=b,this.$element=$(this.element),c={fadeInDuration:20,fadeOutDuration:100,onClickActionItemCallback:null},this.options=$.extend({},c,a),this.$menuButton=this.$element.find(".dropdown_menu_button"),this.$menuList=this.$element.find(".dropdown_menu_list_wrapper"),this.isOpen=!1,this._buildMenuList(),this._bind(),this}return a.name="DropdownMenu",a.prototype.open=function(){return this.isOpen=!0,this.$menuList.fadeIn(this.options.fadeInDuration),this._positionMenuList(),this._positionNipple(),this},a.prototype.close=function(){return this.isOpen=!1,this.$menuList.fadeOut(this.options.fadeOutDuration),this},a.prototype.destroy=function(){return this.$element.unbind(),this.$element=null,this},a.prototype.isDisabled=function(){return this.$menuButton.hasClass("disabled")},a.prototype.disable=function(){return this.$menuButton.addClass("disabled")},a.prototype.enable=function(){return this.$menuButton.removeClass("disabled")},a.prototype.option=function(a,b){return $.isPlainObject(a)?this.options=$.extend(!0,this.options,a):a!=null?this.options[a]:this.options[a]=b},a.prototype._buildMenuList=function(){return this.$menuList.prepend('<div class="dropdown_menu_nipple"></div>'),this.$menuList.hide()},a.prototype._bind=function(){var a=this;return $("body").bind("click",function(){if(a.isOpen===!0)return a.close()}),this.$menuButton.bind("click",function(){return a.isDisabled()||(a.isOpen===!0?a.close():a.open()),!1})},a.prototype._positionMenuList=function(){var a,b,c;return a=this.$menuButton.offset().left+this.$menuButton.outerWidth()/2,b=this.$menuList.outerWidth()/2,c=a-b,this.$menuList.css("left",c)},a.prototype._positionNipple=function(){var a,b,c,d,e;return c=this.$menuList.outerWidth()/2,b=this.$menuButton.offset().top+this.$menuButton.outerHeight()+10,this.$menuList.css("top",b),a=this.$menuList.find(".dropdown_menu_nipple"),d=a.outerWidth()/2,e=c-d,a.css("left",e)},a}(),function(a){return a.widget.bridge("aaDropdownMenu",AA.DropdownMenu),a(function(){return a(".dropdown_menu").aaDropdownMenu()})}(jQuery)}.call(this),function(){window.AA.Popover=AA.Popover=function(){function a(a,b){var c;return this.options=a,this.element=b,this.$element=$(this.element),c={fadeInDuration:20,fadeOutDuration:100,autoOpen:!0,pageWrapperElement:"#wrapper",onClickActionItemCallback:null},this.options=$.extend({},c,a),this.$popover=null,this.isOpen=!1,$(this.$element.attr("href")).length>0?this.$popover=$(this.$element.attr("href")):this.$popover=this.$element.next(".popover"),this._buildPopover(),this._bind(),this}return a.name="Popover",a.prototype.open=function(){return this.isOpen=!0,this.$popover.fadeIn(this.options.fadeInDuration),this._positionPopover(),this._positionNipple(),this},a.prototype.close=function(){return this.isOpen=!1,this.$popover.fadeOut(this.options.fadeOutDuration),this},a.prototype.destroy=function(){return this.$element.removeData("popover"),this.$element.unbind(),this.$element=null,this},a.prototype.option=function(){},a.prototype._buildPopover=function(){return this.$popover.prepend('<div class="popover_nipple"></div>'),this.$popover.hide(),this.$popover.addClass("popover")},a.prototype._bind=function(){var a=this;$(this.options.pageWrapperElement).bind("click",function(b){if(a.isOpen===!0)return a.close()});if(this.options.autoOpen===!0)return this.$element.bind("click",function(){return a.isOpen===!0?a.close():a.open(),!1})},a.prototype._positionPopover=function(){var a,b,c;return a=this.$element.offset().left+this.$element.outerWidth()/2,b=this.$popover.outerWidth()/2,c=a-b,this.$popover.css("left",c)},a.prototype._positionNipple=function(){var a,b,c,d,e;return c=this.$popover.outerWidth()/2,b=this.$element.offset().top+this.$element.outerHeight()+10,this.$popover.css("top",b),a=this.$popover.find(".popover_nipple"),d=a.outerWidth()/2,e=c-d,a.css("left",e)},a}(),function(a){return a.widget.bridge("popover",AA.Popover)}(jQuery)}.call(this),function(){var a={}.hasOwnProperty,b=function(b,c){function e(){this.constructor=b}for(var d in c)a.call(c,d)&&(b[d]=c[d]);return e.prototype=c.prototype,b.prototype=new e,b.__super__=c.prototype,b};window.AA.TableCheckboxToggler=AA.TableCheckboxToggler=function(a){function c(){return c.__super__.constructor.apply(this,arguments)}return b(c,a),c.name="TableCheckboxToggler",c.prototype._init=function(){return c.__super__._init.apply(this,arguments)},c.prototype._bind=function(){var a=this;return c.__super__._bind.apply(this,arguments),this.$container.find("tbody").find("td").bind("click",function(b){if(b.target.type!=="checkbox")return a._didClickCell(b.target)})},c.prototype._didChangeCheckbox=function(a){var b;return c.__super__._didChangeCheckbox.apply(this,arguments),b=$(a).parents("tr"),a.checked?b.addClass("selected"):b.removeClass("selected")},c.prototype._didClickCell=function(a){return $(a).parent("tr").find(":checkbox").click()},c}(AA.CheckboxToggler),function(a){return a.widget.bridge("tableCheckboxToggler",AA.TableCheckboxToggler)}(jQuery)}.call(this),function(){$(function(){return $(".datepicker").datepicker({dateFormat:"yy-mm-dd"}),$(".clear_filters_btn").click(function(){return window.location.search="",!1}),$(".dropdown_button").popover()})}.call(this),function(){jQuery(function(a){a(document).delegate("#batch_actions_selector li a","click.rails",function(){return a("#batch_action").val(a(this).attr("data-action")),a("#collection_selection").submit()});if(a("#batch_actions_selector").length&&a(":checkbox.toggle_all").length)return a(".paginated_collection").find("table.index_table").length?a(".paginated_collection table").tableCheckboxToggler():a(".paginated_collection").checkboxToggler(),a(".paginated_collection").find(":checkbox").bind("change",function(){return a(".paginated_collection").find(":checkbox").filter(":checked").length>0?a("#batch_actions_selector").aaDropdownMenu("enable"):a("#batch_actions_selector").aaDropdownMenu("disable")})})}.call(this);
1
+ (function(){window.ActiveAdmin={},window.AA||(window.AA=window.ActiveAdmin)}).call(this),function(){window.ActiveAdmin.CheckboxToggler=ActiveAdmin.CheckboxToggler=function(){function t(t,e){var n;this.options=t,this.container=e,n={},this.options=$.extend({},n,t),this._init(),this._bind()}return t.prototype._init=function(){if(!this.container)throw new Error("Container element not found");if(this.$container=$(this.container),!this.$container.find(".toggle_all").length)throw new Error('"toggle all" checkbox not found');return this.toggle_all_checkbox=this.$container.find(".toggle_all"),this.checkboxes=this.$container.find(":checkbox").not(this.toggle_all_checkbox)},t.prototype._bind=function(){var t=this;return this.checkboxes.change(function(e){return t._didChangeCheckbox(e.target)}),this.toggle_all_checkbox.change(function(){return t._didChangeToggleAllCheckbox()})},t.prototype._didChangeCheckbox=function(){switch(this.checkboxes.filter(":checked").length){case this.checkboxes.length-1:return this.toggle_all_checkbox.prop({checked:null});case this.checkboxes.length:return this.toggle_all_checkbox.prop({checked:!0})}},t.prototype._didChangeToggleAllCheckbox=function(){var t,e=this;return t=this.toggle_all_checkbox.prop("checked")?!0:null,this.checkboxes.each(function(n,i){return $(i).prop({checked:t}),e._didChangeCheckbox(i)})},t}(),jQuery(function(t){return t.widget.bridge("checkboxToggler",ActiveAdmin.CheckboxToggler)})}.call(this),function(){window.ActiveAdmin.DropdownMenu=ActiveAdmin.DropdownMenu=function(){function t(t,e){var n;this.options=t,this.element=e,this.$element=$(this.element),n={fadeInDuration:20,fadeOutDuration:100,onClickActionItemCallback:null},this.options=$.extend({},n,t),this.$menuButton=this.$element.find(".dropdown_menu_button"),this.$menuList=this.$element.find(".dropdown_menu_list_wrapper"),this.isOpen=!1,this._buildMenuList(),this._bind()}return t.prototype.open=function(){return this.isOpen=!0,this.$menuList.fadeIn(this.options.fadeInDuration),this._positionMenuList(),this._positionNipple(),this},t.prototype.close=function(){return this.isOpen=!1,this.$menuList.fadeOut(this.options.fadeOutDuration),this},t.prototype.destroy=function(){return this.$element.unbind(),this.$element=null,this},t.prototype.isDisabled=function(){return this.$menuButton.hasClass("disabled")},t.prototype.disable=function(){return this.$menuButton.addClass("disabled")},t.prototype.enable=function(){return this.$menuButton.removeClass("disabled")},t.prototype.option=function(t,e){return $.isPlainObject(t)?this.options=$.extend(!0,this.options,t):null!=t?this.options[t]:this.options[t]=e},t.prototype._buildMenuList=function(){return this.$menuList.prepend('<div class="dropdown_menu_nipple"></div>'),this.$menuList.hide()},t.prototype._bind=function(){var t=this;return $("body").bind("click",function(){return t.isOpen===!0?t.close():void 0}),this.$menuButton.bind("click",function(){return t.isDisabled()||(t.isOpen===!0?t.close():t.open()),!1})},t.prototype._positionMenuList=function(){var t,e,n;return t=this.$menuButton.position().left+this.$menuButton.outerWidth()/2,e=this.$menuList.outerWidth()/2,n=t-e,this.$menuList.css("left",n)},t.prototype._positionNipple=function(){var t,e,n,i,o;return n=this.$menuList.outerWidth()/2,e=this.$menuButton.position().top+this.$menuButton.outerHeight()+10,this.$menuList.css("top",e),t=this.$menuList.find(".dropdown_menu_nipple"),i=t.outerWidth()/2,o=n-i,t.css("left",o)},t}(),function(t){return t.widget.bridge("aaDropdownMenu",ActiveAdmin.DropdownMenu),t(function(){return t(".dropdown_menu").aaDropdownMenu()})}(jQuery)}.call(this),function(){window.ActiveAdmin.Popover=ActiveAdmin.Popover=function(){function t(t,e){var n;this.options=t,this.element=e,this.$element=$(this.element),n={fadeInDuration:20,fadeOutDuration:100,autoOpen:!0,pageWrapperElement:"#wrapper",onClickActionItemCallback:null},this.options=$.extend({},n,t),this.$popover=null,this.isOpen=!1,this.$popover=$(this.$element.attr("href")).length>0?$(this.$element.attr("href")):this.$element.next(".popover"),this._buildPopover(),this._bind()}return t.prototype.open=function(){return this.isOpen=!0,this.$popover.fadeIn(this.options.fadeInDuration),this._positionPopover(),this._positionNipple(),this},t.prototype.close=function(){return this.isOpen=!1,this.$popover.fadeOut(this.options.fadeOutDuration),this},t.prototype.destroy=function(){return this.$element.removeData("popover"),this.$element.unbind(),this.$element=null,this},t.prototype.option=function(){},t.prototype._buildPopover=function(){return this.$popover.prepend('<div class="popover_nipple"></div>'),this.$popover.hide(),this.$popover.addClass("popover")},t.prototype._bind=function(){var t=this;return $(this.options.pageWrapperElement).bind("click",function(){return t.isOpen===!0?t.close():void 0}),this.options.autoOpen===!0?this.$element.bind("click",function(){return t.isOpen===!0?t.close():t.open(),!1}):void 0},t.prototype._positionPopover=function(){var t,e,n;return t=this.$element.offset().left+this.$element.outerWidth()/2,e=this.$popover.outerWidth()/2,n=t-e,this.$popover.css("left",n)},t.prototype._positionNipple=function(){var t,e,n,i,o;return n=this.$popover.outerWidth()/2,e=this.$element.offset().top+this.$element.outerHeight()+10,this.$popover.css("top",e),t=this.$popover.find(".popover_nipple"),i=t.outerWidth()/2,o=n-i,t.css("left",o)},t}(),function(t){return t.widget.bridge("popover",ActiveAdmin.Popover)}(jQuery)}.call(this),function(){var t,e={}.hasOwnProperty,n=function(t,n){function i(){this.constructor=t}for(var o in n)e.call(n,o)&&(t[o]=n[o]);return i.prototype=n.prototype,t.prototype=new i,t.__super__=n.prototype,t};window.ActiveAdmin.TableCheckboxToggler=ActiveAdmin.TableCheckboxToggler=function(e){function i(){return t=i.__super__.constructor.apply(this,arguments)}return n(i,e),i.prototype._init=function(){return i.__super__._init.apply(this,arguments)},i.prototype._bind=function(){var t=this;return i.__super__._bind.apply(this,arguments),this.$container.find("tbody td").click(function(e){return"checkbox"!==e.target.type?t._didClickCell(e.target):void 0})},i.prototype._didChangeCheckbox=function(t){var e;return i.__super__._didChangeCheckbox.apply(this,arguments),e=$(t).parents("tr"),t.checked?e.addClass("selected"):e.removeClass("selected")},i.prototype._didClickCell=function(t){return $(t).parent("tr").find(":checkbox").click()},i}(ActiveAdmin.CheckboxToggler),jQuery(function(t){return t.widget.bridge("tableCheckboxToggler",ActiveAdmin.TableCheckboxToggler)})}.call(this),function(){$(function(){return $(document).on("focus",".datepicker:not(.hasDatepicker)",function(){return $(this).datepicker({dateFormat:"yy-mm-dd"})}),$(".clear_filters_btn").click(function(){return window.location.search=""}),$(".dropdown_button").popover(),$(".filter_form").submit(function(){return $(this).find(":input").filter(function(){return""===this.value}).prop("disabled",!0)}),$(".filter_form_field.select_and_search select").change(function(){return $(this).siblings("input").prop({name:"q["+this.value+"]"})})})}.call(this),function(){jQuery(function(t){return t(document).delegate("#batch_actions_selector li a","click.rails",function(){return t("#batch_action").val(t(this).attr("data-action")),t("#collection_selection").submit()}),t("#batch_actions_selector").length&&t(":checkbox.toggle_all").length?(t(".paginated_collection table.index_table").length?t(".paginated_collection table.index_table").tableCheckboxToggler():t(".paginated_collection").checkboxToggler(),t(".paginated_collection").find(":checkbox").bind("change",function(){return t(".paginated_collection").find(":checkbox").filter(":checked").length>0?t("#batch_actions_selector").aaDropdownMenu("enable"):t("#batch_actions_selector").aaDropdownMenu("disable")})):void 0})}.call(this);
@@ -14,16 +14,4 @@
14
14
  // Overriding any non-variable SASS must be done after the fact.
15
15
  // For example, to change the default status-tag color:
16
16
  //
17
- // body.active_admin {
18
- // .status_tag { background: #6090DB; }
19
- // }
20
- //
21
- // Notice that Active Admin CSS rules are nested within a
22
- // 'body.active_admin' selector to prevent conflicts with
23
- // other pages in the app. It is best to wrap your changes in a
24
- // namespace so they are properly recognized. You have options
25
- // if you e.g. want different styles for different namespaces:
26
- //
27
- // .active_admin applies to any Active Admin namespace
28
- // .admin_namespace applies to the admin namespace (eg: /admin)
29
- // .other_namespace applies to a custom namespace named other (eg: /other)
17
+ // .status_tag { background: #6090DB; }
@@ -1,5 +1,8 @@
1
1
  module ActiveAdmin
2
2
  module Generators
3
+ class Error < Rails::Generators::Error
4
+ end
5
+
3
6
  class DeviseGenerator < Rails::Generators::NamedBase
4
7
  desc "Creates an admin user and uses Devise for authentication"
5
8
  argument :name, :type => :string, :default => "AdminUser"
@@ -7,6 +10,8 @@ module ActiveAdmin
7
10
  class_option :registerable, :type => :boolean, :default => false,
8
11
  :desc => "Should the generated resource be registerable?"
9
12
 
13
+ RESERVED_NAMES = [:active_admin_user]
14
+
10
15
  def install_devise
11
16
  require 'devise'
12
17
  if File.exists?(File.join(destination_root, "config", "initializers", "devise.rb"))
@@ -18,6 +23,9 @@ module ActiveAdmin
18
23
  end
19
24
 
20
25
  def create_admin_user
26
+ if RESERVED_NAMES.include?(name.underscore)
27
+ raise Error, "The name #{name} is reserved by Active Admin"
28
+ end
21
29
  invoke "devise", [name]
22
30
  end
23
31
 
@@ -28,6 +36,19 @@ module ActiveAdmin
28
36
  end
29
37
  end
30
38
 
39
+ # This fixes a bug in the 3.0.0 release of Devise. For more info:
40
+ # https://github.com/plataformatec/devise/issues/2515
41
+ def add_attr_accessible_if_missing
42
+ require 'devise/version'
43
+ if ::Devise::VERSION == '3.0.0'
44
+ if Rails::VERSION::MAJOR == 3 && !defined?(ActionController::StrongParameters)
45
+ model = File.join(destination_root, "app", "models", "#{file_path}.rb")
46
+ inject_into_file model, "\n attr_accessible :email, :password, :password_confirmation, :remember_me\n",
47
+ :before => /end\s*\z/
48
+ end
49
+ end
50
+ end
51
+
31
52
  def set_namespace_for_path
32
53
  routes_file = File.join(destination_root, "config", "routes.rb")
33
54
  gsub_file routes_file, /devise_for :#{plural_table_name}/, "devise_for :#{plural_table_name}, ActiveAdmin::Devise.config"
@@ -42,7 +63,7 @@ module ActiveAdmin
42
63
 
43
64
  if devise_migration_content["def change"]
44
65
  inject_into_file devise_migration_file,
45
- "def migrate(direction)\n super\n # Create a default user\n #{class_name}.create!(:email => 'admin@example.com', :password => 'password', :password_confirmation => 'password') if direction == :up\n end\n\n ",
66
+ "def migrate(direction)\n super\n # Create a default user\n #{class_name}.create!(:email => 'admin@example.com', :password => 'password', :password_confirmation => 'password') if direction == :up\n end\n\n ",
46
67
  :before => "def change"
47
68
  elsif devise_migration_content[/def (self.)?up/]
48
69
  inject_into_file devise_migration_file,
@@ -39,11 +39,7 @@ module ActiveAdmin
39
39
  end
40
40
 
41
41
  def create_migrations
42
- Dir["#{self.class.source_root}/migrations/*.rb"].sort.each do |filepath|
43
- name = File.basename(filepath)
44
- migration_template "migrations/#{name}", "db/migrate/#{name.gsub(/^\d+_/,'')}"
45
- sleep 1
46
- end
42
+ migration_template 'migrations/create_active_admin_comments.rb', 'db/migrate/create_active_admin_comments.rb'
47
43
  end
48
44
  end
49
45
  end
@@ -57,6 +57,23 @@ ActiveAdmin.setup do |config|
57
57
  # within the controller.
58
58
  config.authentication_method = :authenticate_<%= @underscored_user_name %>!
59
59
 
60
+ # == User Authorization
61
+ #
62
+ # Active Admin will automatically call an authorization
63
+ # method in a before filter of all controller actions to
64
+ # ensure that there is a user with proper rights. You can use
65
+ # CanCanAdapter or make your own. Please refer to documentation.
66
+ # config.authorization_adapter = ActiveAdmin::CanCanAdapter
67
+
68
+ # You can customize your CanCan Ability class name here.
69
+ # config.cancan_ability_class = "Ability"
70
+
71
+ # You can specify a method to be called on unauthorized access.
72
+ # This is necessary in order to prevent a redirect loop which happens
73
+ # because, by default, user gets redirected to Dashboard. If user
74
+ # doesn't have access to Dashboard, he'll end up in a redirect loop.
75
+ # Method provided here should be defined in application_controller.rb.
76
+ # config.on_unauthorized_access = :access_denied
60
77
 
61
78
  # == Current User
62
79
  #
@@ -86,6 +103,7 @@ ActiveAdmin.setup do |config|
86
103
  # Default:
87
104
  # config.logout_link_method = :get
88
105
 
106
+
89
107
  # == Root
90
108
  #
91
109
  # Set the action to call for the root path. You can set different
@@ -94,21 +112,19 @@ ActiveAdmin.setup do |config|
94
112
  # Default:
95
113
  # config.root_to = 'dashboard#index'
96
114
 
115
+
97
116
  # == Admin Comments
98
117
  #
99
- # Admin comments allow you to add comments to any model for admin use.
100
- # Admin comments are enabled by default.
118
+ # This allows your users to comment on any resource registered with Active Admin.
101
119
  #
102
- # Default:
103
- # config.allow_comments = true
120
+ # You can completely disable comments:
121
+ # config.allow_comments = false
104
122
  #
105
- # You can turn them on and off for any given namespace by using a
106
- # namespace config block.
123
+ # You can disable the menu item for the comments index page:
124
+ # config.show_comments_in_menu = false
107
125
  #
108
- # Eg:
109
- # config.namespace :without_comments do |without_comments|
110
- # without_comments.allow_comments = false
111
- # end
126
+ # You can change the name under which comments are registered:
127
+ # config.comments_registration_name = 'AdminComment'
112
128
 
113
129
 
114
130
  # == Batch Actions
@@ -124,6 +140,11 @@ ActiveAdmin.setup do |config|
124
140
  # Active Admin resources and pages from here.
125
141
  #
126
142
  # config.before_filter :do_something_awesome
143
+
144
+
145
+ # == Setting a Favicon
146
+ #
147
+ # config.favicon = '/assets/favicon.ico'
127
148
 
128
149
 
129
150
  # == Register Stylesheets & Javascripts
@@ -134,7 +155,7 @@ ActiveAdmin.setup do |config|
134
155
  #
135
156
  # To load a stylesheet:
136
157
  # config.register_stylesheet 'my_stylesheet.css'
137
-
158
+ #
138
159
  # You can provide an options hash for more control, which is passed along to stylesheet_link_tag():
139
160
  # config.register_stylesheet 'my_print_stylesheet.css', :media => :print
140
161
  #
@@ -144,19 +165,19 @@ ActiveAdmin.setup do |config|
144
165
 
145
166
  # == CSV options
146
167
  #
147
- # Set the CSV builder separator (default is ",")
148
- # config.csv_column_separator = ','
168
+ # Set the CSV builder separator
169
+ # config.csv_options = { :col_sep => ';' }
149
170
  #
150
- # Set the CSV builder options (default is {})
151
- # config.csv_options = {}
171
+ # Force the use of quotes
172
+ # config.csv_options = { :force_quotes => true }
152
173
 
153
174
 
154
175
  # == Menu System
155
176
  #
156
177
  # You can add a navigation menu to be used in your application, or configure a provided menu
157
- #
178
+ #
158
179
  # To change the default utility navigation to show a link to your website & a logout btn
159
- #
180
+ #
160
181
  # config.namespace :admin do |admin|
161
182
  # admin.build_menu :utility_navigation do |menu|
162
183
  # menu.add label: "My Great Website", url: "http://www.mygreatwebsite.com", html_options: { target: :blank }
@@ -172,6 +193,7 @@ ActiveAdmin.setup do |config|
172
193
  # end
173
194
  # end
174
195
 
196
+
175
197
  # == Download Links
176
198
  #
177
199
  # You can disable download links on resource listing pages,
@@ -200,11 +222,10 @@ ActiveAdmin.setup do |config|
200
222
 
201
223
  # == Filters
202
224
  #
203
- # By default the index screen includes a “Filters” sidebar on the right
225
+ # By default the index screen includes a “Filters” sidebar on the right
204
226
  # hand side with a filter for each attribute of the registered model.
205
227
  # You can enable or disable them for all resources here.
206
228
  #
207
229
  # config.filters = true
208
230
 
209
-
210
231
  end
@@ -1,20 +1,20 @@
1
- ActiveAdmin.register <%= @user_class %> do
2
- index do
3
- column :email
4
- column :current_sign_in_at
5
- column :last_sign_in_at
6
- column :sign_in_count
7
- default_actions
8
- end
1
+ ActiveAdmin.register <%= @user_class %> do
2
+ index do
3
+ column :email
4
+ column :current_sign_in_at
5
+ column :last_sign_in_at
6
+ column :sign_in_count
7
+ default_actions
8
+ end
9
9
 
10
- filter :email
10
+ filter :email
11
11
 
12
- form do |f|
13
- f.inputs "Admin Details" do
14
- f.input :email
15
- f.input :password
16
- f.input :password_confirmation
17
- end
18
- f.actions
19
- end
20
- end
12
+ form do |f|
13
+ f.inputs "Admin Details" do
14
+ f.input :email
15
+ f.input :password
16
+ f.input :password_confirmation
17
+ end
18
+ f.actions
19
+ end
20
+ end
@@ -0,0 +1,19 @@
1
+ class CreateActiveAdminComments < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :active_admin_comments do |t|
4
+ t.string :namespace
5
+ t.text :body
6
+ t.string :resource_id, :null => false
7
+ t.string :resource_type, :null => false
8
+ t.references :author, :polymorphic => true
9
+ t.timestamps
10
+ end
11
+ add_index :active_admin_comments, [:namespace]
12
+ add_index :active_admin_comments, [:author_type, :author_id]
13
+ add_index :active_admin_comments, [:resource_type, :resource_id]
14
+ end
15
+
16
+ def self.down
17
+ drop_table :active_admin_comments
18
+ end
19
+ end
@@ -8,7 +8,7 @@ module ActiveAdmin
8
8
  end
9
9
 
10
10
  def generate_config_file
11
- template "admin.rb", "app/admin/#{file_path.gsub('/', '_').pluralize}.rb"
11
+ template "admin.rb", "app/admin/#{file_path.gsub('/', '_')}.rb"
12
12
  end
13
13
 
14
14
  end
@@ -1,3 +1,3 @@
1
1
  ActiveAdmin.register <%= class_name %> do
2
-
2
+
3
3
  end
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  #
3
3
  # Switches the development environment to use the given
4
- # version of rails. Caches the Gemfile.locks so that
4
+ # version of rails. Caches the Gemfile.locks so that
5
5
  # switching it very fast.
6
6
  #
7
7
  require File.expand_path("../../spec/support/detect_rails_version", __FILE__)
@@ -11,13 +11,14 @@ describe "Memory Leak" do
11
11
 
12
12
  def self.it_should_not_leak(klass)
13
13
  it "should not leak #{klass}" do
14
+ previously_disabled = GC.enable # returns true if the garbage collector was disabled
14
15
  GC.start
15
-
16
16
  count = count_instances_of(klass)
17
17
 
18
18
  load_defaults!
19
- GC.start
20
19
 
20
+ GC.start
21
+ GC.disable if previously_disabled
21
22
  count_instances_of(klass).should <= count
22
23
  end
23
24
  end
@@ -1,4 +1,4 @@
1
- describe "AA.CheckboxToggler", ->
1
+ describe "ActiveAdmin.CheckboxToggler", ->
2
2
 
3
3
  beforeEach ->
4
4
  loadFixtures('checkboxes.html')
@@ -9,15 +9,15 @@ describe "AA.CheckboxToggler", ->
9
9
  @checkboxes = @collection.find(":checkbox").not(@toggle_all)
10
10
 
11
11
 
12
- new AA.CheckboxToggler({}, @collection)
12
+ new ActiveAdmin.CheckboxToggler({}, @collection)
13
13
 
14
14
  describe "on init", ->
15
15
  it "should raise an error if container not found", ->
16
- expect( => new AA.CheckboxToggler({}) ).toThrow("Container element not found")
16
+ expect( => new ActiveAdmin.CheckboxToggler({}) ).toThrow("Container element not found")
17
17
 
18
18
  it "should raise an error if 'toggle all' checkbox not found", ->
19
19
  @toggle_all.remove()
20
- expect( => new AA.CheckboxToggler({}, @collection); ).toThrow("'toggle all' checkbox not found")
20
+ expect( => new ActiveAdmin.CheckboxToggler({}, @collection); ).toThrow("'toggle all' checkbox not found")
21
21
 
22
22
  describe "'toggle all' checkbox", ->
23
23
  it "should check all checkboxes when checked", ->
@@ -1,4 +1,4 @@
1
- describe "AA.Popover", ->
1
+ describe "ActiveAdmin.Popover", ->
2
2
  $wrapper = undefined
3
3
  $button = undefined
4
4
  $popover = undefined
@@ -1,4 +1,4 @@
1
- describe "AA.TableCheckboxToggler", ->
1
+ describe "ActiveAdmin.TableCheckboxToggler", ->
2
2
 
3
3
  beforeEach ->
4
4
  loadFixtures('table_checkboxes.html');
@@ -8,7 +8,7 @@ describe "AA.TableCheckboxToggler", ->
8
8
 
9
9
  @checkboxes = @collection.find(":checkbox").not(@toggle_all)
10
10
 
11
- new AA.TableCheckboxToggler({}, @collection)
11
+ new ActiveAdmin.TableCheckboxToggler({}, @collection)
12
12
 
13
13
  describe "'selected' class for table row", ->
14
14
  it "should add the class 'selected' to rows when their checkbox is checked ", ->
@@ -1,25 +1,25 @@
1
1
  (function() {
2
2
 
3
- describe("AA.CheckboxToggler", function() {
3
+ describe("ActiveAdmin.CheckboxToggler", function() {
4
4
  beforeEach(function() {
5
5
  loadFixtures('checkboxes.html');
6
6
  this.collection = $("#collection");
7
7
  this.toggle_all = this.collection.find(".toggle_all");
8
8
  this.checkboxes = this.collection.find(":checkbox").not(this.toggle_all);
9
- return new AA.CheckboxToggler({}, this.collection);
9
+ return new ActiveAdmin.CheckboxToggler({}, this.collection);
10
10
  });
11
11
  describe("on init", function() {
12
12
  it("should raise an error if container not found", function() {
13
13
  var _this = this;
14
14
  return expect(function() {
15
- return new AA.CheckboxToggler({});
15
+ return new ActiveAdmin.CheckboxToggler({});
16
16
  }).toThrow("Container element not found");
17
17
  });
18
18
  return it("should raise an error if 'toggle all' checkbox not found", function() {
19
19
  var _this = this;
20
20
  this.toggle_all.remove();
21
21
  return expect(function() {
22
- return new AA.CheckboxToggler({}, _this.collection);
22
+ return new ActiveAdmin.CheckboxToggler({}, _this.collection);
23
23
  }).toThrow("'toggle all' checkbox not found");
24
24
  });
25
25
  });