administrate 0.20.1 → 1.0.0.beta1

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 (57) 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 +1 -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 +19 -19
  24. data/app/controllers/concerns/administrate/punditize.rb +5 -5
  25. data/app/helpers/administrate/application_helper.rb +4 -4
  26. data/lib/administrate/base_dashboard.rb +5 -5
  27. data/lib/administrate/engine.rb +1 -6
  28. data/lib/administrate/field/associative.rb +1 -1
  29. data/lib/administrate/field/base.rb +2 -2
  30. data/lib/administrate/field/belongs_to.rb +1 -1
  31. data/lib/administrate/field/date.rb +1 -1
  32. data/lib/administrate/field/date_time.rb +2 -2
  33. data/lib/administrate/field/deferred.rb +1 -1
  34. data/lib/administrate/field/has_many.rb +5 -5
  35. data/lib/administrate/field/has_one.rb +6 -6
  36. data/lib/administrate/field/number.rb +2 -2
  37. data/lib/administrate/field/polymorphic.rb +3 -3
  38. data/lib/administrate/generator_helpers.rb +1 -1
  39. data/lib/administrate/namespace/resource.rb +1 -1
  40. data/lib/administrate/order.rb +6 -6
  41. data/lib/administrate/page/base.rb +1 -1
  42. data/lib/administrate/page/collection.rb +2 -2
  43. data/lib/administrate/page/form.rb +1 -1
  44. data/lib/administrate/page/show.rb +1 -1
  45. data/lib/administrate/resource_resolver.rb +1 -1
  46. data/lib/administrate/search.rb +6 -7
  47. data/lib/administrate/version.rb +1 -1
  48. data/lib/administrate/view_generator.rb +3 -3
  49. data/lib/administrate.rb +18 -18
  50. data/lib/generators/administrate/dashboard/dashboard_generator.rb +9 -9
  51. data/lib/generators/administrate/field/field_generator.rb +2 -2
  52. data/lib/generators/administrate/install/install_generator.rb +2 -2
  53. data/lib/generators/administrate/routes/routes_generator.rb +5 -5
  54. data/lib/generators/administrate/views/field_generator.rb +2 -2
  55. data/lib/generators/administrate/views/layout_generator.rb +1 -1
  56. metadata +13 -47
  57. /data/app/assets/stylesheets/{docs.scss → administrate-internal/docs.scss} +0 -0
@@ -0,0 +1,89 @@
1
+ html,
2
+ body {
3
+ font-family: "Lato", serif;
4
+ font-size: 18px;
5
+ line-height: 1.62em;
6
+ margin: 0;
7
+ }
8
+
9
+ img {
10
+ max-width: 100%;
11
+ }
12
+
13
+ h1,
14
+ h2,
15
+ h3 {
16
+ font-family: "Fjalla One", sans-serif;
17
+ margin-top: 2em;
18
+ }
19
+
20
+ a {
21
+ color: #53adc6;
22
+ text-decoration: none;
23
+ }
24
+
25
+ .content {
26
+ margin-bottom: 2em;
27
+ margin-left: auto;
28
+ margin-right: auto;
29
+ margin-top: 2em;
30
+ width: 60em;
31
+ }
32
+ .content .sidebar {
33
+ float: left;
34
+ width: 20em;
35
+ }
36
+ .content .sidebar-links {
37
+ list-style: none;
38
+ padding-left: 0;
39
+ }
40
+ .content .main {
41
+ float: right;
42
+ width: 40em;
43
+ }
44
+
45
+ .flash-wrapper {
46
+ background-color: #cf726e;
47
+ color: #f0f0f0;
48
+ padding: 1em;
49
+ }
50
+ .flash-wrapper .flash {
51
+ margin-left: auto;
52
+ margin-right: auto;
53
+ width: 40em;
54
+ }
55
+
56
+ code {
57
+ font-family: "Source Code Pro";
58
+ font-size: 0.8rem;
59
+ padding: 0.4em 0.2em 0;
60
+ }
61
+ code.hljs {
62
+ background-color: #202020;
63
+ color: #e0e0dc;
64
+ padding-left: 1rem;
65
+ }
66
+ code.hljs .hljs-string {
67
+ color: #b0bf82;
68
+ }
69
+ code.hljs .hljs-subst {
70
+ color: #e0e0dc;
71
+ }
72
+ code.hljs .hljs-constant {
73
+ color: #8fbdcc;
74
+ }
75
+ code.hljs .hljs-symbol {
76
+ color: #b95c56;
77
+ }
78
+ code.hljs .hljs-keyword {
79
+ color: #f8d29d;
80
+ }
81
+ code.hljs .hljs-title,
82
+ code.hljs .hljs-parent {
83
+ color: #8fbdcc;
84
+ }
85
+ code.hljs .hljs-tag {
86
+ color: #f8d29d;
87
+ }
88
+
89
+ /*# sourceMappingURL=docs.css.map */
@@ -0,0 +1 @@
1
+ {"version":3,"sourceRoot":"","sources":["../../stylesheets/administrate-internal/docs.scss"],"names":[],"mappings":"AAYA;AAAA;EAEE;EACA;EACA;EACA;;;AAGF;EACE;;;AAGF;AAAA;AAAA;EAGE;EACA;;;AAGF;EACE,OAhCK;EAiCL;;;AAGF;EACE;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;;AAEA;EACE;EACA;;AAIJ;EACE;EACA;;;AAIJ;EACE,kBA3DI;EA4DJ,OA1DM;EA2DN;;AAEA;EACE;EACA;EACA;;;AAIJ;EACE;EACA;EACA;;AAEA;EACE,kBAxES;EAyET,OAxES;EAyET;;AAEA;EAAe,OA1EN;;AA2ET;EAAc,OA5EL;;AA6ET;EAAiB,OA3ET;;AA4ER;EAAe,OA1ER;;AA2EP;EAAgB,OA5EN;;AA8EV;AAAA;EACe,OAhFP;;AAkFR;EAAY,OAjFF","file":"docs.css"}
@@ -0,0 +1,2 @@
1
+ //= link_tree ../images
2
+ //= link_tree ../builds
@@ -0,0 +1,4 @@
1
+ import jquery from "jquery";
2
+
3
+ window.jQuery = jquery;
4
+ window.$ = jquery;
@@ -1,4 +1,8 @@
1
- //= require jquery
2
- //= require jquery_ujs
3
- //= require selectize
4
- //= require_tree .
1
+ import "./add_jquery";
2
+
3
+ import {} from "jquery-ujs";
4
+ import "selectize/dist/js/selectize.min.js";
5
+
6
+ import "./components/associative";
7
+ import "./components/select";
8
+ import "./components/table";
@@ -2,7 +2,8 @@
2
2
 
3
3
  @import "reset/normalize";
4
4
 
5
- @import "selectize";
5
+ @import "selectize/dist/css/selectize";
6
+ @import "selectize/dist/css/selectize.default";
6
7
 
7
8
  @import "library/clearfix";
8
9
  @import "library/data-label";
@@ -32,6 +32,10 @@ textarea {
32
32
  font-size: 16px;
33
33
  }
34
34
 
35
+ textarea {
36
+ resize: vertical;
37
+ }
38
+
35
39
  [type="color"],
36
40
  [type="date"],
37
41
  [type="datetime-local"],
@@ -78,10 +82,6 @@ textarea {
78
82
  }
79
83
  }
80
84
 
81
- textarea {
82
- resize: vertical;
83
- }
84
-
85
85
  [type="checkbox"],
86
86
  [type="radio"] {
87
87
  display: inline;
@@ -23,7 +23,7 @@ tbody tr {
23
23
  background-color: $base-background-color;
24
24
  }
25
25
 
26
- [role=link] {
26
+ [role="link"] {
27
27
  cursor: pointer;
28
28
  }
29
29
 
@@ -1,5 +1,6 @@
1
1
  .attribute-label {
2
2
  @include data-label;
3
+
3
4
  clear: left;
4
5
  float: left;
5
6
  margin-bottom: $base-spacing;
@@ -1,7 +1,5 @@
1
1
  button,
2
- input[type="button"],
3
- input[type="reset"],
4
- input[type="submit"],
2
+ input,
5
3
  .button {
6
4
  appearance: none;
7
5
  background-color: $action-color;
@@ -1,6 +1,25 @@
1
+ .cell-label__sort-indicator {
2
+ float: right;
3
+ margin-left: 5px;
4
+
5
+ svg {
6
+ fill: $hint-grey;
7
+ height: 13px;
8
+ transition: transform $base-duration $base-timing;
9
+ width: 13px;
10
+ }
11
+ }
12
+
1
13
  .cell-label {
2
14
  padding-top: 0.15em;
3
15
 
16
+ a {
17
+ color: inherit;
18
+ display: inline-block;
19
+ transition: color $base-duration $base-timing;
20
+ width: 100%;
21
+ }
22
+
4
23
  &:hover {
5
24
  a {
6
25
  color: $action-color;
@@ -11,13 +30,6 @@
11
30
  transform: rotate(180deg);
12
31
  }
13
32
  }
14
-
15
- a {
16
- color: inherit;
17
- display: inline-block;
18
- transition: color $base-duration $base-timing;
19
- width: 100%;
20
- }
21
33
  }
22
34
 
23
35
  .cell-label--asc,
@@ -25,18 +37,6 @@
25
37
  font-weight: $bold-font-weight;
26
38
  }
27
39
 
28
- .cell-label__sort-indicator {
29
- float: right;
30
- margin-left: 5px;
31
-
32
- svg {
33
- fill: $hint-grey;
34
- height: 13px;
35
- transition: transform $base-duration $base-timing;
36
- width: 13px;
37
- }
38
- }
39
-
40
40
  .cell-label__sort-indicator--desc {
41
41
  transform: rotate(180deg);
42
42
  }
@@ -1,5 +1,6 @@
1
1
  .field-unit {
2
2
  @include administrate-clearfix;
3
+
3
4
  align-items: center;
4
5
  display: flex;
5
6
  flex-wrap: wrap;
@@ -4,8 +4,8 @@
4
4
  box-shadow: 0 0 6px 0 rgba($black, 0.12),
5
5
  0 2px 2px rgba($black, 0.2);
6
6
  flex: 1 1 100%;
7
- padding-bottom: 10vh;
8
7
  min-width: 800px;
8
+ padding-bottom: 10vh;
9
9
  }
10
10
 
11
11
  .main-content__header,
@@ -1,4 +1,4 @@
1
- $_navigation-link-padding: 0.6em;
1
+ $navigation-link-padding: 0.6em;
2
2
 
3
3
  .navigation {
4
4
  flex: 1 0 10rem;
@@ -11,8 +11,8 @@ $_navigation-link-padding: 0.6em;
11
11
  color: $base-font-color;
12
12
  display: block;
13
13
  line-height: 1;
14
- margin-left: -($_navigation-link-padding);
15
- padding: $_navigation-link-padding;
14
+ margin-left: -($navigation-link-padding);
15
+ padding: $navigation-link-padding;
16
16
  transition: background-color $base-duration $base-timing,
17
17
  color $base-duration $base-timing;
18
18
 
@@ -1,4 +1,4 @@
1
- $_search-icon-size: 1rem;
1
+ $search-icon-size: 1rem;
2
2
 
3
3
  .search {
4
4
  margin-left: auto;
@@ -10,35 +10,35 @@ $_search-icon-size: 1rem;
10
10
 
11
11
  .search__input {
12
12
  border-radius: 100rem;
13
- padding-left: $_search-icon-size * 2.5;
14
- padding-right: $_search-icon-size * 2.5;
13
+ padding-left: $search-icon-size * 2.5;
14
+ padding-right: $search-icon-size * 2.5;
15
15
  }
16
16
 
17
17
  .search__eyeglass-icon {
18
18
  fill: $grey-7;
19
- height: $_search-icon-size;
20
- left: $_search-icon-size;
19
+ height: $search-icon-size;
20
+ left: $search-icon-size;
21
21
  position: absolute;
22
22
  top: 50%;
23
23
  transform: translateY(-50%);
24
- width: $_search-icon-size;
24
+ width: $search-icon-size;
25
25
  }
26
26
 
27
27
  .search__clear-link {
28
- height: $_search-icon-size;
28
+ height: $search-icon-size;
29
29
  position: absolute;
30
- right: $_search-icon-size * 0.75;
30
+ right: $search-icon-size * 0.75;
31
31
  top: 50%;
32
32
  transform: translateY(-50%);
33
- width: $_search-icon-size;
33
+ width: $search-icon-size;
34
34
  }
35
35
 
36
36
  .search__clear-icon {
37
37
  fill: $grey-5;
38
- height: $_search-icon-size;
38
+ height: $search-icon-size;
39
39
  position: absolute;
40
40
  transition: fill $base-duration $base-timing;
41
- width: $_search-icon-size;
41
+ width: $search-icon-size;
42
42
 
43
43
  &:hover {
44
44
  fill: $action-color;
@@ -1,5 +1,7 @@
1
+ /* stylelint-disable scss/dollar-variable-empty-line-before */
2
+
1
3
  // Typography
2
- $base-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto",
4
+ $base-font-family: -apple-system, blinkmacsystemfont, "Segoe UI", "Roboto",
3
5
  "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
4
6
  sans-serif !default;
5
7
  $heading-font-family: $base-font-family !default;
@@ -17,8 +19,8 @@ $base-spacing: $base-line-height * 1em !default;
17
19
  $small-spacing: $base-spacing * 0.5 !default;
18
20
 
19
21
  // Colors
20
- $white: #fff !default;
21
- $black: #000 !default;
22
+ $white: #ffffff !default;
23
+ $black: #000000 !default;
22
24
 
23
25
  $blue: #1976d2 !default;
24
26
  $red: #d32f2f !default;
@@ -63,3 +65,5 @@ $base-border: 1px solid $base-border-color !default;
63
65
  // Transitions
64
66
  $base-duration: 250ms !default;
65
67
  $base-timing: ease-in-out !default;
68
+
69
+ /* stylelint-enable scss/dollar-variable-empty-line-before */
@@ -15,13 +15,13 @@ module Administrate
15
15
  resources: resources,
16
16
  search_term: search_term,
17
17
  page: page,
18
- show_search_bar: show_search_bar?,
18
+ show_search_bar: show_search_bar?
19
19
  }
20
20
  end
21
21
 
22
22
  def show
23
23
  render locals: {
24
- page: Administrate::Page::Show.new(dashboard, requested_resource),
24
+ page: Administrate::Page::Show.new(dashboard, requested_resource)
25
25
  }
26
26
  end
27
27
 
@@ -29,13 +29,13 @@ module Administrate
29
29
  resource = new_resource
30
30
  authorize_resource(resource)
31
31
  render locals: {
32
- page: Administrate::Page::Form.new(dashboard, resource),
32
+ page: Administrate::Page::Form.new(dashboard, resource)
33
33
  }
34
34
  end
35
35
 
36
36
  def edit
37
37
  render locals: {
38
- page: Administrate::Page::Form.new(dashboard, requested_resource),
38
+ page: Administrate::Page::Form.new(dashboard, requested_resource)
39
39
  }
40
40
  end
41
41
 
@@ -47,11 +47,11 @@ module Administrate
47
47
  yield(resource) if block_given?
48
48
  redirect_to(
49
49
  after_resource_created_path(resource),
50
- notice: translate_with_resource("create.success"),
50
+ notice: translate_with_resource("create.success")
51
51
  )
52
52
  else
53
53
  render :new, locals: {
54
- page: Administrate::Page::Form.new(dashboard, resource),
54
+ page: Administrate::Page::Form.new(dashboard, resource)
55
55
  }, status: :unprocessable_entity
56
56
  end
57
57
  end
@@ -60,11 +60,11 @@ module Administrate
60
60
  if requested_resource.update(resource_params)
61
61
  redirect_to(
62
62
  after_resource_updated_path(requested_resource),
63
- notice: translate_with_resource("update.success"),
63
+ notice: translate_with_resource("update.success")
64
64
  )
65
65
  else
66
66
  render :edit, locals: {
67
- page: Administrate::Page::Form.new(dashboard, requested_resource),
67
+ page: Administrate::Page::Form.new(dashboard, requested_resource)
68
68
  }, status: :unprocessable_entity
69
69
  end
70
70
  end
@@ -84,12 +84,12 @@ module Administrate
84
84
  Administrate::Search.new(
85
85
  resources,
86
86
  dashboard,
87
- search_term,
87
+ search_term
88
88
  ).run
89
89
  end
90
90
 
91
91
  def after_resource_destroyed_path(_requested_resource)
92
- { action: :index }
92
+ {action: :index}
93
93
  end
94
94
 
95
95
  def after_resource_created_path(requested_resource)
@@ -103,7 +103,7 @@ module Administrate
103
103
  helper_method :nav_link_state
104
104
  def nav_link_state(resource)
105
105
  underscore_resource = resource.to_s.split("/").join("__")
106
- resource_name.to_s.pluralize == underscore_resource ? :active : :inactive
106
+ (resource_name.to_s.pluralize == underscore_resource) ? :active : :inactive
107
107
  end
108
108
 
109
109
  # Whether the named action route exists for the resource class.
@@ -141,8 +141,8 @@ module Administrate
141
141
  sorting_attribute,
142
142
  sorting_direction,
143
143
  association_attribute: order_by_field(
144
- dashboard_attribute(sorting_attribute),
145
- ),
144
+ dashboard_attribute(sorting_attribute)
145
+ )
146
146
  )
147
147
  end
148
148
 
@@ -201,9 +201,9 @@ module Administrate
201
201
  end
202
202
 
203
203
  def resource_params
204
- params.require(resource_class.model_name.param_key).
205
- permit(dashboard.permitted_attributes(action_name)).
206
- transform_values { |v| read_param_value(v) }
204
+ params.require(resource_class.model_name.param_key)
205
+ .permit(dashboard.permitted_attributes(action_name))
206
+ .transform_values { |v| read_param_value(v) }
207
207
  end
208
208
 
209
209
  def read_param_value(data)
@@ -236,13 +236,13 @@ module Administrate
236
236
  def translate_with_resource(key)
237
237
  t(
238
238
  "administrate.controller.#{key}",
239
- resource: resource_resolver.resource_title,
239
+ resource: resource_resolver.resource_title
240
240
  )
241
241
  end
242
242
 
243
243
  def show_search_bar?
244
244
  dashboard.attribute_types_for(
245
- dashboard.all_attributes,
245
+ dashboard.all_attributes
246
246
  ).any? { |_name, attribute| attribute.searchable? }
247
247
  end
248
248
 
@@ -279,7 +279,7 @@ module Administrate
279
279
  else
280
280
  raise Administrate::NotAuthorizedError.new(
281
281
  action: action_name,
282
- resource: resource,
282
+ resource: resource
283
283
  )
284
284
  end
285
285
  end
@@ -1,6 +1,6 @@
1
1
  module Administrate
2
2
  module Punditize
3
- if Object.const_defined?("Pundit")
3
+ if Object.const_defined?(:Pundit)
4
4
  extend ActiveSupport::Concern
5
5
 
6
6
  if Pundit.const_defined?(:Authorization)
@@ -28,7 +28,7 @@ module Administrate
28
28
  def authorized_action?(resource, action)
29
29
  namespaced_resource = policy_namespace + [resource]
30
30
  policy = Pundit.policy!(pundit_user, namespaced_resource)
31
- policy.send("#{action}?".to_sym)
31
+ policy.send(:"#{action}?")
32
32
  end
33
33
 
34
34
  def policy_scope!(user, scope)
@@ -38,13 +38,13 @@ module Administrate
38
38
  policy_scope = policy_scope_class.new(user, pundit_model(scope))
39
39
  rescue ArgumentError
40
40
  raise(Pundit::InvalidConstructorError,
41
- "Invalid #<#{policy_scope_class}> constructor is called")
41
+ "Invalid #<#{policy_scope_class}> constructor is called")
42
42
  end
43
43
 
44
44
  if policy_scope.respond_to? :resolve_admin
45
45
  Administrate.deprecator.warn(
46
- "Pundit policy scope `resolve_admin` method is deprecated. " +
47
- "Please use a namespaced pundit policy instead.",
46
+ "Pundit policy scope `resolve_admin` method is deprecated. " \
47
+ "Please use a namespaced pundit policy instead."
48
48
  )
49
49
  policy_scope.resolve_admin
50
50
  else
@@ -50,7 +50,7 @@ module Administrate
50
50
  def display_resource_name(resource_name, opts = {})
51
51
  dashboard_from_resource(resource_name).resource_name(
52
52
  count: opts[:singular] ? SINGULAR_COUNT : PLURAL_MANY_COUNT,
53
- default: default_resource_name(resource_name, opts),
53
+ default: default_resource_name(resource_name, opts)
54
54
  )
55
55
  end
56
56
 
@@ -65,14 +65,14 @@ module Administrate
65
65
  def resource_index_route(resource_name)
66
66
  url_for(
67
67
  action: "index",
68
- controller: "/#{namespace}/#{resource_name}",
68
+ controller: "/#{namespace}/#{resource_name}"
69
69
  )
70
70
  end
71
71
 
72
72
  def sanitized_order_params(page, current_field_name)
73
73
  collection_names = page.item_associations + [current_field_name]
74
74
  association_params = collection_names.map do |assoc_name|
75
- { assoc_name => %i[order direction page per_page] }
75
+ {assoc_name => %i[order direction page per_page]}
76
76
  end
77
77
  params.permit(:search, :id, :_page, :per_page, association_params)
78
78
  end
@@ -87,7 +87,7 @@ module Administrate
87
87
 
88
88
  def default_resource_name(name, opts = {})
89
89
  resource_name = (opts[:singular] ? name.to_s : name.to_s.pluralize)
90
- resource_name.gsub("/", "_").titleize
90
+ resource_name.tr("/", "_").titleize
91
91
  end
92
92
  end
93
93
  end
@@ -79,7 +79,7 @@ module Administrate
79
79
  attribute_types[attr].permitted_attribute(
80
80
  attr,
81
81
  resource_class: self.class.model,
82
- action: action,
82
+ action: action
83
83
  )
84
84
  end.uniq
85
85
  end
@@ -118,10 +118,10 @@ module Administrate
118
118
 
119
119
  def item_associations
120
120
  attributes = if show_page_attributes.is_a?(Hash)
121
- show_page_attributes.values.flatten
122
- else
123
- show_page_attributes
124
- end
121
+ show_page_attributes.values.flatten
122
+ else
123
+ show_page_attributes
124
+ end
125
125
  attribute_associated attributes
126
126
  end
127
127
 
@@ -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,7 +20,7 @@ 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
 
@@ -41,7 +41,7 @@ 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
@@ -56,13 +56,13 @@ module Administrate
56
56
  return false unless resource.class.respond_to?(:validators_on)
57
57
 
58
58
  resource.class.validators_on(attribute).any? do |v|
59
- next false unless v.class == ActiveRecord::Validations::PresenceValidator
59
+ next false unless v.instance_of?(ActiveRecord::Validations::PresenceValidator)
60
60
 
61
61
  options = v.options
62
62
  next false if options.include?(:if)
63
63
  next false if options.include?(:unless)
64
64
 
65
- if on_option = options[:on]
65
+ if (on_option = options[:on])
66
66
  if on_option == :create && !resource.persisted?
67
67
  next true
68
68
  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
@@ -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
 
@@ -35,7 +35,7 @@ module Administrate
35
35
 
36
36
  def searchable_field
37
37
  Administrate.deprecator.warn(
38
- "searchable_field is deprecated, use searchable_fields instead",
38
+ "searchable_field is deprecated, use searchable_fields instead"
39
39
  )
40
40
  options.fetch(:searchable_field)
41
41
  end