uchi 0.1.3 → 0.1.4
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/README.md +222 -0
- data/app/assets/config/uchi_manifest.js +2 -0
- data/app/assets/javascripts/uchi/application.js +6095 -0
- data/app/assets/javascripts/uchi.js +4 -0
- data/app/assets/stylesheets/uchi/application.css +3971 -0
- data/app/assets/stylesheets/uchi/uchi.css +17 -0
- data/app/assets/tailwind/uchi.css +21 -0
- data/app/components/flowbite/breadcrumb.rb +33 -0
- data/app/components/flowbite/breadcrumb_home.rb +26 -0
- data/app/components/flowbite/breadcrumb_item/current.rb +33 -0
- data/app/components/flowbite/breadcrumb_item/first.rb +35 -0
- data/app/components/flowbite/breadcrumb_item.rb +48 -0
- data/app/components/flowbite/breadcrumb_separator.rb +30 -0
- data/app/components/flowbite/button/outline.rb +22 -0
- data/app/components/flowbite/button/pill.rb +40 -0
- data/app/components/flowbite/button.rb +92 -0
- data/app/components/flowbite/card.rb +45 -0
- data/app/components/flowbite/input/checkbox.rb +73 -0
- data/app/components/flowbite/input/date.rb +11 -0
- data/app/components/flowbite/input/date_time.rb +11 -0
- data/app/components/flowbite/input/email.rb +12 -0
- data/app/components/flowbite/input/field.rb +117 -0
- data/app/components/flowbite/input/file.rb +30 -0
- data/app/components/flowbite/input/hint.rb +57 -0
- data/app/components/flowbite/input/label.rb +82 -0
- data/app/components/flowbite/input/number.rb +11 -0
- data/app/components/flowbite/input/password.rb +11 -0
- data/app/components/flowbite/input/phone.rb +11 -0
- data/app/components/flowbite/input/radio_button.rb +50 -0
- data/app/components/flowbite/input/select.rb +49 -0
- data/app/components/flowbite/input/textarea.rb +42 -0
- data/app/components/flowbite/input/url.rb +12 -0
- data/app/components/flowbite/input/validation_error.rb +11 -0
- data/app/components/flowbite/input_field/checkbox.html.erb +14 -0
- data/app/components/flowbite/input_field/checkbox.rb +54 -0
- data/app/components/flowbite/input_field/date.rb +13 -0
- data/app/components/flowbite/input_field/date_time.rb +13 -0
- data/app/components/flowbite/input_field/email.rb +13 -0
- data/app/components/flowbite/input_field/file.rb +13 -0
- data/app/components/flowbite/input_field/input_field.html.erb +8 -0
- data/app/components/flowbite/input_field/number.rb +13 -0
- data/app/components/flowbite/input_field/password.rb +13 -0
- data/app/components/flowbite/input_field/phone.rb +13 -0
- data/app/components/flowbite/input_field/radio_button.html.erb +14 -0
- data/app/components/flowbite/input_field/radio_button.rb +86 -0
- data/app/components/flowbite/input_field/select.rb +31 -0
- data/app/components/flowbite/input_field/text.rb +8 -0
- data/app/components/flowbite/input_field/textarea.rb +13 -0
- data/app/components/flowbite/input_field/url.rb +13 -0
- data/app/components/flowbite/input_field.rb +192 -0
- data/app/components/flowbite/link.rb +21 -0
- data/app/components/flowbite/style.rb +13 -0
- data/app/components/flowbite/toast/icon.html.erb +5 -0
- data/app/components/flowbite/toast/icon.rb +57 -0
- data/app/components/flowbite/toast/toast.html.erb +11 -0
- data/app/components/flowbite/toast.rb +34 -0
- data/app/components/uchi/field/base.rb +57 -0
- data/app/components/uchi/field/belongs_to/edit.html.erb +1 -0
- data/app/components/uchi/field/belongs_to/index.html.erb +1 -0
- data/app/components/uchi/field/belongs_to/show.html.erb +3 -0
- data/app/components/uchi/field/belongs_to.rb +105 -0
- data/app/components/uchi/field/blank/edit.html.erb +1 -0
- data/app/components/uchi/field/blank/index.html.erb +1 -0
- data/app/components/uchi/field/blank/show.html.erb +1 -0
- data/app/components/uchi/field/blank.rb +16 -0
- data/app/components/uchi/field/boolean/edit.html.erb +1 -0
- data/app/components/uchi/field/boolean/index.html.erb +9 -0
- data/app/components/uchi/field/boolean/show.html.erb +9 -0
- data/app/components/uchi/field/boolean.rb +27 -0
- data/app/components/uchi/field/date/edit.html.erb +1 -0
- data/app/components/uchi/field/date/index.html.erb +1 -0
- data/app/components/uchi/field/date/show.html.erb +1 -0
- data/app/components/uchi/field/date.rb +27 -0
- data/app/components/uchi/field/date_time/edit.html.erb +1 -0
- data/app/components/uchi/field/date_time/index.html.erb +1 -0
- data/app/components/uchi/field/date_time/show.html.erb +1 -0
- data/app/components/uchi/field/date_time.rb +27 -0
- data/app/components/uchi/field/file/edit.html.erb +1 -0
- data/app/components/uchi/field/file/index.html.erb +6 -0
- data/app/components/uchi/field/file/show.html.erb +8 -0
- data/app/components/uchi/field/file.rb +37 -0
- data/app/components/uchi/field/has_and_belongs_to_many/edit.html.erb +9 -0
- data/app/components/uchi/field/has_and_belongs_to_many/index.html.erb +1 -0
- data/app/components/uchi/field/has_and_belongs_to_many/show.html.erb +28 -0
- data/app/components/uchi/field/has_and_belongs_to_many.rb +131 -0
- data/app/components/uchi/field/has_many/edit.html.erb +1 -0
- data/app/components/uchi/field/has_many/index.html.erb +1 -0
- data/app/components/uchi/field/has_many/show.html.erb +28 -0
- data/app/components/uchi/field/has_many.rb +107 -0
- data/app/components/uchi/field/id/index.html.erb +4 -0
- data/app/components/uchi/field/id/show.html.erb +4 -0
- data/app/components/uchi/field/id.rb +26 -0
- data/app/components/uchi/field/image/edit.html.erb +1 -0
- data/app/components/uchi/field/image/index.html.erb +6 -0
- data/app/components/uchi/field/image/show.html.erb +6 -0
- data/app/components/uchi/field/image.rb +38 -0
- data/app/components/uchi/field/number/edit.html.erb +1 -0
- data/app/components/uchi/field/number/index.html.erb +1 -0
- data/app/components/uchi/field/number/show.html.erb +1 -0
- data/app/components/uchi/field/number.rb +32 -0
- data/app/components/uchi/field/string/edit.html.erb +1 -0
- data/app/components/uchi/field/string/index.html.erb +1 -0
- data/app/components/uchi/field/string/show.html.erb +1 -0
- data/app/components/uchi/field/string.rb +33 -0
- data/app/components/uchi/field/text/edit.html.erb +1 -0
- data/app/components/uchi/field/text/index.html.erb +1 -0
- data/app/components/uchi/field/text/show.html.erb +1 -0
- data/app/components/uchi/field/text.rb +38 -0
- data/app/components/uchi/ui/breadcrumb/breadcrumb.html.erb +13 -0
- data/app/components/uchi/ui/breadcrumb.rb +14 -0
- data/app/components/uchi/ui/form/footer/footer.html.erb +5 -0
- data/app/components/uchi/ui/form/footer.rb +15 -0
- data/app/components/uchi/ui/form/input/collection_checkboxes.html.erb +32 -0
- data/app/components/uchi/ui/form/input/collection_checkboxes.rb +125 -0
- data/app/components/uchi/ui/frame/frame.html.erb +3 -0
- data/app/components/uchi/ui/frame.rb +10 -0
- data/app/components/uchi/ui/index/records_table/records_table.html.erb +67 -0
- data/app/components/uchi/ui/index/records_table/search_form/search_form.html.erb +21 -0
- data/app/components/uchi/ui/index/records_table/search_form.rb +49 -0
- data/app/components/uchi/ui/index/records_table.rb +29 -0
- data/app/components/uchi/ui/index/turbo_frame.rb +50 -0
- data/app/components/uchi/ui/page_header/page_header.html.erb +24 -0
- data/app/components/uchi/ui/page_header.rb +18 -0
- data/app/components/uchi/ui/pagination/current_link.html.erb +3 -0
- data/app/components/uchi/ui/pagination/current_link.rb +10 -0
- data/app/components/uchi/ui/pagination/gap.html.erb +3 -0
- data/app/components/uchi/ui/pagination/gap.rb +10 -0
- data/app/components/uchi/ui/pagination/item.rb +24 -0
- data/app/components/uchi/ui/pagination/link.html.erb +3 -0
- data/app/components/uchi/ui/pagination/link.rb +10 -0
- data/app/components/uchi/ui/pagination/next_link.html.erb +8 -0
- data/app/components/uchi/ui/pagination/next_link.rb +22 -0
- data/app/components/uchi/ui/pagination/pagination.html.erb +15 -0
- data/app/components/uchi/ui/pagination/previous_link.html.erb +8 -0
- data/app/components/uchi/ui/pagination/previous_link.rb +22 -0
- data/app/components/uchi/ui/pagination.rb +48 -0
- data/app/components/uchi/ui/show/attribute_fields/attribute_fields.html.erb +14 -0
- data/app/components/uchi/ui/show/attribute_fields.rb +18 -0
- data/app/components/uchi/ui/spinner/spinner.html.erb +7 -0
- data/app/components/uchi/ui/spinner.rb +15 -0
- data/app/controllers/uchi/application_controller.rb +4 -0
- data/app/controllers/uchi/controller.rb +13 -0
- data/app/controllers/uchi/repository_controller.rb +166 -0
- data/app/helpers/uchi/application_helper.rb +17 -0
- data/app/jobs/uchi/application_job.rb +4 -0
- data/app/mailers/uchi/application_mailer.rb +6 -0
- data/app/views/layouts/uchi/_flash_messages.html.erb +10 -0
- data/app/views/layouts/uchi/application.html.erb +33 -0
- data/app/views/uchi/repository/edit.html.erb +40 -0
- data/app/views/uchi/repository/index.html.erb +49 -0
- data/app/views/uchi/repository/new.html.erb +37 -0
- data/app/views/uchi/repository/show.html.erb +41 -0
- data/lib/generators/uchi/controller/controller_generator.rb +16 -0
- data/lib/generators/uchi/controller/templates/controller.rb.tt +11 -0
- data/lib/generators/uchi/install/install_generator.rb +13 -0
- data/lib/generators/uchi/repository/repository_generator.rb +16 -0
- data/lib/generators/uchi/repository/templates/repository.rb.tt +11 -0
- data/lib/tasks/uchi_tasks.rake +4 -0
- data/lib/uchi/application_record.rb +5 -0
- data/lib/uchi/engine.rb +24 -0
- data/lib/uchi/field/configuration.rb +142 -0
- data/lib/uchi/field.rb +80 -0
- data/lib/uchi/i18n.rb +13 -0
- data/lib/uchi/pagination/controller.rb +26 -0
- data/lib/uchi/pagination/page.rb +20 -0
- data/lib/uchi/pagy/LICENSE.txt +21 -0
- data/lib/uchi/pagy/classes/exceptions.rb +35 -0
- data/lib/uchi/pagy/classes/offset/offset.rb +56 -0
- data/lib/uchi/pagy/classes/request.rb +38 -0
- data/lib/uchi/pagy/modules/abilities/configurable.rb +38 -0
- data/lib/uchi/pagy/modules/abilities/linkable.rb +62 -0
- data/lib/uchi/pagy/modules/abilities/rangeable.rb +17 -0
- data/lib/uchi/pagy/modules/abilities/shiftable.rb +14 -0
- data/lib/uchi/pagy/modules/console.rb +40 -0
- data/lib/uchi/pagy/toolbox/helpers/loader.rb +19 -0
- data/lib/uchi/pagy/toolbox/helpers/page_url.rb +25 -0
- data/lib/uchi/pagy/toolbox/paginators/method.rb +21 -0
- data/lib/uchi/pagy/toolbox/paginators/offset.rb +35 -0
- data/lib/uchi/pagy.rb +60 -0
- data/lib/uchi/repository/routes.rb +62 -0
- data/lib/uchi/repository/translate.rb +284 -0
- data/lib/uchi/repository.rb +156 -0
- data/lib/uchi/sort_order.rb +35 -0
- data/lib/uchi/version.rb +5 -0
- data/lib/uchi.rb +18 -0
- data/uchi.gemspec +35 -0
- metadata +189 -97
- data/.github/dependabot.yml +0 -17
- data/.github/workflows/build.yml +0 -23
- data/.github/workflows/lint.yml +0 -30
- data/CHANGELOG.md +0 -29
- data/docs/fields.md +0 -82
- data/docs/repositories.md +0 -63
- data/package.json +0 -31
- data/sig/uchi.rbs +0 -4
- data/test/components/uchi/field/belongs_to_test.rb +0 -134
- data/test/components/uchi/field/blank_test.rb +0 -119
- data/test/components/uchi/field/boolean_test.rb +0 -163
- data/test/components/uchi/field/date_test.rb +0 -163
- data/test/components/uchi/field/date_time_test.rb +0 -152
- data/test/components/uchi/field/has_and_belongs_to_many_test.rb +0 -144
- data/test/components/uchi/field/has_many_test.rb +0 -138
- data/test/components/uchi/field/id_test.rb +0 -113
- data/test/components/uchi/field/number_test.rb +0 -163
- data/test/components/uchi/field/string_test.rb +0 -159
- data/test/components/uchi/field/text_test.rb +0 -160
- data/test/components/uchi/ui/form/input/collection_checkboxes_test.rb +0 -171
- data/test/controllers/uchi/authors_controller_test.rb +0 -120
- data/test/controllers/uchi/repository_controller_test.rb +0 -93
- data/test/controllers/uchi/scoped_repository_controller_test.rb +0 -73
- data/test/dummy/Rakefile +0 -6
- data/test/dummy/app/assets/images/.keep +0 -0
- data/test/dummy/app/assets/stylesheets/application.css +0 -15
- data/test/dummy/app/controllers/application_controller.rb +0 -4
- data/test/dummy/app/controllers/concerns/.keep +0 -0
- data/test/dummy/app/controllers/uchi/authors_controller.rb +0 -7
- data/test/dummy/app/controllers/uchi/books_controller.rb +0 -7
- data/test/dummy/app/controllers/uchi/titles_controller.rb +0 -7
- data/test/dummy/app/helpers/application_helper.rb +0 -2
- data/test/dummy/app/jobs/application_job.rb +0 -7
- data/test/dummy/app/mailers/application_mailer.rb +0 -4
- data/test/dummy/app/models/application_record.rb +0 -3
- data/test/dummy/app/models/author.rb +0 -5
- data/test/dummy/app/models/book.rb +0 -4
- data/test/dummy/app/models/concerns/.keep +0 -0
- data/test/dummy/app/models/title.rb +0 -3
- data/test/dummy/app/uchi/repositories/author.rb +0 -20
- data/test/dummy/app/uchi/repositories/book.rb +0 -16
- data/test/dummy/app/uchi/repositories/title.rb +0 -17
- data/test/dummy/app/views/layouts/application.html.erb +0 -27
- data/test/dummy/app/views/layouts/mailer.html.erb +0 -13
- data/test/dummy/app/views/layouts/mailer.text.erb +0 -1
- data/test/dummy/app/views/pwa/manifest.json.erb +0 -22
- data/test/dummy/app/views/pwa/service-worker.js +0 -26
- data/test/dummy/bin/dev +0 -2
- data/test/dummy/bin/rails +0 -4
- data/test/dummy/bin/rake +0 -4
- data/test/dummy/bin/setup +0 -34
- data/test/dummy/config/application.rb +0 -29
- data/test/dummy/config/boot.rb +0 -5
- data/test/dummy/config/cable.yml +0 -10
- data/test/dummy/config/database.yml +0 -32
- data/test/dummy/config/environment.rb +0 -5
- data/test/dummy/config/environments/development.rb +0 -69
- data/test/dummy/config/environments/production.rb +0 -89
- data/test/dummy/config/environments/test.rb +0 -53
- data/test/dummy/config/initializers/content_security_policy.rb +0 -25
- data/test/dummy/config/initializers/filter_parameter_logging.rb +0 -8
- data/test/dummy/config/initializers/inflections.rb +0 -16
- data/test/dummy/config/locales/da.yml +0 -52
- data/test/dummy/config/locales/en.yml +0 -31
- data/test/dummy/config/puma.rb +0 -38
- data/test/dummy/config/routes.rb +0 -9
- data/test/dummy/config/storage.yml +0 -34
- data/test/dummy/config.ru +0 -6
- data/test/dummy/db/migrate/20251002183635_create_authors.rb +0 -11
- data/test/dummy/db/migrate/20251005131726_create_books.rb +0 -9
- data/test/dummy/db/migrate/20251005131811_create_titles.rb +0 -11
- data/test/dummy/db/migrate/20251031140958_add_author_books_join_table.rb +0 -9
- data/test/dummy/db/schema.rb +0 -44
- data/test/dummy/log/.keep +0 -0
- data/test/dummy/public/400.html +0 -114
- data/test/dummy/public/404.html +0 -114
- data/test/dummy/public/406-unsupported-browser.html +0 -114
- data/test/dummy/public/422.html +0 -114
- data/test/dummy/public/500.html +0 -114
- data/test/dummy/public/icon.png +0 -0
- data/test/dummy/public/icon.svg +0 -3
- data/test/dummy/storage/.keep +0 -0
- data/test/dummy/test/fixtures/authors.yml +0 -11
- data/test/dummy/test/models/author_test.rb +0 -7
- data/test/dummy/tmp/.keep +0 -0
- data/test/dummy/tmp/pids/.keep +0 -0
- data/test/dummy/tmp/storage/.keep +0 -0
- data/test/test_helper.rb +0 -15
- data/test/uchi/field_test.rb +0 -77
- data/test/uchi/i18n_test.rb +0 -18
- data/test/uchi/repository/routes_test.rb +0 -49
- data/test/uchi/repository/translate_test.rb +0 -272
- data/test/uchi/repository_test.rb +0 -137
- data/test/uchi/sort_order_test.rb +0 -47
- data/test/uchi_test.rb +0 -7
data/lib/uchi.rb
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
gem "turbo-rails"
|
|
2
|
+
require "turbo-rails"
|
|
3
|
+
|
|
4
|
+
gem "view_component"
|
|
5
|
+
require "view_component"
|
|
6
|
+
|
|
7
|
+
require "uchi/version"
|
|
8
|
+
require "uchi/engine"
|
|
9
|
+
|
|
10
|
+
require "uchi/field"
|
|
11
|
+
require "uchi/i18n"
|
|
12
|
+
require "uchi/repository"
|
|
13
|
+
require "uchi/sort_order"
|
|
14
|
+
require "uchi/repository/translate"
|
|
15
|
+
|
|
16
|
+
module Uchi
|
|
17
|
+
# Your code goes here...
|
|
18
|
+
end
|
data/uchi.gemspec
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "lib/uchi/version"
|
|
4
|
+
|
|
5
|
+
Gem::Specification.new do |spec|
|
|
6
|
+
spec.name = "uchi"
|
|
7
|
+
spec.version = Uchi::VERSION
|
|
8
|
+
spec.authors = ["Jakob Skjerning"]
|
|
9
|
+
spec.email = ["jakob@substancelab.com"]
|
|
10
|
+
|
|
11
|
+
spec.summary = "Build usable and extensible admin panels for your Ruby on Rails application in minutes."
|
|
12
|
+
spec.description = "Level up your scaffolds with a modern admin backend framework, designed for Rails developers who demand both beauty, functionality, and extensibility. Uchi provides a set of components and conventions for creating user interfaces that are both powerful and easy to use."
|
|
13
|
+
spec.homepage = "https://www.uchiadmin.com/"
|
|
14
|
+
spec.required_ruby_version = ">= 3.2.0"
|
|
15
|
+
|
|
16
|
+
spec.metadata["changelog_uri"] = "https://github.com/substancelab/uchi/blob/main/CHANGELOG.md"
|
|
17
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
|
18
|
+
spec.metadata["source_code_uri"] = "https://github.com/substancelab/uchi"
|
|
19
|
+
|
|
20
|
+
# Specify which files should be added to the gem when it is released.
|
|
21
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
22
|
+
spec.files = \
|
|
23
|
+
Dir["app/**/*"] +
|
|
24
|
+
Dir["lib/**/*"] +
|
|
25
|
+
[
|
|
26
|
+
"README.md",
|
|
27
|
+
"uchi.gemspec"
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
spec.require_paths = ["lib"]
|
|
31
|
+
|
|
32
|
+
spec.add_dependency "rails", ">= 7.2"
|
|
33
|
+
spec.add_dependency "turbo-rails"
|
|
34
|
+
spec.add_dependency "view_component", ">= 4.0"
|
|
35
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: uchi
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jakob Skjerning
|
|
@@ -61,104 +61,196 @@ executables: []
|
|
|
61
61
|
extensions: []
|
|
62
62
|
extra_rdoc_files: []
|
|
63
63
|
files:
|
|
64
|
-
-
|
|
65
|
-
-
|
|
66
|
-
-
|
|
67
|
-
-
|
|
68
|
-
-
|
|
69
|
-
-
|
|
70
|
-
-
|
|
71
|
-
-
|
|
72
|
-
-
|
|
73
|
-
-
|
|
74
|
-
-
|
|
75
|
-
-
|
|
76
|
-
-
|
|
77
|
-
-
|
|
78
|
-
-
|
|
79
|
-
-
|
|
80
|
-
-
|
|
81
|
-
-
|
|
82
|
-
-
|
|
83
|
-
-
|
|
84
|
-
-
|
|
85
|
-
-
|
|
86
|
-
-
|
|
87
|
-
-
|
|
88
|
-
-
|
|
89
|
-
-
|
|
90
|
-
-
|
|
91
|
-
-
|
|
92
|
-
-
|
|
93
|
-
-
|
|
94
|
-
-
|
|
95
|
-
-
|
|
96
|
-
-
|
|
97
|
-
-
|
|
98
|
-
-
|
|
99
|
-
-
|
|
100
|
-
-
|
|
101
|
-
-
|
|
102
|
-
-
|
|
103
|
-
-
|
|
104
|
-
-
|
|
105
|
-
-
|
|
106
|
-
-
|
|
107
|
-
-
|
|
108
|
-
-
|
|
109
|
-
-
|
|
110
|
-
-
|
|
111
|
-
-
|
|
112
|
-
-
|
|
113
|
-
-
|
|
114
|
-
-
|
|
115
|
-
-
|
|
116
|
-
-
|
|
117
|
-
-
|
|
118
|
-
-
|
|
119
|
-
-
|
|
120
|
-
-
|
|
121
|
-
-
|
|
122
|
-
-
|
|
123
|
-
-
|
|
124
|
-
-
|
|
125
|
-
-
|
|
126
|
-
-
|
|
127
|
-
-
|
|
128
|
-
-
|
|
129
|
-
-
|
|
130
|
-
-
|
|
131
|
-
-
|
|
132
|
-
-
|
|
133
|
-
-
|
|
134
|
-
-
|
|
135
|
-
-
|
|
136
|
-
-
|
|
137
|
-
-
|
|
138
|
-
-
|
|
139
|
-
-
|
|
140
|
-
-
|
|
141
|
-
-
|
|
142
|
-
-
|
|
143
|
-
-
|
|
144
|
-
-
|
|
145
|
-
-
|
|
146
|
-
-
|
|
147
|
-
-
|
|
148
|
-
-
|
|
149
|
-
-
|
|
150
|
-
-
|
|
151
|
-
-
|
|
152
|
-
-
|
|
153
|
-
-
|
|
154
|
-
-
|
|
155
|
-
-
|
|
156
|
-
-
|
|
157
|
-
-
|
|
158
|
-
-
|
|
159
|
-
|
|
64
|
+
- README.md
|
|
65
|
+
- app/assets/config/uchi_manifest.js
|
|
66
|
+
- app/assets/javascripts/uchi.js
|
|
67
|
+
- app/assets/javascripts/uchi/application.js
|
|
68
|
+
- app/assets/stylesheets/uchi/application.css
|
|
69
|
+
- app/assets/stylesheets/uchi/uchi.css
|
|
70
|
+
- app/assets/tailwind/uchi.css
|
|
71
|
+
- app/components/flowbite/breadcrumb.rb
|
|
72
|
+
- app/components/flowbite/breadcrumb_home.rb
|
|
73
|
+
- app/components/flowbite/breadcrumb_item.rb
|
|
74
|
+
- app/components/flowbite/breadcrumb_item/current.rb
|
|
75
|
+
- app/components/flowbite/breadcrumb_item/first.rb
|
|
76
|
+
- app/components/flowbite/breadcrumb_separator.rb
|
|
77
|
+
- app/components/flowbite/button.rb
|
|
78
|
+
- app/components/flowbite/button/outline.rb
|
|
79
|
+
- app/components/flowbite/button/pill.rb
|
|
80
|
+
- app/components/flowbite/card.rb
|
|
81
|
+
- app/components/flowbite/input/checkbox.rb
|
|
82
|
+
- app/components/flowbite/input/date.rb
|
|
83
|
+
- app/components/flowbite/input/date_time.rb
|
|
84
|
+
- app/components/flowbite/input/email.rb
|
|
85
|
+
- app/components/flowbite/input/field.rb
|
|
86
|
+
- app/components/flowbite/input/file.rb
|
|
87
|
+
- app/components/flowbite/input/hint.rb
|
|
88
|
+
- app/components/flowbite/input/label.rb
|
|
89
|
+
- app/components/flowbite/input/number.rb
|
|
90
|
+
- app/components/flowbite/input/password.rb
|
|
91
|
+
- app/components/flowbite/input/phone.rb
|
|
92
|
+
- app/components/flowbite/input/radio_button.rb
|
|
93
|
+
- app/components/flowbite/input/select.rb
|
|
94
|
+
- app/components/flowbite/input/textarea.rb
|
|
95
|
+
- app/components/flowbite/input/url.rb
|
|
96
|
+
- app/components/flowbite/input/validation_error.rb
|
|
97
|
+
- app/components/flowbite/input_field.rb
|
|
98
|
+
- app/components/flowbite/input_field/checkbox.html.erb
|
|
99
|
+
- app/components/flowbite/input_field/checkbox.rb
|
|
100
|
+
- app/components/flowbite/input_field/date.rb
|
|
101
|
+
- app/components/flowbite/input_field/date_time.rb
|
|
102
|
+
- app/components/flowbite/input_field/email.rb
|
|
103
|
+
- app/components/flowbite/input_field/file.rb
|
|
104
|
+
- app/components/flowbite/input_field/input_field.html.erb
|
|
105
|
+
- app/components/flowbite/input_field/number.rb
|
|
106
|
+
- app/components/flowbite/input_field/password.rb
|
|
107
|
+
- app/components/flowbite/input_field/phone.rb
|
|
108
|
+
- app/components/flowbite/input_field/radio_button.html.erb
|
|
109
|
+
- app/components/flowbite/input_field/radio_button.rb
|
|
110
|
+
- app/components/flowbite/input_field/select.rb
|
|
111
|
+
- app/components/flowbite/input_field/text.rb
|
|
112
|
+
- app/components/flowbite/input_field/textarea.rb
|
|
113
|
+
- app/components/flowbite/input_field/url.rb
|
|
114
|
+
- app/components/flowbite/link.rb
|
|
115
|
+
- app/components/flowbite/style.rb
|
|
116
|
+
- app/components/flowbite/toast.rb
|
|
117
|
+
- app/components/flowbite/toast/icon.html.erb
|
|
118
|
+
- app/components/flowbite/toast/icon.rb
|
|
119
|
+
- app/components/flowbite/toast/toast.html.erb
|
|
120
|
+
- app/components/uchi/field/base.rb
|
|
121
|
+
- app/components/uchi/field/belongs_to.rb
|
|
122
|
+
- app/components/uchi/field/belongs_to/edit.html.erb
|
|
123
|
+
- app/components/uchi/field/belongs_to/index.html.erb
|
|
124
|
+
- app/components/uchi/field/belongs_to/show.html.erb
|
|
125
|
+
- app/components/uchi/field/blank.rb
|
|
126
|
+
- app/components/uchi/field/blank/edit.html.erb
|
|
127
|
+
- app/components/uchi/field/blank/index.html.erb
|
|
128
|
+
- app/components/uchi/field/blank/show.html.erb
|
|
129
|
+
- app/components/uchi/field/boolean.rb
|
|
130
|
+
- app/components/uchi/field/boolean/edit.html.erb
|
|
131
|
+
- app/components/uchi/field/boolean/index.html.erb
|
|
132
|
+
- app/components/uchi/field/boolean/show.html.erb
|
|
133
|
+
- app/components/uchi/field/date.rb
|
|
134
|
+
- app/components/uchi/field/date/edit.html.erb
|
|
135
|
+
- app/components/uchi/field/date/index.html.erb
|
|
136
|
+
- app/components/uchi/field/date/show.html.erb
|
|
137
|
+
- app/components/uchi/field/date_time.rb
|
|
138
|
+
- app/components/uchi/field/date_time/edit.html.erb
|
|
139
|
+
- app/components/uchi/field/date_time/index.html.erb
|
|
140
|
+
- app/components/uchi/field/date_time/show.html.erb
|
|
141
|
+
- app/components/uchi/field/file.rb
|
|
142
|
+
- app/components/uchi/field/file/edit.html.erb
|
|
143
|
+
- app/components/uchi/field/file/index.html.erb
|
|
144
|
+
- app/components/uchi/field/file/show.html.erb
|
|
145
|
+
- app/components/uchi/field/has_and_belongs_to_many.rb
|
|
146
|
+
- app/components/uchi/field/has_and_belongs_to_many/edit.html.erb
|
|
147
|
+
- app/components/uchi/field/has_and_belongs_to_many/index.html.erb
|
|
148
|
+
- app/components/uchi/field/has_and_belongs_to_many/show.html.erb
|
|
149
|
+
- app/components/uchi/field/has_many.rb
|
|
150
|
+
- app/components/uchi/field/has_many/edit.html.erb
|
|
151
|
+
- app/components/uchi/field/has_many/index.html.erb
|
|
152
|
+
- app/components/uchi/field/has_many/show.html.erb
|
|
153
|
+
- app/components/uchi/field/id.rb
|
|
154
|
+
- app/components/uchi/field/id/index.html.erb
|
|
155
|
+
- app/components/uchi/field/id/show.html.erb
|
|
156
|
+
- app/components/uchi/field/image.rb
|
|
157
|
+
- app/components/uchi/field/image/edit.html.erb
|
|
158
|
+
- app/components/uchi/field/image/index.html.erb
|
|
159
|
+
- app/components/uchi/field/image/show.html.erb
|
|
160
|
+
- app/components/uchi/field/number.rb
|
|
161
|
+
- app/components/uchi/field/number/edit.html.erb
|
|
162
|
+
- app/components/uchi/field/number/index.html.erb
|
|
163
|
+
- app/components/uchi/field/number/show.html.erb
|
|
164
|
+
- app/components/uchi/field/string.rb
|
|
165
|
+
- app/components/uchi/field/string/edit.html.erb
|
|
166
|
+
- app/components/uchi/field/string/index.html.erb
|
|
167
|
+
- app/components/uchi/field/string/show.html.erb
|
|
168
|
+
- app/components/uchi/field/text.rb
|
|
169
|
+
- app/components/uchi/field/text/edit.html.erb
|
|
170
|
+
- app/components/uchi/field/text/index.html.erb
|
|
171
|
+
- app/components/uchi/field/text/show.html.erb
|
|
172
|
+
- app/components/uchi/ui/breadcrumb.rb
|
|
173
|
+
- app/components/uchi/ui/breadcrumb/breadcrumb.html.erb
|
|
174
|
+
- app/components/uchi/ui/form/footer.rb
|
|
175
|
+
- app/components/uchi/ui/form/footer/footer.html.erb
|
|
176
|
+
- app/components/uchi/ui/form/input/collection_checkboxes.html.erb
|
|
177
|
+
- app/components/uchi/ui/form/input/collection_checkboxes.rb
|
|
178
|
+
- app/components/uchi/ui/frame.rb
|
|
179
|
+
- app/components/uchi/ui/frame/frame.html.erb
|
|
180
|
+
- app/components/uchi/ui/index/records_table.rb
|
|
181
|
+
- app/components/uchi/ui/index/records_table/records_table.html.erb
|
|
182
|
+
- app/components/uchi/ui/index/records_table/search_form.rb
|
|
183
|
+
- app/components/uchi/ui/index/records_table/search_form/search_form.html.erb
|
|
184
|
+
- app/components/uchi/ui/index/turbo_frame.rb
|
|
185
|
+
- app/components/uchi/ui/page_header.rb
|
|
186
|
+
- app/components/uchi/ui/page_header/page_header.html.erb
|
|
187
|
+
- app/components/uchi/ui/pagination.rb
|
|
188
|
+
- app/components/uchi/ui/pagination/current_link.html.erb
|
|
189
|
+
- app/components/uchi/ui/pagination/current_link.rb
|
|
190
|
+
- app/components/uchi/ui/pagination/gap.html.erb
|
|
191
|
+
- app/components/uchi/ui/pagination/gap.rb
|
|
192
|
+
- app/components/uchi/ui/pagination/item.rb
|
|
193
|
+
- app/components/uchi/ui/pagination/link.html.erb
|
|
194
|
+
- app/components/uchi/ui/pagination/link.rb
|
|
195
|
+
- app/components/uchi/ui/pagination/next_link.html.erb
|
|
196
|
+
- app/components/uchi/ui/pagination/next_link.rb
|
|
197
|
+
- app/components/uchi/ui/pagination/pagination.html.erb
|
|
198
|
+
- app/components/uchi/ui/pagination/previous_link.html.erb
|
|
199
|
+
- app/components/uchi/ui/pagination/previous_link.rb
|
|
200
|
+
- app/components/uchi/ui/show/attribute_fields.rb
|
|
201
|
+
- app/components/uchi/ui/show/attribute_fields/attribute_fields.html.erb
|
|
202
|
+
- app/components/uchi/ui/spinner.rb
|
|
203
|
+
- app/components/uchi/ui/spinner/spinner.html.erb
|
|
204
|
+
- app/controllers/uchi/application_controller.rb
|
|
205
|
+
- app/controllers/uchi/controller.rb
|
|
206
|
+
- app/controllers/uchi/repository_controller.rb
|
|
207
|
+
- app/helpers/uchi/application_helper.rb
|
|
208
|
+
- app/jobs/uchi/application_job.rb
|
|
209
|
+
- app/mailers/uchi/application_mailer.rb
|
|
210
|
+
- app/views/layouts/uchi/_flash_messages.html.erb
|
|
211
|
+
- app/views/layouts/uchi/application.html.erb
|
|
212
|
+
- app/views/uchi/repository/edit.html.erb
|
|
213
|
+
- app/views/uchi/repository/index.html.erb
|
|
214
|
+
- app/views/uchi/repository/new.html.erb
|
|
215
|
+
- app/views/uchi/repository/show.html.erb
|
|
216
|
+
- lib/generators/uchi/controller/controller_generator.rb
|
|
217
|
+
- lib/generators/uchi/controller/templates/controller.rb.tt
|
|
218
|
+
- lib/generators/uchi/install/install_generator.rb
|
|
219
|
+
- lib/generators/uchi/repository/repository_generator.rb
|
|
220
|
+
- lib/generators/uchi/repository/templates/repository.rb.tt
|
|
221
|
+
- lib/tasks/uchi_tasks.rake
|
|
222
|
+
- lib/uchi.rb
|
|
223
|
+
- lib/uchi/application_record.rb
|
|
224
|
+
- lib/uchi/engine.rb
|
|
225
|
+
- lib/uchi/field.rb
|
|
226
|
+
- lib/uchi/field/configuration.rb
|
|
227
|
+
- lib/uchi/i18n.rb
|
|
228
|
+
- lib/uchi/pagination/controller.rb
|
|
229
|
+
- lib/uchi/pagination/page.rb
|
|
230
|
+
- lib/uchi/pagy.rb
|
|
231
|
+
- lib/uchi/pagy/LICENSE.txt
|
|
232
|
+
- lib/uchi/pagy/classes/exceptions.rb
|
|
233
|
+
- lib/uchi/pagy/classes/offset/offset.rb
|
|
234
|
+
- lib/uchi/pagy/classes/request.rb
|
|
235
|
+
- lib/uchi/pagy/modules/abilities/configurable.rb
|
|
236
|
+
- lib/uchi/pagy/modules/abilities/linkable.rb
|
|
237
|
+
- lib/uchi/pagy/modules/abilities/rangeable.rb
|
|
238
|
+
- lib/uchi/pagy/modules/abilities/shiftable.rb
|
|
239
|
+
- lib/uchi/pagy/modules/console.rb
|
|
240
|
+
- lib/uchi/pagy/toolbox/helpers/loader.rb
|
|
241
|
+
- lib/uchi/pagy/toolbox/helpers/page_url.rb
|
|
242
|
+
- lib/uchi/pagy/toolbox/paginators/method.rb
|
|
243
|
+
- lib/uchi/pagy/toolbox/paginators/offset.rb
|
|
244
|
+
- lib/uchi/repository.rb
|
|
245
|
+
- lib/uchi/repository/routes.rb
|
|
246
|
+
- lib/uchi/repository/translate.rb
|
|
247
|
+
- lib/uchi/sort_order.rb
|
|
248
|
+
- lib/uchi/version.rb
|
|
249
|
+
- uchi.gemspec
|
|
250
|
+
homepage: https://www.uchiadmin.com/
|
|
160
251
|
licenses: []
|
|
161
252
|
metadata:
|
|
253
|
+
changelog_uri: https://github.com/substancelab/uchi/blob/main/CHANGELOG.md
|
|
162
254
|
homepage_uri: https://www.uchiadmin.com/
|
|
163
255
|
source_code_uri: https://github.com/substancelab/uchi
|
|
164
256
|
rdoc_options: []
|
data/.github/dependabot.yml
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
# To get started with Dependabot version updates, you'll need to specify which
|
|
2
|
-
# package ecosystems to update and where the package manifests are located.
|
|
3
|
-
# Please see the documentation for all configuration options:
|
|
4
|
-
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
|
|
5
|
-
|
|
6
|
-
version: 2
|
|
7
|
-
updates:
|
|
8
|
-
- package-ecosystem: "bundler"
|
|
9
|
-
directory: "/"
|
|
10
|
-
schedule:
|
|
11
|
-
interval: "weekly"
|
|
12
|
-
|
|
13
|
-
- package-ecosystem: "npm"
|
|
14
|
-
directory: "/"
|
|
15
|
-
schedule:
|
|
16
|
-
interval: "weekly"
|
|
17
|
-
|
data/.github/workflows/build.yml
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
name: "Build"
|
|
2
|
-
on:
|
|
3
|
-
push:
|
|
4
|
-
branches: [ "main" ]
|
|
5
|
-
pull_request:
|
|
6
|
-
branches: [ "main" ]
|
|
7
|
-
jobs:
|
|
8
|
-
test:
|
|
9
|
-
runs-on: ubuntu-latest
|
|
10
|
-
env:
|
|
11
|
-
RAILS_ENV: test
|
|
12
|
-
steps:
|
|
13
|
-
- name: Checkout code
|
|
14
|
-
uses: actions/checkout@v5
|
|
15
|
-
- name: Install Ruby and gems
|
|
16
|
-
uses: ruby/setup-ruby@v1
|
|
17
|
-
with:
|
|
18
|
-
bundler-cache: true
|
|
19
|
-
ruby-version: '3.4.5'
|
|
20
|
-
- name: Set up database schema
|
|
21
|
-
run: bundle exec rake app:db:schema:load
|
|
22
|
-
- name: Run tests
|
|
23
|
-
run: bundle exec rake app:test
|
data/.github/workflows/lint.yml
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
name: "Lint"
|
|
2
|
-
on:
|
|
3
|
-
push:
|
|
4
|
-
branches: [ "main" ]
|
|
5
|
-
pull_request:
|
|
6
|
-
branches: [ "main" ]
|
|
7
|
-
jobs:
|
|
8
|
-
erb:
|
|
9
|
-
runs-on: ubuntu-latest
|
|
10
|
-
steps:
|
|
11
|
-
- name: Checkout code
|
|
12
|
-
uses: actions/checkout@v5
|
|
13
|
-
- name: Install Node
|
|
14
|
-
uses: actions/setup-node@v5
|
|
15
|
-
- name: Install dependencies
|
|
16
|
-
run: npm install
|
|
17
|
-
- name: Herb
|
|
18
|
-
run: npm run herb:lint
|
|
19
|
-
ruby:
|
|
20
|
-
runs-on: ubuntu-latest
|
|
21
|
-
steps:
|
|
22
|
-
- name: Checkout code
|
|
23
|
-
uses: actions/checkout@v5
|
|
24
|
-
- name: Install Ruby and gems
|
|
25
|
-
uses: ruby/setup-ruby@v1
|
|
26
|
-
with:
|
|
27
|
-
bundler-cache: true
|
|
28
|
-
ruby-version: '3.4.5'
|
|
29
|
-
- name: Standard
|
|
30
|
-
run: bundle exec rake standard
|
data/CHANGELOG.md
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
|
4
|
-
|
|
5
|
-
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
-
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
-
|
|
8
|
-
## [Unreleased]
|
|
9
|
-
|
|
10
|
-
### Added
|
|
11
|
-
|
|
12
|
-
### Fixed
|
|
13
|
-
|
|
14
|
-
### Removed
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
## [0.1.3]
|
|
18
|
-
|
|
19
|
-
### Added
|
|
20
|
-
|
|
21
|
-
- Field::Text for multi-line text content like descriptions, biographies, notes, and comments.
|
|
22
|
-
- Field for HasAndBelongsToMany associations.
|
|
23
|
-
- Better blank slate when a RecordsTable has no records; we also no longer show page navigation when there are no records.
|
|
24
|
-
- A changelog!
|
|
25
|
-
- Everything else up until now ;)
|
|
26
|
-
|
|
27
|
-
### Fixed
|
|
28
|
-
|
|
29
|
-
- uchi:controller generator now generates proper controller names when name contains multiple words.
|
data/docs/fields.md
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
# Fields
|
|
2
|
-
|
|
3
|
-
## Only show a field on specific pages
|
|
4
|
-
|
|
5
|
-
Use the `on` method to control what pages to show a field on. For example if your id field should only be visible on the index listing, you can configure it as
|
|
6
|
-
|
|
7
|
-
```ruby
|
|
8
|
-
Field::Number.new(:id).on(:index)
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
Possible actions are
|
|
12
|
-
|
|
13
|
-
- `:index`
|
|
14
|
-
- `:show`
|
|
15
|
-
- `:new`
|
|
16
|
-
- `:edit`
|
|
17
|
-
|
|
18
|
-
The default is to show all fields on all pages.
|
|
19
|
-
|
|
20
|
-
## Search
|
|
21
|
-
|
|
22
|
-
If a repository contains at least one searchable `Field` a search field appears on the index page. By default all text-based fields are considered searchable.
|
|
23
|
-
|
|
24
|
-
The search is fairly naive and is a bunch of `LIKE '%query%'` (`ILIKE` in PostgreSQL) clauses strung together by `OR`.
|
|
25
|
-
|
|
26
|
-
### Disable search
|
|
27
|
-
|
|
28
|
-
To toggle searchability for a field use the `:searchable` option:
|
|
29
|
-
|
|
30
|
-
```ruby
|
|
31
|
-
Field::String.new(:password).searchable(false)
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
### Enable search
|
|
35
|
-
|
|
36
|
-
You can also enable search for fields that don't enable it by default:
|
|
37
|
-
|
|
38
|
-
```ruby
|
|
39
|
-
Field::Number.new(:id).searchable(true)
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
Uchi casts whatever datatype the field uses into a string when searching and perform a partial match on it using `LIKE` (`ILIKE` in PostgreSQL), which may or may not yield the results you expect.
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
## Sorting
|
|
46
|
-
|
|
47
|
-
All fields are considered sortable by default. This means that a link to toggle the order of a column appears for all columns on index pages. How to sort a specific field - or to disable it entirely - is configured using the `:sortable` option.
|
|
48
|
-
|
|
49
|
-
### Disable sorting
|
|
50
|
-
|
|
51
|
-
To disable sorting a specific field:
|
|
52
|
-
|
|
53
|
-
```ruby
|
|
54
|
-
Field::Number.new(:calculated_sum).sortable(false)
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
### Customize sorting
|
|
58
|
-
|
|
59
|
-
To customize the query used to sort by a given field, pass a lambda to the `sortable` method:
|
|
60
|
-
|
|
61
|
-
```ruby
|
|
62
|
-
Field::Number.new(:users_count).sortable(lambda { |query, direction|
|
|
63
|
-
query.joins(:users).group(:id).order("COUNT(users.id) #{direction}")
|
|
64
|
-
})
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
The lambda receives 2 arguments:
|
|
68
|
-
|
|
69
|
-
1. `query`: The `ActiveRecord::Relation` that makes up the current database query
|
|
70
|
-
2. `direction`: A symbol indicating what order to sort; either `:asc` or `:desc`.
|
|
71
|
-
|
|
72
|
-
The lambda should return an `ActiveRecord::Relation` with the desired sort order added.
|
|
73
|
-
|
|
74
|
-
### Sorting by columns in another table
|
|
75
|
-
|
|
76
|
-
Thanks to ActiveRecord we can even sort by columns in other tables/models. If you have an `Employee` model that belongs to a `Company` and you want to allow your users to sort the employee list by company name, you can configure the field like this:
|
|
77
|
-
|
|
78
|
-
```ruby
|
|
79
|
-
Field::BelongsTo.new(:company).sortable(lambda { |query, direction|
|
|
80
|
-
query.joins(:office).order(:offices => {:name => direction})
|
|
81
|
-
})
|
|
82
|
-
```
|
data/docs/repositories.md
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
# Repositories
|
|
2
|
-
|
|
3
|
-
The cornerstones of Uchi are the repositories. This is where you configure what parts of your models you want to expose and how to do it.
|
|
4
|
-
|
|
5
|
-
## Models
|
|
6
|
-
|
|
7
|
-
There's a one-to-one mapping between a repository and a model. So if you have a `User` model that you want to include in Uchi, you must have a `User` repository as well.
|
|
8
|
-
|
|
9
|
-
## Routes
|
|
10
|
-
|
|
11
|
-
In order to expose your requests to your users, you need a route for each of them. These routes are added to `config/routes.rb` in your main application under the `uchi` namespace:
|
|
12
|
-
|
|
13
|
-
```ruby
|
|
14
|
-
namespace :uchi do
|
|
15
|
-
resources :companies
|
|
16
|
-
end
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
See [Rails' routing documentation](https://guides.rubyonrails.org/routing.html) for more details.
|
|
20
|
-
|
|
21
|
-
### Root URL
|
|
22
|
-
|
|
23
|
-
If you want to expose a repository at the root URL (ie `/uchi/`) you can configure a [`root`](https://guides.rubyonrails.org/routing.html#using-root) for the namespace:
|
|
24
|
-
|
|
25
|
-
```ruby
|
|
26
|
-
namespace :uchi do
|
|
27
|
-
root "companies#index"
|
|
28
|
-
end
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
## Default sort order
|
|
32
|
-
|
|
33
|
-
Lists of records in a repository are by default sorted by a column called `id`. To customize the default sort order, which is used when a user hasn’t explicitly chosen to sort by a specific field, you can create a `default_sort_order` method in the repository:
|
|
34
|
-
|
|
35
|
-
```ruby
|
|
36
|
-
module Uchi
|
|
37
|
-
class CustomersRepository < Uchi::Repository
|
|
38
|
-
def default_sort_order
|
|
39
|
-
SortOrder.new(:name, :desc)
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
`default_sort_order` should return a `Uchi::Repository::SortOrder`.
|
|
46
|
-
|
|
47
|
-
## Avoiding n+1
|
|
48
|
-
|
|
49
|
-
To avoid n+1 performance issues on your index pages and other lists, you can set up includes for the repository.
|
|
50
|
-
|
|
51
|
-
```ruby
|
|
52
|
-
module Uchi
|
|
53
|
-
module Repositories
|
|
54
|
-
class User < Repository
|
|
55
|
-
def includes
|
|
56
|
-
[:account]
|
|
57
|
-
end
|
|
58
|
-
end
|
|
59
|
-
end
|
|
60
|
-
end
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
See https://api.rubyonrails.org/classes/ActiveRecord/QueryMethods.html#method-i-includes for details.
|
data/package.json
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "uchi",
|
|
3
|
-
"version": "0.0.1",
|
|
4
|
-
"description": "## Installation",
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"directories": {
|
|
7
|
-
"lib": "lib",
|
|
8
|
-
"test": "test"
|
|
9
|
-
},
|
|
10
|
-
"scripts": {
|
|
11
|
-
"assets:build": "npm run build:css && npm run build:js",
|
|
12
|
-
"build:css": "node_modules/.bin/tailwindcss -i ./app/assets/tailwind/uchi.css -o ./app/assets/stylesheets/uchi/application.css",
|
|
13
|
-
"build:js": "node_modules/.bin/esbuild --bundle --outfile=app/assets/javascripts/uchi/application.js app/assets/javascripts/uchi.js",
|
|
14
|
-
"herb:lint": "herb-lint '**/*.html.erb'",
|
|
15
|
-
"test": "echo \"Error: no test specified\" && exit 1",
|
|
16
|
-
"watch:css": "node_modules/.bin/tailwindcss --watch -i ./app/assets/tailwind/uchi.css -o ./app/assets/stylesheets/uchi/application.css",
|
|
17
|
-
"watch:js": "node_modules/.bin/esbuild --watch --bundle --outfile=app/assets/javascripts/uchi/application.js app/assets/javascripts/uchi.js"
|
|
18
|
-
},
|
|
19
|
-
"author": "",
|
|
20
|
-
"license": "ISC",
|
|
21
|
-
"dependencies": {
|
|
22
|
-
"@hotwired/turbo-rails": "^8.0.16",
|
|
23
|
-
"@tailwindcss/cli": "^4.1.13",
|
|
24
|
-
"flowbite": "^3.1.2",
|
|
25
|
-
"tailwindcss": "^4.1.13"
|
|
26
|
-
},
|
|
27
|
-
"devDependencies": {
|
|
28
|
-
"@herb-tools/linter": "^0.7.4",
|
|
29
|
-
"esbuild": "0.25.11"
|
|
30
|
-
}
|
|
31
|
-
}
|