administrate 0.14.0 → 0.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/administrate/components/associative.js +1 -0
  3. data/app/assets/stylesheets/administrate/components/_attributes.scss +3 -2
  4. data/app/assets/stylesheets/administrate/components/_field-unit.scss +4 -0
  5. data/app/assets/stylesheets/administrate/components/_main-content.scss +1 -0
  6. data/app/controllers/administrate/application_controller.rb +11 -11
  7. data/app/helpers/administrate/application_helper.rb +10 -23
  8. data/app/views/administrate/application/_collection.html.erb +1 -1
  9. data/app/views/administrate/application/_form.html.erb +1 -1
  10. data/app/views/administrate/application/index.html.erb +2 -2
  11. data/app/views/administrate/application/show.html.erb +1 -1
  12. data/app/views/fields/belongs_to/_form.html.erb +3 -3
  13. data/app/views/fields/has_one/_index.html.erb +1 -1
  14. data/app/views/fields/has_one/_show.html.erb +4 -4
  15. data/app/views/fields/number/_form.html.erb +1 -1
  16. data/app/views/fields/polymorphic/_show.html.erb +1 -1
  17. data/app/views/fields/select/_form.html.erb +2 -2
  18. data/app/views/fields/time/_index.html.erb +3 -1
  19. data/app/views/fields/time/_show.html.erb +3 -1
  20. data/app/views/layouts/administrate/application.html.erb +1 -0
  21. data/config/locales/administrate.fi.yml +30 -0
  22. data/config/locales/administrate.fr.yml +2 -2
  23. data/config/locales/administrate.nl.yml +4 -4
  24. data/config/locales/administrate.pt-BR.yml +2 -2
  25. data/config/locales/administrate.pt.yml +3 -3
  26. data/config/locales/administrate.tr.yml +30 -0
  27. data/config/unicorn.rb +8 -13
  28. data/docs/adding_controllers_without_related_model.md +18 -0
  29. data/docs/customizing_dashboards.md +32 -16
  30. data/docs/extending_administrate.md +27 -0
  31. data/docs/getting_started.md +27 -5
  32. data/docs/guides.md +5 -0
  33. data/docs/guides/hiding_dashboards_from_sidebar.md +19 -0
  34. data/lib/administrate.rb +19 -0
  35. data/lib/administrate/base_dashboard.rb +5 -2
  36. data/lib/administrate/engine.rb +7 -0
  37. data/lib/administrate/field/associative.rb +48 -4
  38. data/lib/administrate/field/base.rb +26 -0
  39. data/lib/administrate/field/belongs_to.rb +13 -3
  40. data/lib/administrate/field/deferred.rb +7 -3
  41. data/lib/administrate/field/has_many.rb +15 -2
  42. data/lib/administrate/field/has_one.rb +28 -8
  43. data/lib/administrate/field/number.rb +19 -2
  44. data/lib/administrate/field/polymorphic.rb +1 -1
  45. data/lib/administrate/order.rb +3 -1
  46. data/lib/administrate/resource_resolver.rb +1 -1
  47. data/lib/administrate/search.rb +11 -8
  48. data/lib/administrate/version.rb +1 -1
  49. data/lib/administrate/view_generator.rb +7 -1
  50. data/lib/generators/administrate/dashboard/dashboard_generator.rb +3 -10
  51. data/lib/generators/administrate/dashboard/templates/dashboard.rb.erb +3 -3
  52. data/lib/generators/administrate/install/install_generator.rb +37 -1
  53. data/lib/generators/administrate/routes/routes_generator.rb +3 -13
  54. data/lib/generators/administrate/views/views_generator.rb +5 -4
  55. metadata +15 -25
  56. data/docs/contributing.md +0 -1
@@ -5,16 +5,18 @@ else
5
5
  end
6
6
 
7
7
  require "rails/generators/base"
8
+ require "administrate/generator_helpers"
8
9
  require "administrate/namespace"
9
10
 
10
11
  module Administrate
11
12
  module Generators
12
13
  class RoutesGenerator < Rails::Generators::Base
14
+ include Administrate::GeneratorHelpers
13
15
  source_root File.expand_path("../templates", __FILE__)
14
16
  class_option :namespace, type: :string, default: "admin"
15
17
 
16
18
  def insert_dashboard_routes
17
- if should_route_dashboard?
19
+ if valid_dashboard_models.any?
18
20
  route(dashboard_routes)
19
21
  end
20
22
  end
@@ -76,21 +78,9 @@ module Administrate
76
78
  ERB.new(File.read(routes_file_path)).result(binding)
77
79
  end
78
80
 
79
- def routes_includes_resources?
80
- File.read(rails_routes_file_path).include?(dashboard_routes)
81
- end
82
-
83
- def rails_routes_file_path
84
- Rails.root.join("config/routes.rb")
85
- end
86
-
87
81
  def routes_file_path
88
82
  File.expand_path(find_in_source_paths("routes.rb.erb"))
89
83
  end
90
-
91
- def should_route_dashboard?
92
- routes_includes_resources? || valid_dashboard_models.any?
93
- end
94
84
  end
95
85
  end
96
86
  end
@@ -4,10 +4,11 @@ module Administrate
4
4
  module Generators
5
5
  class ViewsGenerator < Administrate::ViewGenerator
6
6
  def copy_templates
7
- call_generator("administrate:views:index", resource_path)
8
- call_generator("administrate:views:show", resource_path)
9
- call_generator("administrate:views:new", resource_path)
10
- call_generator("administrate:views:edit", resource_path)
7
+ view = "administrate:views:"
8
+ call_generator("#{view}index", resource_path, "--namespace", namespace)
9
+ call_generator("#{view}show", resource_path, "--namespace", namespace)
10
+ call_generator("#{view}new", resource_path, "--namespace", namespace)
11
+ call_generator("#{view}edit", resource_path, "--namespace", namespace)
11
12
  end
12
13
  end
13
14
  end
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.14.0
4
+ version: 0.15.0
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: 2020-07-02 00:00:00.000000000 Z
12
+ date: 2021-02-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionpack
@@ -17,56 +17,42 @@ dependencies:
17
17
  requirements:
18
18
  - - ">="
19
19
  - !ruby/object:Gem::Version
20
- version: '4.2'
20
+ version: '5.0'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - ">="
26
26
  - !ruby/object:Gem::Version
27
- version: '4.2'
27
+ version: '5.0'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: actionview
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
32
  - - ">="
33
33
  - !ruby/object:Gem::Version
34
- version: '4.2'
34
+ version: '5.0'
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - ">="
40
40
  - !ruby/object:Gem::Version
41
- version: '4.2'
41
+ version: '5.0'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: activerecord
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
46
  - - ">="
47
47
  - !ruby/object:Gem::Version
48
- version: '4.2'
48
+ version: '5.0'
49
49
  type: :runtime
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
53
  - - ">="
54
54
  - !ruby/object:Gem::Version
55
- version: '4.2'
56
- - !ruby/object:Gem::Dependency
57
- name: autoprefixer-rails
58
- requirement: !ruby/object:Gem::Requirement
59
- requirements:
60
- - - ">="
61
- - !ruby/object:Gem::Version
62
- version: '6.0'
63
- type: :runtime
64
- prerelease: false
65
- version_requirements: !ruby/object:Gem::Requirement
66
- requirements:
67
- - - ">="
68
- - !ruby/object:Gem::Version
69
- version: '6.0'
55
+ version: '5.0'
70
56
  - !ruby/object:Gem::Dependency
71
57
  name: datetime_picker_rails
72
58
  requirement: !ruby/object:Gem::Requirement
@@ -282,6 +268,7 @@ files:
282
268
  - config/locales/administrate.de.yml
283
269
  - config/locales/administrate.en.yml
284
270
  - config/locales/administrate.es.yml
271
+ - config/locales/administrate.fi.yml
285
272
  - config/locales/administrate.fr.yml
286
273
  - config/locales/administrate.id.yml
287
274
  - config/locales/administrate.it.yml
@@ -294,6 +281,7 @@ files:
294
281
  - config/locales/administrate.ru.yml
295
282
  - config/locales/administrate.sq.yml
296
283
  - config/locales/administrate.sv.yml
284
+ - config/locales/administrate.tr.yml
297
285
  - config/locales/administrate.uk.yml
298
286
  - config/locales/administrate.vi.yml
299
287
  - config/locales/administrate.zh-CN.yml
@@ -304,12 +292,14 @@ files:
304
292
  - docs/adding_custom_field_types.md
305
293
  - docs/authentication.md
306
294
  - docs/authorization.md
307
- - docs/contributing.md
308
295
  - docs/customizing_attribute_partials.md
309
296
  - docs/customizing_controller_actions.md
310
297
  - docs/customizing_dashboards.md
311
298
  - docs/customizing_page_views.md
299
+ - docs/extending_administrate.md
312
300
  - docs/getting_started.md
301
+ - docs/guides.md
302
+ - docs/guides/hiding_dashboards_from_sidebar.md
313
303
  - docs/rails_api.md
314
304
  - lib/administrate.rb
315
305
  - lib/administrate/base_dashboard.rb
@@ -372,7 +362,7 @@ files:
372
362
  - lib/generators/administrate/views/show_generator.rb
373
363
  - lib/generators/administrate/views/views_generator.rb
374
364
  - lib/tasks/administrate_tasks.rake
375
- homepage: https://administrate-prototype.herokuapp.com/
365
+ homepage: https://administrate-demo.herokuapp.com/
376
366
  licenses:
377
367
  - MIT
378
368
  metadata: {}
@@ -391,7 +381,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
391
381
  - !ruby/object:Gem::Version
392
382
  version: '0'
393
383
  requirements: []
394
- rubygems_version: 3.0.3
384
+ rubygems_version: 3.1.4
395
385
  signing_key:
396
386
  specification_version: 4
397
387
  summary: A Rails engine for creating super-flexible admin dashboards
data/docs/contributing.md DELETED
@@ -1 +0,0 @@
1
- ../CONTRIBUTING.md