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.
- checksums.yaml +4 -4
- data/app/assets/builds/administrate/application.css +91 -19
- data/app/assets/builds/administrate/application.css.map +1 -1
- data/app/assets/builds/administrate/application.js +12648 -3156
- data/app/assets/builds/administrate/application.js.map +4 -4
- data/app/assets/builds/administrate-internal/docs.css +25 -12
- data/app/assets/builds/administrate-internal/docs.css.map +1 -1
- data/app/assets/javascripts/administrate/application.js +1 -0
- data/app/assets/javascripts/administrate/controllers/index.js +2 -0
- data/app/assets/javascripts/administrate/controllers/select_controller.js +18 -1
- data/app/assets/javascripts/administrate/controllers/tooltip_controller.js +24 -0
- data/app/assets/javascripts/administrate/vendor/css-anchor-positioning.js +9310 -0
- data/app/assets/stylesheets/administrate/base/_typography.scss +8 -5
- data/app/assets/stylesheets/administrate/components/_buttons.scss +26 -1
- data/app/assets/stylesheets/administrate/components/_cells.scss +8 -1
- data/app/assets/stylesheets/administrate/components/_search.scss +44 -3
- data/app/assets/stylesheets/administrate-internal/docs.scss +25 -23
- data/app/controllers/administrate/application_controller.rb +9 -22
- data/app/controllers/concerns/administrate/punditize.rb +1 -9
- data/app/helpers/administrate/application_helper.rb +9 -1
- data/app/views/administrate/application/_collection.html.erb +29 -19
- data/app/views/administrate/application/_collection_header_actions.html.erb +1 -1
- data/app/views/administrate/application/_collection_item_actions.html.erb +2 -2
- data/app/views/administrate/application/_form.html.erb +1 -1
- data/app/views/administrate/application/_icons.html.erb +14 -6
- data/app/views/administrate/application/_index_header.html.erb +19 -0
- data/app/views/administrate/application/index.html.erb +1 -0
- data/app/views/administrate/application/new.html.erb +1 -1
- data/app/views/fields/has_many/_form.html.erb +1 -1
- data/app/views/fields/has_one/_form.html.erb +6 -0
- data/app/views/fields/polymorphic/_form.html.erb +1 -1
- data/app/views/fields/rich_text/_form.html.erb +16 -0
- data/docs/customizing_dashboards.md +76 -7
- data/docs/customizing_page_views.md +22 -0
- data/docs/guides/scoping_has_many_relations.md +2 -2
- data/docs/guides/switching_templates_with_view_variants.md +45 -0
- data/docs/guides.md +1 -0
- data/docs/migrating-to-v1.md +34 -0
- data/lib/administrate/base_dashboard.rb +0 -6
- data/lib/administrate/field/associative.rb +3 -22
- data/lib/administrate/field/base.rb +19 -2
- data/lib/administrate/field/belongs_to.rb +1 -6
- data/lib/administrate/field/date.rb +5 -1
- data/lib/administrate/field/date_time.rb +2 -3
- data/lib/administrate/field/deferred.rb +5 -17
- data/lib/administrate/field/has_many.rb +22 -3
- data/lib/administrate/field/has_one.rb +1 -9
- data/lib/administrate/field/password.rb +4 -0
- data/lib/administrate/field/polymorphic.rb +1 -1
- data/lib/administrate/field/time.rb +5 -4
- data/lib/administrate/namespace.rb +10 -10
- data/lib/administrate/order.rb +8 -8
- data/lib/administrate/search.rb +8 -9
- data/lib/administrate/version.rb +1 -1
- data/lib/administrate/view_generator.rb +1 -0
- data/lib/administrate.rb +0 -38
- data/lib/generators/administrate/install/install_generator.rb +1 -0
- data/lib/generators/administrate/routes/routes_generator.rb +1 -0
- data/lib/generators/administrate/views/index_generator.rb +4 -0
- metadata +18 -26
data/lib/administrate/order.rb
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
module Administrate
|
|
2
2
|
class Order
|
|
3
|
-
def initialize(attribute = nil, direction = nil,
|
|
3
|
+
def initialize(attribute = nil, direction = nil, sorting_column: nil)
|
|
4
4
|
@attribute = attribute
|
|
5
5
|
@direction = sanitize_direction(direction)
|
|
6
|
-
@
|
|
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[
|
|
13
|
+
order = relation.arel_table[sorting_column].public_send(direction)
|
|
14
14
|
|
|
15
15
|
return relation.reorder(order) if
|
|
16
|
-
column_exist?(relation,
|
|
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, :
|
|
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
|
-
|
|
97
|
+
(attribute != sorting_column) &&
|
|
98
98
|
column_exist?(
|
|
99
|
-
reflect_association(relation).klass,
|
|
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,
|
|
116
|
+
order_by_association_column(relation, sorting_column)
|
|
117
117
|
end
|
|
118
118
|
|
|
119
119
|
def order_by_association_column(relation, column_name)
|
data/lib/administrate/search.rb
CHANGED
|
@@ -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
|
data/lib/administrate/version.rb
CHANGED
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
|
|
@@ -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
|
|
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:
|
|
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: '
|
|
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: '
|
|
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: '
|
|
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: '
|
|
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: '
|
|
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: '
|
|
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
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
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.
|
|
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: []
|