activeadmin 1.0.0.pre1 → 1.0.0.pre2

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 (167) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +18 -16
  3. data/CHANGELOG.md +18 -1013
  4. data/Gemfile +18 -11
  5. data/LICENSE +0 -5
  6. data/README.md +0 -2
  7. data/activeadmin.gemspec +3 -1
  8. data/app/assets/javascripts/active_admin/application.js.coffee +8 -3
  9. data/app/assets/javascripts/active_admin/base.js.coffee +1 -6
  10. data/app/assets/javascripts/active_admin/jquery_ui.js.erb +11 -0
  11. data/app/assets/javascripts/active_admin/lib/flash.js.coffee +1 -1
  12. data/app/assets/javascripts/active_admin/lib/modal_dialog.js.coffee +11 -3
  13. data/app/assets/javascripts/active_admin/lib/per_page.js.coffee +5 -1
  14. data/app/assets/stylesheets/active_admin/_base.scss +1 -4
  15. data/app/assets/stylesheets/active_admin/_forms.scss +13 -8
  16. data/app/assets/stylesheets/active_admin/components/_buttons.scss +0 -5
  17. data/app/assets/stylesheets/active_admin/mixins/_all.scss +0 -1
  18. data/app/assets/stylesheets/active_admin/mixins/_sections.scss +0 -1
  19. data/app/assets/stylesheets/active_admin/mixins/_typography.scss +1 -1
  20. data/app/assets/stylesheets/active_admin/mixins/_variables.scss +1 -1
  21. data/app/assets/stylesheets/active_admin/structure/_title_bar.scss +0 -5
  22. data/app/views/layouts/active_admin_logged_out.html.erb +4 -0
  23. data/config/locales/ar.yml +14 -2
  24. data/config/locales/de-CH.yml +2 -0
  25. data/config/locales/de.yml +15 -0
  26. data/config/locales/en.yml +10 -2
  27. data/config/locales/es.yml +26 -4
  28. data/config/locales/fr.yml +5 -0
  29. data/config/locales/id.yml +135 -0
  30. data/config/locales/ja.yml +21 -3
  31. data/config/locales/ko.yml +66 -36
  32. data/config/locales/nl.yml +14 -1
  33. data/config/locales/pt-BR.yml +11 -0
  34. data/config/locales/ru.yml +15 -1
  35. data/config/locales/sv-SE.yml +45 -5
  36. data/config/locales/uk.yml +16 -4
  37. data/config/locales/zh-CN.yml +5 -0
  38. data/config/locales/zh-TW.yml +32 -1
  39. data/docs/0-installation.md +7 -1
  40. data/docs/1-general-configuration.md +9 -0
  41. data/docs/10-custom-pages.md +10 -0
  42. data/docs/12-arbre-components.md +1 -1
  43. data/docs/14-gotchas.md +2 -2
  44. data/docs/2-resource-customization.md +5 -3
  45. data/docs/3-index-pages.md +7 -0
  46. data/docs/3-index-pages/index-as-table.md +4 -0
  47. data/docs/6-show-pages.md +1 -1
  48. data/docs/7-sidebars.md +8 -0
  49. data/features/index/batch_actions.feature +21 -2
  50. data/features/index/pagination.feature +16 -12
  51. data/features/meta_tags.feature +21 -0
  52. data/features/registering_assets.feature +1 -2
  53. data/features/show/columns.feature +40 -0
  54. data/features/show/default_content.feature +2 -1
  55. data/features/step_definitions/asset_steps.rb +3 -3
  56. data/features/step_definitions/batch_action_steps.rb +11 -2
  57. data/features/step_definitions/column_steps.rb +8 -0
  58. data/features/step_definitions/configuration_steps.rb +2 -2
  59. data/features/step_definitions/factory_steps.rb +3 -2
  60. data/features/step_definitions/meta_tag_steps.rb +3 -0
  61. data/features/step_definitions/pagination_steps.rb +8 -0
  62. data/features/step_definitions/table_steps.rb +2 -1
  63. data/lib/active_admin.rb +3 -3
  64. data/lib/active_admin/application.rb +66 -16
  65. data/lib/active_admin/batch_actions.rb +0 -1
  66. data/lib/active_admin/batch_actions/controller.rb +2 -2
  67. data/lib/active_admin/batch_actions/resource_extension.rb +3 -1
  68. data/lib/active_admin/callbacks.rb +1 -1
  69. data/lib/active_admin/csv_builder.rb +2 -2
  70. data/lib/active_admin/dependency.rb +18 -16
  71. data/lib/active_admin/devise.rb +1 -1
  72. data/lib/active_admin/dsl.rb +1 -1
  73. data/lib/active_admin/event.rb +8 -17
  74. data/lib/active_admin/filters/active.rb +29 -0
  75. data/lib/active_admin/filters/forms.rb +6 -1
  76. data/lib/active_admin/filters/humanized.rb +68 -0
  77. data/lib/active_admin/filters/resource_extension.rb +48 -1
  78. data/lib/active_admin/form_builder.rb +4 -4
  79. data/lib/active_admin/generators/boilerplate.rb +37 -0
  80. data/lib/active_admin/helpers/routes/url_helpers.rb +1 -1
  81. data/lib/active_admin/inputs.rb +1 -0
  82. data/lib/active_admin/inputs/filters/date_picker_input.rb +13 -0
  83. data/lib/active_admin/inputs/filters/date_range_input.rb +1 -1
  84. data/lib/active_admin/menu.rb +1 -0
  85. data/lib/active_admin/menu_item.rb +1 -1
  86. data/lib/active_admin/namespace.rb +5 -5
  87. data/lib/active_admin/orm/active_record/comments.rb +10 -1
  88. data/lib/active_admin/orm/active_record/comments/comment.rb +1 -1
  89. data/lib/active_admin/orm/active_record/comments/views/active_admin_comments.rb +11 -0
  90. data/lib/active_admin/resource.rb +9 -3
  91. data/lib/active_admin/resource/action_items.rb +13 -3
  92. data/lib/active_admin/resource/belongs_to.rb +6 -2
  93. data/lib/active_admin/resource/pagination.rb +4 -0
  94. data/lib/active_admin/resource_collection.rb +3 -1
  95. data/lib/active_admin/resource_controller/data_access.rb +6 -11
  96. data/lib/active_admin/resource_controller/decorators.rb +1 -1
  97. data/lib/active_admin/resource_dsl.rb +8 -2
  98. data/lib/active_admin/sidebar_section.rb +4 -12
  99. data/lib/active_admin/version.rb +1 -1
  100. data/lib/active_admin/view_factory.rb +1 -2
  101. data/lib/active_admin/view_helpers.rb +0 -1
  102. data/lib/active_admin/view_helpers/display_helper.rb +3 -4
  103. data/lib/active_admin/view_helpers/method_or_proc_helper.rb +3 -3
  104. data/lib/active_admin/views/components/active_admin_form.rb +3 -3
  105. data/lib/active_admin/views/components/columns.rb +9 -4
  106. data/lib/active_admin/views/components/dropdown_menu.rb +0 -2
  107. data/lib/active_admin/views/components/paginated_collection.rb +35 -13
  108. data/lib/active_admin/views/components/panel.rb +1 -3
  109. data/lib/active_admin/views/components/sidebar_section.rb +6 -1
  110. data/lib/active_admin/views/components/status_tag.rb +3 -2
  111. data/lib/active_admin/views/components/table_for.rb +2 -1
  112. data/lib/active_admin/views/index_as_table.rb +2 -2
  113. data/lib/active_admin/views/pages/base.rb +4 -0
  114. data/lib/active_admin/views/pages/show.rb +1 -1
  115. data/lib/generators/active_admin/assets/assets_generator.rb +1 -1
  116. data/lib/generators/active_admin/assets/templates/{active_admin.css.scss → active_admin.scss} +0 -0
  117. data/lib/generators/active_admin/devise/devise_generator.rb +7 -19
  118. data/lib/generators/active_admin/install/templates/active_admin.rb.erb +29 -0
  119. data/lib/generators/active_admin/page/templates/page.rb +1 -1
  120. data/lib/generators/active_admin/resource/resource_generator.rb +6 -0
  121. data/lib/generators/active_admin/resource/templates/admin.rb +34 -13
  122. data/spec/rails_helper.rb +6 -2
  123. data/spec/requests/memory_spec.rb +1 -3
  124. data/spec/support/active_admin_request_helpers.rb +27 -0
  125. data/spec/support/detect_rails_version.rb +1 -1
  126. data/spec/support/rails_template.rb +7 -0
  127. data/spec/unit/application_spec.rb +29 -4
  128. data/spec/unit/batch_actions/resource_spec.rb +5 -0
  129. data/spec/unit/belongs_to_spec.rb +14 -0
  130. data/spec/unit/comments_spec.rb +24 -2
  131. data/spec/unit/controller_filters_spec.rb +25 -28
  132. data/spec/unit/dsl_spec.rb +1 -1
  133. data/spec/unit/filters/humanized_spec.rb +56 -0
  134. data/spec/unit/filters/resource_spec.rb +1 -1
  135. data/spec/unit/form_builder_spec.rb +71 -11
  136. data/spec/unit/generators/install_spec.rb +3 -2
  137. data/spec/unit/pretty_format_spec.rb +15 -1
  138. data/spec/unit/resource_collection_spec.rb +17 -0
  139. data/spec/unit/resource_controller_spec.rb +2 -2
  140. data/spec/unit/resource_registration_spec.rb +3 -3
  141. data/spec/unit/resource_spec.rb +53 -2
  142. data/spec/unit/view_factory_spec.rb +0 -2
  143. data/spec/unit/view_helpers/display_name_spec.rb +6 -4
  144. data/spec/unit/views/components/{batch_action_popover_spec.rb → batch_action_selector_spec.rb} +9 -13
  145. data/spec/unit/views/components/columns_spec.rb +17 -0
  146. data/spec/unit/views/components/paginated_collection_spec.rb +16 -2
  147. data/spec/unit/views/components/panel_spec.rb +1 -5
  148. data/spec/unit/views/components/sidebar_section_spec.rb +21 -0
  149. data/spec/unit/views/components/status_tag_spec.rb +15 -1
  150. data/spec/unit/views/components/table_for_spec.rb +45 -0
  151. data/tasks/parallel_tests.rake +1 -1
  152. data/tasks/test.rake +4 -4
  153. metadata +29 -30
  154. data/app/assets/javascripts/active_admin/lib/popover.js.coffee +0 -68
  155. data/app/assets/stylesheets/active_admin/components/_popovers.scss +0 -122
  156. data/app/assets/stylesheets/active_admin/mixins/_icons.scss +0 -20
  157. data/lib/active_admin/batch_actions/views/batch_action_popover.rb +0 -28
  158. data/lib/active_admin/iconic.rb +0 -53
  159. data/lib/active_admin/iconic/icons.rb +0 -142
  160. data/lib/active_admin/view_helpers/icon_helper.rb +0 -12
  161. data/lib/active_admin/views/components/action_list_popover.rb +0 -29
  162. data/lib/active_admin/views/components/popover.rb +0 -27
  163. data/spec/javascripts/coffeescripts/jquery.aa.popover-spec.js.coffee +0 -82
  164. data/spec/support/integration_example_group.rb +0 -31
  165. data/spec/unit/event_spec.rb +0 -47
  166. data/spec/unit/views/components/action_list_popover_spec.rb +0 -40
  167. data/spec/unit/views/components/popover_spec.rb +0 -33
@@ -8,7 +8,6 @@ ActiveAdmin.before_load do |app|
8
8
 
9
9
  # Require all the views
10
10
  require "active_admin/batch_actions/views/batch_action_form"
11
- require "active_admin/batch_actions/views/batch_action_popover"
12
11
  require "active_admin/batch_actions/views/selection_cells"
13
12
  require "active_admin/batch_actions/views/batch_action_selector"
14
13
 
@@ -27,10 +27,10 @@ module ActiveAdmin
27
27
 
28
28
  COLLECTION_APPLIES = [
29
29
  :authorization_scope,
30
- :collection_decorator,
31
30
  :filtering,
32
31
  :scoping,
33
- :includes
32
+ :includes,
33
+ :collection_decorator
34
34
  ].freeze
35
35
 
36
36
  def batch_action_collection(only = COLLECTION_APPLIES)
@@ -53,7 +53,9 @@ module ActiveAdmin
53
53
 
54
54
  # Path to the batch action itself
55
55
  def batch_action_path(params = {})
56
- [route_collection_path(params), "batch_action"].join("/")
56
+ path = [route_collection_path(params), "batch_action"].join("/")
57
+ query = params.slice(:q, :scope).to_param
58
+ [path, query].reject(&:blank?).join("?")
57
59
  end
58
60
 
59
61
  private
@@ -7,7 +7,7 @@ module ActiveAdmin
7
7
  # Simple callback system. Implements before and after callbacks for
8
8
  # use within the controllers.
9
9
  #
10
- # We didn't use the ActiveSupport callbacks becuase they do not support
10
+ # We didn't use the ActiveSupport callbacks because they do not support
11
11
  # passing in any arbitrary object into the callback method (which we
12
12
  # need to do)
13
13
 
@@ -6,8 +6,8 @@ module ActiveAdmin
6
6
  # csv_builder = CSVBuilder.new
7
7
  # csv_builder.column :id
8
8
  # csv_builder.column("Name") { |resource| resource.full_name }
9
- # csv_builder.column(:name, humanize: false)
10
- # csv_builder.column("name", humanize: false) { |resource| resource.full_name }
9
+ # csv_builder.column(:name, humanize_name: false)
10
+ # csv_builder.column("name", humanize_name: false) { |resource| resource.full_name }
11
11
  #
12
12
  # csv_builder = CSVBuilder.new col_sep: ";"
13
13
  # csv_builder = CSVBuilder.new humanize_name: false
@@ -1,6 +1,8 @@
1
1
  module ActiveAdmin
2
2
  module Dependency
3
- DEVISE = '~> 3.2'
3
+ module Requirements
4
+ DEVISE = '~> 3.2'
5
+ end
4
6
 
5
7
  # Provides a clean interface to check for gem dependencies at runtime.
6
8
  #
@@ -54,38 +56,38 @@ module ActiveAdmin
54
56
  end
55
57
 
56
58
  class Matcher
59
+ attr_reader :name
60
+
57
61
  def initialize(name)
58
- @name, @spec = name, Gem.loaded_specs[name]
62
+ @name = name
63
+ end
64
+
65
+ def spec
66
+ @spec ||= Gem.loaded_specs[name]
67
+ end
68
+
69
+ def spec!
70
+ spec || raise(DependencyError, "To use #{name} you need to specify it in your Gemfile.")
59
71
  end
60
72
 
61
73
  def match?(*reqs)
62
- !!@spec && Gem::Requirement.create(reqs).satisfied_by?(@spec.version)
74
+ !!spec && Gem::Requirement.create(reqs).satisfied_by?(spec.version)
63
75
  end
64
76
 
65
77
  def match!(*reqs)
66
- unless @spec
67
- raise DependencyError, "To use #{@name} you need to specify it in your Gemfile."
68
- end
69
-
70
78
  unless match? reqs
71
- raise DependencyError, "You provided #{@spec.name} #{@spec.version} but we need: #{reqs.join ', '}."
79
+ raise DependencyError, "You provided #{spec!.name} #{spec!.version} but we need: #{reqs.join ', '}."
72
80
  end
73
81
  end
74
82
 
75
83
  include Comparable
76
84
 
77
85
  def <=>(other)
78
- if @spec
79
- @spec.version <=> Gem::Version.create(other)
80
- else
81
- # you'd otherwise get an unhelpful error message:
82
- # ArgumentError: comparison of ActiveAdmin::Dependency::Matcher with 2 failed
83
- raise DependencyError, "To use #{@name} you need to specify it in your Gemfile."
84
- end
86
+ spec!.version <=> Gem::Version.create(other)
85
87
  end
86
88
 
87
89
  def inspect
88
- info = @spec ? "#{@spec.name} #{@spec.version}" : '(missing)'
90
+ info = spec ? "#{spec.name} #{spec.version}" : '(missing)'
89
91
  "<ActiveAdmin::Dependency::Matcher for #{info}>"
90
92
  end
91
93
  end
@@ -1,4 +1,4 @@
1
- ActiveAdmin::Dependency.devise! ActiveAdmin::Dependency::DEVISE
1
+ ActiveAdmin::Dependency.devise! ActiveAdmin::Dependency::Requirements::DEVISE
2
2
 
3
3
  require 'devise'
4
4
 
@@ -128,7 +128,7 @@ module ActiveAdmin
128
128
  config.menu_item_options = options
129
129
  end
130
130
 
131
- # Set the name of the navigation menu to display. This is mainly used in conjuction with the
131
+ # Set the name of the navigation menu to display. This is mainly used in conjunction with the
132
132
  # `#belongs_to` functionality.
133
133
  #
134
134
  # @param [Symbol] menu_name The name of the menu to display as the global navigation
@@ -1,33 +1,24 @@
1
1
  module ActiveAdmin
2
2
 
3
3
  class EventDispatcher
4
- def initialize
5
- @events = {}
6
- end
7
-
8
- def clear_all_subscribers!
9
- @events = {}
10
- end
11
-
12
4
  def subscribe(*event_names, &block)
5
+ Deprecation.warn "`ActiveAdmin::Event.subscribe` is deprecated, use `ActiveSupport::Notifications.subscribe`"
13
6
  event_names.each do |event|
14
- @events[event] ||= []
15
- @events[event] << block
7
+ ActiveSupport::Notifications.subscribe event,
8
+ &wrap_block_for_active_support_notifications(block)
16
9
  end
17
10
  end
18
11
 
19
- def subscribers(event)
20
- @events[event] || []
12
+ def dispatch(event, *args)
13
+ Deprecation.warn "`ActiveAdmin::Event.dispatch` is deprecated, use `ActiveSupport::Notifications.publish`"
14
+ ActiveSupport::Notifications.publish event, *args
21
15
  end
22
16
 
23
- def dispatch(event, *args)
24
- subscribers(event).each do |subscriber|
25
- subscriber.call(*args)
26
- end
17
+ def wrap_block_for_active_support_notifications block
18
+ proc { |event, *args| block.call *args }
27
19
  end
28
20
  end
29
21
 
30
22
  # ActiveAdmin::Event is set to a dispatcher
31
23
  Event = EventDispatcher.new
32
-
33
24
  end
@@ -0,0 +1,29 @@
1
+ require 'active_admin/filters/humanized'
2
+
3
+ module ActiveAdmin
4
+ module Filters
5
+
6
+ class Active
7
+ attr_accessor :filters, :scope
8
+
9
+ def initialize(resource_class, params)
10
+ @resource_class, @params = resource_class, params
11
+ @scope = humanize_scope
12
+ @filters = build_filters
13
+ end
14
+
15
+ private
16
+
17
+ def build_filters
18
+ @params[:q] ||= []
19
+ @params[:q].map { |param| Humanized.new(param) }
20
+ end
21
+
22
+ def humanize_scope
23
+ scope = @params['scope']
24
+ scope ? scope.humanize : "All"
25
+ end
26
+ end
27
+
28
+ end
29
+ end
@@ -65,13 +65,18 @@ module ActiveAdmin
65
65
  buttons = content_tag :div, class: "buttons" do
66
66
  f.submit(I18n.t('active_admin.filters.buttons.filter')) +
67
67
  link_to(I18n.t('active_admin.filters.buttons.clear'), '#', class: 'clear_filters_btn') +
68
- hidden_field_tags_for(params, except: [:q, :page])
68
+ hidden_field_tags_for(params, except: except_hidden_fields)
69
69
  end
70
70
 
71
71
  f.template.concat buttons
72
72
  end
73
73
  end
74
74
 
75
+ private
76
+
77
+ def except_hidden_fields
78
+ [:q, :page]
79
+ end
75
80
  end
76
81
 
77
82
  end
@@ -0,0 +1,68 @@
1
+ module ActiveAdmin
2
+ module Filters
3
+
4
+ class Humanized
5
+ include ActiveAdmin::ViewHelpers
6
+
7
+ def initialize(param)
8
+ @body = param[0]
9
+ @value = param[1]
10
+ end
11
+
12
+ def value
13
+ @value.is_a?(::Array) ? @value.compact.join(', ') : @value
14
+ end
15
+
16
+ def body
17
+ predicate = ransack_predicate_translation
18
+
19
+ if current_predicate.nil?
20
+ predicate = @body.titleize
21
+ elsif translation_missing?(predicate)
22
+ predicate = active_admin_predicate_translation
23
+ end
24
+
25
+ "#{parse_parameter_body} #{predicate}".strip
26
+ end
27
+
28
+ private
29
+
30
+ def parse_parameter_body
31
+ return if current_predicate.nil?
32
+
33
+ # Accounting for strings that might contain other predicates. Example:
34
+ # 'requires_approval' contains the substring 'eq'
35
+ split_string = "_#{current_predicate}"
36
+
37
+ @body.split(split_string)
38
+ .first
39
+ .gsub('_', ' ')
40
+ .strip
41
+ .titleize
42
+ .gsub('Id', 'ID')
43
+ end
44
+
45
+ def current_predicate
46
+ @current_predicate ||= predicates.detect { |p| @body.include?(p) }
47
+ end
48
+
49
+ def predicates
50
+ Ransack::Predicate.names_by_decreasing_length
51
+ end
52
+
53
+ def ransack_predicate_translation
54
+ I18n.t("ransack.predicates.#{current_predicate}")
55
+ end
56
+
57
+ def active_admin_predicate_translation
58
+ translation = I18n.t("active_admin.filters.predicates.#{current_predicate}").downcase
59
+ end
60
+
61
+ def translation_missing?(predicate)
62
+ predicate.downcase.include?('translation missing')
63
+ end
64
+
65
+ end
66
+
67
+ end
68
+ end
@@ -1,3 +1,5 @@
1
+ require 'active_admin/filters/active'
2
+
1
3
  module ActiveAdmin
2
4
  module Filters
3
5
 
@@ -12,10 +14,11 @@ module ActiveAdmin
12
14
  def initialize(*)
13
15
  super
14
16
  add_filters_sidebar_section
17
+ add_search_status_sidebar_section
15
18
  end
16
19
 
17
20
  # Returns the filters for this resource. If filters are not enabled,
18
- # it will always return an empty array.
21
+ # it will always return an empty hash.
19
22
  #
20
23
  # @return [Hash] Filters that apply for this resource
21
24
  def filters
@@ -29,11 +32,23 @@ module ActiveAdmin
29
32
  @filters_enabled = bool
30
33
  end
31
34
 
35
+ # Setter to enable/disable showing current filters on this resource.
36
+ #
37
+ # Set to `nil` to inherit the setting from the namespace
38
+ def current_filters=(bool)
39
+ @current_filters_enabled = bool
40
+ end
41
+
32
42
  # @return [Boolean] If filters are enabled for this resource
33
43
  def filters_enabled?
34
44
  @filters_enabled.nil? ? namespace.filters : @filters_enabled
35
45
  end
36
46
 
47
+ # @return [Boolean] If show current filters are enabled for this resource
48
+ def current_filters_enabled?
49
+ @current_filters_enabled.nil? ? namespace.current_filters : @current_filters_enabled
50
+ end
51
+
37
52
  def preserve_default_filters!
38
53
  @preserve_default_filters = true
39
54
  end
@@ -137,6 +152,38 @@ module ActiveAdmin
137
152
  end
138
153
  end
139
154
 
155
+ def add_search_status_sidebar_section
156
+ if current_filters_enabled?
157
+ self.sidebar_sections << search_status_section
158
+ end
159
+ end
160
+
161
+ def search_status_section
162
+ ActiveAdmin::SidebarSection.new :search_status, only: :index, if: -> { params[:q] || params[:scope] } do
163
+ active = ActiveAdmin::Filters::Active.new(resource_class, params)
164
+
165
+ span do
166
+ h4 I18n.t("active_admin.search_status.headline"), style: 'display: inline'
167
+ b active.scope, style: "display: inline"
168
+
169
+ div style: "margin-top: 10px" do
170
+ h4 I18n.t("active_admin.search_status.current_filters"), style: 'margin-bottom: 10px'
171
+ ul do
172
+ if active.filters.blank?
173
+ li I18n.t("active_admin.search_status.no_current_filters")
174
+ else
175
+ active.filters.each do |filter|
176
+ li do
177
+ span filter.body
178
+ b filter.value
179
+ end
180
+ end
181
+ end
182
+ end
183
+ end
184
+ end
185
+ end
186
+ end
140
187
  end
141
188
 
142
189
  end
@@ -4,7 +4,7 @@ module Formtastic
4
4
  module Base
5
5
  def input_wrapping(&block)
6
6
  html = super
7
- template.concat(html) if template.output_buffer && template.assigns['has_many_block']
7
+ template.concat(html) if template.output_buffer && template.assigns[:has_many_block]
8
8
  html
9
9
  end
10
10
  end
@@ -60,8 +60,8 @@ module ActiveAdmin
60
60
  template.concat has_many_actions(has_many_form, builder_options, "".html_safe)
61
61
  end
62
62
 
63
- template.assign('has_many_block'=> true)
64
- contents = without_wrapper { inputs(options, &form_block) }
63
+ template.assign(has_many_block: true)
64
+ contents = without_wrapper { inputs(options, &form_block) } || "".html_safe
65
65
 
66
66
  if builder_options[:new_record]
67
67
  contents << js_for_has_many(assoc, form_block, template, builder_options[:new_record], options[:class])
@@ -93,7 +93,7 @@ module ActiveAdmin
93
93
  has_many_form.input builder_options[:sortable], as: :hidden
94
94
 
95
95
  contents << template.content_tag(:li, class: 'handle') do
96
- Iconic.icon :move_vertical
96
+ "MOVE"
97
97
  end
98
98
  end
99
99
 
@@ -0,0 +1,37 @@
1
+ module ActiveAdmin
2
+ module Generators
3
+ class Boilerplate
4
+ def initialize(class_name)
5
+ @class_name = class_name
6
+ end
7
+
8
+ def attributes
9
+ @class_name.constantize.new.attributes.keys
10
+ end
11
+
12
+ def rows
13
+ attributes.map { |a| row(a) }.join("\n")
14
+ end
15
+
16
+ def row(name)
17
+ "# row :#{name.gsub(/_id$/, '')}"
18
+ end
19
+
20
+ def columns
21
+ attributes.map { |a| column(a) }.join("\n")
22
+ end
23
+
24
+ def column(name)
25
+ "# column :#{name.gsub(/_id$/, '')}"
26
+ end
27
+
28
+ def filters
29
+ attributes.map { |a| filter(a) }.join("\n")
30
+ end
31
+
32
+ def filter(name)
33
+ "# filter :#{name.gsub(/_id$/, '')}"
34
+ end
35
+ end
36
+ end
37
+ end