andrewroth_activeadmin 0.3.4 → 0.3.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (201) hide show
  1. data/CHANGELOG.md +159 -3
  2. data/CONTRIBUTING.md +113 -0
  3. data/LICENSE +1 -1
  4. data/README.rdoc +19 -20
  5. data/activeadmin.gemspec +3 -1
  6. data/app/assets/javascripts/active_admin/application.js +9 -0
  7. data/app/assets/javascripts/active_admin/base.js +4 -12
  8. data/app/assets/stylesheets/active_admin/_base.css.scss +16 -340
  9. data/app/assets/stylesheets/active_admin/_forms.css.scss +13 -7
  10. data/app/assets/stylesheets/active_admin/_header.css.scss +23 -4
  11. data/app/assets/stylesheets/active_admin/components/_blank_slates.scss +31 -0
  12. data/app/assets/stylesheets/active_admin/components/_breadcrumbs.scss +20 -0
  13. data/app/assets/stylesheets/active_admin/components/_buttons.scss +12 -0
  14. data/app/assets/stylesheets/active_admin/components/_flash_messages.css.scss +2 -0
  15. data/app/assets/stylesheets/active_admin/components/_grid.scss +9 -0
  16. data/app/assets/stylesheets/active_admin/components/_links.scss +5 -0
  17. data/app/assets/stylesheets/active_admin/components/_pagination.scss +34 -0
  18. data/app/assets/stylesheets/active_admin/components/_panels.scss +6 -0
  19. data/app/assets/stylesheets/active_admin/components/_scopes.scss +10 -0
  20. data/app/assets/stylesheets/active_admin/components/_status_tags.scss +12 -0
  21. data/app/assets/stylesheets/active_admin/components/_table_tools.css.scss +101 -0
  22. data/app/assets/stylesheets/active_admin/mixins/_all.css.scss +2 -1
  23. data/app/assets/stylesheets/active_admin/mixins/_buttons.css.scss +50 -13
  24. data/app/assets/stylesheets/active_admin/mixins/_gradients.css.scss +9 -1
  25. data/app/assets/stylesheets/active_admin/mixins/_sections.css.scss +7 -5
  26. data/app/assets/stylesheets/active_admin/mixins/_shadows.css.scss +1 -0
  27. data/app/assets/stylesheets/active_admin/mixins/_typography.scss +3 -0
  28. data/app/assets/stylesheets/active_admin/mixins/_variables.css.scss +1 -0
  29. data/app/assets/stylesheets/active_admin/pages/_dashboard.scss +5 -0
  30. data/app/assets/stylesheets/active_admin/pages/_logged_out.scss +44 -0
  31. data/app/assets/stylesheets/active_admin/structure/_footer.scss +14 -0
  32. data/app/assets/stylesheets/active_admin/structure/_main_structure.scss +26 -0
  33. data/app/assets/stylesheets/active_admin/structure/_title_bar.scss +44 -0
  34. data/app/views/active_admin/devise/passwords/edit.html.erb +1 -1
  35. data/app/views/active_admin/devise/passwords/new.html.erb +1 -1
  36. data/app/views/active_admin/devise/sessions/new.html.erb +1 -1
  37. data/app/views/active_admin/devise/shared/_links.erb +1 -1
  38. data/app/views/active_admin/devise/unlocks/new.html.erb +1 -1
  39. data/app/views/active_admin/page/index.html.arb +1 -0
  40. data/app/views/layouts/active_admin_logged_out.html.erb +2 -2
  41. data/cucumber.yml +3 -2
  42. data/docs/1-general-configuration.md +46 -10
  43. data/docs/6-show-screens.md +7 -0
  44. data/docs/8-custom-actions.md +12 -2
  45. data/docs/9-custom-pages.md +84 -0
  46. data/features/belongs_to.feature +27 -0
  47. data/features/comments/commenting.feature +3 -2
  48. data/features/dashboard.feature +18 -0
  49. data/features/development_reloading.feature +19 -0
  50. data/features/index/filter_with_check_boxes.feature +25 -0
  51. data/features/index/index_as_table.feature +14 -0
  52. data/features/index/index_scopes.feature +42 -0
  53. data/features/index/pagination.feature +19 -1
  54. data/features/menu.feature +22 -2
  55. data/features/registering_assets.feature +2 -2
  56. data/features/registering_pages.feature +66 -0
  57. data/features/specifying_actions.feature +5 -0
  58. data/features/step_definitions/action_item_steps.rb +2 -6
  59. data/features/step_definitions/action_link_steps.rb +7 -0
  60. data/features/step_definitions/additional_web_steps.rb +8 -0
  61. data/features/step_definitions/asset_steps.rb +5 -1
  62. data/features/step_definitions/breadcrumb_steps.rb +5 -0
  63. data/features/step_definitions/configuration_steps.rb +56 -8
  64. data/features/step_definitions/dashboard_steps.rb +5 -1
  65. data/features/step_definitions/factory_steps.rb +9 -2
  66. data/features/step_definitions/flash_steps.rb +9 -1
  67. data/features/step_definitions/index_scope_steps.rb +16 -4
  68. data/features/step_definitions/member_link_steps.rb +7 -0
  69. data/features/step_definitions/site_title_steps.rb +15 -0
  70. data/features/support/paths.rb +6 -0
  71. data/features/users/logging_out.feature +11 -0
  72. data/lib/active_admin.rb +25 -10
  73. data/lib/active_admin/application.rb +63 -20
  74. data/lib/active_admin/arbre/html/element.rb +10 -0
  75. data/lib/active_admin/asset_registration.rb +15 -2
  76. data/lib/active_admin/base_controller.rb +61 -0
  77. data/lib/active_admin/{resource_controller → base_controller}/menu.rb +1 -1
  78. data/lib/active_admin/comments.rb +48 -54
  79. data/lib/active_admin/comments/comment.rb +13 -2
  80. data/lib/active_admin/comments/namespace_helper.rb +1 -1
  81. data/lib/active_admin/comments/views/active_admin_comments.rb +7 -3
  82. data/lib/active_admin/dashboards.rb +4 -0
  83. data/lib/active_admin/dashboards/dashboard_controller.rb +20 -4
  84. data/lib/active_admin/dsl.rb +6 -159
  85. data/lib/active_admin/event.rb +5 -3
  86. data/lib/active_admin/filter_form_builder.rb +53 -0
  87. data/lib/active_admin/form_builder.rb +25 -19
  88. data/lib/active_admin/inputs.rb +14 -0
  89. data/lib/active_admin/inputs/datepicker_input.rb +11 -0
  90. data/lib/active_admin/inputs/filter_base.rb +46 -0
  91. data/lib/active_admin/inputs/filter_check_boxes_input.rb +40 -0
  92. data/lib/active_admin/inputs/filter_date_range_input.rb +34 -0
  93. data/lib/active_admin/inputs/filter_numeric_input.rb +55 -0
  94. data/lib/active_admin/inputs/filter_select_input.rb +23 -0
  95. data/lib/active_admin/inputs/filter_string_input.rb +22 -0
  96. data/lib/active_admin/locales/ca.yml +44 -0
  97. data/lib/active_admin/locales/cs.yml +14 -10
  98. data/lib/active_admin/locales/de.yml +43 -0
  99. data/lib/active_admin/locales/en.yml +5 -0
  100. data/lib/active_admin/locales/hr.yml +40 -0
  101. data/lib/active_admin/locales/ko.yml +40 -0
  102. data/lib/active_admin/locales/lv.yml +43 -0
  103. data/lib/active_admin/locales/nl.yml +40 -0
  104. data/lib/active_admin/locales/no-NB.yml +40 -0
  105. data/lib/active_admin/locales/pl.yml +7 -1
  106. data/lib/active_admin/locales/pt-BR.yml +6 -2
  107. data/lib/active_admin/namespace.rb +48 -33
  108. data/lib/active_admin/page.rb +54 -0
  109. data/lib/active_admin/page_controller.rb +15 -0
  110. data/lib/active_admin/page_dsl.rb +21 -0
  111. data/lib/active_admin/page_presenter.rb +30 -0
  112. data/lib/active_admin/resource.rb +38 -44
  113. data/lib/active_admin/resource/action_items.rb +5 -0
  114. data/lib/active_admin/resource/belongs_to.rb +4 -2
  115. data/lib/active_admin/resource/controllers.rb +35 -0
  116. data/lib/active_admin/resource/menu.rb +1 -2
  117. data/lib/active_admin/resource/naming.rb +43 -31
  118. data/lib/active_admin/resource/page_presenters.rb +28 -0
  119. data/lib/active_admin/resource/scopes.rb +16 -3
  120. data/lib/active_admin/resource/sidebars.rb +4 -0
  121. data/lib/active_admin/resource_collection.rb +88 -0
  122. data/lib/active_admin/resource_controller.rb +18 -54
  123. data/lib/active_admin/resource_controller/action_builder.rb +1 -1
  124. data/lib/active_admin/resource_controller/actions.rb +1 -1
  125. data/lib/active_admin/resource_controller/callbacks.rb +1 -1
  126. data/lib/active_admin/resource_controller/collection.rb +8 -4
  127. data/lib/active_admin/resource_controller/filters.rb +1 -1
  128. data/lib/active_admin/resource_controller/resource_class_methods.rb +24 -0
  129. data/lib/active_admin/resource_controller/scoping.rb +1 -1
  130. data/lib/active_admin/resource_controller/sidebars.rb +1 -1
  131. data/lib/active_admin/resource_dsl.rb +157 -0
  132. data/lib/active_admin/router.rb +21 -14
  133. data/lib/active_admin/scope.rb +15 -3
  134. data/lib/active_admin/version.rb +1 -1
  135. data/lib/active_admin/view_factory.rb +4 -3
  136. data/lib/active_admin/view_helpers/auto_link_helper.rb +1 -10
  137. data/lib/active_admin/view_helpers/breadcrumb_helper.rb +25 -21
  138. data/lib/active_admin/view_helpers/filter_form_helper.rb +0 -150
  139. data/lib/active_admin/views/components/attributes_table.rb +1 -1
  140. data/lib/active_admin/views/components/paginated_collection.rb +42 -13
  141. data/lib/active_admin/views/components/scopes.rb +17 -17
  142. data/lib/active_admin/views/components/status_tag.rb +6 -5
  143. data/lib/active_admin/views/components/table_for.rb +6 -2
  144. data/lib/active_admin/views/header_renderer.rb +31 -12
  145. data/lib/active_admin/views/index_as_block.rb +2 -2
  146. data/lib/active_admin/views/index_as_blog.rb +3 -3
  147. data/lib/active_admin/views/index_as_grid.rb +4 -4
  148. data/lib/active_admin/views/index_as_table.rb +13 -6
  149. data/lib/active_admin/views/pages/base.rb +4 -4
  150. data/lib/active_admin/views/pages/form.rb +49 -0
  151. data/lib/active_admin/views/pages/index.rb +18 -6
  152. data/lib/active_admin/views/pages/page.rb +24 -0
  153. data/lib/active_admin/views/pages/show.rb +1 -1
  154. data/lib/generators/active_admin/assets/assets_generator.rb +19 -1
  155. data/lib/generators/active_admin/install/templates/active_admin.rb.erb +38 -12
  156. data/lib/generators/active_admin/install/templates/dashboards.rb +6 -0
  157. data/spec/spec_helper.rb +4 -0
  158. data/spec/support/rails_template.rb +11 -0
  159. data/spec/support/templates/cucumber_with_reloading.rb +5 -0
  160. data/spec/unit/active_admin_spec.rb +8 -0
  161. data/spec/unit/application_spec.rb +48 -2
  162. data/spec/unit/arbre/html/element_finder_methods_spec.rb +58 -2
  163. data/spec/unit/asset_registration_spec.rb +9 -3
  164. data/spec/unit/auto_link_spec.rb +2 -2
  165. data/spec/unit/base_controller_shared_examples.rb +28 -0
  166. data/spec/unit/base_controller_spec.rb +8 -0
  167. data/spec/unit/belongs_to_spec.rb +30 -33
  168. data/spec/unit/comments_spec.rb +45 -15
  169. data/spec/unit/config_shared_examples.rb +108 -0
  170. data/spec/unit/dashboard_controller_spec.rb +44 -0
  171. data/spec/unit/event_spec.rb +6 -0
  172. data/spec/unit/filter_form_builder_spec.rb +9 -0
  173. data/spec/unit/form_builder_spec.rb +8 -14
  174. data/spec/unit/namespace/register_page_spec.rb +102 -0
  175. data/spec/unit/namespace/register_resource_spec.rb +188 -0
  176. data/spec/unit/namespace_spec.rb +11 -183
  177. data/spec/unit/page_controller_spec.rb +8 -0
  178. data/spec/unit/page_spec.rb +60 -0
  179. data/spec/unit/resource/menu_spec.rb +1 -51
  180. data/spec/unit/resource/naming_spec.rb +24 -19
  181. data/spec/unit/resource/page_presenters_spec.rb +32 -0
  182. data/spec/unit/resource/scopes_spec.rb +13 -0
  183. data/spec/unit/resource_collection_spec.rb +101 -0
  184. data/spec/unit/resource_controller_spec.rb +40 -32
  185. data/spec/unit/{registration_spec.rb → resource_registration_spec.rb} +0 -0
  186. data/spec/unit/resource_spec.rb +8 -24
  187. data/spec/unit/routing_spec.rb +50 -1
  188. data/spec/unit/scope_spec.rb +18 -4
  189. data/spec/unit/views/components/paginated_collection_spec.rb +150 -0
  190. data/spec/unit/views/components/status_tag_spec.rb +9 -0
  191. data/tasks/test.rake +43 -27
  192. metadata +140 -31
  193. data/app/assets/javascripts/active_admin/vendor.js +0 -382
  194. data/lib/active_admin/comments/configuration.rb +0 -18
  195. data/lib/active_admin/page_config.rb +0 -15
  196. data/lib/active_admin/resource_controller/form.rb +0 -42
  197. data/lib/active_admin/resource_controller/page_configurations.rb +0 -53
  198. data/lib/active_admin/views/pages/edit.rb +0 -28
  199. data/lib/active_admin/views/pages/new.rb +0 -28
  200. data/lib/generators/active_admin/assets/templates/3.0/active_admin.js +0 -427
  201. data/spec/integration/belongs_to_spec.rb +0 -42
@@ -20,10 +20,18 @@ $secondary-gradient-stop: #dfe1e2;
20
20
  @include gradient($secondary-gradient-start, $secondary-gradient-stop);
21
21
  }
22
22
 
23
+ @mixin highlight-gradient {
24
+ @include gradient(#75a1c2, #608cb4);
25
+ }
26
+
27
+ @mixin reverse-highlight-gradient {
28
+ @include gradient(#608cb4, #75a1c2);
29
+ }
30
+
23
31
  @mixin no-gradient {
24
32
  background: none;
25
33
  // IE 6 & 7
26
34
  filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
27
35
  // IE 8
28
36
  -ms-filter: "progid:DXImageTransform.Microsoft.gradient(enabled=false)";
29
- }
37
+ }
@@ -1,16 +1,18 @@
1
1
  @mixin section-header {
2
2
  @include secondary-gradient;
3
- @include shadow;
4
3
  @include text-shadow;
5
- border-bottom: 1px solid #ededed;
6
- padding: 5px 10px 3px 10px;
4
+ border: solid 1px #cdcdcd;
5
+ @include border-colors(#e6e6e6, #d4d4d4, #cdcdcd);
6
+ @include box-shadow(0 1px 3px rgba(0,0,0,0.12), 0 0 1px #FFF inset);
7
+
7
8
  font-size: 1.0em;
8
9
  font-weight: bold;
9
- line-height: 140%;
10
+ line-height: 18px;
10
11
  margin-bottom: 0.5em;
11
12
  color: $section-header-text-color;
12
13
  @include icon($section-header-text-color, 1.0em);
13
- span.icon { margin-right: 5px; }
14
+
15
+ padding: 5px 10px 3px 10px;
14
16
  }
15
17
 
16
18
  @mixin section-background {
@@ -19,3 +19,4 @@
19
19
  @mixin text-shadow($color: #fff, $x: 0, $y: 1px, $blur: 0) {
20
20
  text-shadow: $color $x $y $blur;
21
21
  }
22
+
@@ -0,0 +1,3 @@
1
+ @mixin sans-family {
2
+ font-family: Helvetica, Arial, sans-serif;
3
+ }
@@ -9,6 +9,7 @@ $section-header-text-color: $primary-color;
9
9
  $current-menu-item-background: lighten($primary-color, 12%);
10
10
  $hover-menu-item-background: lighten($primary-color, 12%);
11
11
  $table-stripe-color: lighten($primary-color, 57%);
12
+ $table-selected-color: #d9e4ec;
12
13
  $error-color: #932419;
13
14
 
14
15
  // Sizes
@@ -0,0 +1,5 @@
1
+ table.dashboard {
2
+ width: 100%;
3
+ td { border-bottom: none; }
4
+ .dashboard_section { @include section; }
5
+ }
@@ -0,0 +1,44 @@
1
+ body.logged_out {
2
+ background: #e8e9ea;
3
+
4
+ #content_wrapper{
5
+ width: 500px;
6
+ margin: 70px auto;
7
+ #active_admin_content {
8
+ @include shadow;
9
+ background: #fff;
10
+ padding: 13px 30px;
11
+ }
12
+ }
13
+
14
+ h2 {
15
+ @include section-header;
16
+ @include primary-gradient;
17
+ @include text-shadow(#000);
18
+ @include box-shadow(0 1px 3px rgba(0,0,0,0.3));
19
+ border: none;
20
+ color: #fff;
21
+ margin: -13px -30px 20px -30px;
22
+ }
23
+
24
+ #login {
25
+ /* Login Form */
26
+ form {
27
+ fieldset {
28
+ @include no-shadow;
29
+ background: none;
30
+ padding: 0;
31
+ li { padding: 10px 0; }
32
+
33
+ input[type=text], input[type=email], input[type=password] {
34
+ width: 70%;
35
+ }
36
+ &.buttons { margin-left: 20%; }
37
+ margin-bottom: 0;
38
+ }
39
+ }
40
+
41
+ a { float: right; margin-top: -32px; }
42
+ }
43
+
44
+ }
@@ -0,0 +1,14 @@
1
+ #footer {
2
+ padding: 30px 30px;
3
+ font-size: 0.8em;
4
+ clear: both;
5
+
6
+ p {
7
+ padding-top: 10px
8
+ }
9
+ }
10
+
11
+ // -------------------------------------- Index Footer (Under Table)
12
+ #index_footer { padding-top: 5px; text-align: right; font-size: 0.85em; }
13
+
14
+ .index_content { clear: both; }
@@ -0,0 +1,26 @@
1
+ #wrapper {
2
+ display: table;
3
+ width: 100%;
4
+ }
5
+
6
+ #active_admin_content {
7
+ margin: 0;
8
+ padding: 25px $horizontal-page-margin;
9
+
10
+ #main_content_wrapper {
11
+ float: left;
12
+ width: 100%;
13
+
14
+ #main_content{
15
+ margin-right: 300px;
16
+ }
17
+ }
18
+
19
+ &.without_sidebar #main_content_wrapper #main_content{ margin-right: 0; }
20
+
21
+ #sidebar {
22
+ float: left;
23
+ width: $sidebar-width;
24
+ margin-left: -$sidebar-width;
25
+ }
26
+ }
@@ -0,0 +1,44 @@
1
+ #title_bar {
2
+ @include section-header;
3
+ @include clearfix;
4
+ @include box-sizing(border-box);
5
+ @include box-shadow(0 1px 2px rgba(0, 0, 0, 0.37));
6
+ display: table;
7
+ border-bottom-color: #EEE;
8
+ width: 100%;
9
+ position: relative;
10
+ margin: 0;
11
+ margin-bottom: 15px;
12
+ padding: 10px $horizontal-page-margin;
13
+ z-index: 800;
14
+
15
+ #titlebar_left, #titlebar_right {
16
+ height: 50px;
17
+ vertical-align: middle;
18
+ display: table-cell;
19
+ }
20
+
21
+ #titlebar_right {
22
+ text-align: right;
23
+ }
24
+
25
+ h2 {
26
+ margin: 0;
27
+ padding: 0;
28
+ font-size: 2.6em;
29
+ font-weight: bold;
30
+ }
31
+
32
+ .action_items {
33
+ a {
34
+ @include light-button;
35
+ padding: 12px 17px 10px;
36
+ span.icon { vertical-align: bottom; margin-right: 4px;}
37
+ margin: 0px;
38
+
39
+ &:hover{
40
+ @include icon-color(#000);
41
+ }
42
+ }
43
+ }
44
+ }
@@ -13,4 +13,4 @@
13
13
  <p><%= f.submit "Change my password" %></p>
14
14
  <% end %>
15
15
 
16
- <%= render :partial => "devise/shared/links" %>
16
+ <%= render :partial => "active_admin/devise/shared/links" %>
@@ -10,5 +10,5 @@
10
10
  end
11
11
  end %>
12
12
 
13
- <%= render :partial => "devise/shared/links" %>
13
+ <%= render :partial => "active_admin/devise/shared/links" %>
14
14
  </div>
@@ -14,5 +14,5 @@
14
14
  end
15
15
  %>
16
16
 
17
- <%= render :partial => "devise/shared/links" %>
17
+ <%= render :partial => "active_admin/devise/shared/links" %>
18
18
  </div>
@@ -1,6 +1,6 @@
1
1
  <%- if controller_name != 'sessions' %>
2
2
  <% scope = Devise::Mapping.find_scope!(resource_name) %>
3
- <%= link_to "Sign in", send(:"new_#{scope}_session_path") }")br />
3
+ <%= link_to "Sign in", send(:"new_#{scope}_session_path") %><br />
4
4
  <% end -%>
5
5
 
6
6
  <%- if devise_mapping.registerable? && controller_name != 'registrations' %>
@@ -9,4 +9,4 @@
9
9
  <p><%= f.submit "Resend unlock instructions" %></p>
10
10
  <% end %>
11
11
 
12
- <%= render :partial => "devise/shared/links" %>
12
+ <%= render :partial => "active_admin/devise/shared/links" %>
@@ -0,0 +1 @@
1
+ render active_admin_application.view_factory["page"]
@@ -5,8 +5,8 @@
5
5
 
6
6
  <title><%= [@page_title, active_admin_application.site_title].compact.join(" | ") %></title>
7
7
 
8
- <% ActiveAdmin.application.stylesheets.each do |path| %>
9
- <%= stylesheet_link_tag path %>
8
+ <% ActiveAdmin.application.stylesheets.each do |style| %>
9
+ <%= stylesheet_link_tag style.path, style.options %>
10
10
  <% end %>
11
11
  <% ActiveAdmin.application.javascripts.each do |path| %>
12
12
  <%= javascript_include_tag path %>
data/cucumber.yml CHANGED
@@ -1,2 +1,3 @@
1
- default: --format 'progress' --require features/support/env.rb --require features/step_definitions features
2
- wip: --format 'progress' --require features/support/env.rb --require features/step_definitions features --tags @wip:3 --wip features
1
+ default: --format 'progress' --require features/support/env.rb --require features/step_definitions features --tags ~@requires-reloading
2
+ wip: --format 'progress' --require features/support/env.rb --require features/step_definitions features --tags @wip:3 --wip features
3
+ class-reloading: RAILS_ENV=cucumber_with_reloading --format 'progress' --require features/support/env.rb --require features/step_definitions features --tags @requires-reloading
@@ -1,15 +1,15 @@
1
1
  # General Configuration
2
2
 
3
- Below are some common settings you'll find in
4
- `config/initializers/active_admin.rb`.
3
+ Active Admin generates an initializer for you with sane defaults. The
4
+ initializer can be found at `config/initializers/active_admin.rb`. For the most
5
+ part, it is well documented. Here are a few common configurations.
5
6
 
6
7
  ## Authentication
7
8
 
8
9
  Active Admin requires two settings to authenticate and use the current user
9
- within your application. Both are set in
10
- <tt>config/initializers/active_admin.rb</tt>. By default they are setup for use
11
- with Devise and a model named AdminUser. If you chose a different model name,
12
- you will need to update these settings.
10
+ within your application. Both are set in `config/initializers/active_admin.rb`.
11
+ By default they are setup for use with Devise and a model named AdminUser. If
12
+ you chose a different model name, you will need to update these settings.
13
13
 
14
14
  Set the method that controllers should call to authenticate the current user
15
15
  with:
@@ -28,16 +28,52 @@ Both of these settings can be set to false to turn off authentication.
28
28
  config.authentication_method = false
29
29
  config.current_user_method = false
30
30
 
31
- ## Site Title
31
+ ## Site Title Options
32
32
 
33
- You can update the title used for the site in the initializer also. By default
34
- it is set to the name of your Rails.application class name.
33
+ You can update the title or use an optional image in the initializer also. In addition you can set the link. By default
34
+ there is no link and the title is set to the name of your Rails.application class name.
35
35
 
36
36
  # config/initializers/active_admin.rb
37
37
  config.site_title = "My Admin Site"
38
+ config.site_title_link = "/" ## Rails url helpers do not work here
39
+ config.site_title_image = "site_log_image.png"
38
40
 
39
41
  ## Internationalization (I18n)
40
42
 
41
43
  To internationalize Active Admin or to change default strings, you can copy
42
- lib/active_admin/locales/en.yml to your application config/locales directory and
44
+ `lib/active_admin/locales/en.yml` to your application `config/locales` directory and
43
45
  change its content. You can contribute to the project with your translations too!
46
+
47
+ ## Namespaces
48
+
49
+ When registering resources in Active Admin, they are loaded into a namespace.
50
+ The default namespace is "admin".
51
+
52
+ # app/admin/posts.rb
53
+ ActiveAdmin.register Post do
54
+ # ...
55
+ end
56
+
57
+ The Post resource will be loaded into the "admin" namespace and will be
58
+ available at `/admin/posts`. Each namespace holds on to its own configuration
59
+ settings which inherit from the application's general configurations.
60
+
61
+ For example, if you have two namespaces: `:admin` and `super_admin` and want to
62
+ have different site title's for each namespace. You can use the
63
+ `config.namespace(name)` block within the initializer file to configure them
64
+ individually.
65
+
66
+ ActiveAdmin.setup do |config|
67
+ config.site_title = "My Default Site Title"
68
+
69
+ config.namespace :admin do |admin|
70
+ admin.site_title = "Admin Site"
71
+ end
72
+
73
+ config.namespace :super_admin do |super_admin|
74
+ super_admin.site_title = "Super Admin Site"
75
+ end
76
+ end
77
+
78
+ Each setting available in the Active Admin setup block is configurable on a per
79
+ namespace basis.
@@ -34,3 +34,10 @@ If you'd like to keep the default active_admin look, you can also use "attribute
34
34
  active_admin_comments
35
35
  end
36
36
  end
37
+
38
+ You can customize the title of the object in the show screen. The default is the resouce name and the ID. You can customize as follows:
39
+
40
+ show :title => :name do
41
+ end
42
+
43
+
@@ -17,7 +17,7 @@ To add a collection action, use the collection_action method:
17
17
 
18
18
  collection_action :import_csv, :method => :post do
19
19
  # Do some CSV importing work here...
20
- redirect_to :action => :index, :notice => "CSV imported successfully!"
20
+ redirect_to {:action => :index}, :notice => "CSV imported successfully!"
21
21
  end
22
22
 
23
23
  end
@@ -37,7 +37,7 @@ following:
37
37
  member_action :lock, :method => :put do
38
38
  user = User.find(params[:id])
39
39
  user.lock!
40
- redirect_to :action => :show, :notice => "Locked!"
40
+ redirect_to {:action => :show}, :notice => "Locked!"
41
41
  end
42
42
 
43
43
  end
@@ -81,6 +81,16 @@ For example, create app/views/admin/posts/comments.html.arb with:
81
81
  simple_format comment.body
82
82
  end
83
83
  end
84
+
85
+ ### Custom Action Items
86
+
87
+ To include your own action items (like the New, Edit and Delete buttons), add an
88
+ `action_item` block. For example, to add a "View on site" button to view a blog
89
+ post:
90
+
91
+ action_item :only => :show do
92
+ link_to('View on site', post_path(post)) if post.published?
93
+ end
84
94
 
85
95
  ### Page Titles
86
96
 
@@ -0,0 +1,84 @@
1
+ # Custom Pages
2
+
3
+ Although it's nice to be able to register resources, sometimes you need a non
4
+ resourceful page in your application. Active Admin supports the generation of
5
+ custom pages using the same familiar syntax available for resources.
6
+
7
+ ## Create a new Page
8
+
9
+ Creating a page is a simple as calling the `register_page` method:
10
+
11
+ ActiveAdmin.register_page "My Page" do
12
+ content do
13
+ para "Hello World"
14
+ end
15
+ end
16
+
17
+ In the above example, a new page will be created at `/admin/my_page` with the
18
+ title "My Page" and the content of "Hello World". Anything rendered within the
19
+ `#content` block will be set in the main content area of the page.
20
+
21
+ ## Page Title & I18n
22
+
23
+ Coming soon...
24
+
25
+ ## Customize the Menu
26
+
27
+ The menu item is available to customize just like in any other resource in
28
+ Active Admin:
29
+
30
+ ActiveAdmin.register_page "My Page" do
31
+ menu :label => "My Menu Item Label", :parent => "Dashboard"
32
+
33
+ content do
34
+ para "Hello World"
35
+ end
36
+ end
37
+
38
+ This configuration will add the page to the menu with the label "My Menu Item
39
+ Label" and will nest it underneath the "Dashboard" link.
40
+
41
+ To view the full list of available menu options visit ([Resource
42
+ Customization](2-resource-customization.md))
43
+
44
+ ## Add a Sidebar Section
45
+
46
+ You can add sidebar sections to your pages using the same DSL as other resources
47
+ in Active Admin:
48
+
49
+ ActiveAdmin.register_page "My Page" do
50
+
51
+ sidebar :help do
52
+ ul do
53
+ li "First Line of Help"
54
+ end
55
+ end
56
+
57
+ content do
58
+ para "Hello World"
59
+ end
60
+ end
61
+
62
+ This configuration creates a sidebar section named "Help" with an unordered list
63
+ in it.
64
+
65
+ To view the full list of available sidebar section options visit
66
+ ([Sidebars](7-sidebars.md))
67
+
68
+ ## Add an Action Item
69
+
70
+ Just like other resources, you can add Action Item's to pages:
71
+
72
+ ActiveAdmin.register_page "My Page" do
73
+
74
+ action_item do
75
+ link_to "View Site", "/"
76
+ end
77
+
78
+ content do
79
+ para "Hello World"
80
+ end
81
+ end
82
+
83
+ This configuration adds an action item that links to the root URL of the
84
+ application.