administrate 1.0.0.beta2 → 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 (60) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/builds/administrate/application.css +91 -19
  3. data/app/assets/builds/administrate/application.css.map +1 -1
  4. data/app/assets/builds/administrate/application.js +12648 -3156
  5. data/app/assets/builds/administrate/application.js.map +4 -4
  6. data/app/assets/builds/administrate-internal/docs.css +25 -12
  7. data/app/assets/builds/administrate-internal/docs.css.map +1 -1
  8. data/app/assets/javascripts/administrate/application.js +1 -0
  9. data/app/assets/javascripts/administrate/controllers/index.js +2 -0
  10. data/app/assets/javascripts/administrate/controllers/select_controller.js +18 -1
  11. data/app/assets/javascripts/administrate/controllers/tooltip_controller.js +24 -0
  12. data/app/assets/javascripts/administrate/vendor/css-anchor-positioning.js +9310 -0
  13. data/app/assets/stylesheets/administrate/base/_typography.scss +8 -5
  14. data/app/assets/stylesheets/administrate/components/_buttons.scss +26 -1
  15. data/app/assets/stylesheets/administrate/components/_cells.scss +8 -1
  16. data/app/assets/stylesheets/administrate/components/_search.scss +44 -3
  17. data/app/assets/stylesheets/administrate-internal/docs.scss +25 -23
  18. data/app/controllers/administrate/application_controller.rb +9 -22
  19. data/app/controllers/concerns/administrate/punditize.rb +1 -9
  20. data/app/helpers/administrate/application_helper.rb +9 -1
  21. data/app/views/administrate/application/_collection.html.erb +29 -19
  22. data/app/views/administrate/application/_collection_header_actions.html.erb +1 -1
  23. data/app/views/administrate/application/_collection_item_actions.html.erb +2 -2
  24. data/app/views/administrate/application/_form.html.erb +1 -1
  25. data/app/views/administrate/application/_icons.html.erb +14 -6
  26. data/app/views/administrate/application/_index_header.html.erb +19 -0
  27. data/app/views/administrate/application/index.html.erb +1 -0
  28. data/app/views/administrate/application/new.html.erb +1 -1
  29. data/app/views/fields/has_many/_form.html.erb +1 -1
  30. data/app/views/fields/has_one/_form.html.erb +6 -0
  31. data/app/views/fields/polymorphic/_form.html.erb +1 -1
  32. data/app/views/fields/rich_text/_form.html.erb +16 -0
  33. data/docs/customizing_dashboards.md +76 -7
  34. data/docs/customizing_page_views.md +22 -0
  35. data/docs/guides/scoping_has_many_relations.md +2 -2
  36. data/docs/guides/switching_templates_with_view_variants.md +45 -0
  37. data/docs/guides.md +1 -0
  38. data/docs/migrating-to-v1.md +34 -0
  39. data/lib/administrate/base_dashboard.rb +0 -6
  40. data/lib/administrate/field/associative.rb +3 -22
  41. data/lib/administrate/field/base.rb +19 -2
  42. data/lib/administrate/field/belongs_to.rb +1 -6
  43. data/lib/administrate/field/date.rb +5 -1
  44. data/lib/administrate/field/date_time.rb +2 -3
  45. data/lib/administrate/field/deferred.rb +5 -17
  46. data/lib/administrate/field/has_many.rb +22 -3
  47. data/lib/administrate/field/has_one.rb +1 -9
  48. data/lib/administrate/field/password.rb +4 -0
  49. data/lib/administrate/field/polymorphic.rb +1 -1
  50. data/lib/administrate/field/time.rb +5 -4
  51. data/lib/administrate/namespace.rb +10 -10
  52. data/lib/administrate/order.rb +8 -8
  53. data/lib/administrate/search.rb +8 -9
  54. data/lib/administrate/version.rb +1 -1
  55. data/lib/administrate/view_generator.rb +1 -0
  56. data/lib/administrate.rb +0 -38
  57. data/lib/generators/administrate/install/install_generator.rb +1 -0
  58. data/lib/generators/administrate/routes/routes_generator.rb +1 -0
  59. data/lib/generators/administrate/views/index_generator.rb +4 -0
  60. metadata +18 -26
@@ -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
@@ -94,9 +94,9 @@ module Administrate
94
94
  end
95
95
 
96
96
  def ordering_by_association_column?(relation)
97
- association_attribute &&
97
+ (attribute != sorting_column) &&
98
98
  column_exist?(
99
- reflect_association(relation).klass, association_attribute.to_sym
99
+ reflect_association(relation).klass, sorting_column.to_sym
100
100
  )
101
101
  end
102
102
 
@@ -113,7 +113,7 @@ module Administrate
113
113
  end
114
114
 
115
115
  def order_by_association_attribute(relation)
116
- order_by_association_column(relation, association_attribute)
116
+ order_by_association_column(relation, sorting_column)
117
117
  end
118
118
 
119
119
  def order_by_association_column(relation, column_name)
@@ -63,6 +63,14 @@ module Administrate
63
63
  end
64
64
  end
65
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
+ {}
71
+ end
72
+ end
73
+
66
74
  private
67
75
 
68
76
  def apply_filter(filter, filter_param, resources)
@@ -116,14 +124,6 @@ module Administrate
116
124
  .where(query_template, *query_values)
117
125
  end
118
126
 
119
- def valid_filters
120
- if @dashboard.class.const_defined?(:COLLECTION_FILTERS)
121
- @dashboard.class.const_get(:COLLECTION_FILTERS).stringify_keys
122
- else
123
- {}
124
- end
125
- end
126
-
127
127
  def attribute_types
128
128
  @dashboard.class.const_get(:ATTRIBUTE_TYPES)
129
129
  end
@@ -133,7 +133,6 @@ module Administrate
133
133
  provided_class_name = attribute_types[attr].options[:class_name]
134
134
  unquoted_table_name =
135
135
  if provided_class_name
136
- Administrate.warn_of_deprecated_option(:class_name)
137
136
  provided_class_name.constantize.table_name
138
137
  else
139
138
  @scoped_resource.reflect_on_association(attr).klass.table_name
@@ -1,3 +1,3 @@
1
1
  module Administrate
2
- VERSION = "1.0.0.beta2".freeze
2
+ VERSION = "1.0.0".freeze
3
3
  end
@@ -5,6 +5,7 @@ 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,
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
@@ -12,6 +12,7 @@ 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(
@@ -13,6 +13,7 @@ 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,
@@ -9,7 +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")
12
14
  copy_resource_template("_index_header")
15
+ copy_resource_template("_pagination")
16
+ copy_resource_template("_search")
13
17
  end
14
18
  end
15
19
  end
metadata CHANGED
@@ -1,15 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: administrate
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.beta2
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Charlton
8
- - Grayson Wright
9
- autorequire:
10
8
  bindir: bin
11
9
  cert_chain: []
12
- date: 2024-10-25 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
13
11
  dependencies:
14
12
  - !ruby/object:Gem::Dependency
15
13
  name: actionpack
@@ -20,7 +18,7 @@ dependencies:
20
18
  version: '6.0'
21
19
  - - "<"
22
20
  - !ruby/object:Gem::Version
23
- version: '8.0'
21
+ version: '9.0'
24
22
  type: :runtime
25
23
  prerelease: false
26
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -30,7 +28,7 @@ dependencies:
30
28
  version: '6.0'
31
29
  - - "<"
32
30
  - !ruby/object:Gem::Version
33
- version: '8.0'
31
+ version: '9.0'
34
32
  - !ruby/object:Gem::Dependency
35
33
  name: actionview
36
34
  requirement: !ruby/object:Gem::Requirement
@@ -40,7 +38,7 @@ dependencies:
40
38
  version: '6.0'
41
39
  - - "<"
42
40
  - !ruby/object:Gem::Version
43
- version: '8.0'
41
+ version: '9.0'
44
42
  type: :runtime
45
43
  prerelease: false
46
44
  version_requirements: !ruby/object:Gem::Requirement
@@ -50,7 +48,7 @@ dependencies:
50
48
  version: '6.0'
51
49
  - - "<"
52
50
  - !ruby/object:Gem::Version
53
- version: '8.0'
51
+ version: '9.0'
54
52
  - !ruby/object:Gem::Dependency
55
53
  name: activerecord
56
54
  requirement: !ruby/object:Gem::Requirement
@@ -60,7 +58,7 @@ dependencies:
60
58
  version: '6.0'
61
59
  - - "<"
62
60
  - !ruby/object:Gem::Version
63
- version: '8.0'
61
+ version: '9.0'
64
62
  type: :runtime
65
63
  prerelease: false
66
64
  version_requirements: !ruby/object:Gem::Requirement
@@ -70,7 +68,7 @@ dependencies:
70
68
  version: '6.0'
71
69
  - - "<"
72
70
  - !ruby/object:Gem::Version
73
- version: '8.0'
71
+ version: '9.0'
74
72
  - !ruby/object:Gem::Dependency
75
73
  name: kaminari
76
74
  requirement: !ruby/object:Gem::Requirement
@@ -86,21 +84,13 @@ dependencies:
86
84
  - !ruby/object:Gem::Version
87
85
  version: 1.2.2
88
86
  description: |
89
- Administrate is heavily inspired by projects like Rails Admin and ActiveAdmin,
90
- but aims to provide a better user experience for site admins,
91
- and to be easier for developers to customize.
92
-
93
- To do that, we're following a few simple rules:
94
-
95
- - No DSLs (domain-specific languages)
96
- - Support the simplest use cases,
97
- and let the user override defaults with standard tools
98
- such as plain Rails controllers and views.
99
- - Break up the library into core components and plugins,
100
- so each component stays small and easy to maintain.
87
+ Administrate is a library for Rails that generates admin dashboards. These
88
+ give users clean interfaces that allow them to create, edit, search, and
89
+ delete records for any model in the application. Administrate aims to
90
+ provide the best user experience, and doing as much work as possible for
91
+ you, whilst also being flexible to customise.
101
92
  email:
102
93
  - nick@nickcharlton.net
103
- - grayson@thoughtbot.com
104
94
  executables: []
105
95
  extensions: []
106
96
  extra_rdoc_files: []
@@ -119,6 +109,8 @@ files:
119
109
  - app/assets/javascripts/administrate/controllers/index.js
120
110
  - app/assets/javascripts/administrate/controllers/select_controller.js
121
111
  - app/assets/javascripts/administrate/controllers/table_controller.js
112
+ - app/assets/javascripts/administrate/controllers/tooltip_controller.js
113
+ - app/assets/javascripts/administrate/vendor/css-anchor-positioning.js
122
114
  - app/assets/stylesheets/administrate-internal/docs.scss
123
115
  - app/assets/stylesheets/administrate/application.scss
124
116
  - app/assets/stylesheets/administrate/base/_forms.scss
@@ -249,6 +241,8 @@ files:
249
241
  - docs/guides/customising_search.md
250
242
  - docs/guides/hiding_dashboards_from_sidebar.md
251
243
  - docs/guides/scoping_has_many_relations.md
244
+ - docs/guides/switching_templates_with_view_variants.md
245
+ - docs/migrating-to-v1.md
252
246
  - docs/rails_api.md
253
247
  - lib/administrate.rb
254
248
  - lib/administrate/base_dashboard.rb
@@ -315,7 +309,6 @@ homepage: https://administrate-demo.herokuapp.com/
315
309
  licenses:
316
310
  - MIT
317
311
  metadata: {}
318
- post_install_message:
319
312
  rdoc_options: []
320
313
  require_paths:
321
314
  - lib
@@ -330,8 +323,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
330
323
  - !ruby/object:Gem::Version
331
324
  version: '0'
332
325
  requirements: []
333
- rubygems_version: 3.5.6
334
- signing_key:
326
+ rubygems_version: 3.6.9
335
327
  specification_version: 4
336
328
  summary: A Rails engine for creating super-flexible admin dashboards
337
329
  test_files: []