super 0.0.8 → 0.0.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (120) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +0 -7
  3. data/README.md +53 -79
  4. data/app/assets/javascripts/super/application.js +2728 -96
  5. data/app/assets/stylesheets/super/application.css +6405 -0
  6. data/app/controllers/super/application_controller.rb +19 -13
  7. data/app/helpers/super/form_builder_helper.rb +25 -0
  8. data/app/views/layouts/super/application.html.erb +11 -5
  9. data/app/views/super/application/{_super_schema_display_actions.html.erb → _display_actions.html.erb} +0 -0
  10. data/app/views/super/application/{_super_schema_display_index.html.erb → _display_index.html.erb} +5 -5
  11. data/app/views/super/application/_display_rich_text.html.erb +1 -0
  12. data/app/views/super/application/_display_show.html.erb +8 -0
  13. data/app/views/super/application/_filter.html.erb +5 -13
  14. data/app/views/super/application/_filter_type_select.html.erb +9 -19
  15. data/app/views/super/application/_filter_type_text.html.erb +7 -11
  16. data/app/views/super/application/_filter_type_timestamp.html.erb +6 -17
  17. data/app/views/super/application/_form.html.erb +15 -0
  18. data/app/views/super/application/_form_field__destroy.html.erb +1 -9
  19. data/app/views/super/application/_form_field_checkbox.html.erb +1 -0
  20. data/app/views/super/application/_form_field_flatpickr_date.html.erb +8 -0
  21. data/app/views/super/application/_form_field_flatpickr_datetime.html.erb +8 -0
  22. data/app/views/super/application/_form_field_flatpickr_time.html.erb +8 -0
  23. data/app/views/super/application/_form_field_rich_text_area.html.erb +1 -0
  24. data/app/views/super/application/_form_field_select.html.erb +1 -23
  25. data/app/views/super/application/_form_field_text.html.erb +1 -13
  26. data/app/views/super/application/{_super_layout.html.erb → _layout.html.erb} +7 -7
  27. data/app/views/super/application/{_super_pagination.html.erb → _pagination.html.erb} +1 -1
  28. data/app/views/super/application/{_super_panel.html.erb → _panel.html.erb} +2 -2
  29. data/app/views/super/application/_query.html.erb +18 -0
  30. data/app/views/super/application/_sort.html.erb +18 -0
  31. data/app/views/super/application/_sort_expression.html.erb +25 -0
  32. data/app/views/super/application/edit.html.erb +1 -0
  33. data/app/views/super/application/index.html.erb +1 -0
  34. data/app/views/super/application/new.html.erb +1 -0
  35. data/app/views/super/application/show.html.erb +1 -0
  36. data/app/views/super/feather/README.md +1 -0
  37. data/app/views/super/feather/_x.html +15 -0
  38. data/config/routes.rb +2 -0
  39. data/docs/cheat.md +8 -8
  40. data/frontend/super-frontend/dist/application.css +6405 -0
  41. data/frontend/super-frontend/dist/application.js +2728 -96
  42. data/lib/generators/super/action_text/USAGE +23 -0
  43. data/lib/generators/super/action_text/action_text_generator.rb +32 -0
  44. data/lib/generators/super/action_text/templates/pack_super_action_text.css +23 -0
  45. data/lib/generators/super/action_text/templates/pack_super_action_text.js +4 -0
  46. data/lib/generators/super/install/install_generator.rb +18 -7
  47. data/lib/generators/super/install/templates/base_controller.rb.tt +9 -1
  48. data/lib/generators/super/install/templates/initializer.rb.tt +9 -2
  49. data/lib/generators/super/resource/resource_generator.rb +107 -30
  50. data/lib/generators/super/resource/templates/resources_controller.rb.tt +3 -9
  51. data/lib/generators/super/webpacker/USAGE +5 -4
  52. data/lib/generators/super/webpacker/webpacker_generator.rb +2 -0
  53. data/lib/super.rb +7 -1
  54. data/lib/super/action_inquirer.rb +2 -0
  55. data/lib/super/assets.rb +6 -0
  56. data/lib/super/client_error.rb +2 -0
  57. data/lib/super/compatibility.rb +2 -0
  58. data/lib/super/configuration.rb +16 -24
  59. data/lib/super/controls.rb +11 -2
  60. data/lib/super/controls/optional.rb +35 -1
  61. data/lib/super/controls/steps.rb +27 -35
  62. data/lib/super/controls/view.rb +55 -0
  63. data/lib/super/display.rb +29 -13
  64. data/lib/super/display/guesser.rb +4 -0
  65. data/lib/super/display/schema_types.rb +74 -28
  66. data/lib/super/engine.rb +4 -0
  67. data/lib/super/error.rb +21 -0
  68. data/lib/super/filter.rb +2 -0
  69. data/lib/super/filter/form_object.rb +5 -8
  70. data/lib/super/filter/guesser.rb +2 -0
  71. data/lib/super/filter/operator.rb +2 -0
  72. data/lib/super/filter/schema_types.rb +2 -0
  73. data/lib/super/form.rb +3 -1
  74. data/lib/super/form/builder.rb +289 -39
  75. data/lib/super/form/guesser.rb +12 -1
  76. data/lib/super/form/inline_errors.rb +28 -0
  77. data/lib/super/form/schema_types.rb +25 -0
  78. data/lib/super/form/strong_params.rb +2 -0
  79. data/lib/super/layout.rb +3 -1
  80. data/lib/super/link.rb +7 -0
  81. data/lib/super/navigation/automatic.rb +4 -2
  82. data/lib/super/pagination.rb +3 -1
  83. data/lib/super/panel.rb +3 -1
  84. data/lib/super/partial.rb +2 -0
  85. data/lib/super/partial/resolving.rb +2 -0
  86. data/lib/super/plugin.rb +2 -0
  87. data/lib/super/query/form_object.rb +48 -0
  88. data/lib/super/schema.rb +2 -0
  89. data/lib/super/schema/common.rb +2 -0
  90. data/lib/super/schema/guesser.rb +2 -0
  91. data/lib/super/sort.rb +110 -0
  92. data/lib/super/useful/builder.rb +25 -0
  93. data/lib/super/useful/enum.rb +63 -0
  94. data/lib/super/version.rb +3 -1
  95. data/lib/super/view_helper.rb +2 -19
  96. metadata +56 -38
  97. data/CONTRIBUTING.md +0 -56
  98. data/Rakefile +0 -34
  99. data/STABILITY.md +0 -50
  100. data/app/views/super/application/_form_inline_errors.html.erb +0 -10
  101. data/app/views/super/application/_super_schema_display_show.html.erb +0 -8
  102. data/app/views/super/application/_super_schema_form.html.erb +0 -15
  103. data/docs/README.md +0 -6
  104. data/docs/faq.md +0 -44
  105. data/docs/quick_start.md +0 -45
  106. data/docs/webpacker.md +0 -17
  107. data/docs/yard_customizations.rb +0 -41
  108. data/frontend/super-frontend/build.js +0 -36
  109. data/frontend/super-frontend/package.json +0 -21
  110. data/frontend/super-frontend/postcss.config.js +0 -6
  111. data/frontend/super-frontend/src/javascripts/super/application.ts +0 -15
  112. data/frontend/super-frontend/src/javascripts/super/apply_template_controller.ts +0 -19
  113. data/frontend/super-frontend/src/javascripts/super/rails__ujs.d.ts +0 -1
  114. data/frontend/super-frontend/src/javascripts/super/toggle_pending_destruction_controller.ts +0 -15
  115. data/frontend/super-frontend/src/stylesheets/super/application.css +0 -77
  116. data/frontend/super-frontend/tailwind.config.js +0 -15
  117. data/frontend/super-frontend/tsconfig.json +0 -13
  118. data/frontend/super-frontend/yarn.lock +0 -5448
  119. data/lib/super/controls/required.rb +0 -13
  120. data/lib/super/filter/plugin.rb +0 -47
data/lib/super/version.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Super
2
- VERSION = "0.0.8"
4
+ VERSION = "0.0.13"
3
5
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Super
2
4
  module ViewHelper
3
5
  module_function
@@ -20,24 +22,5 @@ module Super
20
22
 
21
23
  result.compact.join(" ")
22
24
  end
23
-
24
- def errors_accounting_for_reflections(model_instance, column_or_association)
25
- errable_fields(model_instance, column_or_association)
26
- .flat_map { |field| Compatability.errable_fields(field) }
27
- .flat_map { |field| model_instance.errors.full_messages_for(field) }
28
- .uniq
29
- end
30
-
31
- def errable_fields(model_instance, column_or_association)
32
- column_or_association = column_or_association.to_s
33
- reflection = model_instance.class.reflect_on_association(column_or_association)
34
- reflection ||= model_instance.class.reflections.values.find { |r| r.foreign_key == column_or_association }
35
-
36
- if reflection
37
- [reflection.name.to_s, reflection.foreign_key.to_s]
38
- else
39
- [column_or_association]
40
- end
41
- end
42
25
  end
43
26
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: super
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zach Ahn
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-28 00:00:00.000000000 Z
11
+ date: 2021-04-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -198,7 +198,21 @@ dependencies:
198
198
  - - ">="
199
199
  - !ruby/object:Gem::Version
200
200
  version: '0'
201
- description:
201
+ - !ruby/object:Gem::Dependency
202
+ name: simplecov
203
+ requirement: !ruby/object:Gem::Requirement
204
+ requirements:
205
+ - - ">="
206
+ - !ruby/object:Gem::Version
207
+ version: '0'
208
+ type: :development
209
+ prerelease: false
210
+ version_requirements: !ruby/object:Gem::Requirement
211
+ requirements:
212
+ - - ">="
213
+ - !ruby/object:Gem::Version
214
+ version: '0'
215
+ description:
202
216
  email:
203
217
  - engineering@zachahn.com
204
218
  executables: []
@@ -206,37 +220,43 @@ extensions: []
206
220
  extra_rdoc_files: []
207
221
  files:
208
222
  - ".yardopts"
209
- - CONTRIBUTING.md
210
223
  - LICENSE
211
224
  - README.md
212
- - Rakefile
213
- - STABILITY.md
214
225
  - app/assets/config/super_manifest.js
215
226
  - app/assets/javascripts/super/application.js
216
227
  - app/assets/stylesheets/super/application.css
217
228
  - app/controllers/super/application_controller.rb
229
+ - app/helpers/super/form_builder_helper.rb
218
230
  - app/views/layouts/super/application.html.erb
219
231
  - app/views/super/application/_collection_header.html.erb
232
+ - app/views/super/application/_display_actions.html.erb
233
+ - app/views/super/application/_display_index.html.erb
234
+ - app/views/super/application/_display_rich_text.html.erb
235
+ - app/views/super/application/_display_show.html.erb
220
236
  - app/views/super/application/_filter.html.erb
221
237
  - app/views/super/application/_filter_type_select.html.erb
222
238
  - app/views/super/application/_filter_type_text.html.erb
223
239
  - app/views/super/application/_filter_type_timestamp.html.erb
224
240
  - app/views/super/application/_flash.html.erb
241
+ - app/views/super/application/_form.html.erb
225
242
  - app/views/super/application/_form_field__destroy.html.erb
243
+ - app/views/super/application/_form_field_checkbox.html.erb
244
+ - app/views/super/application/_form_field_flatpickr_date.html.erb
245
+ - app/views/super/application/_form_field_flatpickr_datetime.html.erb
246
+ - app/views/super/application/_form_field_flatpickr_time.html.erb
247
+ - app/views/super/application/_form_field_rich_text_area.html.erb
226
248
  - app/views/super/application/_form_field_select.html.erb
227
249
  - app/views/super/application/_form_field_text.html.erb
228
250
  - app/views/super/application/_form_fieldset.html.erb
229
251
  - app/views/super/application/_form_has_many.html.erb
230
252
  - app/views/super/application/_form_has_one.html.erb
231
- - app/views/super/application/_form_inline_errors.html.erb
253
+ - app/views/super/application/_layout.html.erb
232
254
  - app/views/super/application/_member_header.html.erb
233
- - app/views/super/application/_super_layout.html.erb
234
- - app/views/super/application/_super_pagination.html.erb
235
- - app/views/super/application/_super_panel.html.erb
236
- - app/views/super/application/_super_schema_display_actions.html.erb
237
- - app/views/super/application/_super_schema_display_index.html.erb
238
- - app/views/super/application/_super_schema_display_show.html.erb
239
- - app/views/super/application/_super_schema_form.html.erb
255
+ - app/views/super/application/_pagination.html.erb
256
+ - app/views/super/application/_panel.html.erb
257
+ - app/views/super/application/_query.html.erb
258
+ - app/views/super/application/_sort.html.erb
259
+ - app/views/super/application/_sort_expression.html.erb
240
260
  - app/views/super/application/edit.html.erb
241
261
  - app/views/super/application/index.html.erb
242
262
  - app/views/super/application/new.html.erb
@@ -244,27 +264,16 @@ files:
244
264
  - app/views/super/application/show.html.erb
245
265
  - app/views/super/feather/README.md
246
266
  - app/views/super/feather/_chevron_down.html
267
+ - app/views/super/feather/_x.html
247
268
  - config/locales/en.yml
248
269
  - config/routes.rb
249
- - docs/README.md
250
270
  - docs/cheat.md
251
- - docs/faq.md
252
- - docs/quick_start.md
253
- - docs/webpacker.md
254
- - docs/yard_customizations.rb
255
- - frontend/super-frontend/build.js
256
271
  - frontend/super-frontend/dist/application.css
257
272
  - frontend/super-frontend/dist/application.js
258
- - frontend/super-frontend/package.json
259
- - frontend/super-frontend/postcss.config.js
260
- - frontend/super-frontend/src/javascripts/super/application.ts
261
- - frontend/super-frontend/src/javascripts/super/apply_template_controller.ts
262
- - frontend/super-frontend/src/javascripts/super/rails__ujs.d.ts
263
- - frontend/super-frontend/src/javascripts/super/toggle_pending_destruction_controller.ts
264
- - frontend/super-frontend/src/stylesheets/super/application.css
265
- - frontend/super-frontend/tailwind.config.js
266
- - frontend/super-frontend/tsconfig.json
267
- - frontend/super-frontend/yarn.lock
273
+ - lib/generators/super/action_text/USAGE
274
+ - lib/generators/super/action_text/action_text_generator.rb
275
+ - lib/generators/super/action_text/templates/pack_super_action_text.css
276
+ - lib/generators/super/action_text/templates/pack_super_action_text.js
268
277
  - lib/generators/super/install/USAGE
269
278
  - lib/generators/super/install/install_generator.rb
270
279
  - lib/generators/super/install/templates/base_controller.rb.tt
@@ -283,8 +292,8 @@ files:
283
292
  - lib/super/configuration.rb
284
293
  - lib/super/controls.rb
285
294
  - lib/super/controls/optional.rb
286
- - lib/super/controls/required.rb
287
295
  - lib/super/controls/steps.rb
296
+ - lib/super/controls/view.rb
288
297
  - lib/super/display.rb
289
298
  - lib/super/display/guesser.rb
290
299
  - lib/super/display/schema_types.rb
@@ -294,11 +303,11 @@ files:
294
303
  - lib/super/filter/form_object.rb
295
304
  - lib/super/filter/guesser.rb
296
305
  - lib/super/filter/operator.rb
297
- - lib/super/filter/plugin.rb
298
306
  - lib/super/filter/schema_types.rb
299
307
  - lib/super/form.rb
300
308
  - lib/super/form/builder.rb
301
309
  - lib/super/form/guesser.rb
310
+ - lib/super/form/inline_errors.rb
302
311
  - lib/super/form/schema_types.rb
303
312
  - lib/super/form/strong_params.rb
304
313
  - lib/super/layout.rb
@@ -309,16 +318,25 @@ files:
309
318
  - lib/super/partial.rb
310
319
  - lib/super/partial/resolving.rb
311
320
  - lib/super/plugin.rb
321
+ - lib/super/query/form_object.rb
312
322
  - lib/super/schema.rb
313
323
  - lib/super/schema/common.rb
314
324
  - lib/super/schema/guesser.rb
325
+ - lib/super/sort.rb
326
+ - lib/super/useful/builder.rb
327
+ - lib/super/useful/enum.rb
315
328
  - lib/super/version.rb
316
329
  - lib/super/view_helper.rb
317
- homepage:
330
+ homepage:
318
331
  licenses:
319
332
  - LGPL-3.0-only
320
- metadata: {}
321
- post_install_message:
333
+ metadata:
334
+ bug_tracker_uri: https://github.com/zachahn/super/issues
335
+ changelog_uri: https://github.com/zachahn/super/blob/main/CHANGELOG.md
336
+ documentation_uri: https://superadministration.github.io/
337
+ homepage_uri: https://github.com/zachahn/super
338
+ source_code_uri: https://github.com/zachahn/super
339
+ post_install_message:
322
340
  rdoc_options: []
323
341
  require_paths:
324
342
  - lib
@@ -333,8 +351,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
333
351
  - !ruby/object:Gem::Version
334
352
  version: '0'
335
353
  requirements: []
336
- rubygems_version: 3.1.4
337
- signing_key:
354
+ rubygems_version: 3.2.4
355
+ signing_key:
338
356
  specification_version: 4
339
357
  summary: A simple, powerful, zero dependency Rails admin framework
340
358
  test_files: []
data/CONTRIBUTING.md DELETED
@@ -1,56 +0,0 @@
1
- # Contributing
2
-
3
- Thank you for thinking about contributing to Super!
4
-
5
-
6
- ## General guidelines
7
-
8
- There are a few ground rules that to adhere to:
9
-
10
- * be friendly and patient,
11
- * be welcoming,
12
- * be considerate,
13
- * be respectful,
14
- * be careful in the words that you choose and be kind to others,
15
- * when we disagree, try to understand why.
16
-
17
- This isn't an exhaustive list of things that you can't do. Rather, take it in
18
- the spirit in which it's intended - a guide to make it easier to communicate and
19
- participate in the community.
20
-
21
- This applies to all spaces managed by the Super project.
22
-
23
- If you believe someone is violating the code of conduct, we ask that you report
24
- it by emailing: super+conduct at zachahn.com
25
-
26
- Offenders may be banned, asked to apologize, etc.
27
-
28
- (These guidelines are based on the [FreeBSD CoC][FreeBSD CoC], which in turn is
29
- based on [LLVM Project's draft CoC][LLVM CoC], which in turn is based on the
30
- [Django Project Code of Conduct][Django CoC], which is in turn based on wording
31
- from the Speak Up! project.)
32
-
33
-
34
- ## Bug reports / issues
35
-
36
- 1. Please tell us what version of Super, Ruby, and Rails you are using
37
- 1. Please search the issues before posting your problem
38
- 1. Please ask questions in a public place to benefit all Super users
39
- 1. Please email security-related problems to super+security [at] zachahn.com
40
-
41
-
42
- ## Feature requests / pull requests
43
-
44
- Contributors will need to sign a CLA. This isn't set up yet, so I won't be able
45
- to accept contributions.
46
-
47
- 1. Please note that pull requests may be closed/denied for any reason.
48
- Your feature may be better as its own repository. If so, I will link to your
49
- project from the README!
50
- 1. Please allow Super's contributors to modify your PR before merging.
51
- It might make the process a bit smoother, but this isn't a necessity.
52
-
53
-
54
- [FreeBSD CoC]: https://www.freebsd.org/internal/code-of-conduct.html
55
- [LLVM CoC]: https://llvm.org/docs/CodeOfConduct.html
56
- [Django CoC]: https://www.djangoproject.com/conduct/
data/Rakefile DELETED
@@ -1,34 +0,0 @@
1
- begin
2
- require 'bundler/setup'
3
- rescue LoadError
4
- puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
- end
6
-
7
- require 'rdoc/task'
8
-
9
- RDoc::Task.new(:rdoc) do |rdoc|
10
- rdoc.rdoc_dir = 'rdoc'
11
- rdoc.title = 'Super'
12
- rdoc.options << '--line-numbers'
13
- rdoc.rdoc_files.include('README.md')
14
- rdoc.rdoc_files.include('lib/**/*.rb')
15
- end
16
-
17
- require_relative "dummy_path"
18
-
19
- APP_RAKEFILE = File.expand_path("#{SUPER_DUMMY_PATH}/Rakefile", __dir__)
20
- load 'rails/tasks/engine.rake'
21
-
22
- load 'rails/tasks/statistics.rake'
23
-
24
- require 'bundler/gem_tasks'
25
-
26
- require 'rake/testtask'
27
-
28
- Rake::TestTask.new(:test) do |t|
29
- t.libs << 'test'
30
- t.pattern = 'test/**/*_test.rb'
31
- t.verbose = false
32
- end
33
-
34
- task default: :test
data/STABILITY.md DELETED
@@ -1,50 +0,0 @@
1
- # Stability
2
-
3
- The table below shows the current progress towards API stability and the release
4
- of version 1.0.
5
-
6
- Note though that it is neither a comprehensive list nor a guarantee of
7
- stability.
8
-
9
-
10
- <table>
11
- <thead>
12
- <tr><th>Feature</th><th>Status</th></tr>
13
- </thead>
14
- <tbody>
15
- <tr><td>UI</td> <td>❌</td></tr>
16
- <tr><td>Frontend JS</td> <td>❌</td></tr>
17
- <tr><td><code>Super::ActionInquirer</code></td> <td>✅</td></tr>
18
- <tr><td><code>Super::ApplicationController</code></td> <td>✅</td></tr>
19
- <tr><td><code>Super::Assets</code></td> <td>🚧</td></tr>
20
- <tr><td><code>Super::ClientError</code></td> <td>✅</td></tr>
21
- <tr><td><code>Super::Compatability</code></td> <td>🙈</td></tr>
22
- <tr><td><code>Super::Configuration</code></td> <td>❌</td></tr>
23
- <tr><td><code>Super::Controls::Optional</code></td> <td>✅</td></tr>
24
- <tr><td><code>Super::Controls::Required</code></td> <td>✅</td></tr>
25
- <tr><td><code>Super::Controls::Steps</code></td> <td>🤔</td></tr>
26
- <tr><td><code>Super::Controls</code></td> <td>✅</td></tr>
27
- <tr><td><code>Super::Display</code></td> <td>🤔</td></tr>
28
- <tr><td><code>Super::Engine</code></td> <td>🙈</td></tr>
29
- <tr><td><code>Super::Error</code></td> <td>✅</td></tr>
30
- <tr><td><code>Super::Filter</code></td> <td>❌</td></tr>
31
- <tr><td><code>Super::Form</code></td> <td>🤔</td></tr>
32
- <tr><td><code>Super::Layout</code></td> <td>🤔</td></tr>
33
- <tr><td><code>Super::Link</code></td> <td>✅</td></tr>
34
- <tr><td><code>Super::Navigation</code></td> <td>🤔</td></tr>
35
- <tr><td><code>Super::Pagination</code></td> <td>🤔</td></tr>
36
- <tr><td><code>Super::Panel</code></td> <td>🤔</td></tr>
37
- <tr><td><code>Super::Partial</code></td> <td>🤔</td></tr>
38
- <tr><td><code>Super::Plugin</code></td> <td>✅</td></tr>
39
- <tr><td><code>Super::ViewHelper</code></td> <td>❌</td></tr>
40
- </tbody>
41
- </table>
42
-
43
-
44
- ### Legend
45
-
46
- * ✅ Tentatively stable. Further changes will probably be additive
47
- * 🚧 Likely upcoming breaking changes
48
- * ❌ Planned upcoming breaking changes
49
- * 🤔 Undecided
50
- * 🙈 Private API
@@ -1,10 +0,0 @@
1
- <% if form.object %>
2
- <% Super::ViewHelper.errors_accounting_for_reflections(form.object, column).each do |error_message| %>
3
- <p class="text-red-400 text-xs italic pt-1"><%= error_message %></p>
4
- <% end %>
5
- <% else %>
6
- <p class="text-red-400 text-xs italic pt-1">
7
- This form doesn't have an object, so something is probably wrong.
8
- Maybe <code>accepts_nested_attributes_for</code> isn't set up?
9
- </p>
10
- <% end %>
@@ -1,8 +0,0 @@
1
- <table class="max-w-full leading-loose mt-4">
2
- <% super_schema_display_show.each_attribute_name do |attribute_name| %>
3
- <tr>
4
- <th class="text-right px-4"><%= controls.model.human_attribute_name(attribute_name) %></th>
5
- <td><%= super_schema_display_show.render_field(template: self, record: @record, column: attribute_name) %></td>
6
- </tr>
7
- <% end %>
8
- </table>
@@ -1,15 +0,0 @@
1
- <%= form_for(Super.configuration.path_parts(@record), builder: Super::Form::Builder) do |f| %>
2
- <div class="max-w-3xl">
3
- <% super_schema_form.each_attribute do |field, type| %>
4
- <%= render(
5
- type,
6
- form: f,
7
- column: field
8
- ) %>
9
- <% end %>
10
-
11
- <div>
12
- <%= f.submit class: "super-button super-button--fill-blue mt-2" %>
13
- </div>
14
- </div>
15
- <% end %>
data/docs/README.md DELETED
@@ -1,6 +0,0 @@
1
- # Docs
2
-
3
- * [Quick start](./quick_start.md)
4
- * [Webpacker](./webpacker.md)
5
- * [Controls](./controls.md)
6
- * [FAQ](./faq.md)
data/docs/faq.md DELETED
@@ -1,44 +0,0 @@
1
- <!--
2
- # @title FAQ
3
- -->
4
-
5
- # FAQ
6
-
7
- ## How do I handle authorization?
8
-
9
- Assuming you already have authentication set up, it should only require defining
10
- a `Controls#initialize` that accepts an authenticated user. From there, you can
11
- customize `Controls#scope` to have the required behavior.
12
-
13
- ```ruby
14
- class PostsController < AdminController
15
- def new_controls
16
- Controls.new(current_user)
17
- end
18
-
19
- class Controls
20
- def initialize(current_user)
21
- @current_user = current_user
22
- end
23
-
24
- def model
25
- Post
26
- end
27
-
28
- def scope(action:)
29
- # Example: admins can read and write; customer support can only read
30
- if @current_user.admin?
31
- return model.all
32
- end
33
-
34
- if action.read?
35
- return model.all
36
- end
37
-
38
- raise Super::Error::Forbidden
39
- end
40
-
41
- # ...
42
- end
43
- end
44
- ```