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.
Files changed (92) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +9 -9
  3. data/app/assets/builds/administrate/application.css +2542 -0
  4. data/app/assets/builds/administrate/application.css.map +1 -0
  5. data/app/assets/builds/administrate/application.js +22169 -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/javascripts/administrate/controllers/application.js +9 -0
  13. data/app/assets/javascripts/administrate/controllers/index.js +7 -0
  14. data/app/assets/javascripts/administrate/controllers/select_controller.js +8 -0
  15. data/app/assets/javascripts/administrate/{components/table.js → controllers/table_controller.js} +9 -9
  16. data/app/assets/stylesheets/administrate/application.scss +3 -3
  17. data/app/assets/stylesheets/administrate/base/_forms.scss +4 -4
  18. data/app/assets/stylesheets/administrate/base/_layout.scss +5 -0
  19. data/app/assets/stylesheets/administrate/base/_tables.scss +1 -1
  20. data/app/assets/stylesheets/administrate/base/_typography.scss +12 -1
  21. data/app/assets/stylesheets/administrate/components/_attributes.scss +1 -0
  22. data/app/assets/stylesheets/administrate/components/_buttons.scss +12 -12
  23. data/app/assets/stylesheets/administrate/components/_cells.scss +19 -19
  24. data/app/assets/stylesheets/administrate/components/_field-unit.scss +3 -3
  25. data/app/assets/stylesheets/administrate/components/_main-content.scss +1 -1
  26. data/app/assets/stylesheets/administrate/components/_navigation.scss +3 -3
  27. data/app/assets/stylesheets/administrate/components/_search.scss +11 -11
  28. data/app/assets/stylesheets/administrate/library/_variables.scss +7 -3
  29. data/app/assets/stylesheets/administrate/reset/_normalize.scss +7 -1
  30. data/app/controllers/administrate/application_controller.rb +20 -19
  31. data/app/controllers/concerns/administrate/punditize.rb +5 -5
  32. data/app/helpers/administrate/application_helper.rb +4 -4
  33. data/app/views/administrate/application/_collection.html.erb +1 -1
  34. data/app/views/administrate/application/_collection_item_actions.html.erb +3 -3
  35. data/app/views/administrate/application/_index_header.html.erb +4 -0
  36. data/app/views/administrate/application/_javascript.html.erb +1 -1
  37. data/app/views/administrate/application/edit.html.erb +15 -3
  38. data/app/views/administrate/application/index.html.erb +19 -11
  39. data/app/views/administrate/application/new.html.erb +15 -3
  40. data/app/views/administrate/application/show.html.erb +35 -23
  41. data/app/views/fields/belongs_to/_form.html.erb +3 -2
  42. data/app/views/fields/has_many/_form.html.erb +1 -1
  43. data/app/views/fields/polymorphic/_form.html.erb +1 -1
  44. data/app/views/fields/rich_text/_form.html.erb +6 -0
  45. data/app/views/fields/rich_text/_index.html.erb +18 -0
  46. data/app/views/fields/rich_text/_show.html.erb +18 -0
  47. data/app/views/fields/select/_form.html.erb +2 -1
  48. data/app/views/fields/text/_form.html.erb +1 -1
  49. data/app/views/layouts/administrate/application.html.erb +1 -2
  50. data/docs/customizing_dashboards.md +138 -4
  51. data/docs/customizing_page_views.md +25 -0
  52. data/lib/administrate/base_dashboard.rb +6 -5
  53. data/lib/administrate/engine.rb +7 -6
  54. data/lib/administrate/field/associative.rb +5 -1
  55. data/lib/administrate/field/base.rb +21 -3
  56. data/lib/administrate/field/belongs_to.rb +7 -2
  57. data/lib/administrate/field/date.rb +1 -1
  58. data/lib/administrate/field/date_time.rb +2 -2
  59. data/lib/administrate/field/deferred.rb +10 -2
  60. data/lib/administrate/field/has_many.rb +5 -5
  61. data/lib/administrate/field/has_one.rb +10 -6
  62. data/lib/administrate/field/number.rb +2 -2
  63. data/lib/administrate/field/polymorphic.rb +3 -3
  64. data/lib/administrate/field/rich_text.rb +21 -0
  65. data/lib/administrate/field/select.rb +4 -0
  66. data/lib/administrate/generator_helpers.rb +1 -1
  67. data/lib/administrate/namespace/resource.rb +1 -1
  68. data/lib/administrate/order.rb +30 -26
  69. data/lib/administrate/page/base.rb +2 -7
  70. data/lib/administrate/page/collection.rb +2 -2
  71. data/lib/administrate/page/form.rb +1 -1
  72. data/lib/administrate/page/show.rb +1 -1
  73. data/lib/administrate/resource_resolver.rb +1 -1
  74. data/lib/administrate/search.rb +6 -7
  75. data/lib/administrate/version.rb +1 -1
  76. data/lib/administrate/view_generator.rb +3 -3
  77. data/lib/administrate.rb +18 -18
  78. data/lib/generators/administrate/dashboard/dashboard_generator.rb +12 -9
  79. data/lib/generators/administrate/field/field_generator.rb +2 -2
  80. data/lib/generators/administrate/install/install_generator.rb +2 -2
  81. data/lib/generators/administrate/routes/routes_generator.rb +5 -5
  82. data/lib/generators/administrate/views/field_generator.rb +2 -2
  83. data/lib/generators/administrate/views/index_generator.rb +1 -0
  84. data/lib/generators/administrate/views/layout_generator.rb +1 -1
  85. metadata +20 -53
  86. data/app/assets/javascripts/administrate/components/associative.js +0 -5
  87. data/app/assets/javascripts/administrate/components/select.js +0 -3
  88. data/app/assets/stylesheets/administrate/utilities/_text-color.scss +0 -3
  89. data/lib/generators/administrate/assets/assets_generator.rb +0 -12
  90. data/lib/generators/administrate/assets/javascripts_generator.rb +0 -17
  91. data/lib/generators/administrate/assets/stylesheets_generator.rb +0 -17
  92. /data/app/assets/stylesheets/{docs.scss → administrate-internal/docs.scss} +0 -0
@@ -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
@@ -41,11 +41,15 @@ module Administrate
41
41
  else
42
42
  self.class.associated_class_name(
43
43
  resource.class,
44
- attribute,
44
+ attribute
45
45
  )
46
46
  end
47
47
  end
48
48
 
49
+ def html_controller
50
+ "select"
51
+ end
52
+
49
53
  private
50
54
 
51
55
  def associated_dashboard
@@ -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.class == ActiveRecord::Validations::PresenceValidator
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 = options[:scope] ? options[:scope].call : associated_class.all
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.to_date,
9
- format: format,
9
+ format: format
10
10
  )
11
11
  end
12
12
 
@@ -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.fetch(:searchable, deferred_class.searchable?)
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
- { "#{attr.to_s.singularize}_ids".to_sym => [] }
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
- { "#{attr}_attributes": related_dashboard_attributes }
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
- { attr => %i{type value} }
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
- { attribute => %i{type value} }
19
+ {attribute => %i[type value]}
20
20
  end
21
21
 
22
22
  def selected_global_id
23
- data ? data.to_global_id : nil
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
@@ -35,6 +35,10 @@ module Administrate
35
35
  def active_record_enum_values
36
36
  resource.class.defined_enums[attribute.to_s].map(&:first)
37
37
  end
38
+
39
+ def html_controller
40
+ "select"
41
+ end
38
42
  end
39
43
  end
40
44
  end
@@ -7,7 +7,7 @@ module Administrate
7
7
  private
8
8
 
9
9
  def generator_options
10
- { behavior: behavior }
10
+ {behavior: behavior}
11
11
  end
12
12
  end
13
13
  end
@@ -21,7 +21,7 @@ module Administrate
21
21
  end
22
22
 
23
23
  def path
24
- name.to_s.gsub("/", "_")
24
+ name.to_s.tr("/", "_")
25
25
  end
26
26
  end
27
27
  end
@@ -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,26 +83,16 @@ 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
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[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, 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 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,7 @@ 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)
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
 
@@ -1,3 +1,3 @@
1
1
  module Administrate
2
- VERSION = "0.20.1".freeze
2
+ VERSION = "1.0.0.beta2".freeze
3
3
  end
@@ -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