administrate 0.20.1 → 1.0.0

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 (105) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +9 -9
  3. data/app/assets/builds/administrate/application.css +2614 -0
  4. data/app/assets/builds/administrate/application.css.map +1 -0
  5. data/app/assets/builds/administrate/application.js +31661 -0
  6. data/app/assets/builds/administrate/application.js.map +7 -0
  7. data/app/assets/builds/administrate-internal/docs.css +102 -0
  8. data/app/assets/builds/administrate-internal/docs.css.map +1 -0
  9. data/app/assets/config/administrate_manifest.js +2 -0
  10. data/app/assets/javascripts/administrate/add_jquery.js +4 -0
  11. data/app/assets/javascripts/administrate/application.js +9 -4
  12. data/app/assets/javascripts/administrate/controllers/application.js +9 -0
  13. data/app/assets/javascripts/administrate/controllers/index.js +9 -0
  14. data/app/assets/javascripts/administrate/controllers/select_controller.js +25 -0
  15. data/app/assets/javascripts/administrate/{components/table.js → controllers/table_controller.js} +9 -9
  16. data/app/assets/javascripts/administrate/controllers/tooltip_controller.js +24 -0
  17. data/app/assets/javascripts/administrate/vendor/css-anchor-positioning.js +9310 -0
  18. data/app/assets/stylesheets/administrate/application.scss +3 -3
  19. data/app/assets/stylesheets/administrate/base/_forms.scss +4 -4
  20. data/app/assets/stylesheets/administrate/base/_layout.scss +5 -0
  21. data/app/assets/stylesheets/administrate/base/_tables.scss +1 -1
  22. data/app/assets/stylesheets/administrate/base/_typography.scss +15 -1
  23. data/app/assets/stylesheets/administrate/components/_attributes.scss +1 -0
  24. data/app/assets/stylesheets/administrate/components/_buttons.scss +37 -12
  25. data/app/assets/stylesheets/administrate/components/_cells.scss +26 -19
  26. data/app/assets/stylesheets/administrate/components/_field-unit.scss +3 -3
  27. data/app/assets/stylesheets/administrate/components/_main-content.scss +1 -1
  28. data/app/assets/stylesheets/administrate/components/_navigation.scss +3 -3
  29. data/app/assets/stylesheets/administrate/components/_search.scss +55 -14
  30. data/app/assets/stylesheets/administrate/library/_variables.scss +7 -3
  31. data/app/assets/stylesheets/administrate/reset/_normalize.scss +7 -1
  32. data/app/assets/stylesheets/{docs.scss → administrate-internal/docs.scss} +25 -23
  33. data/app/controllers/administrate/application_controller.rb +27 -39
  34. data/app/controllers/concerns/administrate/punditize.rb +4 -12
  35. data/app/helpers/administrate/application_helper.rb +13 -5
  36. data/app/views/administrate/application/_collection.html.erb +30 -20
  37. data/app/views/administrate/application/_collection_header_actions.html.erb +1 -1
  38. data/app/views/administrate/application/_collection_item_actions.html.erb +4 -4
  39. data/app/views/administrate/application/_form.html.erb +1 -1
  40. data/app/views/administrate/application/_icons.html.erb +14 -6
  41. data/app/views/administrate/application/_index_header.html.erb +23 -0
  42. data/app/views/administrate/application/_javascript.html.erb +1 -1
  43. data/app/views/administrate/application/edit.html.erb +15 -3
  44. data/app/views/administrate/application/index.html.erb +20 -11
  45. data/app/views/administrate/application/new.html.erb +16 -4
  46. data/app/views/administrate/application/show.html.erb +35 -23
  47. data/app/views/fields/belongs_to/_form.html.erb +3 -2
  48. data/app/views/fields/has_many/_form.html.erb +2 -2
  49. data/app/views/fields/has_one/_form.html.erb +6 -0
  50. data/app/views/fields/polymorphic/_form.html.erb +1 -1
  51. data/app/views/fields/rich_text/_form.html.erb +22 -0
  52. data/app/views/fields/rich_text/_index.html.erb +18 -0
  53. data/app/views/fields/rich_text/_show.html.erb +18 -0
  54. data/app/views/fields/select/_form.html.erb +2 -1
  55. data/app/views/fields/text/_form.html.erb +1 -1
  56. data/app/views/layouts/administrate/application.html.erb +1 -2
  57. data/docs/customizing_dashboards.md +214 -11
  58. data/docs/customizing_page_views.md +47 -0
  59. data/docs/guides/scoping_has_many_relations.md +2 -2
  60. data/docs/guides/switching_templates_with_view_variants.md +45 -0
  61. data/docs/guides.md +1 -0
  62. data/docs/migrating-to-v1.md +34 -0
  63. data/lib/administrate/base_dashboard.rb +6 -11
  64. data/lib/administrate/engine.rb +7 -6
  65. data/lib/administrate/field/associative.rb +8 -23
  66. data/lib/administrate/field/base.rb +40 -5
  67. data/lib/administrate/field/belongs_to.rb +8 -8
  68. data/lib/administrate/field/date.rb +6 -2
  69. data/lib/administrate/field/date_time.rb +3 -4
  70. data/lib/administrate/field/deferred.rb +14 -18
  71. data/lib/administrate/field/has_many.rb +25 -6
  72. data/lib/administrate/field/has_one.rb +11 -15
  73. data/lib/administrate/field/number.rb +2 -2
  74. data/lib/administrate/field/password.rb +4 -0
  75. data/lib/administrate/field/polymorphic.rb +4 -4
  76. data/lib/administrate/field/rich_text.rb +21 -0
  77. data/lib/administrate/field/select.rb +4 -0
  78. data/lib/administrate/field/time.rb +5 -4
  79. data/lib/administrate/generator_helpers.rb +1 -1
  80. data/lib/administrate/namespace/resource.rb +1 -1
  81. data/lib/administrate/namespace.rb +10 -10
  82. data/lib/administrate/order.rb +37 -33
  83. data/lib/administrate/page/base.rb +2 -7
  84. data/lib/administrate/page/collection.rb +2 -2
  85. data/lib/administrate/page/form.rb +1 -1
  86. data/lib/administrate/page/show.rb +1 -1
  87. data/lib/administrate/resource_resolver.rb +1 -1
  88. data/lib/administrate/search.rb +14 -16
  89. data/lib/administrate/version.rb +1 -1
  90. data/lib/administrate/view_generator.rb +4 -3
  91. data/lib/administrate.rb +0 -38
  92. data/lib/generators/administrate/dashboard/dashboard_generator.rb +12 -9
  93. data/lib/generators/administrate/field/field_generator.rb +2 -2
  94. data/lib/generators/administrate/install/install_generator.rb +3 -2
  95. data/lib/generators/administrate/routes/routes_generator.rb +6 -5
  96. data/lib/generators/administrate/views/field_generator.rb +2 -2
  97. data/lib/generators/administrate/views/index_generator.rb +5 -0
  98. data/lib/generators/administrate/views/layout_generator.rb +1 -1
  99. metadata +35 -76
  100. data/app/assets/javascripts/administrate/components/associative.js +0 -5
  101. data/app/assets/javascripts/administrate/components/select.js +0 -3
  102. data/app/assets/stylesheets/administrate/utilities/_text-color.scss +0 -3
  103. data/lib/generators/administrate/assets/assets_generator.rb +0 -12
  104. data/lib/generators/administrate/assets/javascripts_generator.rb +0 -17
  105. data/lib/generators/administrate/assets/stylesheets_generator.rb +0 -17
@@ -1,19 +1,19 @@
1
1
  module Administrate
2
2
  class Order
3
- def initialize(attribute = nil, direction = nil, association_attribute: nil)
3
+ def initialize(attribute = nil, direction = nil, sorting_column: nil)
4
4
  @attribute = attribute
5
5
  @direction = sanitize_direction(direction)
6
- @association_attribute = association_attribute
6
+ @sorting_column = sorting_column || attribute
7
7
  end
8
8
 
9
9
  def apply(relation)
10
10
  return order_by_association(relation) unless
11
11
  reflect_association(relation).nil?
12
12
 
13
- order = relation.arel_table[attribute].public_send(direction)
13
+ order = relation.arel_table[sorting_column].public_send(direction)
14
14
 
15
15
  return relation.reorder(order) if
16
- column_exist?(relation, attribute)
16
+ column_exist?(relation, sorting_column)
17
17
 
18
18
  relation
19
19
  end
@@ -33,7 +33,7 @@ module Administrate
33
33
 
34
34
  private
35
35
 
36
- attr_reader :attribute, :association_attribute
36
+ attr_reader :attribute, :sorting_column
37
37
 
38
38
  def sanitize_direction(direction)
39
39
  %w[asc desc].include?(direction.to_s) ? direction.to_sym : :asc
@@ -48,7 +48,7 @@ module Administrate
48
48
  end
49
49
 
50
50
  def opposite_direction
51
- direction == :asc ? :desc : :asc
51
+ (direction == :asc) ? :desc : :asc
52
52
  end
53
53
 
54
54
  def order_by_association(relation)
@@ -67,15 +67,15 @@ module Administrate
67
67
  def order_by_count(relation)
68
68
  klass = reflect_association(relation).klass
69
69
  query = klass.arel_table[klass.primary_key].count.public_send(direction)
70
- relation.
71
- left_joins(attribute.to_sym).
72
- group(:id).
73
- reorder(query)
70
+ relation
71
+ .left_joins(attribute.to_sym)
72
+ .group(:id)
73
+ .reorder(query)
74
74
  end
75
75
 
76
76
  def order_by_belongs_to(relation)
77
77
  if ordering_by_association_column?(relation)
78
- order_by_attribute(relation)
78
+ order_by_association_attribute(relation)
79
79
  else
80
80
  order_by_id(relation)
81
81
  end
@@ -83,30 +83,20 @@ module Administrate
83
83
 
84
84
  def order_by_has_one(relation)
85
85
  if ordering_by_association_column?(relation)
86
- order_by_attribute(relation)
86
+ order_by_association_attribute(relation)
87
87
  else
88
88
  order_by_association_id(relation)
89
89
  end
90
90
  end
91
91
 
92
- def order_by_attribute(relation)
93
- relation.joins(
94
- attribute.to_sym,
95
- ).reorder(order_by_attribute_query)
96
- end
97
-
98
92
  def order_by_id(relation)
99
93
  relation.reorder(order_by_id_query(relation))
100
94
  end
101
95
 
102
- def order_by_association_id(relation)
103
- relation.reorder(order_by_association_id_query)
104
- end
105
-
106
96
  def ordering_by_association_column?(relation)
107
- association_attribute &&
97
+ (attribute != sorting_column) &&
108
98
  column_exist?(
109
- reflect_association(relation).klass, association_attribute.to_sym
99
+ reflect_association(relation).klass, sorting_column.to_sym
110
100
  )
111
101
  end
112
102
 
@@ -115,16 +105,26 @@ module Administrate
115
105
  end
116
106
 
117
107
  def order_by_id_query(relation)
118
- relation.arel_table[foreign_key(relation)].public_send(direction)
108
+ relation.arel_table[association_foreign_key(relation)].public_send(direction)
119
109
  end
120
110
 
121
- def order_by_association_id_query
122
- Arel::Table.new(association_table_name)[:id].public_send(direction)
111
+ def order_by_association_id(relation)
112
+ order_by_association_column(relation, association_primary_key(relation))
123
113
  end
124
114
 
125
- def order_by_attribute_query
126
- table = Arel::Table.new(association_table_name)
127
- table[association_attribute].public_send(direction)
115
+ def order_by_association_attribute(relation)
116
+ order_by_association_column(relation, sorting_column)
117
+ end
118
+
119
+ def order_by_association_column(relation, column_name)
120
+ relation.joins(
121
+ attribute.to_sym
122
+ ).reorder(order_by_association_column_query(relation, column_name))
123
+ end
124
+
125
+ def order_by_association_column_query(relation, column)
126
+ table = Arel::Table.new(association_table_name(relation))
127
+ table[column].public_send(direction)
128
128
  end
129
129
 
130
130
  def relation_type(relation)
@@ -135,12 +135,16 @@ module Administrate
135
135
  relation.klass.reflect_on_association(attribute.to_s)
136
136
  end
137
137
 
138
- def foreign_key(relation)
138
+ def association_foreign_key(relation)
139
139
  reflect_association(relation).foreign_key
140
140
  end
141
141
 
142
- def association_table_name
143
- attribute.tableize
142
+ def association_primary_key(relation)
143
+ reflect_association(relation).association_primary_key
144
+ end
145
+
146
+ def association_table_name(relation)
147
+ reflect_association(relation).table_name
144
148
  end
145
149
  end
146
150
  end
@@ -12,7 +12,7 @@ module Administrate
12
12
  end
13
13
 
14
14
  def resource_path
15
- @resource_path ||= resource_name.gsub("/", "_")
15
+ @resource_path ||= resource_name.tr("/", "_")
16
16
  end
17
17
 
18
18
  def collection_includes
@@ -30,13 +30,8 @@ module Administrate
30
30
  private
31
31
 
32
32
  def attribute_field(dashboard, resource, attribute_name, page)
33
- value = get_attribute_value(resource, attribute_name)
34
33
  field = dashboard.attribute_type_for(attribute_name)
35
- field.new(attribute_name, value, page, resource: resource)
36
- end
37
-
38
- def get_attribute_value(resource, attribute_name)
39
- resource.public_send(attribute_name)
34
+ field.new(attribute_name, nil, page, resource: resource)
40
35
  end
41
36
 
42
37
  attr_reader :dashboard, :options
@@ -5,7 +5,7 @@ module Administrate
5
5
  class Collection < Page::Base
6
6
  def attribute_names
7
7
  options.fetch(:collection_attributes, nil) ||
8
- dashboard.collection_attributes
8
+ dashboard.collection_attributes
9
9
  end
10
10
 
11
11
  def attributes_for(resource)
@@ -25,7 +25,7 @@ module Administrate
25
25
  delegate :ordered_by?, to: :order
26
26
 
27
27
  def order_params_for(attr, key: resource_name)
28
- { key => order.order_params_for(attr) }
28
+ {key => order.order_params_for(attr)}
29
29
  end
30
30
 
31
31
  private
@@ -14,7 +14,7 @@ module Administrate
14
14
  attributes = dashboard.form_attributes(action)
15
15
 
16
16
  if attributes.is_a? Array
17
- attributes = { "" => attributes }
17
+ attributes = {"" => attributes}
18
18
  end
19
19
 
20
20
  attributes.transform_values do |attrs|
@@ -18,7 +18,7 @@ module Administrate
18
18
  attributes = dashboard.show_page_attributes
19
19
 
20
20
  if attributes.is_a? Array
21
- attributes = { "" => attributes }
21
+ attributes = {"" => attributes}
22
22
  end
23
23
 
24
24
  attributes.transform_values do |attrs|
@@ -35,7 +35,7 @@ module Administrate
35
35
  end
36
36
 
37
37
  def controller_path_parts
38
- path_parts = controller_path.split("/")[1..-1]
38
+ path_parts = controller_path.split("/")[1..]
39
39
  path_parts << path_parts.pop.singularize
40
40
  end
41
41
 
@@ -59,8 +59,15 @@ module Administrate
59
59
  @scoped_resource.all
60
60
  else
61
61
  results = search_results(@scoped_resource)
62
- results = filter_results(results)
63
- results
62
+ filter_results(results)
63
+ end
64
+ end
65
+
66
+ def valid_filters
67
+ if @dashboard.class.const_defined?(:COLLECTION_FILTERS)
68
+ @dashboard.class.const_get(:COLLECTION_FILTERS).stringify_keys
69
+ else
70
+ {}
64
71
  end
65
72
  end
66
73
 
@@ -112,17 +119,9 @@ module Administrate
112
119
  end
113
120
 
114
121
  def search_results(resources)
115
- resources.
116
- left_joins(tables_to_join).
117
- where(query_template, *query_values)
118
- end
119
-
120
- def valid_filters
121
- if @dashboard.class.const_defined?(:COLLECTION_FILTERS)
122
- @dashboard.class.const_get(:COLLECTION_FILTERS).stringify_keys
123
- else
124
- {}
125
- end
122
+ resources
123
+ .left_joins(tables_to_join)
124
+ .where(query_template, *query_values)
126
125
  end
127
126
 
128
127
  def attribute_types
@@ -134,15 +133,14 @@ module Administrate
134
133
  provided_class_name = attribute_types[attr].options[:class_name]
135
134
  unquoted_table_name =
136
135
  if provided_class_name
137
- Administrate.warn_of_deprecated_option(:class_name)
138
136
  provided_class_name.constantize.table_name
139
137
  else
140
138
  @scoped_resource.reflect_on_association(attr).klass.table_name
141
139
  end
142
140
  ActiveRecord::Base.connection.quote_table_name(unquoted_table_name)
143
141
  else
144
- ActiveRecord::Base.connection.
145
- quote_table_name(@scoped_resource.table_name)
142
+ ActiveRecord::Base.connection
143
+ .quote_table_name(@scoped_resource.table_name)
146
144
  end
147
145
  end
148
146
 
@@ -1,3 +1,3 @@
1
1
  module Administrate
2
- VERSION = "0.20.1".freeze
2
+ VERSION = "1.0.0".freeze
3
3
  end
@@ -5,17 +5,18 @@ require "administrate/namespace"
5
5
  module Administrate
6
6
  class ViewGenerator < Rails::Generators::Base
7
7
  include Administrate::GeneratorHelpers
8
+
8
9
  class_option(
9
10
  :namespace,
10
11
  type: :string,
11
12
  desc: "Namespace where the admin dashboards live",
12
- default: "admin",
13
+ default: "admin"
13
14
  )
14
15
 
15
16
  def self.template_source_path
16
17
  File.expand_path(
17
18
  "../../../app/views/administrate/application",
18
- __FILE__,
19
+ __FILE__
19
20
  )
20
21
  end
21
22
 
@@ -30,7 +31,7 @@ module Administrate
30
31
 
31
32
  copy_file(
32
33
  template_file,
33
- "app/views/#{namespace}/#{resource_path}/#{template_file}",
34
+ "app/views/#{namespace}/#{resource_path}/#{template_file}"
34
35
  )
35
36
  end
36
37
 
data/lib/administrate.rb CHANGED
@@ -2,44 +2,6 @@ require "administrate/engine"
2
2
  require "administrate/version"
3
3
 
4
4
  module Administrate
5
- def self.warn_of_missing_resource_class
6
- deprecator.warn(
7
- "Calling Field::Base.permitted_attribute without the option " +
8
- ":resource_class is deprecated. If you are seeing this " +
9
- "message, you are probably using a custom field type that" +
10
- "does this. Please make sure to update it to a version that " +
11
- "does not use a deprecated API",
12
- )
13
- end
14
-
15
- def self.warn_of_deprecated_option(name)
16
- deprecator.warn(
17
- "The option :#{name} is deprecated. " +
18
- "Administrate should detect it automatically. " +
19
- "Please file an issue at " +
20
- "https://github.com/thoughtbot/administrate/issues " +
21
- "if you think otherwise.",
22
- )
23
- end
24
-
25
- def self.warn_of_deprecated_method(klass, method)
26
- deprecator.warn(
27
- "The method #{klass}##{method} is deprecated. " +
28
- "If you are seeing this message you are probably " +
29
- "using a dashboard that depends explicitly on it. " +
30
- "Please make sure you update it to a version that " +
31
- "does not use a deprecated API",
32
- )
33
- end
34
-
35
- def self.warn_of_deprecated_authorization_method(method)
36
- deprecator.warn(
37
- "The method `#{method}` is deprecated. " +
38
- "Please use `accessible_action?` instead, " +
39
- "or see the documentation for other options.",
40
- )
41
- end
42
-
43
5
  def self.deprecator
44
6
  @deprecator ||= ActiveSupport::Deprecation.new(VERSION, "Administrate")
45
7
  end
@@ -13,14 +13,14 @@ module Administrate
13
13
  time: "Field::Time",
14
14
  text: "Field::Text",
15
15
  string: "Field::String",
16
- uuid: "Field::String",
16
+ uuid: "Field::String"
17
17
  }
18
18
 
19
19
  ATTRIBUTE_OPTIONS_MAPPING = {
20
20
  # procs must be defined in one line!
21
- enum: { searchable: false,
22
- collection: ->(field) { field.resource.class.send(field.attribute.to_s.pluralize).keys } },
23
- float: { decimals: 2 },
21
+ enum: {searchable: false,
22
+ collection: ->(field) { field.resource.class.send(field.attribute.to_s.pluralize).keys }},
23
+ float: {decimals: 2}
24
24
  }
25
25
 
26
26
  DEFAULT_FIELD_TYPE = "Field::String.with_options(searchable: false)"
@@ -31,21 +31,24 @@ module Administrate
31
31
  :namespace,
32
32
  type: :string,
33
33
  desc: "Namespace where the admin dashboards live",
34
- default: "admin",
34
+ default: "admin"
35
35
  )
36
36
 
37
37
  source_root File.expand_path("../templates", __FILE__)
38
38
 
39
39
  def create_dashboard_definition
40
+ scope = regular_class_path.join("/")
41
+
40
42
  template(
41
43
  "dashboard.rb.erb",
42
- Rails.root.join("app/dashboards/#{file_name}_dashboard.rb"),
44
+ Rails.root.join("app/dashboards/#{scope}/#{file_name}_dashboard.rb")
43
45
  )
44
46
  end
45
47
 
46
48
  def create_resource_controller
49
+ scope = "#{namespace}/#{regular_class_path.join("/")}"
47
50
  destination = Rails.root.join(
48
- "app/controllers/#{namespace}/#{file_name.pluralize}_controller.rb",
51
+ "app/controllers/#{scope}/#{file_name.pluralize}_controller.rb"
49
52
  )
50
53
 
51
54
  template("controller.rb.erb", destination)
@@ -72,7 +75,7 @@ module Administrate
72
75
  primary_key,
73
76
  *attrs.sort,
74
77
  created_at,
75
- updated_at,
78
+ updated_at
76
79
  ].compact
77
80
  end
78
81
 
@@ -116,7 +119,7 @@ module Administrate
116
119
 
117
120
  def enum_column?(attr)
118
121
  klass.respond_to?(:defined_enums) &&
119
- klass.defined_enums.keys.include?(attr)
122
+ klass.defined_enums.key?(attr)
120
123
  end
121
124
 
122
125
  def column_types(attr)
@@ -6,7 +6,7 @@ module Administrate
6
6
  def template_field_object
7
7
  template(
8
8
  "field_object.rb.erb",
9
- "app/fields/#{file_name}_field.rb",
9
+ "app/fields/#{file_name}_field.rb"
10
10
  )
11
11
  end
12
12
 
@@ -23,7 +23,7 @@ module Administrate
23
23
 
24
24
  copy_file(
25
25
  partial,
26
- "app/views/fields/#{file_name}_field/#{partial}",
26
+ "app/views/fields/#{file_name}_field/#{partial}"
27
27
  )
28
28
  end
29
29
  end
@@ -12,13 +12,14 @@ module Administrate
12
12
  module Generators
13
13
  class InstallGenerator < Rails::Generators::Base
14
14
  include Administrate::GeneratorHelpers
15
+
15
16
  source_root File.expand_path("../templates", __FILE__)
16
17
 
17
18
  class_option(
18
19
  :namespace,
19
20
  type: :string,
20
21
  desc: "Namespace where the admin dashboards will live",
21
- default: "admin",
22
+ default: "admin"
22
23
  )
23
24
 
24
25
  def run_routes_generator
@@ -31,7 +32,7 @@ module Administrate
31
32
  def create_dashboard_controller
32
33
  template(
33
34
  "application_controller.rb.erb",
34
- "app/controllers/#{namespace}/application_controller.rb",
35
+ "app/controllers/#{namespace}/application_controller.rb"
35
36
  )
36
37
  end
37
38
 
@@ -13,12 +13,13 @@ module Administrate
13
13
  module Generators
14
14
  class RoutesGenerator < Rails::Generators::Base
15
15
  include Administrate::GeneratorHelpers
16
+
16
17
  source_root File.expand_path("../templates", __FILE__)
17
18
  class_option(
18
19
  :namespace,
19
20
  type: :string,
20
21
  desc: "Namespace where the admin dashboards live",
21
- default: "admin",
22
+ default: "admin"
22
23
  )
23
24
 
24
25
  def insert_dashboard_routes
@@ -61,10 +62,10 @@ module Administrate
61
62
  end
62
63
 
63
64
  def database_models
64
- ActiveRecord::Base.descendants.
65
- reject(&:abstract_class?).
66
- reject { |k| k < Administrate::Generators::TestRecord }.
67
- sort_by(&:to_s)
65
+ ActiveRecord::Base.descendants
66
+ .reject(&:abstract_class?)
67
+ .reject { |k| k < Administrate::Generators::TestRecord }
68
+ .sort_by(&:to_s)
68
69
  end
69
70
 
70
71
  def invalid_dashboard_models
@@ -7,7 +7,7 @@ module Administrate
7
7
  def self.template_source_path
8
8
  File.expand_path(
9
9
  "../../../../../app/views/fields/",
10
- __FILE__,
10
+ __FILE__
11
11
  )
12
12
  end
13
13
 
@@ -41,7 +41,7 @@ module Administrate
41
41
 
42
42
  copy_file(
43
43
  template_file,
44
- "app/views/fields/#{template_file}",
44
+ "app/views/fields/#{template_file}"
45
45
  )
46
46
  end
47
47
  end
@@ -9,6 +9,11 @@ module Administrate
9
9
  def copy_template
10
10
  copy_resource_template("index")
11
11
  copy_resource_template("_collection")
12
+ copy_resource_template("_collection_header_actions")
13
+ copy_resource_template("_collection_item_actions")
14
+ copy_resource_template("_index_header")
15
+ copy_resource_template("_pagination")
16
+ copy_resource_template("_search")
12
17
  end
13
18
  end
14
19
  end
@@ -9,7 +9,7 @@ module Administrate
9
9
  def copy_template
10
10
  copy_file(
11
11
  "../../layouts/administrate/application.html.erb",
12
- "app/views/layouts/admin/application.html.erb",
12
+ "app/views/layouts/#{namespace}/application.html.erb"
13
13
  )
14
14
 
15
15
  call_generator("administrate:views:navigation")