administrate 0.19.0 → 1.0.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +9 -9
  3. data/app/assets/builds/administrate/application.css +1960 -0
  4. data/app/assets/builds/administrate/application.css.map +1 -0
  5. data/app/assets/builds/administrate/application.js +8110 -0
  6. data/app/assets/builds/administrate/application.js.map +7 -0
  7. data/app/assets/builds/administrate-internal/docs.css +89 -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 +8 -4
  12. data/app/assets/stylesheets/administrate/application.scss +2 -1
  13. data/app/assets/stylesheets/administrate/base/_forms.scss +4 -4
  14. data/app/assets/stylesheets/administrate/base/_tables.scss +1 -1
  15. data/app/assets/stylesheets/administrate/components/_attributes.scss +1 -0
  16. data/app/assets/stylesheets/administrate/components/_buttons.scss +1 -3
  17. data/app/assets/stylesheets/administrate/components/_cells.scss +19 -19
  18. data/app/assets/stylesheets/administrate/components/_field-unit.scss +8 -0
  19. data/app/assets/stylesheets/administrate/components/_main-content.scss +1 -1
  20. data/app/assets/stylesheets/administrate/components/_navigation.scss +3 -3
  21. data/app/assets/stylesheets/administrate/components/_search.scss +11 -11
  22. data/app/assets/stylesheets/administrate/library/_variables.scss +7 -3
  23. data/app/controllers/administrate/application_controller.rb +20 -19
  24. data/app/controllers/concerns/administrate/punditize.rb +21 -25
  25. data/app/helpers/administrate/application_helper.rb +4 -4
  26. data/app/views/administrate/application/_form.html.erb +19 -4
  27. data/app/views/administrate/application/show.html.erb +18 -10
  28. data/app/views/fields/has_one/_form.html.erb +14 -4
  29. data/app/views/fields/has_one/_show.html.erb +18 -12
  30. data/docs/customizing_controller_actions.md +14 -0
  31. data/docs/customizing_dashboards.md +55 -2
  32. data/docs/customizing_page_views.md +1 -1
  33. data/docs/getting_started.md +1 -1
  34. data/lib/administrate/base_dashboard.rb +19 -4
  35. data/lib/administrate/engine.rb +1 -6
  36. data/lib/administrate/field/associative.rb +1 -1
  37. data/lib/administrate/field/base.rb +2 -2
  38. data/lib/administrate/field/belongs_to.rb +1 -1
  39. data/lib/administrate/field/date.rb +1 -1
  40. data/lib/administrate/field/date_time.rb +2 -2
  41. data/lib/administrate/field/deferred.rb +2 -2
  42. data/lib/administrate/field/has_many.rb +9 -5
  43. data/lib/administrate/field/has_one.rb +6 -6
  44. data/lib/administrate/field/number.rb +2 -8
  45. data/lib/administrate/field/polymorphic.rb +3 -3
  46. data/lib/administrate/generator_helpers.rb +1 -1
  47. data/lib/administrate/namespace/resource.rb +1 -1
  48. data/lib/administrate/order.rb +16 -15
  49. data/lib/administrate/page/base.rb +1 -1
  50. data/lib/administrate/page/collection.rb +3 -2
  51. data/lib/administrate/page/form.rb +10 -2
  52. data/lib/administrate/page/show.rb +10 -2
  53. data/lib/administrate/resource_resolver.rb +1 -1
  54. data/lib/administrate/search.rb +6 -7
  55. data/lib/administrate/version.rb +1 -1
  56. data/lib/administrate/view_generator.rb +3 -3
  57. data/lib/administrate.rb +27 -22
  58. data/lib/generators/administrate/dashboard/dashboard_generator.rb +9 -9
  59. data/lib/generators/administrate/field/field_generator.rb +2 -2
  60. data/lib/generators/administrate/install/install_generator.rb +2 -2
  61. data/lib/generators/administrate/routes/routes_generator.rb +5 -5
  62. data/lib/generators/administrate/views/field_generator.rb +2 -2
  63. data/lib/generators/administrate/views/layout_generator.rb +1 -1
  64. metadata +39 -55
  65. /data/app/assets/stylesheets/{docs.scss → administrate-internal/docs.scss} +0 -0
@@ -9,13 +9,13 @@ module Administrate
9
9
  :namespace,
10
10
  type: :string,
11
11
  desc: "Namespace where the admin dashboards live",
12
- default: "admin",
12
+ default: "admin"
13
13
  )
14
14
 
15
15
  def self.template_source_path
16
16
  File.expand_path(
17
17
  "../../../app/views/administrate/application",
18
- __FILE__,
18
+ __FILE__
19
19
  )
20
20
  end
21
21
 
@@ -30,7 +30,7 @@ module Administrate
30
30
 
31
31
  copy_file(
32
32
  template_file,
33
- "app/views/#{namespace}/#{resource_path}/#{template_file}",
33
+ "app/views/#{namespace}/#{resource_path}/#{template_file}"
34
34
  )
35
35
  end
36
36
 
data/lib/administrate.rb CHANGED
@@ -1,41 +1,46 @@
1
1
  require "administrate/engine"
2
+ require "administrate/version"
2
3
 
3
4
  module Administrate
4
5
  def self.warn_of_missing_resource_class
5
- ActiveSupport::Deprecation.warn(
6
- "Calling Field::Base.permitted_attribute without the option " +
7
- ":resource_class is deprecated. If you are seeing this " +
8
- "message, you are probably using a custom field type that" +
9
- "does this. Please make sure to update it to a version that " +
10
- "does not use a deprecated API",
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"
11
12
  )
12
13
  end
13
14
 
14
15
  def self.warn_of_deprecated_option(name)
15
- ActiveSupport::Deprecation.warn(
16
- "The option :#{name} is deprecated. " +
17
- "Administrate should detect it automatically. " +
18
- "Please file an issue at " +
19
- "https://github.com/thoughtbot/administrate/issues " +
20
- "if you think otherwise.",
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."
21
22
  )
22
23
  end
23
24
 
24
25
  def self.warn_of_deprecated_method(klass, method)
25
- ActiveSupport::Deprecation.warn(
26
- "The method #{klass}##{method} is deprecated. " +
27
- "If you are seeing this message you are probably " +
28
- "using a dashboard that depends explicitly on it. " +
29
- "Please make sure you update it to a version that " +
30
- "does not use a deprecated API",
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"
31
32
  )
32
33
  end
33
34
 
34
35
  def self.warn_of_deprecated_authorization_method(method)
35
- ActiveSupport::Deprecation.warn(
36
- "The method `#{method}` is deprecated. " +
37
- "Please use `accessible_action?` instead, " +
38
- "or see the documentation for other options.",
36
+ deprecator.warn(
37
+ "The method `#{method}` is deprecated. " \
38
+ "Please use `accessible_action?` instead, " \
39
+ "or see the documentation for other options."
39
40
  )
40
41
  end
42
+
43
+ def self.deprecator
44
+ @deprecator ||= ActiveSupport::Deprecation.new(VERSION, "Administrate")
45
+ end
41
46
  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,7 +31,7 @@ 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__)
@@ -39,13 +39,13 @@ module Administrate
39
39
  def create_dashboard_definition
40
40
  template(
41
41
  "dashboard.rb.erb",
42
- Rails.root.join("app/dashboards/#{file_name}_dashboard.rb"),
42
+ Rails.root.join("app/dashboards/#{file_name}_dashboard.rb")
43
43
  )
44
44
  end
45
45
 
46
46
  def create_resource_controller
47
47
  destination = Rails.root.join(
48
- "app/controllers/#{namespace}/#{file_name.pluralize}_controller.rb",
48
+ "app/controllers/#{namespace}/#{file_name.pluralize}_controller.rb"
49
49
  )
50
50
 
51
51
  template("controller.rb.erb", destination)
@@ -72,7 +72,7 @@ module Administrate
72
72
  primary_key,
73
73
  *attrs.sort,
74
74
  created_at,
75
- updated_at,
75
+ updated_at
76
76
  ].compact
77
77
  end
78
78
 
@@ -116,7 +116,7 @@ module Administrate
116
116
 
117
117
  def enum_column?(attr)
118
118
  klass.respond_to?(:defined_enums) &&
119
- klass.defined_enums.keys.include?(attr)
119
+ klass.defined_enums.key?(attr)
120
120
  end
121
121
 
122
122
  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
@@ -18,7 +18,7 @@ module Administrate
18
18
  :namespace,
19
19
  type: :string,
20
20
  desc: "Namespace where the admin dashboards will live",
21
- default: "admin",
21
+ default: "admin"
22
22
  )
23
23
 
24
24
  def run_routes_generator
@@ -31,7 +31,7 @@ module Administrate
31
31
  def create_dashboard_controller
32
32
  template(
33
33
  "application_controller.rb.erb",
34
- "app/controllers/#{namespace}/application_controller.rb",
34
+ "app/controllers/#{namespace}/application_controller.rb"
35
35
  )
36
36
  end
37
37
 
@@ -18,7 +18,7 @@ module Administrate
18
18
  :namespace,
19
19
  type: :string,
20
20
  desc: "Namespace where the admin dashboards live",
21
- default: "admin",
21
+ default: "admin"
22
22
  )
23
23
 
24
24
  def insert_dashboard_routes
@@ -61,10 +61,10 @@ module Administrate
61
61
  end
62
62
 
63
63
  def database_models
64
- ActiveRecord::Base.descendants.
65
- reject(&:abstract_class?).
66
- reject { |k| k < Administrate::Generators::TestRecord }.
67
- sort_by(&:to_s)
64
+ ActiveRecord::Base.descendants
65
+ .reject(&:abstract_class?)
66
+ .reject { |k| k < Administrate::Generators::TestRecord }
67
+ .sort_by(&:to_s)
68
68
  end
69
69
 
70
70
  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,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/admin/application.html.erb"
13
13
  )
14
14
 
15
15
  call_generator("administrate:views:navigation")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: administrate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.19.0
4
+ version: 1.0.0.beta1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Charlton
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-07-18 00:00:00.000000000 Z
12
+ date: 2024-02-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionpack
@@ -17,98 +17,74 @@ dependencies:
17
17
  requirements:
18
18
  - - ">="
19
19
  - !ruby/object:Gem::Version
20
- version: '5.0'
20
+ version: '6.0'
21
+ - - "<"
22
+ - !ruby/object:Gem::Version
23
+ version: '8.0'
21
24
  type: :runtime
22
25
  prerelease: false
23
26
  version_requirements: !ruby/object:Gem::Requirement
24
27
  requirements:
25
28
  - - ">="
26
29
  - !ruby/object:Gem::Version
27
- version: '5.0'
30
+ version: '6.0'
31
+ - - "<"
32
+ - !ruby/object:Gem::Version
33
+ version: '8.0'
28
34
  - !ruby/object:Gem::Dependency
29
35
  name: actionview
30
36
  requirement: !ruby/object:Gem::Requirement
31
37
  requirements:
32
38
  - - ">="
33
39
  - !ruby/object:Gem::Version
34
- version: '5.0'
35
- type: :runtime
36
- prerelease: false
37
- version_requirements: !ruby/object:Gem::Requirement
38
- requirements:
39
- - - ">="
40
- - !ruby/object:Gem::Version
41
- version: '5.0'
42
- - !ruby/object:Gem::Dependency
43
- name: activerecord
44
- requirement: !ruby/object:Gem::Requirement
45
- requirements:
46
- - - ">="
40
+ version: '6.0'
41
+ - - "<"
47
42
  - !ruby/object:Gem::Version
48
- version: '5.0'
43
+ version: '8.0'
49
44
  type: :runtime
50
45
  prerelease: false
51
46
  version_requirements: !ruby/object:Gem::Requirement
52
47
  requirements:
53
48
  - - ">="
54
49
  - !ruby/object:Gem::Version
55
- version: '5.0'
56
- - !ruby/object:Gem::Dependency
57
- name: jquery-rails
58
- requirement: !ruby/object:Gem::Requirement
59
- requirements:
60
- - - ">="
50
+ version: '6.0'
51
+ - - "<"
61
52
  - !ruby/object:Gem::Version
62
- version: '4.0'
63
- type: :runtime
64
- prerelease: false
65
- version_requirements: !ruby/object:Gem::Requirement
66
- requirements:
67
- - - ">="
68
- - !ruby/object:Gem::Version
69
- version: '4.0'
53
+ version: '8.0'
70
54
  - !ruby/object:Gem::Dependency
71
- name: kaminari
55
+ name: activerecord
72
56
  requirement: !ruby/object:Gem::Requirement
73
57
  requirements:
74
58
  - - ">="
75
59
  - !ruby/object:Gem::Version
76
- version: '1.0'
60
+ version: '6.0'
61
+ - - "<"
62
+ - !ruby/object:Gem::Version
63
+ version: '8.0'
77
64
  type: :runtime
78
65
  prerelease: false
79
66
  version_requirements: !ruby/object:Gem::Requirement
80
67
  requirements:
81
68
  - - ">="
82
69
  - !ruby/object:Gem::Version
83
- version: '1.0'
84
- - !ruby/object:Gem::Dependency
85
- name: sassc-rails
86
- requirement: !ruby/object:Gem::Requirement
87
- requirements:
88
- - - "~>"
70
+ version: '6.0'
71
+ - - "<"
89
72
  - !ruby/object:Gem::Version
90
- version: '2.1'
91
- type: :runtime
92
- prerelease: false
93
- version_requirements: !ruby/object:Gem::Requirement
94
- requirements:
95
- - - "~>"
96
- - !ruby/object:Gem::Version
97
- version: '2.1'
73
+ version: '8.0'
98
74
  - !ruby/object:Gem::Dependency
99
- name: selectize-rails
75
+ name: kaminari
100
76
  requirement: !ruby/object:Gem::Requirement
101
77
  requirements:
102
78
  - - "~>"
103
79
  - !ruby/object:Gem::Version
104
- version: '0.6'
80
+ version: 1.2.2
105
81
  type: :runtime
106
82
  prerelease: false
107
83
  version_requirements: !ruby/object:Gem::Requirement
108
84
  requirements:
109
85
  - - "~>"
110
86
  - !ruby/object:Gem::Version
111
- version: '0.6'
87
+ version: 1.2.2
112
88
  description: |
113
89
  Administrate is heavily inspired by projects like Rails Admin and ActiveAdmin,
114
90
  but aims to provide a better user experience for site admins,
@@ -130,10 +106,19 @@ extensions: []
130
106
  extra_rdoc_files: []
131
107
  files:
132
108
  - Rakefile
109
+ - app/assets/builds/administrate-internal/docs.css
110
+ - app/assets/builds/administrate-internal/docs.css.map
111
+ - app/assets/builds/administrate/application.css
112
+ - app/assets/builds/administrate/application.css.map
113
+ - app/assets/builds/administrate/application.js
114
+ - app/assets/builds/administrate/application.js.map
115
+ - app/assets/config/administrate_manifest.js
116
+ - app/assets/javascripts/administrate/add_jquery.js
133
117
  - app/assets/javascripts/administrate/application.js
134
118
  - app/assets/javascripts/administrate/components/associative.js
135
119
  - app/assets/javascripts/administrate/components/select.js
136
120
  - app/assets/javascripts/administrate/components/table.js
121
+ - app/assets/stylesheets/administrate-internal/docs.scss
137
122
  - app/assets/stylesheets/administrate/application.scss
138
123
  - app/assets/stylesheets/administrate/base/_forms.scss
139
124
  - app/assets/stylesheets/administrate/base/_layout.scss
@@ -156,7 +141,6 @@ files:
156
141
  - app/assets/stylesheets/administrate/library/_variables.scss
157
142
  - app/assets/stylesheets/administrate/reset/_normalize.scss
158
143
  - app/assets/stylesheets/administrate/utilities/_text-color.scss
159
- - app/assets/stylesheets/docs.scss
160
144
  - app/controllers/administrate/application_controller.rb
161
145
  - app/controllers/concerns/administrate/punditize.rb
162
146
  - app/helpers/administrate/application_helper.rb
@@ -341,11 +325,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
341
325
  version: '0'
342
326
  required_rubygems_version: !ruby/object:Gem::Requirement
343
327
  requirements:
344
- - - ">="
328
+ - - ">"
345
329
  - !ruby/object:Gem::Version
346
- version: '0'
330
+ version: 1.3.1
347
331
  requirements: []
348
- rubygems_version: 3.4.14
332
+ rubygems_version: 3.4.20
349
333
  signing_key:
350
334
  specification_version: 4
351
335
  summary: A Rails engine for creating super-flexible admin dashboards