saulolso-activeadmin 0.2.2

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 (255) hide show
  1. data/.document +5 -0
  2. data/.gitignore +32 -0
  3. data/.travis.yml +4 -0
  4. data/CHANGELOG.rdoc +76 -0
  5. data/Gemfile +26 -0
  6. data/LICENSE +25 -0
  7. data/README.rdoc +450 -0
  8. data/Rakefile +100 -0
  9. data/activeadmin.gemspec +28 -0
  10. data/cucumber.yml +2 -0
  11. data/features/comments/commenting.feature +99 -0
  12. data/features/comments/viewing_index.feature +19 -0
  13. data/features/dashboard.feature +26 -0
  14. data/features/edit_page.feature +77 -0
  15. data/features/first_boot.feature +16 -0
  16. data/features/global_navigation.feature +30 -0
  17. data/features/index/format_as_csv.feature +45 -0
  18. data/features/index/formats.feature +10 -0
  19. data/features/index/index_as_block.feature +15 -0
  20. data/features/index/index_as_blog.feature +50 -0
  21. data/features/index/index_as_grid.feature +45 -0
  22. data/features/index/index_as_table.feature +79 -0
  23. data/features/index/index_scopes.feature +52 -0
  24. data/features/index/pagination.feature +23 -0
  25. data/features/menu.feature +26 -0
  26. data/features/new_page.feature +75 -0
  27. data/features/registering_assets.feature +35 -0
  28. data/features/registering_resources.feature +33 -0
  29. data/features/show/default_content.feature +43 -0
  30. data/features/show/page_title.feature +33 -0
  31. data/features/sidebar_sections.feature +127 -0
  32. data/features/specifying_actions.feature +60 -0
  33. data/features/step_definitions/action_item_steps.rb +7 -0
  34. data/features/step_definitions/additional_web_steps.rb +67 -0
  35. data/features/step_definitions/asset_steps.rb +7 -0
  36. data/features/step_definitions/attribute_steps.rb +15 -0
  37. data/features/step_definitions/comment_steps.rb +8 -0
  38. data/features/step_definitions/configuration_steps.rb +31 -0
  39. data/features/step_definitions/dashboard_steps.rb +11 -0
  40. data/features/step_definitions/factory_steps.rb +28 -0
  41. data/features/step_definitions/flash_steps.rb +3 -0
  42. data/features/step_definitions/format_steps.rb +34 -0
  43. data/features/step_definitions/index_scope_steps.rb +20 -0
  44. data/features/step_definitions/menu_steps.rb +7 -0
  45. data/features/step_definitions/pagination_steps.rb +8 -0
  46. data/features/step_definitions/sidebar_steps.rb +11 -0
  47. data/features/step_definitions/tab_steps.rb +3 -0
  48. data/features/step_definitions/user_steps.rb +20 -0
  49. data/features/step_definitions/web_steps.rb +219 -0
  50. data/features/sti_resource.feature +49 -0
  51. data/features/support/env.rb +92 -0
  52. data/features/support/paths.rb +48 -0
  53. data/features/users/logging_in.feature +34 -0
  54. data/features/users/logging_out.feature +13 -0
  55. data/lib/active_admin/abstract_view_factory.rb +95 -0
  56. data/lib/active_admin/action_items.rb +37 -0
  57. data/lib/active_admin/application.rb +204 -0
  58. data/lib/active_admin/arbre/attributes.rb +20 -0
  59. data/lib/active_admin/arbre/class_list.rb +28 -0
  60. data/lib/active_admin/arbre/collection.rb +27 -0
  61. data/lib/active_admin/arbre/context.rb +8 -0
  62. data/lib/active_admin/arbre/core_extensions.rb +5 -0
  63. data/lib/active_admin/arbre/document.rb +42 -0
  64. data/lib/active_admin/arbre/element.rb +151 -0
  65. data/lib/active_admin/arbre/html.rb +84 -0
  66. data/lib/active_admin/arbre/html5_elements.rb +47 -0
  67. data/lib/active_admin/arbre/tag.rb +137 -0
  68. data/lib/active_admin/arbre/text_node.rb +35 -0
  69. data/lib/active_admin/arbre.rb +23 -0
  70. data/lib/active_admin/asset_registration.rb +34 -0
  71. data/lib/active_admin/callbacks.rb +87 -0
  72. data/lib/active_admin/comments/comment.rb +21 -0
  73. data/lib/active_admin/comments/configuration.rb +18 -0
  74. data/lib/active_admin/comments/namespace_helper.rb +14 -0
  75. data/lib/active_admin/comments/resource_helper.rb +17 -0
  76. data/lib/active_admin/comments/show_page_helper.rb +23 -0
  77. data/lib/active_admin/comments/views/active_admin_comment.rb +0 -0
  78. data/lib/active_admin/comments/views/active_admin_comments.rb +82 -0
  79. data/lib/active_admin/comments/views.rb +3 -0
  80. data/lib/active_admin/comments.rb +88 -0
  81. data/lib/active_admin/component.rb +22 -0
  82. data/lib/active_admin/controller_action.rb +12 -0
  83. data/lib/active_admin/csv_builder.rb +45 -0
  84. data/lib/active_admin/dashboards/dashboard_controller.rb +47 -0
  85. data/lib/active_admin/dashboards/section.rb +34 -0
  86. data/lib/active_admin/dashboards.rb +48 -0
  87. data/lib/active_admin/devise.rb +43 -0
  88. data/lib/active_admin/dsl.rb +215 -0
  89. data/lib/active_admin/event.rb +31 -0
  90. data/lib/active_admin/form_builder.rb +109 -0
  91. data/lib/active_admin/helpers/optional_display.rb +34 -0
  92. data/lib/active_admin/iconic/icons.rb +142 -0
  93. data/lib/active_admin/iconic.rb +51 -0
  94. data/lib/active_admin/locales/da.yml +26 -0
  95. data/lib/active_admin/locales/en.yml +34 -0
  96. data/lib/active_admin/locales/es.yml +34 -0
  97. data/lib/active_admin/locales/pt.yml +34 -0
  98. data/lib/active_admin/menu.rb +42 -0
  99. data/lib/active_admin/menu_item.rb +73 -0
  100. data/lib/active_admin/namespace.rb +198 -0
  101. data/lib/active_admin/page_config.rb +15 -0
  102. data/lib/active_admin/renderer.rb +87 -0
  103. data/lib/active_admin/resource/belongs_to.rb +31 -0
  104. data/lib/active_admin/resource.rb +229 -0
  105. data/lib/active_admin/resource_controller/action_builder.rb +21 -0
  106. data/lib/active_admin/resource_controller/actions.rb +79 -0
  107. data/lib/active_admin/resource_controller/callbacks.rb +47 -0
  108. data/lib/active_admin/resource_controller/collection.rb +144 -0
  109. data/lib/active_admin/resource_controller/filters.rb +58 -0
  110. data/lib/active_admin/resource_controller/form.rb +42 -0
  111. data/lib/active_admin/resource_controller/menu.rb +29 -0
  112. data/lib/active_admin/resource_controller/page_configurations.rb +53 -0
  113. data/lib/active_admin/resource_controller/scoping.rb +36 -0
  114. data/lib/active_admin/resource_controller/sidebars.rb +38 -0
  115. data/lib/active_admin/resource_controller.rb +119 -0
  116. data/lib/active_admin/router.rb +85 -0
  117. data/lib/active_admin/scope.rb +17 -0
  118. data/lib/active_admin/sidebar.rb +43 -0
  119. data/lib/active_admin/stylesheets/active_admin/_comments.scss +40 -0
  120. data/lib/active_admin/stylesheets/active_admin/_flash_messages.scss +13 -0
  121. data/lib/active_admin/stylesheets/active_admin/_forms.scss +168 -0
  122. data/lib/active_admin/stylesheets/active_admin/_header.scss +108 -0
  123. data/lib/active_admin/stylesheets/active_admin/_typography.scss +100 -0
  124. data/lib/active_admin/stylesheets/active_admin/mixins/_all.scss +8 -0
  125. data/lib/active_admin/stylesheets/active_admin/mixins/_buttons.scss +27 -0
  126. data/lib/active_admin/stylesheets/active_admin/mixins/_gradients.scss +21 -0
  127. data/lib/active_admin/stylesheets/active_admin/mixins/_icons.scss +20 -0
  128. data/lib/active_admin/stylesheets/active_admin/mixins/_reset.scss +165 -0
  129. data/lib/active_admin/stylesheets/active_admin/mixins/_rounded.scss +43 -0
  130. data/lib/active_admin/stylesheets/active_admin/mixins/_sections.scss +27 -0
  131. data/lib/active_admin/stylesheets/active_admin/mixins/_shadows.scss +21 -0
  132. data/lib/active_admin/stylesheets/active_admin/mixins/_variables.scss +12 -0
  133. data/lib/active_admin/stylesheets/active_admin.scss +429 -0
  134. data/lib/active_admin/version.rb +3 -0
  135. data/lib/active_admin/view_factory.rb +21 -0
  136. data/lib/active_admin/view_helpers/active_admin_application_helper.rb +12 -0
  137. data/lib/active_admin/view_helpers/assigns_with_indifferent_access_helper.rb +7 -0
  138. data/lib/active_admin/view_helpers/auto_link_helper.rb +42 -0
  139. data/lib/active_admin/view_helpers/breadcrumb_helper.rb +29 -0
  140. data/lib/active_admin/view_helpers/display_helper.rb +38 -0
  141. data/lib/active_admin/view_helpers/filter_form_helper.rb +185 -0
  142. data/lib/active_admin/view_helpers/form_helper.rb +12 -0
  143. data/lib/active_admin/view_helpers/icon_helper.rb +12 -0
  144. data/lib/active_admin/view_helpers/method_or_proc_helper.rb +26 -0
  145. data/lib/active_admin/view_helpers/renderer_helper.rb +29 -0
  146. data/lib/active_admin/view_helpers/sidebar_helper.rb +15 -0
  147. data/lib/active_admin/view_helpers/table_helper.rb +12 -0
  148. data/lib/active_admin/view_helpers/title_helper.rb +11 -0
  149. data/lib/active_admin/view_helpers/view_factory_helper.rb +11 -0
  150. data/lib/active_admin/view_helpers.rb +23 -0
  151. data/lib/active_admin/views/action_items.rb +17 -0
  152. data/lib/active_admin/views/components/attributes_table.rb +66 -0
  153. data/lib/active_admin/views/components/columns.rb +47 -0
  154. data/lib/active_admin/views/components/paginated_collection.rb +92 -0
  155. data/lib/active_admin/views/components/panel.rb +26 -0
  156. data/lib/active_admin/views/components/scopes.rb +70 -0
  157. data/lib/active_admin/views/components/sidebar_section.rb +30 -0
  158. data/lib/active_admin/views/components/status_tag.rb +55 -0
  159. data/lib/active_admin/views/components/table_for.rb +193 -0
  160. data/lib/active_admin/views/dashboard_section_renderer.rb +19 -0
  161. data/lib/active_admin/views/header_renderer.rb +37 -0
  162. data/lib/active_admin/views/index_as_block.rb +24 -0
  163. data/lib/active_admin/views/index_as_blog.rb +89 -0
  164. data/lib/active_admin/views/index_as_grid.rb +49 -0
  165. data/lib/active_admin/views/index_as_table.rb +75 -0
  166. data/lib/active_admin/views/pages/base.rb +144 -0
  167. data/lib/active_admin/views/pages/dashboard.rb +59 -0
  168. data/lib/active_admin/views/pages/edit.rb +27 -0
  169. data/lib/active_admin/views/pages/index.rb +66 -0
  170. data/lib/active_admin/views/pages/new.rb +27 -0
  171. data/lib/active_admin/views/pages/show.rb +56 -0
  172. data/lib/active_admin/views/tabs_renderer.rb +58 -0
  173. data/lib/active_admin/views/templates/active_admin/dashboard/index.html.arb +1 -0
  174. data/lib/active_admin/views/templates/active_admin/devise/mailer/reset_password_instructions.html.erb +8 -0
  175. data/lib/active_admin/views/templates/active_admin/devise/mailer/unlock_instructions.html.erb +7 -0
  176. data/lib/active_admin/views/templates/active_admin/devise/passwords/edit.html.erb +16 -0
  177. data/lib/active_admin/views/templates/active_admin/devise/passwords/new.html.erb +14 -0
  178. data/lib/active_admin/views/templates/active_admin/devise/sessions/new.html.erb +18 -0
  179. data/lib/active_admin/views/templates/active_admin/devise/shared/_links.erb +20 -0
  180. data/lib/active_admin/views/templates/active_admin/devise/unlocks/new.html.erb +12 -0
  181. data/lib/active_admin/views/templates/active_admin/resource/edit.html.arb +1 -0
  182. data/lib/active_admin/views/templates/active_admin/resource/index.csv.erb +20 -0
  183. data/lib/active_admin/views/templates/active_admin/resource/index.html.arb +1 -0
  184. data/lib/active_admin/views/templates/active_admin/resource/new.html.arb +1 -0
  185. data/lib/active_admin/views/templates/active_admin/resource/show.html.arb +1 -0
  186. data/lib/active_admin/views/templates/layouts/active_admin.html.erb +39 -0
  187. data/lib/active_admin/views/templates/layouts/active_admin_logged_out.html.erb +31 -0
  188. data/lib/active_admin/views.rb +8 -0
  189. data/lib/active_admin.rb +71 -0
  190. data/lib/activeadmin.rb +1 -0
  191. data/lib/generators/active_admin/devise/devise_generator.rb +49 -0
  192. data/lib/generators/active_admin/install/install_generator.rb +46 -0
  193. data/lib/generators/active_admin/install/templates/active_admin.js +51 -0
  194. data/lib/generators/active_admin/install/templates/active_admin.rb.erb +78 -0
  195. data/lib/generators/active_admin/install/templates/active_admin_vendor.js +382 -0
  196. data/lib/generators/active_admin/install/templates/dashboards.rb +38 -0
  197. data/lib/generators/active_admin/install/templates/images/admin_notes_icon.png +0 -0
  198. data/lib/generators/active_admin/install/templates/images/loading.gif +0 -0
  199. data/lib/generators/active_admin/install/templates/images/nested_menu_arrow.gif +0 -0
  200. data/lib/generators/active_admin/install/templates/images/nested_menu_arrow_dark.gif +0 -0
  201. data/lib/generators/active_admin/install/templates/images/orderable.png +0 -0
  202. data/lib/generators/active_admin/install/templates/migrations/1_create_admin_notes.rb +16 -0
  203. data/lib/generators/active_admin/install/templates/migrations/2_move_admin_notes_to_comments.rb +25 -0
  204. data/lib/generators/active_admin/resource/resource_generator.rb +16 -0
  205. data/lib/generators/active_admin/resource/templates/admin.rb +3 -0
  206. data/spec/integration/belongs_to_spec.rb +42 -0
  207. data/spec/spec_helper.rb +156 -0
  208. data/spec/support/integration_example_group.rb +33 -0
  209. data/spec/support/rails_template.rb +32 -0
  210. data/spec/support/rails_template_with_data.rb +32 -0
  211. data/spec/support/templates/cucumber.rb +24 -0
  212. data/spec/unit/abstract_view_factory_spec.rb +79 -0
  213. data/spec/unit/action_builder_spec.rb +88 -0
  214. data/spec/unit/action_items_spec.rb +27 -0
  215. data/spec/unit/application_spec.rb +67 -0
  216. data/spec/unit/arbre/html/element_finder_methods_spec.rb +54 -0
  217. data/spec/unit/arbre/html/element_spec.rb +224 -0
  218. data/spec/unit/arbre/html/tag_attributes_spec.rb +61 -0
  219. data/spec/unit/arbre/html/tag_spec.rb +63 -0
  220. data/spec/unit/arbre/html_spec.rb +210 -0
  221. data/spec/unit/asset_registration_spec.rb +37 -0
  222. data/spec/unit/auto_link_spec.rb +39 -0
  223. data/spec/unit/belongs_to_spec.rb +45 -0
  224. data/spec/unit/breadcrumbs_spec.rb +110 -0
  225. data/spec/unit/comments_spec.rb +57 -0
  226. data/spec/unit/component_spec.rb +18 -0
  227. data/spec/unit/components/attributes_table_spec.rb +100 -0
  228. data/spec/unit/components/columns_spec.rb +75 -0
  229. data/spec/unit/components/panel_spec.rb +31 -0
  230. data/spec/unit/components/sidebar_section_spec.rb +37 -0
  231. data/spec/unit/components/status_tag_spec.rb +81 -0
  232. data/spec/unit/components/table_for_spec.rb +130 -0
  233. data/spec/unit/controller_filters_spec.rb +27 -0
  234. data/spec/unit/csv_builder_spec.rb +83 -0
  235. data/spec/unit/dashboard_controller_spec.rb +26 -0
  236. data/spec/unit/dashboard_section_spec.rb +56 -0
  237. data/spec/unit/dashboards_spec.rb +59 -0
  238. data/spec/unit/display_name_spec.rb +29 -0
  239. data/spec/unit/event_spec.rb +41 -0
  240. data/spec/unit/filter_form_builder_spec.rb +179 -0
  241. data/spec/unit/form_builder_spec.rb +238 -0
  242. data/spec/unit/menu_item_spec.rb +143 -0
  243. data/spec/unit/menu_spec.rb +53 -0
  244. data/spec/unit/namespace_spec.rb +203 -0
  245. data/spec/unit/pretty_format_spec.rb +35 -0
  246. data/spec/unit/registration_spec.rb +76 -0
  247. data/spec/unit/renderer_spec.rb +108 -0
  248. data/spec/unit/resource_controller/collection_spec.rb +34 -0
  249. data/spec/unit/resource_controller_spec.rb +147 -0
  250. data/spec/unit/resource_spec.rb +290 -0
  251. data/spec/unit/routing_spec.rb +88 -0
  252. data/spec/unit/scope_spec.rb +31 -0
  253. data/spec/unit/tabs_renderer_spec.rb +85 -0
  254. data/spec/unit/view_factory_spec.rb +16 -0
  255. metadata +482 -0
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
data/.gitignore ADDED
@@ -0,0 +1,32 @@
1
+ ## MAC OS
2
+ .DS_Store
3
+
4
+ ## TEXTMATE
5
+ *.tmproj
6
+ tmtags
7
+
8
+ ## EMACS
9
+ *~
10
+ \#*
11
+ .\#*
12
+
13
+ ## VIM
14
+ *.swp
15
+
16
+ ## PROJECT::GENERAL
17
+ tags
18
+ coverage
19
+ rdoc
20
+ doc
21
+ .yardoc
22
+ pkg
23
+
24
+ ## PROJECT::SPECIFIC
25
+ .bundle
26
+ spec/rails
27
+ *.sqlite3-journal
28
+ Gemfile.lock
29
+ capybara*
30
+ viewcumber
31
+ test-rails-app
32
+ public
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ script: bundle exec rake
2
+ rvm:
3
+ - ree
4
+ - 1.9.2
data/CHANGELOG.rdoc ADDED
@@ -0,0 +1,76 @@
1
+ == 0.2.2 (2011-05-26)
2
+
3
+ 68 Commits by 13 Contributors
4
+
5
+ === Features & Enhancements
6
+
7
+ * Arbre includes self closing tags (#100)
8
+ * Controller class & action added to body as CSS classes (#99)
9
+ * HAML is not required by default (#92)
10
+ * Devise login now respects Devise.authentication_keys (#69)
11
+ * Active Admin no longer uses <tt>ActiveRecord::Base#search</tt> (#28)
12
+ * Resource's can now override the label in the menu (#48)
13
+ * Subdirectories are now loaded in the Active Admin load path
14
+
15
+ === Bug Fixes
16
+
17
+ * Sort order now includes table name (#38)
18
+ * Fixed table_for 'odd', 'even' row classes (#96)
19
+ * Fixed Devise installation if AdminUser already exists (#95)
20
+ * Fixed issues when ActiveAdmin.default_namespaces is false (#32)
21
+ * Added styles for missing HTML 5 inputs (#31)
22
+ * Fixed issue if adding empty Active Admin Comment (#21)
23
+ * Fixed layout issues in FF 4 (#22)
24
+ * Use Sass::Plugin.options[:css_location] instead of Rails.root (#55)
25
+
26
+ === Test Suite
27
+
28
+ * Update RSpec to latest & fix specs (Thanks Ben Marini & Jeremt Ruppel!) (#100)
29
+ * Added tests for STI models (#52)
30
+
31
+ === Contributors
32
+
33
+ * Ben Marini
34
+ * Bookis Smuin
35
+ * Caley Woods
36
+ * Doug Puchalski
37
+ * Federico Romero
38
+ * Greg Bell
39
+ * Ian MacLeod
40
+ * Jeremy Ruppel
41
+ * Jordan Sitkin
42
+ * Juha Suuraho
43
+ * Mathieu Martin
44
+ * Paul Annesley
45
+ * Philippe Creux
46
+
47
+ == 0.2.1 (2011-05-12)
48
+
49
+ === Bug Fixes
50
+ * Fixed issue with dashboard rendering a sidebar
51
+
52
+ == 0.2.0 (2011-05-12)
53
+
54
+ 0.2.0 is essentially an entire re-write of Active Admin. Here are some
55
+ of the highlights. 250 commits. Enough said.
56
+
57
+ === Features & Enhancements
58
+
59
+ * Full visual redesign
60
+ * Integrated Devise for authentication
61
+ * Brand new view and component layer called Arbre (Project coming soon)
62
+ * Added ActiveAdmin::Comments
63
+
64
+ === Bug Fixes
65
+
66
+ * Too many to list! Been in production for close to a year
67
+
68
+ == 0.1.1 (2010-09-15)
69
+
70
+ === Bug Fixes
71
+
72
+ * Fixed issues running on Ruby 1.9.2
73
+
74
+ == 0.1.0
75
+
76
+ * Initial release
data/Gemfile ADDED
@@ -0,0 +1,26 @@
1
+ source 'http://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ # Set the RAILS env variable to test with a specific version of rails
6
+ case ENV["RAILS"]
7
+ when /3.0.(\d)*/
8
+ gem 'rails', "= 3.0.#{$1}"
9
+ end
10
+
11
+ group :development, :test do
12
+ gem 'sqlite3-ruby', :require => 'sqlite3'
13
+ gem 'rake', '0.8.7', :require => false
14
+ gem 'haml', '~> 3.1.1', :require => false
15
+ end
16
+
17
+ group :test do
18
+ gem 'rspec', '~> 2.6.0'
19
+ gem 'rspec-rails', '~> 2.6.0'
20
+ gem 'capybara', '0.3.9'
21
+ gem 'cucumber', '0.9.2'
22
+ gem 'cucumber-rails', '0.3.2'
23
+ gem 'database_cleaner'
24
+ gem 'shoulda', '2.11.2', :require => nil
25
+ gem 'launchy'
26
+ end
data/LICENSE ADDED
@@ -0,0 +1,25 @@
1
+ Copyright (c) 2010 Greg Bell, VersaPay Corporation
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
+
22
+ Iconic Icons are designed by P.J. Onori and are shared under
23
+ the Creative Commons Attribution-Share Alike 3.0 license:
24
+ http://creativecommons.org/licenses/by-sa/3.0/us
25
+ http://somerandomdude.com/projects/iconic/
data/README.rdoc ADDED
@@ -0,0 +1,450 @@
1
+ = Active Admin
2
+
3
+ Active Admin is a framework for creating administration style interfaces. It
4
+ abstracts common business application patterns to make it simple for developers
5
+ to implement beautiful and elegant interfaces with very little effort.
6
+
7
+ http://travis-ci.org/gregbell/active_admin.png
8
+
9
+ == Goals
10
+
11
+ 1. Allow developers to quickly create gorgeous administration interfaces
12
+ <strong>(Not Just CRUD)</strong>
13
+ 2. Build a DSL for developers and an interface for businesses.
14
+ 3. Ensure that developers can easily customize every nook and cranny of the interface.
15
+ 4. Build common interfaces as shareable gems so that the entire community benefits.
16
+
17
+
18
+ == Getting Started
19
+
20
+ Active Admin is released as a Ruby Gem. The gem is to be installed within a Ruby
21
+ on Rails 3 application. To install, simply add the following to your Gemfile:
22
+
23
+ # Gemfile
24
+ gem 'activeadmin'
25
+
26
+ After updating your bundle, run the installer
27
+
28
+ $> rails generate active_admin:install
29
+
30
+ The installer creates an initializer used for configuring defaults used by Active Admin as well
31
+ as a new folder at <tt>app/admin</tt> to put all your admin configurations.
32
+
33
+ Migrate your db and start the server:
34
+
35
+ $> rake db:migrate
36
+ $> rails server
37
+
38
+ Visit http://localhost:3000/admin and log in using:
39
+
40
+ * *User*: admin@example.com
41
+ * *Password*: password
42
+
43
+ Voila! You're on your brand new Active Admin dashboard.
44
+
45
+ To register your first model, run:
46
+
47
+ $> rails generate active_admin:resource [MyModelName]
48
+
49
+ This creates a file at <tt>app/admin/my_model_names.rb</tt> for configuring the resource.
50
+ Refresh your web browser to see the interface.
51
+
52
+ To learn how to further configure your admin section, keep on reading!
53
+
54
+ == General Configuration
55
+
56
+ === Admin Users
57
+
58
+ By default Active Admin will include Devise and create a new model called
59
+ AdminUser. If you would like to use another name, you can pass it in to the
60
+ installer through the user option:
61
+
62
+ $> rails generate active_admin:install UserClassName
63
+
64
+ If you don't want the generator to create any user classes:
65
+
66
+ $> rails generate active_admin:install --skip-users
67
+
68
+ === Authentication
69
+
70
+ Active Admin requires two settings to authenticate and use the current user
71
+ within your application. Both are set in
72
+ <tt>config/initializers/active_admin.rb</tt>. By default they are setup for use
73
+ with Devise and a model named AdminUser. If you chose a different model name,
74
+ you will need to update these settings.
75
+
76
+ Set the method that controllers should call to authenticate the current user
77
+ with:
78
+
79
+ # config/initializers/active_admin.rb
80
+ config.authentication_method = :authenticate_admin_user!
81
+
82
+ Set the method to call within the view to access the current admin user
83
+
84
+ # config/initializers/active_admin.rb
85
+ config.current_user_method = :current_admin_user
86
+
87
+ Both of these settings can be set to false to turn off authentication.
88
+
89
+ # Turn off authentication all together
90
+ config.authentication_method = false
91
+ config.current_user_method = false
92
+
93
+ === Site Title
94
+
95
+ You can update the title used for the site in the initializer also. By default
96
+ it is set to the name of your Rails.application class name.
97
+
98
+ # config/initializers/active_admin.rb
99
+ config.site_title = "My Admin Site"
100
+
101
+ == Customize The Resource
102
+
103
+ === Rename the Resource
104
+
105
+ By default, any references to the resource (menu, routes, buttons, etc) in the
106
+ interface will use the name of the class. You can rename the resource by using
107
+ the <tt>:as</tt> option.
108
+
109
+ ActiveAdmin.register Post, :as => "Article"
110
+
111
+ The resource will then be available as /admin/articles
112
+
113
+ === Customize the Navigation
114
+
115
+ The resource will be displayed in the global navigation by default.
116
+
117
+ To disable the resource from being displayed in the global navigation:
118
+
119
+ ActiveAdmin.register Post do
120
+ menu false
121
+ end
122
+
123
+ To change the name of the label in the menu:
124
+
125
+ ActiveAdmin.register Post do
126
+ menu :label => "My Posts"
127
+ end
128
+
129
+ To add the menu as a child of another menu:
130
+
131
+ ActiveAdmin.register Post do
132
+ menu :parent => "Blog"
133
+ end
134
+
135
+ This will create the menu item if it doesn't exist yet.
136
+
137
+ == Customizing the Index Page
138
+
139
+ Filtering and listing resources is one of the most important tasks for
140
+ administering a web application. Active Admin provides many different tools for
141
+ you to build a compelling interface into your data for the admin staff.
142
+
143
+ Built in, Active Admin has the following index renderers:
144
+
145
+ * *Table*: A table drawn with each row being a resource
146
+ * *Grid*: A set of rows and columns each cell being a resource
147
+ * *Blocks*: A set of rows (not tabular) each row being a resource
148
+ * *Blog*: A title and body content, similar to a blog index
149
+
150
+ All index pages also support scopes, filters, pagination, action items, and
151
+ sidebar sections.
152
+
153
+ === Index as a Table
154
+
155
+ By default, the index page is a table with each of the models content columns and links to
156
+ show, edit and delete the object. There are many ways to customize what gets
157
+ displayed.
158
+
159
+ ==== Defining Columns
160
+
161
+ To display an attribute or a method on a resource, simply pass a symbol into the
162
+ column method:
163
+
164
+ index do
165
+ column :title
166
+ end
167
+
168
+ If the default title does not work for you, pass it as the first argument:
169
+
170
+ index do
171
+ column "My Custom Title", :title
172
+ end
173
+
174
+ Sometimes calling methods just isn't enough and you need to write some view
175
+ specific code. For example, say we wanted a colum called Title which holds a
176
+ link to the posts admin screen.
177
+
178
+ The column method accepts a block as an argument which will then be rendered
179
+ within the context of the view for each of the objects in the collection.
180
+
181
+ index do
182
+ column "Title" do |post|
183
+ link_to post.title, admin_post_path(post)
184
+ end
185
+ end
186
+
187
+ The block gets called once for each resource in the collection. The resource gets passed into
188
+ the block as an argument.
189
+
190
+
191
+ ==== Sorting
192
+
193
+ When a column is generated from an Active Record attribute, the table is
194
+ sortable by default. If you are creating a custom column, you may need to give
195
+ Active Admin a hint for how to sort the table.
196
+
197
+ If a column is defined using a block, you must pass the key to turn on sorting. The key
198
+ is the attribute which gets used to sort objects using Active Record.
199
+
200
+ index do
201
+ column "Title", :sortable => :title do |post|
202
+ link_to post.title, admin_post_path(post)
203
+ end
204
+ end
205
+
206
+ You can turn off sorting on any column by passing false:
207
+
208
+ index do
209
+ column :title, :sortable => false
210
+ end
211
+
212
+ ==== Showing and Hiding Columns
213
+
214
+ The entire index block is rendered within the context of the view, so you can
215
+ easily do things that show or hide columns based on the current context.
216
+
217
+ For example, if you were using CanCan:
218
+
219
+ index do
220
+ column :title, :sortable => false
221
+ if can? :manage, Post
222
+ column :some_secret_data
223
+ end
224
+ end
225
+
226
+ === Index as a Grid
227
+
228
+ Sometimes you want to display the index screen for a set of resources as a grid
229
+ (possibly a grid of thumbnail images). To do so, use the :grid option for the
230
+ index block.
231
+
232
+ index :as => :grid do |product|
233
+ link_to(image_tag(product.image_path), admin_products_path(product))
234
+ end
235
+
236
+ The block is rendered within a cell in the grid once for each resource in the
237
+ collection. The resource is passed into the block for you to use in the view.
238
+
239
+ You can customize the number of colums that are rendered using the columns
240
+ option:
241
+
242
+ index :as => :grid, :columns => 5 do |product|
243
+ link_to(image_tag(product.image_path), admin_products_path(product))
244
+ end
245
+
246
+
247
+ === Index as a Block
248
+
249
+ If you want to fully customize the display of your resources on the index
250
+ screen, Index as a Block allows you to render a block of content for each
251
+ resource.
252
+
253
+ index :as => :block do |product|
254
+ div :for => product do
255
+ h2 auto_link(product.title)
256
+ div do
257
+ simple_format product.description
258
+ end
259
+ end
260
+ end
261
+
262
+ === Index Filters
263
+
264
+ By default the index screen includes a "Filters" sidebar on the right hand side
265
+ with a filter for each attribute of the registered model. You can customize the
266
+ filters that are displayed as well as the type of widgets they use.
267
+
268
+ To display a filter for an attribute, use the filter method
269
+
270
+ ActiveAdmin.register Post do
271
+ filter :title
272
+ end
273
+
274
+ Out of the box, Active Admin supports the following filter types:
275
+
276
+ * *:string* - A search field
277
+ * *:date_range* - A start and end date field with calendar inputs
278
+ * *:numeric* - A drop down for selecting "Equal To", "Greater Than" or "Less
279
+ Than" and an input for a value.
280
+ * *:select* - A drop down which filters based on a selected item in a collection
281
+ or all.
282
+ * *:check_boxes* - A list of check boxes users can turn on and off to filter
283
+
284
+ By default, Active Admin will pick the most relevant filter based on the
285
+ attribute type. You can force the type by passing the :as option.
286
+
287
+ filter :author, :as => :check_boxes
288
+
289
+ The :check_boxes and :select types accept options for the collection. By default
290
+ it attempts to create a collection based on an association. But you can pass in
291
+ the collection as a proc to be called at render time.
292
+
293
+ # Will call available
294
+ filter :author, :as => :check_boxes, :collection => proc { Author.all }
295
+
296
+ You can change the filter label by passing a label option:
297
+
298
+ filter :author, :label => 'Author'
299
+
300
+ By default, Active Admin will try to use ActiveModel I18n to determine the label.
301
+
302
+ == Customizing the CSV format
303
+
304
+ Customizing the CSV format is as simple as customizing the index page.
305
+
306
+ csv do
307
+ column :name
308
+ column("Author") { |post| post.author.full_name }
309
+ end
310
+ >>>>>>> master
311
+
312
+ == Customizing the Form
313
+
314
+ Active Admin gives complete control over the output of the form by creating a thin DSL on top of
315
+ the fabulous DSL created by Formtastic (http://github.com/justinfrench/formtastic).
316
+
317
+ ActiveAdmin.register Post do
318
+
319
+ form do |f|
320
+ f.inputs "Details" do
321
+ f.input :title
322
+ f.input :published_at, :label => "Publish Post At"
323
+ f.input :category
324
+ end
325
+ f.inputs "Content" do
326
+ f.input :body
327
+ end
328
+ f.buttons
329
+ end
330
+
331
+ end
332
+
333
+ Please view the documentation for Formtastic to see all the wonderful things you can do:
334
+ http://github.com/justinfrench/formtastic
335
+
336
+
337
+ == Customizing the Show Screen
338
+
339
+ Customizing the show screen is as simple as implementing the show block:
340
+
341
+ ActiveAdmin.register Post do
342
+ show do
343
+ h3 post.title
344
+ div do
345
+ simple_format post.body
346
+ end
347
+ end
348
+ end
349
+
350
+ The show block is rendered within the context of the view and uses the Arbre HTML DSL. You
351
+ can also render a partial at any point.
352
+
353
+ ActiveAdmin.register Post do
354
+ show do
355
+ # renders app/views/admin/posts/_some_partial.html.erb
356
+ render "some_partial"
357
+ end
358
+ end
359
+
360
+
361
+ == Sidebar Sections
362
+
363
+ To add a sidebar section to all the screen within a section, use the sidebar method:
364
+
365
+ sidebar :help do
366
+ "Need help? Email us at help@example.com"
367
+ end
368
+
369
+ This will generate a sidebar section on each screen of the resource. With the block as
370
+ the contents of the section. The first argument is the section title.
371
+
372
+ You can also use Arbre syntax to define the content.
373
+
374
+ sidebar :help do
375
+ ul do
376
+ li "Second List First Item"
377
+ li "Second List Second Item"
378
+ end
379
+ end
380
+
381
+ Sidebar sections can be rendered on a specific action by using the :only or :except
382
+ options.
383
+
384
+ sidebar :help, :only => :index do
385
+ "Need help? Email us at help@example.com"
386
+ end
387
+
388
+ If you only pass a symbol, Active Admin will attempt to locate a partial to render.
389
+
390
+ # Will render app/views/admin/posts/_help_sidebar.html.erb
391
+ sidebar :help
392
+
393
+ Or you can pass your own custom partial to render.
394
+
395
+ sidebar :help, :partial => "custom_help_partial"
396
+
397
+ == Internationalization (I18n)
398
+
399
+ To internationalize Active Admin or to change default strings, you can copy
400
+ lib/active_admin/locales/en.yml to your application config/locales directory and
401
+ change its content. You can contribute to the project with your translations to!
402
+
403
+ == Tools Being Used
404
+
405
+ We believe strongly in not writing code unless we have to, so Active Admin is built using many
406
+ other open source projects:
407
+
408
+ InheritedResources::
409
+ Inherited Resources speeds up development by making your controllers inherit all restful
410
+ actions so you just have to focus on what is important.
411
+ InheritedViews::
412
+ Inherited Views is a thin addition to Inherited Resources which adds in html views to the mix
413
+ Formtastic::
414
+ A DSL for semantically building amazing forms.
415
+ Devise::
416
+ User authentication is done using Devise
417
+ Kaminari::
418
+ Pagination for rails apps
419
+ Iconic Icons::
420
+ Excellent SVG icon set designed by P.J. Onori: http://somerandomdude.com/projects/iconic
421
+
422
+
423
+ == Contributors
424
+
425
+ * Greg Bell http://github.com/gregbell
426
+ * Philippe Creux http://github.com/pcreux
427
+ * Sam Vincent http://github.com/samvincent
428
+ * Matt Vague http://github.com/mattvague
429
+ * Dan Kubb http://github.com/dkubb
430
+ * Sam Reh http://github.com/samuelreh
431
+
432
+
433
+ == Roadmap & Issue Tracking
434
+
435
+ We are using the awesome Github issues!
436
+
437
+ == Note on Patches/Pull Requests
438
+
439
+ * Fork the project.
440
+ * Make your feature addition or bug fix on a new topic branch
441
+ * Add specs and cukes for it. This is important so I don't break it in a
442
+ future version unintentionally.
443
+ * Commit, do not mess with rakefile, version, or history.
444
+ (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
445
+ * Send me a pull request.
446
+
447
+ == Copyright
448
+
449
+ Copyright (c) 2010 Greg Bell, VersaPay Corporation. See LICENSE for details.
450
+