activeadmin 2.6.1 → 2.13.1

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

Potentially problematic release.


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

Files changed (229) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +291 -9
  3. data/CONTRIBUTING.md +9 -25
  4. data/README.md +4 -4
  5. data/app/assets/javascripts/active_admin/base.js +27 -22
  6. data/app/assets/stylesheets/active_admin/_base.scss +53 -37
  7. data/app/assets/stylesheets/active_admin/_forms.scss +0 -10
  8. data/app/assets/stylesheets/active_admin/_header.scss +37 -3
  9. data/app/assets/stylesheets/active_admin/_normalize.scss +25 -123
  10. data/app/assets/stylesheets/active_admin/{print.scss → _print.scss} +0 -0
  11. data/app/assets/stylesheets/active_admin/components/_comments.scss +2 -2
  12. data/app/assets/stylesheets/active_admin/components/_date_picker.scss +1 -2
  13. data/app/assets/stylesheets/active_admin/components/_dropdown_menu.scss +0 -1
  14. data/app/assets/stylesheets/active_admin/mixins/_variables.scss +12 -0
  15. data/app/assets/stylesheets/active_admin/structure/_title_bar.scss +0 -1
  16. data/app/javascript/active_admin/initializers/has-many.js +4 -1
  17. data/app/javascript/active_admin/initializers/per-page.js +1 -1
  18. data/app/javascript/active_admin/lib/checkbox-toggler.js +3 -3
  19. data/app/javascript/active_admin/lib/dropdown-menu.js +1 -1
  20. data/app/javascript/active_admin/lib/modal-dialog.js +7 -7
  21. data/app/javascript/active_admin/lib/per-page.js +1 -1
  22. data/app/javascript/active_admin/lib/table-checkbox-toggler.js +1 -1
  23. data/app/views/active_admin/devise/mailer/reset_password_instructions.html.erb +1 -1
  24. data/app/views/active_admin/devise/mailer/unlock_instructions.html.erb +2 -2
  25. data/app/views/active_admin/devise/shared/_links.erb +1 -1
  26. data/app/views/active_admin/page/index.html.arb +1 -0
  27. data/app/views/active_admin/resource/edit.html.arb +1 -0
  28. data/app/views/active_admin/resource/index.html.arb +1 -0
  29. data/app/views/active_admin/resource/new.html.arb +1 -0
  30. data/app/views/active_admin/resource/show.html.arb +1 -0
  31. data/app/views/layouts/active_admin.html.arb +1 -0
  32. data/app/views/layouts/active_admin_logged_out.html.erb +15 -5
  33. data/config/locales/ar.yml +6 -6
  34. data/config/locales/es-MX.yml +2 -1
  35. data/config/locales/es.yml +2 -2
  36. data/config/locales/it.yml +18 -0
  37. data/config/locales/ja.yml +3 -3
  38. data/config/locales/ko.yml +1 -1
  39. data/config/locales/nl.yml +1 -1
  40. data/config/locales/ro.yml +3 -2
  41. data/config/locales/vi.yml +5 -5
  42. data/docs/0-installation.md +27 -3
  43. data/docs/11-decorators.md +16 -5
  44. data/docs/2-resource-customization.md +10 -1
  45. data/docs/5-forms.md +9 -3
  46. data/docs/6-show-pages.md +12 -0
  47. data/docs/8-custom-actions.md +1 -1
  48. data/docs/Gemfile +3 -2
  49. data/docs/Gemfile.lock +138 -103
  50. data/docs/_includes/top-menu.html +1 -1
  51. data/docs/documentation.md +1 -1
  52. data/docs/index.html +6 -6
  53. data/lib/active_admin/abstract_view_factory.rb +1 -0
  54. data/lib/active_admin/application.rb +19 -19
  55. data/lib/active_admin/application_settings.rb +4 -3
  56. data/lib/active_admin/asset_registration.rb +1 -0
  57. data/lib/active_admin/authorization_adapter.rb +4 -3
  58. data/lib/active_admin/base_controller/authorization.rb +15 -13
  59. data/lib/active_admin/base_controller/menu.rb +1 -0
  60. data/lib/active_admin/base_controller.rb +6 -5
  61. data/lib/active_admin/batch_actions/controller.rb +4 -3
  62. data/lib/active_admin/batch_actions/resource_extension.rb +10 -8
  63. data/lib/active_admin/batch_actions/views/batch_action_form.rb +4 -3
  64. data/lib/active_admin/batch_actions/views/batch_action_selector.rb +7 -6
  65. data/lib/active_admin/batch_actions/views/selection_cells.rb +4 -3
  66. data/lib/active_admin/batch_actions.rb +1 -0
  67. data/lib/active_admin/callbacks.rb +1 -0
  68. data/lib/active_admin/cancan_adapter.rb +2 -1
  69. data/lib/active_admin/collection_decorator.rb +32 -0
  70. data/lib/active_admin/component.rb +1 -0
  71. data/lib/active_admin/controller_action.rb +1 -0
  72. data/lib/active_admin/csv_builder.rb +6 -19
  73. data/lib/active_admin/dependency.rb +13 -12
  74. data/lib/active_admin/deprecation.rb +1 -0
  75. data/lib/active_admin/devise.rb +16 -5
  76. data/lib/active_admin/dsl.rb +2 -1
  77. data/lib/active_admin/dynamic_setting.rb +1 -0
  78. data/lib/active_admin/dynamic_settings_node.rb +3 -2
  79. data/lib/active_admin/engine.rb +13 -9
  80. data/lib/active_admin/error.rb +1 -2
  81. data/lib/active_admin/filters/active.rb +2 -1
  82. data/lib/active_admin/filters/active_filter.rb +6 -6
  83. data/lib/active_admin/filters/active_sidebar.rb +4 -30
  84. data/lib/active_admin/filters/dsl.rb +1 -0
  85. data/lib/active_admin/filters/forms.rb +7 -6
  86. data/lib/active_admin/filters/formtastic_addons.rb +2 -6
  87. data/lib/active_admin/filters/resource_extension.rb +2 -1
  88. data/lib/active_admin/filters.rb +8 -7
  89. data/lib/active_admin/form_builder.rb +25 -20
  90. data/lib/active_admin/generators/boilerplate.rb +2 -1
  91. data/lib/active_admin/helpers/collection.rb +2 -0
  92. data/lib/active_admin/helpers/i18n.rb +1 -0
  93. data/lib/active_admin/helpers/optional_display.rb +3 -2
  94. data/lib/active_admin/helpers/routes/url_helpers.rb +1 -0
  95. data/lib/active_admin/helpers/scope_chain.rb +1 -0
  96. data/lib/active_admin/inputs/datepicker_input.rb +2 -1
  97. data/lib/active_admin/inputs/filters/base/search_method_select.rb +5 -4
  98. data/lib/active_admin/inputs/filters/base.rb +2 -1
  99. data/lib/active_admin/inputs/filters/boolean_input.rb +2 -1
  100. data/lib/active_admin/inputs/filters/check_boxes_input.rb +2 -1
  101. data/lib/active_admin/inputs/filters/date_picker_input.rb +1 -0
  102. data/lib/active_admin/inputs/filters/date_range_input.rb +1 -0
  103. data/lib/active_admin/inputs/filters/numeric_input.rb +1 -0
  104. data/lib/active_admin/inputs/filters/select_input.rb +3 -2
  105. data/lib/active_admin/inputs/filters/string_input.rb +1 -0
  106. data/lib/active_admin/inputs/filters/text_input.rb +1 -0
  107. data/lib/active_admin/inputs.rb +1 -0
  108. data/lib/active_admin/localizers/resource_localizer.rb +4 -3
  109. data/lib/active_admin/localizers.rb +2 -1
  110. data/lib/active_admin/menu.rb +7 -3
  111. data/lib/active_admin/menu_collection.rb +1 -0
  112. data/lib/active_admin/menu_item.rb +8 -7
  113. data/lib/active_admin/namespace.rb +15 -14
  114. data/lib/active_admin/namespace_settings.rb +9 -5
  115. data/lib/active_admin/order_clause.rb +2 -1
  116. data/lib/active_admin/orm/active_record/comments/comment.rb +4 -3
  117. data/lib/active_admin/orm/active_record/comments/namespace_helper.rb +1 -0
  118. data/lib/active_admin/orm/active_record/comments/resource_helper.rb +1 -0
  119. data/lib/active_admin/orm/active_record/comments/show_page_helper.rb +1 -0
  120. data/lib/active_admin/orm/active_record/comments/views/active_admin_comments.rb +20 -19
  121. data/lib/active_admin/orm/active_record/comments/views.rb +3 -2
  122. data/lib/active_admin/orm/active_record/comments.rb +20 -19
  123. data/lib/active_admin/orm/active_record.rb +2 -1
  124. data/lib/active_admin/orm/mongoid.rb +1 -0
  125. data/lib/active_admin/page.rb +2 -1
  126. data/lib/active_admin/page_controller.rb +1 -0
  127. data/lib/active_admin/page_dsl.rb +1 -0
  128. data/lib/active_admin/page_presenter.rb +1 -0
  129. data/lib/active_admin/pundit_adapter.rb +59 -15
  130. data/lib/active_admin/resource/action_items.rb +6 -5
  131. data/lib/active_admin/resource/attributes.rb +2 -1
  132. data/lib/active_admin/resource/belongs_to.rb +3 -2
  133. data/lib/active_admin/resource/controllers.rb +2 -1
  134. data/lib/active_admin/resource/includes.rb +1 -0
  135. data/lib/active_admin/resource/menu.rb +5 -4
  136. data/lib/active_admin/resource/model.rb +1 -0
  137. data/lib/active_admin/resource/naming.rb +5 -4
  138. data/lib/active_admin/resource/ordering.rb +1 -0
  139. data/lib/active_admin/resource/page_presenters.rb +1 -0
  140. data/lib/active_admin/resource/pagination.rb +1 -0
  141. data/lib/active_admin/resource/routes.rb +6 -7
  142. data/lib/active_admin/resource/scope_to.rb +8 -7
  143. data/lib/active_admin/resource/scopes.rb +1 -0
  144. data/lib/active_admin/resource/sidebars.rb +2 -1
  145. data/lib/active_admin/resource.rb +20 -19
  146. data/lib/active_admin/resource_collection.rb +1 -0
  147. data/lib/active_admin/resource_controller/action_builder.rb +1 -0
  148. data/lib/active_admin/resource_controller/data_access.rb +31 -5
  149. data/lib/active_admin/resource_controller/decorators.rb +7 -28
  150. data/lib/active_admin/resource_controller/polymorphic_routes.rb +1 -0
  151. data/lib/active_admin/resource_controller/resource_class_methods.rb +1 -0
  152. data/lib/active_admin/resource_controller/scoping.rb +1 -0
  153. data/lib/active_admin/resource_controller/sidebars.rb +1 -0
  154. data/lib/active_admin/resource_controller/streaming.rb +9 -7
  155. data/lib/active_admin/resource_controller.rb +13 -11
  156. data/lib/active_admin/resource_dsl.rb +11 -25
  157. data/lib/active_admin/router.rb +1 -0
  158. data/lib/active_admin/scope.rb +7 -6
  159. data/lib/active_admin/settings_node.rb +1 -0
  160. data/lib/active_admin/sidebar_section.rb +1 -0
  161. data/lib/active_admin/version.rb +2 -1
  162. data/lib/active_admin/view_factory.rb +18 -17
  163. data/lib/active_admin/view_helpers/active_admin_application_helper.rb +1 -0
  164. data/lib/active_admin/view_helpers/auto_link_helper.rb +1 -0
  165. data/lib/active_admin/view_helpers/breadcrumb_helper.rb +4 -3
  166. data/lib/active_admin/view_helpers/display_helper.rb +15 -7
  167. data/lib/active_admin/view_helpers/download_format_links_helper.rb +2 -1
  168. data/lib/active_admin/view_helpers/fields_for.rb +3 -2
  169. data/lib/active_admin/view_helpers/flash_helper.rb +1 -0
  170. data/lib/active_admin/view_helpers/form_helper.rb +1 -0
  171. data/lib/active_admin/view_helpers/method_or_proc_helper.rb +1 -0
  172. data/lib/active_admin/view_helpers/scope_name_helper.rb +1 -0
  173. data/lib/active_admin/view_helpers/sidebar_helper.rb +1 -0
  174. data/lib/active_admin/view_helpers/title_helper.rb +1 -0
  175. data/lib/active_admin/view_helpers/view_factory_helper.rb +1 -0
  176. data/lib/active_admin/view_helpers.rb +2 -1
  177. data/lib/active_admin/views/action_items.rb +1 -0
  178. data/lib/active_admin/views/components/active_admin_form.rb +7 -6
  179. data/lib/active_admin/views/components/active_filters_sidebar_content.rb +59 -0
  180. data/lib/active_admin/views/components/attributes_table.rb +6 -5
  181. data/lib/active_admin/views/components/blank_slate.rb +2 -1
  182. data/lib/active_admin/views/components/columns.rb +1 -0
  183. data/lib/active_admin/views/components/dropdown_menu.rb +7 -9
  184. data/lib/active_admin/views/components/index_list.rb +4 -3
  185. data/lib/active_admin/views/components/menu.rb +2 -1
  186. data/lib/active_admin/views/components/menu_item.rb +5 -4
  187. data/lib/active_admin/views/components/paginated_collection.rb +19 -18
  188. data/lib/active_admin/views/components/panel.rb +2 -1
  189. data/lib/active_admin/views/components/scopes.rb +8 -5
  190. data/lib/active_admin/views/components/sidebar.rb +1 -0
  191. data/lib/active_admin/views/components/sidebar_section.rb +1 -0
  192. data/lib/active_admin/views/components/site_title.rb +2 -1
  193. data/lib/active_admin/views/components/status_tag.rb +12 -11
  194. data/lib/active_admin/views/components/table_for.rb +18 -17
  195. data/lib/active_admin/views/components/tabs.rb +4 -3
  196. data/lib/active_admin/views/components/unsupported_browser.rb +1 -0
  197. data/lib/active_admin/views/footer.rb +3 -1
  198. data/lib/active_admin/views/header.rb +3 -2
  199. data/lib/active_admin/views/index_as_block.rb +1 -0
  200. data/lib/active_admin/views/index_as_blog.rb +2 -1
  201. data/lib/active_admin/views/index_as_grid.rb +2 -1
  202. data/lib/active_admin/views/index_as_table.rb +17 -16
  203. data/lib/active_admin/views/pages/base.rb +14 -9
  204. data/lib/active_admin/views/pages/form.rb +1 -0
  205. data/lib/active_admin/views/pages/index.rb +15 -13
  206. data/lib/active_admin/views/pages/layout.rb +1 -0
  207. data/lib/active_admin/views/pages/page.rb +1 -0
  208. data/lib/active_admin/views/pages/show.rb +1 -0
  209. data/lib/active_admin/views/tabbed_navigation.rb +3 -2
  210. data/lib/active_admin/views/title_bar.rb +2 -1
  211. data/lib/active_admin/views.rb +2 -1
  212. data/lib/active_admin.rb +61 -61
  213. data/lib/activeadmin.rb +2 -1
  214. data/lib/generators/active_admin/assets/assets_generator.rb +3 -2
  215. data/lib/generators/active_admin/assets/templates/active_admin.scss +2 -2
  216. data/lib/generators/active_admin/devise/devise_generator.rb +6 -5
  217. data/lib/generators/active_admin/install/install_generator.rb +15 -8
  218. data/lib/generators/active_admin/install/templates/active_admin.rb.erb +9 -2
  219. data/lib/generators/active_admin/install/templates/dashboard.rb +1 -0
  220. data/lib/generators/active_admin/page/page_generator.rb +2 -1
  221. data/lib/generators/active_admin/page/templates/page.rb +1 -0
  222. data/lib/generators/active_admin/resource/resource_generator.rb +4 -3
  223. data/lib/generators/active_admin/webpacker/plugins/jquery.js +7 -0
  224. data/lib/generators/active_admin/webpacker/templates/active_admin.js +5 -0
  225. data/lib/generators/active_admin/webpacker/templates/active_admin.scss +17 -0
  226. data/lib/generators/active_admin/webpacker/templates/print.scss +2 -0
  227. data/lib/generators/active_admin/webpacker/webpacker_generator.rb +27 -0
  228. data/lib/ransack_ext.rb +9 -8
  229. metadata +32 -53
@@ -5,6 +5,9 @@
5
5
  // Images
6
6
  $menu-arrow-light-icon-url: 'data:image/png;base64,R0lGODlhBwAEAKIAAL6+vry8vIiIiJWVlf///3t7ewAAAAAAACH5BAEAAAUALAAAAAAHAAQAAAMLWLol80MoF5mQKgEAOw==' !default;
7
7
  $menu-arrow-dark-icon-url: 'data:image/png;base64,R0lGODlhBwAEAKIAAG1tbWxsbElJSVBQUP///0JCQgAAAAAAACH5BAEAAAUALAAAAAAHAAQAAAMLWLol80MoF5mQKgEAOw==' !default;
8
+ $menu-arrow-right-light-icon-url: 'data:image/gif;base64,R0lGODlhBAAHAKECAKqqqszMzPkVFfkVFSH+EUNyZWF0ZWQgd2l0aCBHSU1QACH5BAEKAAIALAAAAAAEAAcAAAIJlA0XKbH9nmAFADs=' !default;
9
+ $menu-arrow-right-dark-icon-url: 'data:image/gif;base64,R0lGODlhBAAHAMIEAG1tbWxsbElJSVBQUPkVFfkVFfkVFfkVFSH+EUNyZWF0ZWQgd2l0aCBHSU1QACH5BAEKAAEALAAAAAAEAAcAAAMKGKqy02G8OGeACQA7' !default;
10
+
8
11
  $orderable-icon-url: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAABGCAYAAAAAVo4aAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAH5JREFUeNpi3LhlOwMU1AExGxDXwARYoHQLEFdD2cxAXAliMKFJgEAFEHfBJEHGMKLhMpgkTsAEdch/NNwCk2xCdiEQtML4LEgCf6EubUX3Cgh0oNvJ+P//f7wOGpUclRwYSZb41CyidNbB8giNM+9oXhmVHHm5bJjUSAABBgDKKiwMMUxPwgAAAABJRU5ErkJggg==' !default;
9
12
 
10
13
  // Colors
@@ -37,3 +40,12 @@ $text-input-horizontal-padding: 10px !default;
37
40
  $text-input-total-padding: $text-input-horizontal-padding * 2 + $border-width * 2;
38
41
 
39
42
  $blank-slate-border: 1px dashed #DADADA !default;
43
+
44
+ // Sidebar Forms
45
+ $sidebar-inner-content-width: $sidebar-width - ($section-padding * 2);
46
+
47
+ // Filter Forms
48
+ $filter-field-seperator-width: 12px !default;
49
+ $side-by-side-filter-input-width: ($sidebar-inner-content-width * 0.5) - ($text-input-horizontal-padding * 2) - $filter-field-seperator-width;
50
+ $side-by-side-filter-select-width: ($sidebar-inner-content-width * 0.5) - $filter-field-seperator-width;
51
+ $date-range-filter-input-width: ($sidebar-inner-content-width * 0.5) - ($filter-field-seperator-width * 0.5);
@@ -1,7 +1,6 @@
1
1
  #title_bar {
2
2
  @include section-header;
3
3
  @include clearfix;
4
- box-sizing: border-box;
5
4
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.37);
6
5
  display: table;
7
6
  border-bottom-color: #EEE;
@@ -57,7 +57,6 @@ $(function() {
57
57
  recompute_positions($(this).closest('.has_many'));
58
58
  });
59
59
 
60
- init_sortable();
61
60
  $(document).on('has_many_add:after', '.has_many_container', init_sortable);
62
61
  });
63
62
 
@@ -93,3 +92,7 @@ var recompute_positions = function(parent){
93
92
  }
94
93
  });
95
94
  };
95
+
96
+ $(document).
97
+ ready(init_sortable).
98
+ on('page:load turbolinks:load', init_sortable);
@@ -3,7 +3,7 @@ import PerPage from "../lib/per-page";
3
3
  (($) => {
4
4
 
5
5
  $(document).
6
- on('change', '.pagination_per_page > select', function(event) {
6
+ on('change', '.pagination_per_page > select', function(_event) {
7
7
  PerPage._jQueryInterface.call($(this), 'update')
8
8
  });
9
9
 
@@ -6,7 +6,7 @@ class CheckboxToggler {
6
6
  this._bind();
7
7
  }
8
8
 
9
- option(key, value) {
9
+ option(_key, _value) {
10
10
  }
11
11
 
12
12
  _init() {
@@ -30,7 +30,7 @@ class CheckboxToggler {
30
30
  this.toggle_all_checkbox.change(() => this._didChangeToggleAllCheckbox());
31
31
  }
32
32
 
33
- _didChangeCheckbox(checkbox){
33
+ _didChangeCheckbox(_checkbox){
34
34
  const numChecked = this.checkboxes.filter(':checked').length;
35
35
 
36
36
  const allChecked = numChecked === this.checkboxes.length;
@@ -44,6 +44,6 @@ class CheckboxToggler {
44
44
  this.checkboxes.prop({ checked: setting });
45
45
  return setting;
46
46
  }
47
- };
47
+ }
48
48
 
49
49
  export default CheckboxToggler;
@@ -111,6 +111,6 @@ class DropdownMenu {
111
111
  this.$nipple.css('left', menu_center - nipple_center);
112
112
  }
113
113
  }
114
- };
114
+ }
115
115
 
116
116
  export default DropdownMenu;
@@ -1,14 +1,14 @@
1
1
  function ModalDialog(message, inputs, callback){
2
2
  let html = `<form id="dialog_confirm" title="${message}"><ul>`;
3
3
  for (let name in inputs) {
4
- var elem, opts, wrapper;
4
+ var opts, wrapper;
5
5
  let type = inputs[name];
6
6
  if (/^(datepicker|checkbox|text|number)$/.test(type)) {
7
7
  wrapper = 'input';
8
8
  } else if (type === 'textarea') {
9
9
  wrapper = 'textarea';
10
10
  } else if ($.isArray(type)) {
11
- [wrapper, elem, opts, type] = ['select', 'option', type, ''];
11
+ [wrapper, opts, type] = ['select', type, ''];
12
12
  } else {
13
13
  throw new Error(`Unsupported input type: {${name}: ${type}}`);
14
14
  }
@@ -21,20 +21,20 @@ function ModalDialog(message, inputs, callback){
21
21
  const result = [];
22
22
 
23
23
  opts.forEach(v => {
24
- const $elem = $(`<${elem}/>`);
24
+ const $elem = $('<option></option>');
25
25
  if ($.isArray(v)) {
26
26
  $elem.text(v[0]).val(v[1]);
27
27
  } else {
28
28
  $elem.text(v);
29
29
  }
30
- result.push($elem.wrap('<div>').parent().html());
30
+ result.push($elem.wrap('<div></div>').parent().html());
31
31
  });
32
32
 
33
33
  return result;
34
34
  })()).join('') : '') +
35
35
  `</${wrapper}>` +
36
36
  "</li>";
37
- [wrapper, elem, opts, type, klass] = []; // unset any temporary variables
37
+ [wrapper, opts, type, klass] = []; // unset any temporary variables
38
38
  }
39
39
 
40
40
  html += "</ul></form>";
@@ -44,7 +44,7 @@ function ModalDialog(message, inputs, callback){
44
44
 
45
45
  form.dialog({
46
46
  modal: true,
47
- open(event, ui) {
47
+ open(_event, _ui) {
48
48
  $('body').trigger('modal_dialog:after_open', [form]);
49
49
  },
50
50
  dialogClass: 'active_admin_dialog',
@@ -58,6 +58,6 @@ function ModalDialog(message, inputs, callback){
58
58
  }
59
59
  }
60
60
  });
61
- };
61
+ }
62
62
 
63
63
  export default ModalDialog;
@@ -33,6 +33,6 @@ class PerPage {
33
33
  }
34
34
  })
35
35
  }
36
- };
36
+ }
37
37
 
38
38
  export default PerPage;
@@ -33,6 +33,6 @@ class TableCheckboxToggler extends CheckboxToggler {
33
33
  .find(':checkbox')
34
34
  .click();
35
35
  }
36
- };
36
+ }
37
37
 
38
38
  export default TableCheckboxToggler;
@@ -2,7 +2,7 @@
2
2
 
3
3
  <p>Someone has requested a link to change your password, and you can do this through the link below.</p>
4
4
 
5
- <p><%= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @resource.reset_password_token) %></p>
5
+ <p><%= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @token) %></p>
6
6
 
7
7
  <p>If you didn't request this, please ignore this email.</p>
8
8
  <p>Your password won't change until you access the link above and create a new one.</p>
@@ -1,7 +1,7 @@
1
1
  <p>Hello <%= @resource.email %>!</p>
2
2
 
3
- <p>Your account has been locked due to an excessive amount of unsuccessful sign in attempts.</p>
3
+ <p>Your account has been locked due to an excessive number of unsuccessful sign in attempts.</p>
4
4
 
5
5
  <p>Click the link below to unlock your account:</p>
6
6
 
7
- <p><%= link_to 'Unlock my account', unlock_url(@resource, unlock_token: @resource.unlock_token) %></p>
7
+ <p><%= link_to 'Unlock my account', unlock_url(@resource, unlock_token: @token) %></p>
@@ -27,7 +27,7 @@
27
27
  <%- if devise_mapping.omniauthable? %>
28
28
  <%- resource_class.omniauth_providers.each do |provider| %>
29
29
  <%= link_to t('active_admin.devise.links.sign_in_with_omniauth_provider', provider: provider.to_s.titleize),
30
- omniauth_authorize_path(resource_name, provider) %>
30
+ omniauth_authorize_path(resource_name, provider), method: :post %>
31
31
  <br>
32
32
  <% end -%>
33
33
  <% end -%>
@@ -1 +1,2 @@
1
+ # frozen_string_literal: true
1
2
  insert_tag active_admin_application.view_factory["page"]
@@ -1 +1,2 @@
1
+ # frozen_string_literal: true
1
2
  insert_tag renderer_for(:edit)
@@ -1 +1,2 @@
1
+ # frozen_string_literal: true
1
2
  insert_tag renderer_for(:index)
@@ -1 +1,2 @@
1
+ # frozen_string_literal: true
1
2
  insert_tag renderer_for(:new)
@@ -1 +1,2 @@
1
+ # frozen_string_literal: true
1
2
  insert_tag renderer_for(:show)
@@ -1 +1,2 @@
1
+ # frozen_string_literal: true
1
2
  insert_tag view_factory.layout
@@ -6,10 +6,18 @@
6
6
  <title><%= [@page_title, ActiveAdmin.application.site_title(self)].compact.join(" | ") %></title>
7
7
 
8
8
  <% ActiveAdmin.application.stylesheets.each do |style, options| %>
9
- <%= stylesheet_link_tag style, options %>
9
+ <% if ActiveAdmin.application.use_webpacker %>
10
+ <%= stylesheet_pack_tag style, **options %>
11
+ <% else %>
12
+ <%= stylesheet_link_tag style, **options %>
13
+ <% end %>
10
14
  <% end %>
11
15
  <% ActiveAdmin.application.javascripts.each do |path| %>
12
- <%= javascript_include_tag path %>
16
+ <% if ActiveAdmin.application.use_webpacker %>
17
+ <%= javascript_pack_tag path %>
18
+ <% else %>
19
+ <%= javascript_include_tag path %>
20
+ <% end %>
13
21
  <% end %>
14
22
 
15
23
  <%= favicon_link_tag ActiveAdmin.application.favicon if ActiveAdmin.application.favicon %>
@@ -24,9 +32,11 @@
24
32
  <div id="wrapper">
25
33
 
26
34
  <div id="content_wrapper">
27
- <% flash_messages.each do |type, message| %>
28
- <%= content_tag :div, message, class: "flash flash_#{type}" %>
29
- <% end %>
35
+ <div class="flashes">
36
+ <% flash_messages.each do |type, message| %>
37
+ <%= content_tag :div, message, class: "flash flash_#{type}" %>
38
+ <% end %>
39
+ </div>
30
40
  <div id="active_admin_content">
31
41
  <%= yield %>
32
42
  </div>
@@ -8,7 +8,7 @@ ar:
8
8
  edit: "تعديل"
9
9
  delete: "حذف"
10
10
  delete_confirmation: "هل تريد تأكيد الحذف؟"
11
- new_model: "جديد %{model}"
11
+ new_model: "%{model} جديد"
12
12
  edit_model: "تعديل %{model}"
13
13
  delete_model: "حذف %{model}"
14
14
  details: "تفاصيل %{model}"
@@ -97,12 +97,12 @@ ar:
97
97
  password:
98
98
  title: "كلمة المرور"
99
99
  sign_up:
100
- title: "تسجيل الدخول"
101
- submit: "تسجيل الدخول"
100
+ title: "تسجيل"
101
+ submit: "تسجيل"
102
102
  login:
103
- title: "دخول"
103
+ title: "تسجيل الدخول"
104
104
  remember_me: "تذكرني"
105
- submit: "تسحيل"
105
+ submit: "تسجيل الدخول"
106
106
  reset_password:
107
107
  title: "هل نسيت كلمة المرور؟"
108
108
  submit: "استرجاع كلمة المرور"
@@ -117,7 +117,7 @@ ar:
117
117
  submit: "إعادة ارسال تعليمات التأكيد"
118
118
  links:
119
119
  sign_up: "التسجيل"
120
- sign_in: "دخول"
120
+ sign_in: "تسجيل الدخول"
121
121
  forgot_your_password: "هل نسيت كلمة المرور؟"
122
122
  sign_in_with_omniauth_provider: "تسجيل الدخول بـ %{provider}"
123
123
  resend_unlock_instructions: "إعادة إرسال تعليمات تنشيط الحساب"
@@ -86,7 +86,8 @@ es-MX:
86
86
  title: "Cambie su contraseña"
87
87
  submit: "Cambiar mi contraseña"
88
88
  links:
89
- sign_in: "Registrarse"
89
+ sign_in: "Iniciar Sesión"
90
+ sign_up: "Registrarse"
90
91
  forgot_your_password: "¿Olvidó su contraseña?"
91
92
  sign_in_with_omniauth_provider: "Conéctate con %{provider}"
92
93
  index_list:
@@ -143,8 +143,8 @@ es:
143
143
  title: "Reenviar instrucciones de confirmación"
144
144
  submit: "Reenviar instrucciones de confirmación"
145
145
  links:
146
- sign_up: "Ingresar"
147
- sign_in: "Registrarse"
146
+ sign_up: "Registrarse"
147
+ sign_in: "Iniciar Sesión"
148
148
  forgot_your_password: "¿Olvidó su contraseña?"
149
149
  sign_in_with_omniauth_provider: "Conéctate con %{provider}"
150
150
  resend_unlock_instructions: "Reenviar instrucciones de desbloqueo"
@@ -1,4 +1,20 @@
1
1
  it:
2
+ activerecord:
3
+ models:
4
+ comment:
5
+ one: "Commento"
6
+ other: "Commenti"
7
+ active_admin/comment:
8
+ one: "Commento"
9
+ other: "Commenti"
10
+ attributes:
11
+ active_admin/comment:
12
+ author_type: "Tipo di Autore"
13
+ body: "Corpo"
14
+ created_at: "Creato il"
15
+ namespace: "Namespace"
16
+ resource_type: "Tipo di risorsa"
17
+ updated_at: "Aggiornato il"
2
18
  active_admin:
3
19
  dashboard: Dashboard
4
20
  dashboard_welcome:
@@ -37,6 +53,8 @@ it:
37
53
  lteq_datetime: "Minore o uguale a"
38
54
  from: "Da"
39
55
  to: "A"
56
+ scopes:
57
+ all: "Tutti"
40
58
  search_status:
41
59
  headline: "Situazione filtri:"
42
60
  current_scope: "Contesto selezionato:"
@@ -8,7 +8,7 @@ ja:
8
8
  edit: "編集"
9
9
  delete: "削除"
10
10
  delete_confirmation: "本当に削除しますか?"
11
- create_another: "%{model} を追加する"
11
+ create_another: "%{model} を続けて作成する"
12
12
  new_model: "%{model} を作成する"
13
13
  edit_model: "%{model} を編集する"
14
14
  delete_model: "%{model} を削除する"
@@ -18,7 +18,7 @@ ja:
18
18
  previous: "前"
19
19
  next: "次"
20
20
  download: "ダウンロード:"
21
- has_many_new: "新規に %{model} を追加する"
21
+ has_many_new: "%{model} を追加する"
22
22
  has_many_delete: "削除する"
23
23
  has_many_remove: "削除する"
24
24
  filters:
@@ -26,7 +26,7 @@ ja:
26
26
  filter: "絞り込む"
27
27
  clear: "条件を削除する"
28
28
  predicates:
29
- contains: "含まれています"
29
+ contains: "を含む"
30
30
  equals: "等しい"
31
31
  starts_with: "で始まる"
32
32
  ends_with: "で終わる"
@@ -69,7 +69,7 @@ ko:
69
69
  one: "성공적으로 1개 %{model}을/를 삭제하였습니다"
70
70
  other: "성공적으로 %{count}개의 %{plural_model}을/를 삭제하였습니다"
71
71
  selection_toggle_explanation: "(선택 항목 바꾸기)"
72
- action_label: "%{title} 선택됨"
72
+ action_label: "선택한 항목 %{title}"
73
73
  labels:
74
74
  destroy: "삭제"
75
75
  comments:
@@ -114,7 +114,7 @@ nl:
114
114
  submit: "inloggen"
115
115
  reset_password:
116
116
  title: "Wachtwoord vergeten?"
117
- submit: "Reset mijn wachtwoord vergeten"
117
+ submit: "Reset mijn wachtwoord"
118
118
  change_password:
119
119
  title: "Wijzig uw wachtwoord"
120
120
  submit: "Mijn wachtwoord wijzigen"
@@ -47,8 +47,9 @@ ro:
47
47
  multiple: "Sunt afisate <b>%{from}&nbsp;-&nbsp;%{to}</b> din <b>%{total}</b> inregistrari"
48
48
  multiple_without_total: "Sunt afisate <b>%{from}&nbsp;-&nbsp;%{to}</b>"
49
49
  entry:
50
- one: "inregistrare"
51
- other: "inregistrari"
50
+ one: "înregistrăre"
51
+ few: "înregistrări"
52
+ other: "înregistrări"
52
53
  any: "Oricare"
53
54
  blank_slate:
54
55
  content: "Momentan nu exista %{resource_name}."
@@ -3,11 +3,11 @@ vi:
3
3
  dashboard: Bảng điều khiển
4
4
  dashboard_welcome:
5
5
  welcome: "Chào mừng bạn đến với Active Admin. Đây là trang điều khiển mặc định."
6
- call_to_action: "Để thêm phần phần cho trang điều khiển hãy chỉnh sửa 'app/admin/dashboard.rb'"
6
+ call_to_action: "Để thêm thành phần cho trang điều khiển hãy chỉnh sửa 'app/admin/dashboard.rb'"
7
7
  view: "Xem"
8
8
  edit: "Chỉnh sửa"
9
9
  delete: "Xóa"
10
- delete_confirmation: "Bạn có chắc chắn rằng mình muốn xóa cái này?"
10
+ delete_confirmation: "Bạn có chắc chắn rằng mình muốn xóa không?"
11
11
  new_model: "Tạo mới %{model}"
12
12
  edit_model: "Chỉnh sửa %{model}"
13
13
  delete_model: "Xóa %{model}"
@@ -16,8 +16,8 @@ vi:
16
16
  cancel: "Hủy"
17
17
  empty: "Trống"
18
18
  previous: "Trước"
19
- next: "Tiếp"
20
- download: "Download:"
19
+ next: "Sau"
20
+ download: "Tải về:"
21
21
  has_many_new: "Thêm mới %{model}"
22
22
  has_many_delete: "Xóa"
23
23
  has_many_remove: "Hủy bỏ"
@@ -29,7 +29,7 @@ vi:
29
29
  contains: "Có chứa"
30
30
  equals: "Bằng"
31
31
  starts_with: "Bắt đầu với"
32
- ends_with: "Kết thúc với việc"
32
+ ends_with: "Kết thúc bởi"
33
33
  greater_than: "Lớn hơn"
34
34
  less_than: "Nhỏ hơn"
35
35
  gteq_datetime: "Lớn hơn hoặc bằng"
@@ -29,7 +29,7 @@ After installing the gem, you need to run the generator. Here are your options:
29
29
  rails g active_admin:install --skip-users
30
30
  ```
31
31
 
32
- * If you want to use an existing user class, provide it as an argument:
32
+ * If you want to customize the name of the generated user class, or if you want to use an existing user class, provide the class name as an argument:
33
33
 
34
34
  ```sh
35
35
  rails g active_admin:install User
@@ -51,8 +51,8 @@ The generator adds these core files, among others:
51
51
  Now, migrate and seed your database before starting the server:
52
52
 
53
53
  ```sh
54
- rake db:migrate
55
- rake db:seed
54
+ rails db:migrate
55
+ rails db:seed
56
56
  rails server
57
57
  ```
58
58
 
@@ -112,6 +112,30 @@ Draper::CollectionDecorator.send :delegate, :per_page_kaminari
112
112
 
113
113
  If you're getting the error `wrong number of arguments (6 for 4..5)`, [read #2703].
114
114
 
115
+ ## webpacker
116
+
117
+ You can **opt-in to using Webpacker for ActiveAdmin assets** as well by updating your configuration to turn on the `use_webpacker` option, either at installation time or manually.
118
+
119
+ * at active_admin installation:
120
+
121
+ ```sh
122
+ rails g active_admin:install --use_webpacker
123
+ ```
124
+
125
+ * manually:
126
+
127
+ ```ruby
128
+ ActiveAdmin.setup do |config|
129
+ config.use_webpacker = true
130
+ end
131
+ ```
132
+
133
+ And run the generator to get default Active Admin assets:
134
+
135
+ ```sh
136
+ rails g active_admin:webpacker
137
+ ```
138
+
115
139
  [CHANGELOG]: https://github.com/activeadmin/activeadmin/blob/master/CHANGELOG.md
116
140
  [dashboard.rb]: https://github.com/activeadmin/activeadmin/blob/master/lib/generators/active_admin/install/templates/dashboard.rb
117
141
  [active_admin.rb]: https://github.com/activeadmin/activeadmin/blob/master/lib/generators/active_admin/install/templates/active_admin.rb.erb
@@ -8,11 +8,6 @@ Active Admin allows you to use the decorator pattern to provide view-specific
8
8
  versions of a resource. [Draper](https://github.com/drapergem/draper) is
9
9
  recommended but not required.
10
10
 
11
- To use decorator support without Draper, your decorator must support a variety
12
- of collection methods to support pagination, filtering, etc. See
13
- [this github issue discussion](https://github.com/activeadmin/activeadmin/issues/3600)
14
- and [this gem](https://github.com/kiote/activeadmin-poro-decorator) for more details.
15
-
16
11
  ## Example usage
17
12
 
18
13
  ```ruby
@@ -42,6 +37,22 @@ ActiveAdmin.register Post do
42
37
  end
43
38
  ```
44
39
 
40
+ You can pass any decorator class as an argument to `decorate_with`
41
+ as long as it accepts the record to be decorated as a parameter in
42
+ the initializer, and responds to all the necessary methods.
43
+
44
+ ```ruby
45
+ # app/decorators/post_decorator.rb
46
+ class PostDecorator
47
+ attr_reader :post
48
+ delegate_missing_to :post
49
+
50
+ def initialize(post)
51
+ @post = post
52
+ end
53
+ end
54
+ ```
55
+
45
56
  ## Forms
46
57
 
47
58
  By default, ActiveAdmin does *not* decorate the resource used to render forms.
@@ -164,7 +164,8 @@ The menu method accepts a hash with the following options:
164
164
 
165
165
  * `:label` - The string or proc label to display in the menu. If it's a proc, it
166
166
  will be called each time the menu is rendered.
167
- * `:parent` - The string id (or label) of the parent used for this menu
167
+ * `:parent` - The string id (or label) of the parent used for this menu, or an array
168
+ of string ids (or labels) for a nested menu
168
169
  * `:if` - A block or a symbol of a method to call to decide if the menu item
169
170
  should be displayed
170
171
  * `:priority` - The integer value of the priority, which defaults to `10`
@@ -227,6 +228,14 @@ end
227
228
  Note that the "Blog" parent menu item doesn't even have to exist yet; it can be
228
229
  dynamically generated for you.
229
230
 
231
+ To further nest an item under a submenu, provide an array of parents.
232
+
233
+ ```ruby
234
+ ActiveAdmin.register Post do
235
+ menu parent: ["Admin", "Blog"]
236
+ end
237
+ ```
238
+
230
239
  ### Customizing Parent Menu Items
231
240
 
232
241
  All of the options given to a standard menu item are also available to
data/docs/5-forms.md CHANGED
@@ -56,7 +56,7 @@ Which looks for something like this:
56
56
 
57
57
  ```ruby
58
58
  # app/views/admin/posts/_form.html.arb
59
- insert_tag active_admin_form_for resource do |f|
59
+ active_admin_form_for [:admin, resource] do |f|
60
60
  inputs :title, :body
61
61
  actions
62
62
  end
@@ -110,8 +110,9 @@ ActiveAdmin.register Post do
110
110
  end
111
111
  end
112
112
  f.inputs do
113
- f.has_many :comment,
113
+ f.has_many :comments,
114
114
  new_record: 'Leave Comment',
115
+ remove_record: 'Remove Comment',
115
116
  allow_destroy: -> (c) { c.author?(current_admin_user) } do |b|
116
117
  b.input :body
117
118
  end
@@ -139,6 +140,10 @@ The `:new_record` option controls the visibility of the new record button (shown
139
140
  by default). If you pass a string, it will be used as the text for the new
140
141
  record button.
141
142
 
143
+ The `:remove_record` option controls the text of the remove button (shown after
144
+ the new record button is pressed). If you pass a string, it will be used as the
145
+ text for the remove button.
146
+
142
147
  The `:sortable` option adds a hidden field and will enable drag & drop sorting
143
148
  of the children. It expects the name of the column that will store the index of
144
149
  each child.
@@ -177,7 +182,8 @@ To display a list of all validation errors:
177
182
 
178
183
  ```ruby
179
184
  form do |f|
180
- f.semantic_errors *f.object.errors.keys
185
+ f.semantic_errors *f.object.errors.attribute_names
186
+
181
187
  # ...
182
188
  end
183
189
  ```
data/docs/6-show-pages.md CHANGED
@@ -79,3 +79,15 @@ ActiveAdmin.register Book do
79
79
  end
80
80
  end
81
81
  ```
82
+
83
+ If you want to keep the default show data, but add something extra to it:
84
+
85
+ ```ruby
86
+ show do
87
+ div do
88
+ h3 'Some custom charts about this object'
89
+ render partial: 'charts'
90
+ end
91
+ default_main_content
92
+ end
93
+ ```
@@ -62,7 +62,7 @@ HTTP verbs. In that case, this is the suggested approach:
62
62
  ```ruby
63
63
  member_action :foo, method: [:get, :post] do
64
64
  if request.post?
65
- resource.update_attributes! foo: params[:foo] || {}
65
+ resource.update! foo: params[:foo] || {}
66
66
  head :ok
67
67
  else
68
68
  render :foo
data/docs/Gemfile CHANGED
@@ -1,3 +1,4 @@
1
- source 'https://rubygems.org'
1
+ # frozen_string_literal: true
2
+ source "https://rubygems.org"
2
3
 
3
- gem 'github-pages'
4
+ gem "github-pages"