uchi 0.1.2 → 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 +197 -107
- data/.github/dependabot.yml +0 -17
- data/.github/workflows/build.yml +0 -23
- data/.github/workflows/lint.yml +0 -30
- 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_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/controllers/uchi/authors_controller_test.rb +0 -119
- 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 -3
- data/test/dummy/app/models/book.rb +0 -3
- 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 -51
- 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/schema.rb +0 -38
- 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 -63
- 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 -263
- 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
|
|
@@ -9,20 +9,6 @@ bindir: bin
|
|
|
9
9
|
cert_chain: []
|
|
10
10
|
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
|
-
- !ruby/object:Gem::Dependency
|
|
13
|
-
name: pagy
|
|
14
|
-
requirement: !ruby/object:Gem::Requirement
|
|
15
|
-
requirements:
|
|
16
|
-
- - ">="
|
|
17
|
-
- !ruby/object:Gem::Version
|
|
18
|
-
version: 43.0.0.rc1
|
|
19
|
-
type: :runtime
|
|
20
|
-
prerelease: false
|
|
21
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
-
requirements:
|
|
23
|
-
- - ">="
|
|
24
|
-
- !ruby/object:Gem::Version
|
|
25
|
-
version: 43.0.0.rc1
|
|
26
12
|
- !ruby/object:Gem::Dependency
|
|
27
13
|
name: rails
|
|
28
14
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -65,104 +51,207 @@ dependencies:
|
|
|
65
51
|
- - ">="
|
|
66
52
|
- !ruby/object:Gem::Version
|
|
67
53
|
version: '4.0'
|
|
54
|
+
description: Level up your scaffolds with a modern admin backend framework, designed
|
|
55
|
+
for Rails developers who demand both beauty, functionality, and extensibility. Uchi
|
|
56
|
+
provides a set of components and conventions for creating user interfaces that are
|
|
57
|
+
both powerful and easy to use.
|
|
68
58
|
email:
|
|
69
|
-
- jakob@
|
|
59
|
+
- jakob@substancelab.com
|
|
70
60
|
executables: []
|
|
71
61
|
extensions: []
|
|
72
62
|
extra_rdoc_files: []
|
|
73
63
|
files:
|
|
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
|
-
-
|
|
160
|
-
-
|
|
161
|
-
-
|
|
162
|
-
|
|
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/
|
|
163
251
|
licenses: []
|
|
164
252
|
metadata:
|
|
165
|
-
|
|
253
|
+
changelog_uri: https://github.com/substancelab/uchi/blob/main/CHANGELOG.md
|
|
254
|
+
homepage_uri: https://www.uchiadmin.com/
|
|
166
255
|
source_code_uri: https://github.com/substancelab/uchi
|
|
167
256
|
rdoc_options: []
|
|
168
257
|
require_paths:
|
|
@@ -180,5 +269,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
180
269
|
requirements: []
|
|
181
270
|
rubygems_version: 3.6.9
|
|
182
271
|
specification_version: 4
|
|
183
|
-
summary:
|
|
272
|
+
summary: Build usable and extensible admin panels for your Ruby on Rails application
|
|
273
|
+
in minutes.
|
|
184
274
|
test_files: []
|
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/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
|
-
}
|
data/sig/uchi.rbs
DELETED
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
require "test_helper"
|
|
2
|
-
require "ostruct"
|
|
3
|
-
|
|
4
|
-
module Uchi
|
|
5
|
-
class Field
|
|
6
|
-
class BelongsToTest < ActiveSupport::TestCase
|
|
7
|
-
def setup
|
|
8
|
-
@field = Uchi::Field::BelongsTo.new(:book)
|
|
9
|
-
@form = OpenStruct.new(object: Title.new)
|
|
10
|
-
@repository = Uchi::Repositories::Title.new
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
test "inherits from Uchi::Field" do
|
|
14
|
-
assert_kind_of Uchi::Field, @field
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
test "has default options" do
|
|
18
|
-
assert_equal [:edit, :index, :show], @field.on
|
|
19
|
-
assert_not @field.searchable?
|
|
20
|
-
assert @field.sortable?
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
test "has custom collection_query" do
|
|
24
|
-
custom_query = ->(query) { query.where(active: true) }
|
|
25
|
-
field = Uchi::Field::BelongsTo.new(:book, collection_query: custom_query)
|
|
26
|
-
assert_equal custom_query, field.collection_query
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
test "uses default collection_query" do
|
|
30
|
-
assert_equal Uchi::Field::BelongsTo::DEFAULT_COLLECTION_QUERY, @field.collection_query
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
test "#param_key returns foreign key name" do
|
|
34
|
-
assert_equal :book_id, @field.param_key
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
test "#edit_component returns an instance of Edit component" do
|
|
38
|
-
component = @field.edit_component(form: @form, hint: "Custom hint", label: "Custom label", repository: @repository)
|
|
39
|
-
assert_equal "Custom hint", component.hint
|
|
40
|
-
assert_equal "Custom label", component.label
|
|
41
|
-
assert_equal @field, component.field
|
|
42
|
-
assert_equal @form, component.form
|
|
43
|
-
assert_equal @repository, component.repository
|
|
44
|
-
assert_kind_of Uchi::Field::BelongsTo::Edit, component
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
test "#group_as returns :attributes for :edit" do
|
|
48
|
-
assert_equal :attributes, @field.group_as(:edit)
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
test "#group_as returns :attributes for :show" do
|
|
52
|
-
assert_equal :attributes, @field.group_as(:show)
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
test "#index_component returns an instance of Index component" do
|
|
56
|
-
component = @field.index_component(record: @form.object, repository: @repository)
|
|
57
|
-
assert_equal @field, component.field
|
|
58
|
-
assert_equal @form.object, component.record
|
|
59
|
-
assert_equal @repository, component.repository
|
|
60
|
-
assert_kind_of Uchi::Field::BelongsTo::Index, component
|
|
61
|
-
end
|
|
62
|
-
|
|
63
|
-
test "#searchable? returns false when explicitly set" do
|
|
64
|
-
field = Uchi::Field::BelongsTo.new(:book, searchable: false)
|
|
65
|
-
assert_not field.searchable?
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
test "#show_component returns an instance of Show component" do
|
|
69
|
-
component = @field.show_component(record: @form.object, repository: @repository)
|
|
70
|
-
assert_equal @field, component.field
|
|
71
|
-
assert_equal @form.object, component.record
|
|
72
|
-
assert_equal @repository, component.repository
|
|
73
|
-
assert_kind_of Uchi::Field::BelongsTo::Show, component
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
test "#sortable? returns false when explicitly set" do
|
|
77
|
-
field = Uchi::Field::BelongsTo.new(:book, sortable: false)
|
|
78
|
-
assert_not field.sortable?
|
|
79
|
-
end
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
class BelongsToIndexTest < ViewComponent::TestCase
|
|
83
|
-
def setup
|
|
84
|
-
@book = Book.create!(original_title: "The Hobbit")
|
|
85
|
-
@title = Title.new(book: @book, locale: "da-DK", title: "Hobbitten")
|
|
86
|
-
@field = Uchi::Field::BelongsTo.new(:book)
|
|
87
|
-
@repository = Uchi::Repositories::Title.new
|
|
88
|
-
|
|
89
|
-
@component = Uchi::Field::BelongsTo::Index.new(
|
|
90
|
-
field: @field,
|
|
91
|
-
record: @title,
|
|
92
|
-
repository: @repository
|
|
93
|
-
)
|
|
94
|
-
end
|
|
95
|
-
|
|
96
|
-
test "inherits from Base component" do
|
|
97
|
-
assert_kind_of Uchi::Field::Base::Index, @component
|
|
98
|
-
end
|
|
99
|
-
|
|
100
|
-
test "renders the field content" do
|
|
101
|
-
result = render_inline(@component)
|
|
102
|
-
|
|
103
|
-
# The component renders the object directly, so we check for the object representation
|
|
104
|
-
assert_not_nil result.to_html
|
|
105
|
-
end
|
|
106
|
-
end
|
|
107
|
-
|
|
108
|
-
class BelongsToShowTest < ViewComponent::TestCase
|
|
109
|
-
def setup
|
|
110
|
-
@book = Book.create!(original_title: "The Hobbit")
|
|
111
|
-
@field = Uchi::Field::BelongsTo.new(:book)
|
|
112
|
-
@record = Title.new(book: @book, locale: "da-DK", title: "Hobbitten")
|
|
113
|
-
@repository = Uchi::Repositories::Title.new
|
|
114
|
-
|
|
115
|
-
@component = Uchi::Field::BelongsTo::Show.new(
|
|
116
|
-
field: @field,
|
|
117
|
-
record: @record,
|
|
118
|
-
repository: @repository
|
|
119
|
-
)
|
|
120
|
-
end
|
|
121
|
-
|
|
122
|
-
test "inherits from Base component" do
|
|
123
|
-
assert_kind_of Uchi::Field::Base::Show, @component
|
|
124
|
-
end
|
|
125
|
-
|
|
126
|
-
test "can be rendered without errors" do
|
|
127
|
-
# Skip rendering test due to missing route dependencies
|
|
128
|
-
assert_nothing_raised do
|
|
129
|
-
@component
|
|
130
|
-
end
|
|
131
|
-
end
|
|
132
|
-
end
|
|
133
|
-
end
|
|
134
|
-
end
|