administrate 0.20.1 → 1.0.0.beta2
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/Rakefile +9 -9
- data/app/assets/builds/administrate/application.css +2542 -0
- data/app/assets/builds/administrate/application.css.map +1 -0
- data/app/assets/builds/administrate/application.js +22169 -0
- data/app/assets/builds/administrate/application.js.map +7 -0
- data/app/assets/builds/administrate-internal/docs.css +89 -0
- data/app/assets/builds/administrate-internal/docs.css.map +1 -0
- data/app/assets/config/administrate_manifest.js +2 -0
- data/app/assets/javascripts/administrate/add_jquery.js +4 -0
- data/app/assets/javascripts/administrate/application.js +8 -4
- data/app/assets/javascripts/administrate/controllers/application.js +9 -0
- data/app/assets/javascripts/administrate/controllers/index.js +7 -0
- data/app/assets/javascripts/administrate/controllers/select_controller.js +8 -0
- data/app/assets/javascripts/administrate/{components/table.js → controllers/table_controller.js} +9 -9
- data/app/assets/stylesheets/administrate/application.scss +3 -3
- data/app/assets/stylesheets/administrate/base/_forms.scss +4 -4
- data/app/assets/stylesheets/administrate/base/_layout.scss +5 -0
- data/app/assets/stylesheets/administrate/base/_tables.scss +1 -1
- data/app/assets/stylesheets/administrate/base/_typography.scss +12 -1
- data/app/assets/stylesheets/administrate/components/_attributes.scss +1 -0
- data/app/assets/stylesheets/administrate/components/_buttons.scss +12 -12
- data/app/assets/stylesheets/administrate/components/_cells.scss +19 -19
- data/app/assets/stylesheets/administrate/components/_field-unit.scss +3 -3
- data/app/assets/stylesheets/administrate/components/_main-content.scss +1 -1
- data/app/assets/stylesheets/administrate/components/_navigation.scss +3 -3
- data/app/assets/stylesheets/administrate/components/_search.scss +11 -11
- data/app/assets/stylesheets/administrate/library/_variables.scss +7 -3
- data/app/assets/stylesheets/administrate/reset/_normalize.scss +7 -1
- data/app/controllers/administrate/application_controller.rb +20 -19
- data/app/controllers/concerns/administrate/punditize.rb +5 -5
- data/app/helpers/administrate/application_helper.rb +4 -4
- data/app/views/administrate/application/_collection.html.erb +1 -1
- data/app/views/administrate/application/_collection_item_actions.html.erb +3 -3
- data/app/views/administrate/application/_index_header.html.erb +4 -0
- data/app/views/administrate/application/_javascript.html.erb +1 -1
- data/app/views/administrate/application/edit.html.erb +15 -3
- data/app/views/administrate/application/index.html.erb +19 -11
- data/app/views/administrate/application/new.html.erb +15 -3
- data/app/views/administrate/application/show.html.erb +35 -23
- data/app/views/fields/belongs_to/_form.html.erb +3 -2
- data/app/views/fields/has_many/_form.html.erb +1 -1
- data/app/views/fields/polymorphic/_form.html.erb +1 -1
- data/app/views/fields/rich_text/_form.html.erb +6 -0
- data/app/views/fields/rich_text/_index.html.erb +18 -0
- data/app/views/fields/rich_text/_show.html.erb +18 -0
- data/app/views/fields/select/_form.html.erb +2 -1
- data/app/views/fields/text/_form.html.erb +1 -1
- data/app/views/layouts/administrate/application.html.erb +1 -2
- data/docs/customizing_dashboards.md +138 -4
- data/docs/customizing_page_views.md +25 -0
- data/lib/administrate/base_dashboard.rb +6 -5
- data/lib/administrate/engine.rb +7 -6
- data/lib/administrate/field/associative.rb +5 -1
- data/lib/administrate/field/base.rb +21 -3
- data/lib/administrate/field/belongs_to.rb +7 -2
- data/lib/administrate/field/date.rb +1 -1
- data/lib/administrate/field/date_time.rb +2 -2
- data/lib/administrate/field/deferred.rb +10 -2
- data/lib/administrate/field/has_many.rb +5 -5
- data/lib/administrate/field/has_one.rb +10 -6
- data/lib/administrate/field/number.rb +2 -2
- data/lib/administrate/field/polymorphic.rb +3 -3
- data/lib/administrate/field/rich_text.rb +21 -0
- data/lib/administrate/field/select.rb +4 -0
- data/lib/administrate/generator_helpers.rb +1 -1
- data/lib/administrate/namespace/resource.rb +1 -1
- data/lib/administrate/order.rb +30 -26
- data/lib/administrate/page/base.rb +2 -7
- data/lib/administrate/page/collection.rb +2 -2
- data/lib/administrate/page/form.rb +1 -1
- data/lib/administrate/page/show.rb +1 -1
- data/lib/administrate/resource_resolver.rb +1 -1
- data/lib/administrate/search.rb +6 -7
- data/lib/administrate/version.rb +1 -1
- data/lib/administrate/view_generator.rb +3 -3
- data/lib/administrate.rb +18 -18
- data/lib/generators/administrate/dashboard/dashboard_generator.rb +12 -9
- data/lib/generators/administrate/field/field_generator.rb +2 -2
- data/lib/generators/administrate/install/install_generator.rb +2 -2
- data/lib/generators/administrate/routes/routes_generator.rb +5 -5
- data/lib/generators/administrate/views/field_generator.rb +2 -2
- data/lib/generators/administrate/views/index_generator.rb +1 -0
- data/lib/generators/administrate/views/layout_generator.rb +1 -1
- metadata +20 -53
- data/app/assets/javascripts/administrate/components/associative.js +0 -5
- data/app/assets/javascripts/administrate/components/select.js +0 -3
- data/app/assets/stylesheets/administrate/utilities/_text-color.scss +0 -3
- data/lib/generators/administrate/assets/assets_generator.rb +0 -12
- data/lib/generators/administrate/assets/javascripts_generator.rb +0 -17
- data/lib/generators/administrate/assets/stylesheets_generator.rb +0 -17
- /data/app/assets/stylesheets/{docs.scss → administrate-internal/docs.scss} +0 -0
data/lib/administrate/engine.rb
CHANGED
@@ -1,8 +1,4 @@
|
|
1
|
-
require "jquery-rails"
|
2
1
|
require "kaminari"
|
3
|
-
require "sassc-rails"
|
4
|
-
require "selectize-rails"
|
5
|
-
require "sprockets/railtie"
|
6
2
|
|
7
3
|
require "administrate/namespace/resource"
|
8
4
|
require "administrate/not_authorized_error"
|
@@ -13,7 +9,6 @@ require "administrate/order"
|
|
13
9
|
require "administrate/resource_resolver"
|
14
10
|
require "administrate/search"
|
15
11
|
require "administrate/namespace"
|
16
|
-
require "administrate/namespace/resource"
|
17
12
|
|
18
13
|
module Administrate
|
19
14
|
class Engine < ::Rails::Engine
|
@@ -25,10 +20,16 @@ module Administrate
|
|
25
20
|
initializer "administrate.assets.precompile" do |app|
|
26
21
|
app.config.assets.precompile += [
|
27
22
|
"administrate/application.js",
|
28
|
-
"administrate/application.css"
|
23
|
+
"administrate/application.css"
|
29
24
|
]
|
30
25
|
end
|
31
26
|
|
27
|
+
initializer "administrate.action_text" do
|
28
|
+
ActiveSupport.on_load :action_text_rich_text do
|
29
|
+
require "administrate/field/rich_text"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
32
33
|
def self.add_javascript(script)
|
33
34
|
@@javascripts << script
|
34
35
|
end
|
@@ -34,20 +34,38 @@ module Administrate
|
|
34
34
|
|
35
35
|
def initialize(attribute, data, page, options = {})
|
36
36
|
@attribute = attribute
|
37
|
-
@data = data
|
38
37
|
@page = page
|
39
38
|
@resource = options.delete(:resource)
|
40
39
|
@options = options
|
40
|
+
@data = read_value(data)
|
41
41
|
end
|
42
42
|
|
43
43
|
def html_class
|
44
44
|
self.class.html_class
|
45
45
|
end
|
46
46
|
|
47
|
+
def html_controller
|
48
|
+
nil
|
49
|
+
end
|
50
|
+
|
47
51
|
def name
|
48
52
|
attribute.to_s
|
49
53
|
end
|
50
54
|
|
55
|
+
def read_value(data)
|
56
|
+
if options.key?(:getter)
|
57
|
+
if options[:getter].respond_to?(:call)
|
58
|
+
options[:getter].call(self)
|
59
|
+
else
|
60
|
+
resource.try(options[:getter])
|
61
|
+
end
|
62
|
+
elsif data.nil?
|
63
|
+
resource.try(attribute)
|
64
|
+
else
|
65
|
+
data
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
51
69
|
def to_partial_path
|
52
70
|
"/fields/#{self.class.field_type}/#{page}"
|
53
71
|
end
|
@@ -56,13 +74,13 @@ module Administrate
|
|
56
74
|
return false unless resource.class.respond_to?(:validators_on)
|
57
75
|
|
58
76
|
resource.class.validators_on(attribute).any? do |v|
|
59
|
-
next false unless v.
|
77
|
+
next false unless v.instance_of?(ActiveRecord::Validations::PresenceValidator)
|
60
78
|
|
61
79
|
options = v.options
|
62
80
|
next false if options.include?(:if)
|
63
81
|
next false if options.include?(:unless)
|
64
82
|
|
65
|
-
if on_option = options[:on]
|
83
|
+
if (on_option = options[:on])
|
66
84
|
if on_option == :create && !resource.persisted?
|
67
85
|
next true
|
68
86
|
end
|
@@ -25,7 +25,7 @@ module Administrate
|
|
25
25
|
candidate_resources.map do |resource|
|
26
26
|
[
|
27
27
|
display_candidate_resource(resource),
|
28
|
-
resource.send(association_primary_key)
|
28
|
+
resource.send(association_primary_key)
|
29
29
|
]
|
30
30
|
end
|
31
31
|
end
|
@@ -41,7 +41,12 @@ module Administrate
|
|
41
41
|
private
|
42
42
|
|
43
43
|
def candidate_resources
|
44
|
-
scope =
|
44
|
+
scope =
|
45
|
+
if options[:scope]
|
46
|
+
options[:scope].arity.positive? ? options[:scope].call(self) : options[:scope].call
|
47
|
+
else
|
48
|
+
associated_class.all
|
49
|
+
end
|
45
50
|
|
46
51
|
order = options.delete(:order)
|
47
52
|
order ? scope.reorder(order) : scope
|
@@ -6,7 +6,7 @@ module Administrate
|
|
6
6
|
def date
|
7
7
|
I18n.localize(
|
8
8
|
data.in_time_zone(timezone).to_date,
|
9
|
-
format: format
|
9
|
+
format: format
|
10
10
|
)
|
11
11
|
end
|
12
12
|
|
@@ -14,7 +14,7 @@ module Administrate
|
|
14
14
|
I18n.localize(
|
15
15
|
data.in_time_zone(timezone),
|
16
16
|
format: format,
|
17
|
-
default: data
|
17
|
+
default: data
|
18
18
|
)
|
19
19
|
end
|
20
20
|
|
@@ -21,6 +21,10 @@ module Administrate
|
|
21
21
|
options == other.options
|
22
22
|
end
|
23
23
|
|
24
|
+
def getter
|
25
|
+
options.fetch(:getter, nil)
|
26
|
+
end
|
27
|
+
|
24
28
|
def associative?
|
25
29
|
deferred_class.associative?
|
26
30
|
end
|
@@ -30,12 +34,16 @@ module Administrate
|
|
30
34
|
end
|
31
35
|
|
32
36
|
def searchable?
|
33
|
-
options.
|
37
|
+
if options.key?(:getter)
|
38
|
+
false
|
39
|
+
else
|
40
|
+
options.fetch(:searchable, deferred_class.searchable?)
|
41
|
+
end
|
34
42
|
end
|
35
43
|
|
36
44
|
def searchable_field
|
37
45
|
Administrate.deprecator.warn(
|
38
|
-
"searchable_field is deprecated, use searchable_fields instead"
|
46
|
+
"searchable_field is deprecated, use searchable_fields instead"
|
39
47
|
)
|
40
48
|
options.fetch(:searchable_field)
|
41
49
|
end
|
@@ -18,14 +18,14 @@ module Administrate
|
|
18
18
|
# be `country_ids` instead.
|
19
19
|
#
|
20
20
|
# See https://github.com/rails/rails/blob/b30a23f53b52e59d31358f7b80385ee5c2ba3afe/activerecord/lib/active_record/associations/builder/collection_association.rb#L48
|
21
|
-
{
|
21
|
+
{"#{attr.to_s.singularize}_ids": []}
|
22
22
|
end
|
23
23
|
|
24
24
|
def associated_collection(order = self.order)
|
25
25
|
Administrate::Page::Collection.new(
|
26
26
|
associated_dashboard,
|
27
27
|
order: order,
|
28
|
-
collection_attributes: options[:collection_attributes]
|
28
|
+
collection_attributes: options[:collection_attributes]
|
29
29
|
)
|
30
30
|
end
|
31
31
|
|
@@ -37,7 +37,7 @@ module Administrate
|
|
37
37
|
candidate_resources.map do |associated_resource|
|
38
38
|
[
|
39
39
|
display_candidate_resource(associated_resource),
|
40
|
-
associated_resource.send(association_primary_key)
|
40
|
+
associated_resource.send(association_primary_key)
|
41
41
|
]
|
42
42
|
end
|
43
43
|
end
|
@@ -59,7 +59,7 @@ module Administrate
|
|
59
59
|
def permitted_attribute
|
60
60
|
self.class.permitted_attribute(
|
61
61
|
attribute,
|
62
|
-
resource_class: resource.class
|
62
|
+
resource_class: resource.class
|
63
63
|
)
|
64
64
|
end
|
65
65
|
|
@@ -82,7 +82,7 @@ module Administrate
|
|
82
82
|
def order_from_params(params)
|
83
83
|
Administrate::Order.new(
|
84
84
|
params.fetch(:order, sort_by),
|
85
|
-
params.fetch(:direction, direction)
|
85
|
+
params.fetch(:direction, direction)
|
86
86
|
)
|
87
87
|
end
|
88
88
|
|
@@ -20,10 +20,10 @@ module Administrate
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
related_dashboard_attributes =
|
23
|
-
Administrate::ResourceResolver
|
24
|
-
new("admin/#{final_associated_class_name}")
|
25
|
-
dashboard_class.new.permitted_attributes + [:id]
|
26
|
-
{
|
23
|
+
Administrate::ResourceResolver
|
24
|
+
.new("admin/#{final_associated_class_name}")
|
25
|
+
.dashboard_class.new.permitted_attributes + [:id]
|
26
|
+
{"#{attr}_attributes": related_dashboard_attributes}
|
27
27
|
end
|
28
28
|
|
29
29
|
def self.eager_load?
|
@@ -33,14 +33,14 @@ module Administrate
|
|
33
33
|
def nested_form
|
34
34
|
@nested_form ||= Administrate::Page::Form.new(
|
35
35
|
resolver.dashboard_class.new,
|
36
|
-
data || resolver.resource_class.new
|
36
|
+
data || resolver.resource_class.new
|
37
37
|
)
|
38
38
|
end
|
39
39
|
|
40
40
|
def nested_show
|
41
41
|
@nested_show ||= Administrate::Page::Show.new(
|
42
42
|
resolver.dashboard_class.new,
|
43
|
-
data || resolver.resource_class.new
|
43
|
+
data || resolver.resource_class.new
|
44
44
|
)
|
45
45
|
end
|
46
46
|
|
@@ -48,6 +48,10 @@ module Administrate
|
|
48
48
|
data.try(:persisted?)
|
49
49
|
end
|
50
50
|
|
51
|
+
def html_controller
|
52
|
+
"select"
|
53
|
+
end
|
54
|
+
|
51
55
|
private
|
52
56
|
|
53
57
|
def resolver
|
@@ -38,8 +38,8 @@ module Administrate
|
|
38
38
|
formatter = options[:format][:formatter]
|
39
39
|
formatter_options = options[:format][:formatter_options].to_h
|
40
40
|
|
41
|
-
ActiveSupport::NumberHelper
|
42
|
-
try(formatter, result, **formatter_options) || result
|
41
|
+
ActiveSupport::NumberHelper
|
42
|
+
.try(formatter, result, **formatter_options) || result
|
43
43
|
end
|
44
44
|
end
|
45
45
|
end
|
@@ -4,7 +4,7 @@ module Administrate
|
|
4
4
|
module Field
|
5
5
|
class Polymorphic < BelongsTo
|
6
6
|
def self.permitted_attribute(attr, _options = {})
|
7
|
-
{
|
7
|
+
{attr => %i[type value]}
|
8
8
|
end
|
9
9
|
|
10
10
|
def associated_resource_grouped_options
|
@@ -16,11 +16,11 @@ module Administrate
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def permitted_attribute
|
19
|
-
{
|
19
|
+
{attribute => %i[type value]}
|
20
20
|
end
|
21
21
|
|
22
22
|
def selected_global_id
|
23
|
-
data
|
23
|
+
data&.to_global_id
|
24
24
|
end
|
25
25
|
|
26
26
|
private
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require "administrate/field/base"
|
2
|
+
|
3
|
+
module Administrate
|
4
|
+
module Field
|
5
|
+
class RichText < Administrate::Field::Base
|
6
|
+
def to_s
|
7
|
+
data&.to_plain_text
|
8
|
+
end
|
9
|
+
|
10
|
+
def truncate
|
11
|
+
to_s.truncate(truncation_length)
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def truncation_length
|
17
|
+
options.fetch(:truncate, 50)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/administrate/order.rb
CHANGED
@@ -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
|
-
|
78
|
+
order_by_association_attribute(relation)
|
79
79
|
else
|
80
80
|
order_by_id(relation)
|
81
81
|
end
|
@@ -83,26 +83,16 @@ module Administrate
|
|
83
83
|
|
84
84
|
def order_by_has_one(relation)
|
85
85
|
if ordering_by_association_column?(relation)
|
86
|
-
|
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
97
|
association_attribute &&
|
108
98
|
column_exist?(
|
@@ -115,16 +105,26 @@ module Administrate
|
|
115
105
|
end
|
116
106
|
|
117
107
|
def order_by_id_query(relation)
|
118
|
-
relation.arel_table[
|
108
|
+
relation.arel_table[association_foreign_key(relation)].public_send(direction)
|
119
109
|
end
|
120
110
|
|
121
|
-
def
|
122
|
-
|
111
|
+
def order_by_association_id(relation)
|
112
|
+
order_by_association_column(relation, association_primary_key(relation))
|
123
113
|
end
|
124
114
|
|
125
|
-
def
|
126
|
-
|
127
|
-
|
115
|
+
def order_by_association_attribute(relation)
|
116
|
+
order_by_association_column(relation, association_attribute)
|
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
|
138
|
+
def association_foreign_key(relation)
|
139
139
|
reflect_association(relation).foreign_key
|
140
140
|
end
|
141
141
|
|
142
|
-
def
|
143
|
-
|
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.
|
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,
|
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
|
-
|
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
|
-
{
|
28
|
+
{key => order.order_params_for(attr)}
|
29
29
|
end
|
30
30
|
|
31
31
|
private
|
data/lib/administrate/search.rb
CHANGED
@@ -59,8 +59,7 @@ module Administrate
|
|
59
59
|
@scoped_resource.all
|
60
60
|
else
|
61
61
|
results = search_results(@scoped_resource)
|
62
|
-
|
63
|
-
results
|
62
|
+
filter_results(results)
|
64
63
|
end
|
65
64
|
end
|
66
65
|
|
@@ -112,9 +111,9 @@ module Administrate
|
|
112
111
|
end
|
113
112
|
|
114
113
|
def search_results(resources)
|
115
|
-
resources
|
116
|
-
left_joins(tables_to_join)
|
117
|
-
where(query_template, *query_values)
|
114
|
+
resources
|
115
|
+
.left_joins(tables_to_join)
|
116
|
+
.where(query_template, *query_values)
|
118
117
|
end
|
119
118
|
|
120
119
|
def valid_filters
|
@@ -141,8 +140,8 @@ module Administrate
|
|
141
140
|
end
|
142
141
|
ActiveRecord::Base.connection.quote_table_name(unquoted_table_name)
|
143
142
|
else
|
144
|
-
ActiveRecord::Base.connection
|
145
|
-
quote_table_name(@scoped_resource.table_name)
|
143
|
+
ActiveRecord::Base.connection
|
144
|
+
.quote_table_name(@scoped_resource.table_name)
|
146
145
|
end
|
147
146
|
end
|
148
147
|
|
data/lib/administrate/version.rb
CHANGED
@@ -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
@@ -4,39 +4,39 @@ require "administrate/version"
|
|
4
4
|
module Administrate
|
5
5
|
def self.warn_of_missing_resource_class
|
6
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"
|
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
12
|
)
|
13
13
|
end
|
14
14
|
|
15
15
|
def self.warn_of_deprecated_option(name)
|
16
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."
|
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
22
|
)
|
23
23
|
end
|
24
24
|
|
25
25
|
def self.warn_of_deprecated_method(klass, method)
|
26
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"
|
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
32
|
)
|
33
33
|
end
|
34
34
|
|
35
35
|
def self.warn_of_deprecated_authorization_method(method)
|
36
36
|
deprecator.warn(
|
37
|
-
"The method `#{method}` is deprecated. "
|
38
|
-
"Please use `accessible_action?` instead, "
|
39
|
-
"or see the documentation for other options."
|
37
|
+
"The method `#{method}` is deprecated. " \
|
38
|
+
"Please use `accessible_action?` instead, " \
|
39
|
+
"or see the documentation for other options."
|
40
40
|
)
|
41
41
|
end
|
42
42
|
|